Tidied up the code
Signed-off-by: Roman Schmerold (BNoiZe) <bnoize@froxlor.org>
This commit is contained in:
70
templates/Sparkle/assets/js/main.js
vendored
70
templates/Sparkle/assets/js/main.js
vendored
@@ -43,7 +43,7 @@ $(document).ready(function() {
|
|||||||
// Enable notes
|
// Enable notes
|
||||||
$(".notes").click(function() {
|
$(".notes").click(function() {
|
||||||
$("#notes_" + $(this).attr("data-id")).toggle("slow");
|
$("#notes_" + $(this).attr("data-id")).toggle("slow");
|
||||||
})
|
});
|
||||||
// Enable reset search click
|
// Enable reset search click
|
||||||
$(".resetsearch").click(function() {
|
$(".resetsearch").click(function() {
|
||||||
$(".searchtext").val("");
|
$(".searchtext").val("");
|
||||||
@@ -58,11 +58,13 @@ $(document).ready(function() {
|
|||||||
// this is necessary for the special setting feature (ref #1010)
|
// this is necessary for the special setting feature (ref #1010)
|
||||||
$.getQueryVariable = function(key) {
|
$.getQueryVariable = function(key) {
|
||||||
var urlParams = decodeURI(window.location.search.substring(1));
|
var urlParams = decodeURI(window.location.search.substring(1));
|
||||||
if (urlParams === false | urlParams === '') return null;
|
if (urlParams === false || urlParams === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
var vars = urlParams.split("&");
|
var vars = urlParams.split("&");
|
||||||
for (var i = 0; i < vars.length; i++) {
|
for (var i = 0; i < vars.length; i++) {
|
||||||
var pair = vars[i].split("=");
|
var pair = vars[i].split("=");
|
||||||
if (pair[0] == key) {
|
if (pair[0] === key) {
|
||||||
return pair[1];
|
return pair[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,14 +95,14 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
// Speciallogfile popup dialog
|
// Speciallogfile popup dialog
|
||||||
$('input[name=speciallogfile]').click(function() {
|
$('input[name=speciallogfile]').click(function() {
|
||||||
if ($.getQueryVariable("page") == "domains" && $.getQueryVariable("action") == "edit") {
|
if ($.getQueryVariable("page") === "domains" && $.getQueryVariable("action") === "edit") {
|
||||||
$speciallogdialog.dialog("open");
|
$speciallogdialog.dialog("open");
|
||||||
$(".ui-dialog-titlebar").hide();
|
$(".ui-dialog-titlebar").hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#speciallogyesbutton').click(function() {
|
$('#speciallogyesbutton').click(function() {
|
||||||
$speciallogdialog.dialog("close");
|
$speciallogdialog.dialog("close");
|
||||||
if ($('#delete_stats').val().toLowerCase() != $('#delete_statistics_str').val().toLowerCase()) {
|
if ($('#delete_stats').val().toLowerCase() !== $('#delete_statistics_str').val().toLowerCase()) {
|
||||||
$("#speciallogverified").val("0");
|
$("#speciallogverified").val("0");
|
||||||
if ($('input[name=speciallogfile]').prop("checked") !== false) {
|
if ($('input[name=speciallogfile]').prop("checked") !== false) {
|
||||||
$('input[name=speciallogfile]').attr("checked", false);
|
$('input[name=speciallogfile]').attr("checked", false);
|
||||||
@@ -121,30 +123,54 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Tablesorting on admin traffic
|
// Tablesorting on admin traffic
|
||||||
$("table").each(function(index) {
|
$("table").each(function() {
|
||||||
if ($(this).data("toggle") == "table") {
|
if ($(this).data("toggle") === "table") {
|
||||||
$(this).tablesorter({
|
$(this).tablesorter({
|
||||||
textExtraction: (function(node) {
|
textExtraction: (function(node) {
|
||||||
// extract data from markup and return it
|
// extract data from markup and return it
|
||||||
if (node.innerText != '-') {
|
if (node.innerText !== "-") {
|
||||||
return node.innerText;
|
return node.innerText;
|
||||||
} else {
|
} else {
|
||||||
return '0 B';
|
return '0 B';
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
1: { sorter: 'filesize' },
|
1: {
|
||||||
2: { sorter: 'filesize' },
|
sorter: 'filesize'
|
||||||
3: { sorter: 'filesize' },
|
},
|
||||||
4: { sorter: 'filesize' },
|
2: {
|
||||||
5: { sorter: 'filesize' },
|
sorter: 'filesize'
|
||||||
6: { sorter: 'filesize' },
|
},
|
||||||
7: { sorter: 'filesize' },
|
3: {
|
||||||
8: { sorter: 'filesize' },
|
sorter: 'filesize'
|
||||||
9: { sorter: 'filesize' },
|
},
|
||||||
10: { sorter: 'filesize' },
|
4: {
|
||||||
11: { sorter: 'filesize' },
|
sorter: 'filesize'
|
||||||
12: { sorter: 'filesize' }
|
},
|
||||||
|
5: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
},
|
||||||
|
6: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
},
|
||||||
|
7: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
},
|
||||||
|
8: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
},
|
||||||
|
9: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
},
|
||||||
|
10: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
},
|
||||||
|
11: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
},
|
||||||
|
12: {
|
||||||
|
sorter: 'filesize'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -153,7 +179,9 @@ $(document).ready(function() {
|
|||||||
var mailTemplate = $("#mailTemplate").html();
|
var mailTemplate = $("#mailTemplate").html();
|
||||||
$("#mailLanguage").change(function() {
|
$("#mailLanguage").change(function() {
|
||||||
var mailLanguage = $(this).val();
|
var mailLanguage = $(this).val();
|
||||||
var mailOptions = $(mailTemplate).filter(function() { return !$(this).attr("id") || $(this).attr("id") == mailLanguage; });
|
var mailOptions = $(mailTemplate).filter(function() {
|
||||||
|
return !$(this).attr("id") || $(this).attr("id") === mailLanguage;
|
||||||
|
});
|
||||||
$("#mailTemplate").html(mailOptions);
|
$("#mailTemplate").html(mailOptions);
|
||||||
});
|
});
|
||||||
$("#mailLanguage").trigger("change");
|
$("#mailLanguage").trigger("change");
|
||||||
|
|||||||
Reference in New Issue
Block a user