Completely removed jQuery

- Missing results/search not working properly
This commit is contained in:
Kasper Rynning-Tønnesen
2018-04-25 16:59:40 +02:00
parent f540f10cca
commit e01bef2ace
22 changed files with 1112 additions and 993 deletions

View File

@@ -1,25 +1,25 @@
$(document).ready(function() {
window.addEventListener("DOMContentLoaded", function(e) {
M.Modal.init(document.getElementById("about"));
M.Modal.init(document.getElementById("contact"));
Helper.addClass(".help-button-footer", "hide");
Helper.setHtml("#contact-container", "");
Helper.setHtml("#contact-container", "Send a mail to us: <a title='Open in client' href='mailto:contact@zoff.me?Subject=Contact%20Zoff'>contact@zoff.me</a>");
$("#submit-contact-form").hide();
Helper.css("#submit-contact-form", "display", "none");
ga('send', 'pageview');
if(!Helper.mobilecheck()) {
$("#iframe-container").append('<iframe id="iframe" src="https://zoff.me/_embed#celebrate&808080" width="600px" height="300px"></iframe>');
document.getElementById("iframe-container").insertAdjacentHTML("beforeend", '<iframe id="iframe" src="https://zoff.me/_embed#celebrate&808080" width="600px" height="300px"></iframe>');
}
$(".token-form").on("submit", function(e) {
document.getElementsByClassName("token-form")[0].addEventListener("submit", function(e) {
e.preventDefault();
var email = $("#email_address").val();
var origin = $("#origin").val();
$("#origin").attr("readonly", true);
$("#email_address").attr("readonly", true);
$(".submit").toggleClass("disabled");
var email = document.getElementById("email_address").value;
var origin = document.getElementById("origin").value;
document.getElementById("origin").setAttribute("readonly", true);
document.getElementById("email_address").setAttribute("readonly", true);
Helper.toggleClass(".submit", "disabled");
Helper.removeClass(".full-form-token", "hide");
var captcha_response = grecaptcha.getResponse();
Helper.ajax({
@@ -35,23 +35,23 @@ $(document).ready(function() {
if(response == "success") {
M.toast({html: "Email sent!", displayLength: 3000, classes: "green lighten"});
} else {
$("#email_address").attr("readonly", false);
$(".submit").toggleClass("disabled");
$("#origin").attr("readonly", false);
document.getElementById("email_address").setAttribute("readonly", false);
Helper.toggleClass(".submit", "disabled");
document.getElementById("origin").setAttribute("readonly", false);
grecaptcha.reset();
M.toast({html: "Something went wrong. Sure that email hasn't been used for another token?",displayLength: 3000, classes: "red lighten"});
}
},
error: function(response) {
Helper.addClass(".full-form-token", "hide");
$("#email_address").attr("readonly", false);
$(".submit").toggleClass("disabled");
document.getElementById("email_address").setAttribute("readonly", false);
Helper.toggleClass(".submit", "disabled");
}
});
});
$('#submit-contact-form').on('click', function(e) {
document.getElementById('submit-contact-form').addEventListener('click', function(e) {
e.preventDefault();
$("#contact-form").submit();
document.getElementById("contact-form").submit();
});
});