diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/forms.js | 32 | ||||
-rw-r--r-- | public/js/moment-countdown.js | 28 | ||||
-rw-r--r-- | public/js/sticky-headers.js | 33 |
3 files changed, 46 insertions, 47 deletions
diff --git a/public/js/forms.js b/public/js/forms.js index f4e2e042..c4eb68df 100644 --- a/public/js/forms.js +++ b/public/js/forms.js @@ -1,28 +1,28 @@ /** * Runs through the DOM under the element with the given id, finds all * checkboxes and sets them to the wanted state. - * + * * @param String * id Id of the element containing all the checkboxes * @param Boolean * checked True if the checkboxes should be checked */ function checkAll(id, checked) { - var obj = document.getElementById(id); - var boxes = obj.getElementsByTagName("input"); - for (var i = 0; i < boxes.length; i++) { - if (boxes[i].type === "checkbox" && !boxes[i].disabled) { - boxes[i].checked = checked; - } - } + var obj = document.getElementById(id); + var boxes = obj.getElementsByTagName("input"); + for (var i = 0; i < boxes.length; i++) { + if (boxes[i].type === "checkbox" && !boxes[i].disabled) { + boxes[i].checked = checked; + } + } } -$(function() { - /** - * Disable every submit button after clicking (to prevent double-clicking) - */ - $("form").submit(function(ev) { - $("input[type='submit']").prop("readonly", true).addClass("disabled"); - return true; - }); +$(function () { + /** + * Disable every submit button after clicking (to prevent double-clicking) + */ + $("form").submit(function (ev) { + $("input[type='submit']").prop("readonly", true).addClass("disabled"); + return true; + }); }); diff --git a/public/js/moment-countdown.js b/public/js/moment-countdown.js index 9d655038..0cc78210 100644 --- a/public/js/moment-countdown.js +++ b/public/js/moment-countdown.js @@ -3,17 +3,17 @@ * class "moment-countdown" and the attribute "data-timestamp" which defines the * countdown's time goal. */ -$(document).ready(function() { - if (typeof moment !== "undefined") { - $.each($(".moment-countdown"), function(i, e) { - var span = $(e); - var text = span.html(); - /* global moment */ - var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000)); - span.html(text.replace("%c", timestamp.fromNow())); - setInterval(function() { - span.html(text.replace("%c", timestamp.fromNow())); - }, 1000); - }); - } -});
\ No newline at end of file +$(document).ready(function () { + if (typeof moment !== "undefined") { + $.each($(".moment-countdown"), function (i, e) { + var span = $(e); + var text = span.html(); + /* global moment */ + var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000)); + span.html(text.replace("%c", timestamp.fromNow())); + setInterval(function () { + span.html(text.replace("%c", timestamp.fromNow())); + }, 1000); + }); + } +}); diff --git a/public/js/sticky-headers.js b/public/js/sticky-headers.js index 1d6e9402..60f294b3 100644 --- a/public/js/sticky-headers.js +++ b/public/js/sticky-headers.js @@ -1,32 +1,31 @@ /** * Enables the fixed headers and time lane for the shift-calendar and datatables */ -$(document).ready( - function() { - if ($(".shift-calendar").length) { +$(document).ready(function () { + if ($(".shift-calendar").length) { var timeLanes = $(".shift-calendar .time"); var headers = $(".shift-calendar .header"); var topReference = $(".container-fluid .row"); var top = headers.offset().top; var left = 15; timeLanes.css({ - "position" : "relative", - "z-index" : 999 + "position": "relative", + "z-index": 999 }); headers.css({ - "position" : "relative", - "z-index" : 900 + "position": "relative", + "z-index": 900 }); $(window).scroll( - function() { - timeLanes.css({ - "left" : Math.max(0, $(window).scrollLeft() - left) + "px" - }); - headers.css({ - "top" : Math.max(0, $(window).scrollTop() - top - + topReference.offset().top) + function () { + timeLanes.css({ + "left": Math.max(0, $(window).scrollLeft() - left) + "px" + }); + headers.css({ + "top": Math.max(0, $(window).scrollTop() - top + + topReference.offset().top) + "px" - }); + }); }); - } - });
\ No newline at end of file + } +}); |