1/*============================================ 2 * 3 * userNotice() 4 * 5 *============================================= 6 * 7 * Set up a special notice with a cookie. 8 * 9 */ 10 11 12function noticeInit() { 13 14 // Add notice 15 userNotice('setup-guide', '/_setupguide', 'See the setup guide for this theme'); 16 17} 18 19function userNotice(name, url, text, position) { 20 21 function getCookie(name) { 22 var nameEQ = name + "="; 23 var ca = document.cookie.split(';'); 24 for (var i = 0; i < ca.length; i++) { 25 var c = ca[i]; 26 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 27 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 28 } 29 return null; 30 } 31 32 function setCookie(name, value, days) { 33 if (days) { 34 var date = new Date(); 35 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 36 var expires = "; expires=" + date.toUTCString(); 37 } else var expires = ""; 38 document.cookie = name + "=" + value + expires + "; path=/"; 39 } 40 41 if (typeof(position) === 'undefined') { 42 position = 'bottom'; 43 } 44 45 var notice_name = name + '-notice'; 46 var notice_name_id = '#' + notice_name; 47 48 var noticeHTML = '<div id="' + notice_name + '" class="notice pos-' + position + '"><p><a href="' + url + '" target="_blank" class="notice-link">' + text + '</a><a href="#" class="notice-close">close notice</a></p></div>'; 49 50 if ($('html').hasClass(notice_name) && getCookie(notice_name) != 'hide') { 51 $('body') 52 .append(noticeHTML) 53 .on('click', notice_name_id + ' .notice-close', function (e) { 54 e.preventDefault(); 55 $(notice_name_id).fadeOut('', function () { 56 setCookie(notice_name, 'hide', 40); 57 }); 58 }); 59 } 60 61}
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.