1// Write your Javascript code. 2 3// Attach the anti-forgery token to every same-origin non-GET AJAX request. 4// The token is rendered by @Html.AntiForgeryToken() in the shared layouts. 5$.ajaxPrefilter(function (options, originalOptions, jqXHR) { 6 if (options.type && options.type.toUpperCase() !== "GET") { 7 var url = options.url || ""; 8 var sameOrigin = url.indexOf("//") === -1 || url.indexOf(window.location.origin) === 0; 9 if (sameOrigin) { 10 var token = $("input[name='__RequestVerificationToken']").first().val(); 11 if (token) { 12 jqXHR.setRequestHeader("RequestVerificationToken", token); 13 } 14 } 15 } 16}); 17 18$(document).ready(function () { 19 //prevent all forms from double submissions 20 //$("form").preventDoubleSubmission(); 21 22 if ($("#showFlashNews").val() === "true") { 23 //$("#flashNews").removeClass("hidden"); 24 } 25 26 //-----Functions to slide down and up menues 27 $(".dropdown").mouseleave(function () { 28 $(".navbar-nav>li").removeClass("open"); 29 }); 30 $(".navbar .dropdown").hover(function () { 31 $(this).find(".dropdown-menu").first().stop(true, true).slideDown(250); 32 }, function () { 33 $(this).find(".dropdown-menu").first().stop(true, true).slideUp(205); 34 }); 35 //for each element that is classed as 'pull-down', set its margin-top to the difference between its own height and the height of its parent 36 $(".pull-down").each(function () { 37 $(this).css("margin-top", $(this).parent().height() - $(this).height()); 38 }); 39 //----------end of Menues Functions 40 41}); 42 43//add padding zeros to numbers 44//(9).pad(); //returns "09" 45//(7).pad(3); //returns "007" 46Number.prototype.pad = function (size) { 47 var s = String(this); 48 while (s.length < (size || 2)) { s = "0" + s; } 49 return s; 50} 51 52function checkSessionState() { 53 $.get(window.rootUrl + "account/issessionalive", function (data) { 54 if (!data || data.Active === false) { 55 window.location.assign(window.rootUrl + "account/logoff"); 56 } 57 }); 58} 59 60function dateFromString(str) { 61 if (str == null) return new Date(); 62 var m = str.match(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)/); 63 return new Date(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]); 64} 65 66function getTimeString(date) { 67 68 var d = date == null ? new Date() : date; 69 var h = d.getHours(), 70 m = d.getMinutes(); 71 if (h < 10) h = "0" + h; 72 if (m < 10) m = "0" + m; 73 var y = d.getFullYear(); 74 if (y < 2000) return ""; 75 return h + ":" + m; 76} 77function getDateTime(d) { 78 79} 80 81function getDateString(date) { 82 var d = date == null ? new Date() : date; 83 var dd = d.getDate(); 84 var mm = d.getMonth() + 1; //January is 0! 85 var yyyy = d.getFullYear(); 86 if (dd < 10) { dd = "0" + dd }; 87 if (mm < 10) { mm = "0" + mm }; 88 return yyyy + "-" + mm + "-" + dd; 89} 90 91var minSize = 1.3; 92var maxSize = 1.9; 93 94function resizeText(multiplier) { 95 var elem = document.body; 96 var currentSize = elem.style.fontSize || 1; 97 var newSize = parseFloat(currentSize) + multiplier * 0.2; 98 if (newSize < minSize) newSize = minSize; 99 if (newSize > maxSize) newSize = maxSize; 100 elem.style.fontSize = newSize + "rem"; 101} 102 103function fluidPage() { 104 $("#bodyContainer").removeClass("container").addClass("container-fluid"); 105 $("#navbarContainer").removeClass("container").addClass("container-fluid"); 106} 107 108 109// ***********LOGIN Form functions ************* // 110$('#loginform input[type="submit"]').mousedown(function () { 111 $(this).css("background", "#2ecc71"); 112}); 113$('#loginform input[type="submit"]').mouseup(function () { 114 $(this).css("background", "#1abc9c"); 115}); 116 117$("#loginform").click(function () { 118 $(".login").fadeToggle("slow"); 119 $(this).toggleClass("green"); 120}); 121 122 123 124$(document).mouseup(function (e) { 125 var container = $(".login"); 126 127 if (!container.is(e.target) // if the target of the click isn't the container... 128 && container.has(e.target).length === 0) // ... nor a descendant of the container 129 { 130 container.hide(); 131 $("#loginform").removeClass("green"); 132 } 133}); 134//************ **********************//
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.