1//beredskap.min.js som er lastet inn i toppmaster. Bruk feks http://www.minifyjavascript.com/ for å kopiere inn endringer. 2(function ($) { 3 var settings = {}; 4 var cookieName = 'ignoreemergency'; 5 if (typeof String.prototype.trimLeft !== "function") { 6 String.prototype.trimLeft = function () { 7 return this.replace(/^\s+/, ""); 8 }; 9 } 10 if (typeof String.prototype.trimRight !== "function") { 11 String.prototype.trimRight = function () { 12 return this.replace(/\s+$/, ""); 13 }; 14 } 15 if (typeof Array.prototype.map !== "function") { 16 Array.prototype.map = function (callback, thisArg) { 17 for (var i = 0, n = this.length, a = []; i < n; i++) { 18 if (i in this) a[i] = callback.call(thisArg, this[i]); 19 } 20 return a; 21 }; 22 } 23 var funksjoner = { 24 getCookies: function () { 25 var c = document.cookie, v = 0, cookies = {}; 26 if (document.cookie.match(/^\s*\$Version=(?:"1"|1);\s*(.*)/)) { 27 c = RegExp.$1; 28 v = 1; 29 } 30 if (v === 0) { 31 c.split(/[,;]/).map(function (cookie) { 32 var parts = cookie.split(/=/, 2), 33 name = decodeURIComponent(parts[0].trimLeft()), 34 value = parts.length > 1 ? decodeURIComponent(parts[1].trimRight()) : null; 35 cookies[name] = value; 36 }); 37 } else { 38 c.match(/(?:^|\s+)([!#$%&'*+\-.0-9A-Z^`a-z|~]+)=([!#$%&'*+\-.0-9A-Z^`a-z|~]*|"(?:[\x20-\x7E\x80\xFF]|\\[\x00-\x7F])*")(?=\s*[,;]|$)/g).map(function ($0, $1) { 39 var name = $0, 40 value = $1.charAt(0) === '"' 41 ? $1.substr(1, -1).replace(/\\(.)/g, "$1") 42 : $1; 43 cookies[name] = value; 44 }); 45 } 46 return cookies; 47 }, 48 getCookie: function (name) { 49 return funksjoner.getCookies()[name]; 50 }, 51 setCookie: function (c_name, value, exms) { 52 var exdate = new Date(exms); 53 var c_value = escape(value) + '; Path = /;' + ((exms == null) ? "" : "; expires=" + exdate.toUTCString()); 54 document.cookie = c_name + "=" + c_value; 55 }, 56 VisInformasjon: function () { 57 var cookie = funksjoner.getCookie(cookieName); 58 var ignoreBeredskap = '0'; 59 if (cookie == null || cookie.length == 0 || cookie == "0") { 60 ignoreBeredskap = '1'; 61 } else { 62 ignoreBeredskap = '0'; 63 } 64 var url = settings.baseUrl + "css/beredskap.css"; 65 if (document.createStyleSheet) { 66 document.createStyleSheet(url); 67 } else { 68 $('head').append( 69 $('<link />').attr("type", "text/css").attr("rel", "stylesheet").attr("href", url) 70 ); 71 } 72 var targeturl = settings.targetUrl; 73 var wrapper = $("<div/>") 74 .addClass("beredskap-floating-notifications") 75 .css("background-color", "#af1f23"); 76 var basic = $("<div/>").addClass("basic"); 77 var accessText = $("<h2/>").addClass("access-text"); 78 var text1 = $("<span/>").append(settings.oKriseberedskap); 79 if (targeturl.length > 0 || cookie == "1") { 80 var a = $("<a/>") 81 .text(ignoreBeredskap == '1' ? settings.oTrykkHerOppgitt : settings.oTrykkHerBeredskap) 82 .css("text-decoration", "underline") 83 .css("cursor", "pointer") 84 .attr("href", targeturl) 85 .on("click", function (e) { 86 e.preventDefault(); 87 funksjoner.setCookie(cookieName, ignoreBeredskap); 88 window.location.href = settings.targetUrl; 89 }); 90 } 91 basic 92 .append(accessText) 93 .append(text1) 94 .append(a) 95 wrapper.append(basic); 96 $("body").prepend(wrapper); 97 $("body").css("padding-top", '46px'); 98 } 99 }; 100 $.fn.beredskap = function () { 101 settings = $.extend({ 102 targetUrl: '', 103 baseUrl: '/', 104 oKriseberedskap: 'Nettstedet er satt i kriseberedskap.', 105 oTrykkHerOppgitt: ' Tilgang til våre vanlige sider får du ved å klikke her.', 106 oTrykkHerBeredskap: ' Klikk her for å gå til beredskapsp
106ortal.' 107 }, arguments[0]); 108 funksjoner.VisInformasjon(); 109 110 111 }; 112}(jQuery));
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.