1// IE checker 2function gkIsIE() { 3 var myNav = navigator.userAgent.toLowerCase(); 4 return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false; 5} 6 7// Function to change styles 8function changeStyle(style){ 9 // cookie function 10 jQuery.cookie = function (key, value, options) { 11 // key and at least value given, set cookie... 12 if (arguments.length > 1 && String(value) !== "[object Object]") { 13 options = jQuery.extend({}, options); 14 if (value === null || value === undefined) { 15 options.expires = -1; 16 } 17 if (typeof options.expires === 'number') { 18 var days = options.expires, t = options.expires = new Date(); 19 t.setDate(t.getDate() + days); 20 } 21 22 value = String(value); 23 24 return (document.cookie = [ 25 encodeURIComponent(key), '=', 26 options.raw ? value : encodeURIComponent(value), 27 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 28 options.path ? '; path=' + options.path : '', 29 options.domain ? '; domain=' + options.domain : '', 30 options.secure ? '; secure' : '' 31 ].join('')); 32 } 33 // key and possibly options given, get cookie... 34 options = value || {}; 35 var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; 36 return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 37 }; 38 39 var file1 = $GK_TMPL_URL+'/css/style'+style+'.css'; 40 var file2 = $GK_TMPL_URL+'/css/typography/typography.style'+style+'.css'; 41 jQuery('head').append('<link rel="stylesheet" href="'+file1+'" type="text/css" />'); 42 jQuery('head').append('<link rel="stylesheet" href="'+file2+'" type="text/css" />'); 43 44 jQuery.cookie('gk_writer_j30_style', style, { expires: 365, path: '/' }); 45} 46 47// 48jQuery(document).ready(function() { 49 // smooth anchor scrolling 50 if(!(jQuery('#gkMainbody').find('.subpage').length && jQuery('#gkMainbody').find('.subpage').hasClass('edit')) && !jQuery('#gkMainbody').find('.subpage').find('form#modules-form')) { 51 jQuery('a[href*="#"]').on('click', function (e) { 52 e.preventDefault(); 53 if(this.hash !== '' && this.hash.indexOf('carousel') === -1) { 54 var target = jQuery(this.hash); 55 56 if(this.hash !== '' && this.href.replace(this.hash, '') == window.location.href.replace(window.location.hash, '')) { 57 if(target.length && this.hash !== '#') { 58 jQuery('html, body').stop().animate({ 59 'scrollTop': target.offset().top 60 }, 1000, 'swing', function () { 61 if(this.hash !== '#') { 62 window.location.hash = target.selector; 63 } 64 }); 65 } else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') { 66 window.location.href = this.href; 67 } 68 } else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') { 69 window.location.href = this.href; 70 } 71 } 72 }); 73 } 74 // style area 75 if(jQuery('#gk-style-area').length > 0){ 76 jQuery('#gk-style-area').find('a').each(function(i, element){ 77 jQuery(element).click(function(e){ 78 e.preventDefault(); 79 e.stopPropagation(); 80 changeStyle(i+1); 81 }); 82 }); 83 } 84 // K2 font-size switcher fix 85 if(jQuery('#fontIncrease').length > 0 && jQuery('.itemIntroText').length > 0) { 86 jQuery('#fontIncrease').click(function() { 87 jQuery('.itemIntroText').attr('class', 'itemIntroText largerFontSize'); 88 }); 89 90 jQuery('#fontDecrease').click( function() { 91 jQuery('.itemIntroText').attr('class', 'itemIntroText smallerFontSize'); 92 }); 93 } 94 // Equal columns 95 gkEqualColumns(); 96 // Floating sidebar 97 if(jQuery('#gk-right-top')) { 98 var top_area = jQuery('#gk-right-top'); 99 var top_area_bg = jQuery('#gk-right-top-bg'); 100 var win = jQuery(window); 101 var body = jQuery(document.body); 102 103 jQuery(window).scroll(function() { 104 if(win.width() >= body.attr('data-tablet-width')) { 105 var scrolled = win.scrollTop(); 106 top_area.css('top', scrolled + 'px'); 107 top_area_bg.css('top', scrolled + 'px'); 108 } else { 109 top_area.css('top', '0px'); 110 } 111 }); 112 } 113 // Login popup 114 if(jQuery('#gk-login-btn')) { 115 var login_btn = jQuery('#gk-login-btn'); 116 var sidebar = jQuery('#gk-right'); 117 var popup = jQuery('#gkPopupLogin'); 118 119 login_btn.click(function(e) { 120 e.preventDefault(); 121 122 if(login_btn.hasClass('popup-open')) { 123 sidebar.removeClass('popup-open') 124 login_btn.removeClass('popup-open'); 125 126 setTimeout(function() { 127 popup.css('display', 'none'); 128 }, 350); 129 } else { 130 popup.css('display', 'block'); 131 132 if(jQuery(window).width() <= jQuery(document.body).attr('data-tablet-width')) { 133 popup.css('top', '100px'); 134 } else { 135 popup.css('top', (jQuery(window).scrollTop() + 100) + "px"); 136 } 137 138 setTimeout(function() { 139 sidebar.addClass('popup-open'); 140 login_btn.addClass('popup-open'); 141 }, 50); 142 } 143 }); 144 } 145 // search 146 var searchbox = jQuery('#gk-search .inputbox'); 147 if(searchbox.length) { 148 jQuery('#gk-search').click(function() { 149 searchbox.trigger('focus'); 150 }); 151 152 searchbox.focus(function() { 153 var input = jQuery('#gk-search'); 154 input.addClass('search-active'); 155 }); 156 157 searchbox.blur(function() { 158 var input = jQuery('#gk-search'); 159 input.removeClass('search-active'); 160 }); 161 } 162}); 163 164jQuery(window).on("load",function() { 165 gkEqualColumns(); 166}); 167 168jQuery(window).resize(function() { 169 gkEqualColumns(); 170}); 171 172function gkEqualColumns() { 173 if(jQuery(window).width() > jQuery(document.body).attr('data-tablet-width')) { 174 var content = jQuery('#gk-content'); 175 var sidebar = jQuery('#gk-right'); 176 177 if(!jQuery(document.body).hasClass('fixed-content')) { 178 content.css('min-height', 0); 179 180 if(content.outerHeight() < jQuery(window).height()) { 181 content.css('min-height', jQuery(window).height() + "px"); 182 } 183 184 if( 185 content.outerHeight() < sidebar.outerHeight() && 186 jQuery(window).height() < sidebar.outerHeight() 187 ) { 188 content.css('min-height', sidebar.outerHeight() + "px"); 189 } 190 } 191 } 192} 193 194// function used to maintain fixed content on frontpage 195jQuery(document).ready(function() { 196 if(jQuery('#gk-right') && jQuery(document.body).hasClass('fixed-content')) { 197 function gkFixedContent() { 198 if(jQuery(window).width() <= jQuery(document.body).attr('data-tablet-width')) { 199 jQuery('#gk-right').css('margin-top', jQuery('#gk-content').outerHeight() + "px"); 200 } else { 201 jQuery('#gk-right').css('margin-top', '0px'); 202 } 203 } 204 205 gkFixedContent(); 206 207 jQuery(window).resize(function() { 208 gkFixedContent(); 209 }); 210 } 211});
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.