PageSourceSearch

https://rua.gr/templates/gk_news/js/gk.scripts.js

js rua.gr collected 2026-09-24 20:15:40 UTC 7,511 bytes, 243 lines download raw bytes

1/**
2 * jQuery Cookie plugin
3 *
4 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
5 * Dual licensed under the MIT and GPL licenses:
6 * http://www.opensource.org/licenses/mit-license.php
7 * http://www.gnu.org/licenses/gpl.html
8 *
9 */
10jQuery.noConflict();
11jQuery.cookie = function (key, value, options) {
12
13    // key and at least value given, set cookie...
14    if (arguments.length > 1 && String(value) !== "[object Object]") {
15        options = jQuery.extend({}, options);
16
17        if (value === null || value === undefined) {
18            options.expires = -1;
19        }
20
21        if (typeof options.expires === 'number') {
22            var days = options.expires, t = options.expires = new Date();
23            t.setDate(t.getDate() + days);
24        }
25
26        value = String(value);
27
28        return (document.cookie = [
29            encodeURIComponent(key), '=',
30            options.raw ? value : encodeURIComponent(value),
31            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
32            options.path ? '; path=' + options.path : '',
33            options.domain ? '; domain=' + options.domain : '',
34            options.secure ? '; secure' : ''
35        ].join(''));
36    }
37
38    // key and possibly options given, get cookie...
39    options = value || {};
40    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
41    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
42};
43
44/**
45 *
46 * Template scripts
47 *
48 **/
49
50jQuery(window).on("load", function() {
51
52	if(jQuery(document.body).attr('data-smoothscroll') == '1') {
53		// smooth anchor scrolling
54		if(
55	    !(
56		    jQuery('#gkMainbody').find('.item-page').length &&
57		    jQuery('#gkMainbody').find('.item-page').hasClass('edit')
58		   ) && !(
59		    jQuery('#gkMainbody').find('.subpage').length &&
60		    jQuery('#gkMainbody').find('.subpage').hasClass('edit')
61		   ) && !(
62		    jQuery('#modules-form').length
63		   )
64	  ) {
65        jQuery('a[href*="#"]').not('.joms-tab__bar a').on('click', function (e) {
66            e.preventDefault();
67            if(
68                this.hash !== '' &&
69                this.hash.indexOf('carousel') === -1 &&
70                this.hash.indexOf('advancedSearch') === -1
71            ) {
72                var target = jQuery(this.hash);
73
74                if(this.hash !== '' && this.href.replace(this.hash, '') == window.location.href.replace(window.location.hash, '')) {
75                    if(target.length && this.hash !== '#') {
76                        jQuery('html, body').stop().animate({
77                            'scrollTop': target.offset().top
78                        }, 1000, 'swing', function () {
79                            if(this.hash !== '#') {
80                                window.location.hash = target.selector;
81                            }
82                        });
83                    } else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') {
84                        window.location.href = this.href;
85                    }
86                } else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') {
87                    window.location.href = this.href;
88                }
89            }
90        });
91    }
92	}
93
94	// style area
95	if(jQuery('#gkStyleArea')){
96		jQuery('#gkStyleArea').find('a').each(function(i, element){
97			jQuery(element).on('click',function(e){
98	            e.preventDefault();
99	            e.stopPropagation();
100				changeStyle(i+1);
101			});
102		});
103
104		jQuery('#gkBackgrounds').find('a').each(function(i, element){
105			element.on('click',function(e){
106		        e.preventDefault();
107		        e.stopPropagation();
108				changeBg(i+1);
109			});
110		});
111	}
112	// font-size switcher
113	if(jQuery('#gkTools') && jQuery('#gkMainbody')) {
114		var current_fs = 100;
115
116		jQuery('#gkMainbody').css('font-size', current_fs+"%");
117
118		jQuery('#gkToolsInc').on('click',function(e){
119			e.stopPropagation();
120			e.preventDefault();
121			if(current_fs < 150) {
122				jQuery('#gkMainbody').animate({ 'font-size': (current_fs + 10) + "%"}, 200);
123				current_fs += 10;
124			}
125		});
126		jQuery('#gkToolsReset').on('click',function(e){
127			e.stopPropagation();
128			e.preventDefault();
129			jQuery('#gkMainbody').animate({ 'font-size' : "100%"}, 200);
130			current_fs = 100;
131		});
132		jQuery('#gkToolsDec').on('click',function(e){
133			e.stopPropagation();
134			e.preventDefault();
135			if(current_fs > 70) {
136				jQuery('#gkMainbody').animate({ 'font-size': (current_fs - 10) + "%"}, 200);
137				current_fs -= 10;
138			}
139		});
140	}
141	// login popup
142	if(jQuery('#gkPopupLogin').length > 0) {
143		var popup_overlay = jQuery('#gkPopupOverlay');
144		popup_overlay.css({'display': 'none', 'opacity' : 0});
145
146		popup_overlay.fadeOut();
147
148		jQuery('#gkPopupLogin').css({'display': 'block', 'opacity': 0, 'height' : 0});
149		var opened_popup = null;
150		var popup_login = null;
151		var popup_login_h = null;
152		var popup_login_fx = null;
153
154		if(jQuery('#gkPopupLogin') && jQuery('#btnLogin')) {
155			popup_login = jQuery('#gkPopupLogin');
156			popup_login.css('display', 'block');
157			popup_login_h = popup_login.find('.gkPopupWrap').outerHeight();
158
159			jQuery('#gkLogin').on('click', function(e) {
160				e.preventDefault();
161				e.stopPropagation();
162				popup_overlay.css({'opacity' : 0.6});
163				popup_overlay.fadeIn('slow');
164
165				popup_login.animate({'opacity':1, 'height': popup_login_h},200, 'swing');
166				opened_popup = 'login';
167
168				setTimeout(function() {
169					if(jQuery('#modlgn-username')) {
170						jQuery('#modlgn-username').focus();
171					}
172				}, 600);
173			});
174		}
175
176		popup_overlay.on('click', function() {
177			if(opened_popup == 'login')	{
178				popup_overlay.fadeOut('slow');
179				popup_login.css({
180					'opacity' : 0,
181					'height' : 0
182				});
183			}
184		});
185	}
186});
187//
188jQuery(window).ready(function() {
189	// NSP header suffix
190	jQuery('.header').each(function(i, elm) {
191		elm = jQuery(elm);
192		if(elm.hasClass('box')) {
193			jQuery(elm).find('.nspArt').each(function(i, art) {
194				art = jQuery(art);
195				art.find('.nspImageWrapper').append(art.find('.nspHeader'));
196			});
197		}
198	});
199	// NSP nsphover suffix
200	jQuery('.nsphover').each(function(i,elm) {
201		elm = jQuery(elm);
202		if(elm.hasClass('box')) {
203			jQuery(elm).find('.nspArt').each(function(i, art) {
204				var overlay = jQuery('<div></div>');
205				overlay.attr('class', 'nspHoverOverlay');
206				//.appendTo(art);
207				var test = jQuery('<div></div>');
208				art = jQuery(art);
209				var info = art.find('.nspInfo1');
210				art.append(overlay);
211				overlay.append(art.find('.nspText'));
212				var copy = art.find('.nspHeader').clone();
213				overlay.prepend(copy);
214
215				art.mouseenter(function() {
216					overlay.addClass('active');
217					if(info) {
218						info.addClass('active');
219					}
220				});
221
222				art.mouseleave(function() {
223					overlay.removeClass('active');
224					if(info) {
225						info.removeClass('active');
226					}
227				});
228			});
229		}
230	});
231});
232
233
234// Function to change styles
235function changeStyle(style){
236	var file1 = $GK_TMPL_URL+'/css/style'+style+'.css';
237	var file2 = $GK_TMPL_URL+'/css/typography/typography.style'+style+'.css';
238	var file3 = $GK_TMPL_URL+'/css/typography/typography.iconset.style'+style+'.css';
239	jQuery('head').append('<link rel="stylesheet" href="'+file1+'" type="text/css" />');
240	jQuery('head').append('<link rel="stylesheet" href="'+file2+'" type="text/css" />');
241	jQuery('head').append('<link rel="stylesheet" href="'+file3+'" type="text/css" />');
242	jQuery.cookie('gk_news_j30_style', style, { expires: 365, path: '/' });
243}

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.