From d8e81c07b6c919caba5b9b68a6562819fd9c3f31 Mon Sep 17 00:00:00 2001 From: Felix Schulze Date: Wed, 25 Sep 2019 19:12:15 +0200 Subject: [PATCH] update jquery and some functions --- html/assets/js/calcscript.js | 14 +++++++------- html/assets/js/changeall.js | 6 +++--- html/assets/js/sparabetyg.js | 15 ++++++++------- html/include/html_script_bottom_head.php | 8 ++++---- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/html/assets/js/calcscript.js b/html/assets/js/calcscript.js index 7a65310..392e7a9 100644 --- a/html/assets/js/calcscript.js +++ b/html/assets/js/calcscript.js @@ -25,11 +25,11 @@ $(document).ready(function() { $('form').change(function() { raknaUtMeritvarde(); }); - $('.add_row').live('click', function() { + $('.add_row').on('click', function() { $('div.sample_row > div').clone().appendTo('form.courses'); raknaUtMeritvarde(); }); - $('.delete_row').live('click', function() { + $('.delete_row').on('click', function() { $(this).parent().slideUp(function() { $(this).remove(); raknaUtMeritvarde(); @@ -65,17 +65,17 @@ function raknaUtMeritvarde() { } $('.score_span').html(''); if (totalPoints > 2400) { - $('.score_span').append('

Ditt meritvärde är ' + totalScore + '

Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '

Du har över 2400 poäng och måste därför välja bort ' + (totalPoints - 2400) + ' poäng

'); + $('.score_span').append('

Ditt meritvärde är ' + totalScore + '

Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '

Du har över 2400 poäng och måste därför välja bort ' + (totalPoints - 2400) + ' poäng

'); } else { - $('.score_span').append('

Ditt meritvärde är ' + totalScore + '

Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '
'); + $('.score_span').append('

Ditt meritvärde är ' + totalScore + '

Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '
'); } - //title set + //title set if (courseTitle === false) { courseTitle = document.title; } var newDocTitle = courseTitle + ' - ' + totalScore; document.title = newDocTitle; - + var urlLink = "?"; $('form.kurser').find('div').each(function(){ subjectScores = parseFloat($(this).find("select").val()); @@ -87,4 +87,4 @@ function raknaUtMeritvarde() { urlLink = urlLink + "mp=" + $('form').find('input.meritpoint').val(); urlLink = "https://" + window.location.hostname + window.location.pathname + urlLink; window.history.pushState("", newDocTitle, urlLink); -} \ No newline at end of file +} diff --git a/html/assets/js/changeall.js b/html/assets/js/changeall.js index c43906c..d39c63d 100644 --- a/html/assets/js/changeall.js +++ b/html/assets/js/changeall.js @@ -1,4 +1,4 @@ -$('.changeall').live('click', function(){ +$('.changeall').on('click', function(){ var grade; var val; if (document.getElementById('option-1').checked) { @@ -20,10 +20,10 @@ $('.changeall').live('click', function(){ grade = "F"; val = 0; } - + $('form.kurser').find('div').each(function(){ $('.select-dropdown').val(grade); $('.grade').val(val); }); raknaUtMeritvarde(); -}); \ No newline at end of file +}); diff --git a/html/assets/js/sparabetyg.js b/html/assets/js/sparabetyg.js index 02d6978..bb76c49 100644 --- a/html/assets/js/sparabetyg.js +++ b/html/assets/js/sparabetyg.js @@ -1,6 +1,7 @@ // JavaScript Document -$('.sparaBetyg').live('click', function(){ +$('.sparaBetyg').on('click', function() { sparaBetyg(); + console.log("lol") }); function sparaBetyg() { var urlLink = "?"; @@ -14,7 +15,7 @@ function sparaBetyg() { urlLink = urlLink + "mp=" + $('form').find('input.meritpoint').val(); urlLink = "https://" + window.location.hostname + window.location.pathname + urlLink; $('.link_span').remove(); - + $('.score_span').append('

Spara

Spara Länken som bokmärke för att kunna återvända till dina betyg
content_copy
'); betygSelect(); } @@ -24,7 +25,7 @@ function betygSelect() { function copyLink() { betygSelect(); document.execCommand("Copy"); - + var snackbarContainer = document.querySelector('#linkCopyToast'); var data = {message: 'Länk kopierad till urklipp'}; snackbarContainer.MaterialSnackbar.showSnackbar(data); @@ -39,11 +40,11 @@ function laddaBetyg() { var grade; var val; subjectName = $(this).find("input.subjectName").val(); - - + + if (typeof subjectName !== 'undefined') { subjectName = encodeURI(subjectName); - + if (getQueryVariable(subjectName) == 20) { grade = "A"; val = 20; @@ -81,4 +82,4 @@ function getQueryVariable(variable) if(pair[0] == variable){return pair[1];} } return(false); -} \ No newline at end of file +} diff --git a/html/include/html_script_bottom_head.php b/html/include/html_script_bottom_head.php index 5643b26..4e9b75d 100644 --- a/html/include/html_script_bottom_head.php +++ b/html/include/html_script_bottom_head.php @@ -1,12 +1,12 @@ + - - - + + +