update jquery and some functions
This commit is contained in:
parent
a934e14f66
commit
d8e81c07b6
@ -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('<div class="demo-card-square mdl-card mdl-shadow--16dp" style="text-align:left;width:260px; height:auto;margin:50px auto 0;"><div class="mdl-card__title"><h2 class="mdl-card__title-text" style="font-size:28px;">Ditt meritvärde är ' + totalScore + '</h2></div><div class="mdl-card__supporting-text">Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '<p style="color:#d50000;text-align:unset;font-weight:unset;">Du har över 2400 poäng och måste därför välja bort ' + (totalPoints - 2400) + ' poäng</p></div><div class="mdl-card__actions mdl-card--border"><a class="sparaBetyg mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary">Spara</a><a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent" href="/">Till Startsidan</a></div></div>');
|
||||
$('.score_span').append('<div class="demo-card-square mdl-card mdl-shadow--16dp" style="text-align:left;width:260px; height:auto;margin:50px auto 0;"><div class="mdl-card__title"><h2 class="mdl-card__title-text" style="font-size:28px;">Ditt meritvärde är ' + totalScore + '</h2></div><div class="mdl-card__supporting-text">Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '<p style="color:#d50000;text-align:unset;font-weight:unset;">Du har över 2400 poäng och måste därför välja bort ' + (totalPoints - 2400) + ' poäng</p></div><div class="mdl-card__actions mdl-card--border"><a onClick="sparaBetyg()" class="sparaBetyg mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary">Spara</a><a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent" href="/">Till Startsidan</a></div></div>');
|
||||
} else {
|
||||
$('.score_span').append('<div class="demo-card-square mdl-card mdl-shadow--16dp" style="text-align:left;width:260px; height:auto;margin:50px auto 0;"><div class="mdl-card__title"><h2 class="mdl-card__title-text" style="font-size:28px;">Ditt meritvärde är ' + totalScore + '</h2></div><div class="mdl-card__supporting-text">Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '</div><div class="mdl-card__actions mdl-card--border"><a class="sparaBetyg mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary">Spara</a><a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent" href="/">Till Startsidan</a></div></div>');
|
||||
$('.score_span').append('<div class="demo-card-square mdl-card mdl-shadow--16dp" style="text-align:left;width:260px; height:auto;margin:50px auto 0;"><div class="mdl-card__title"><h2 class="mdl-card__title-text" style="font-size:28px;">Ditt meritvärde är ' + totalScore + '</h2></div><div class="mdl-card__supporting-text">Ditt Snittbetyg av ' + totalPoints + ' Poäng (+100 poäng för Gymnasiearbete) ger meritvärdet: ' + totalScore + '</div><div class="mdl-card__actions mdl-card--border"><a onClick="sparaBetyg()" class="sparaBetyg mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary">Spara</a><a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent" href="/">Till Startsidan</a></div></div>');
|
||||
}
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
@ -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('<span class="link_span"><div class="demo-card-square mdl-card mdl-shadow--16dp" style="text-align:left;width:260px; height:auto;margin:50px auto 0;"><div class="mdl-card__title"><h2 class="mdl-card__title-text" style="font-size:28px;">Spara</h2></div><div class="mdl-card__supporting-text">Spara Länken som bokmärke för att kunna återvända till dina betyg</div><div class="mdl-card__actions mdl-card--border" style="padding: 4px 16px 8px;"><div style="padding:0; width:125px;" class="mdl-textfield mdl-js-textfield"><input readonly style="margin: 0 0 8px 0; border-bottom: 1px solid #26a69a; box-shadow: 0 1px 0 0 #26a69a;" class="mdl-textfield__input betygLink" id="betygLink" type="text" value="'+ urlLink +'" onClick="betygSelect()"><label class="mdl-textfield__label" for="betygLink"></label></div><i class="material-icons mdl-button--primary" onClick="copyLink()" style="margin:12px 16px; cursor: pointer; position: absolute; right:0;">content_copy</i></div></div></span>');
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
echo "
|
||||
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'></script>
|
||||
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'></script>
|
||||
<script src='https://code.getmdl.io/1.3.0/material.min.js'></script>
|
||||
<script src='https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/js/materialize.min.js'></script>
|
||||
<script src='assets/js/loader.min.js?v=1.6'></script>
|
||||
<script src='assets/js/calcscript.js?v=1.6'></script>
|
||||
<script src='assets/js/changeall.js?v=1.6'></script>
|
||||
<script src='assets/js/sparabetyg.js?v=1.6'></script>
|
||||
<script src='assets/js/calcscript.js?v=1.8'></script>
|
||||
<script src='assets/js/changeall.js?v=1.8'></script>
|
||||
<script src='assets/js/sparabetyg.js?v=1.10'></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
Reference in New Issue
Block a user