PageSourceSearch

https://great-galaxy.ru/wp-content/themes/qa/js/main.js

js great-galaxy.ru collected 2026-10-02 17:28:11 UTC 10,506 bytes, 318 lines download raw bytes

1var $ = jQuery;
2$(document).ready(function(){
3	 
4	$("body").addClass("js");
5	 $('body').on('click','#commentform textarea',function(){
6
7    $('.sgr-main').addClass('active').find('.sgr-main').slideDown(400);
8  });
9	/*$('.js-author').each(function(){
10        var a = $(this), b = a.closest('.js-comm'), c = a.text().substr(0,1), 
11            f = b.find('.js-avatar'), e = f.children('img').attr('src'),
12			d = ["#354064","#ffbb66","#c26688","#00c6c0","#5d8df7","#0e7ca4","#643339"], rand = Math.floor(Math.random() * d.length);
13		if (e == '/templates/'+dle_skin+'/dleimages/noavatar.png') {
14            f.html('<div class="comm-letter" style="background-color:'+d[rand]+'">'+c+'</div>');
15		};
16    });	*/
17	
18	$('body').on('click','.ft-soc .fa',function(){
19		var $url = $(this).attr("data-href");
20		window.open($url);
21	});
22	
23	$('body').on('click','#pagi-load a',function(){
24		var $urlNext = $(this).attr('href');
25		var $scrollNext = $(this).offset().top - 60;
26        if ($urlNext !== undefined) {
27			$.ajax({
28				url: $urlNext,
29				beforeSend: function() {
30					ShowLoading('');
31				},			 
32                success: function(data) {
33                    $('#bottom-nav').remove();
34                    $('#dle-content').append($('#dle-content', data).html());
35                    // $('#dle-content').after($('#bottom-nav'));
36					window.history.pushState("", "", $urlNext);
37					$('html, body').animate({scrollTop:$scrollNext}, 800);	
38					HideLoading('');
39                },
40				  error: function() {				
41					HideLoading('');
42					alert('что-то пошло не так');
43				  }
44			});
45		};
46		return false;
47	});
48	
49	$('.js-search').click(function(){
50		$('.search-wrap').addClass('shown');
51		$('.focused').show();
52	});
53	$('.focused').click(function(){
54		$('.search-wrap').removeClass('shown');
55		$(this).hide();
56	});
57	
58	$('body').append('<div class="close-overlay" id="close-overlay"></div><div class="side-panel" id="side-panel"></div><div class="btn-close"><span class="fa fa-times"></span></div>');
59	$('.to-mob').each(function() {
60		$(this).clone().appendTo('#side-panel');
61	});			
62	$(".js-menu").click(function(){
63		$('#side-panel, .btn-close').addClass('active');
64		$("#close-overlay").fadeIn(200);
65		$('body').addClass('opened-menu');
66	});
67	$(".close-overlay, .btn-close").click(function(){
68		$('#side-panel, .btn-close').removeClass('active');
69		$('#close-overlay').fadeOut(200);
70		$('body').removeClass('opened-menu');
71	}); 
72	
73	$("#login-box").dialog({
74		autoOpen: false,
75		modal: true,
76		show: 'fade',
77		hide: 'fade',
78		width: 320
79	}); 
80
81	$('body').on('click','.js-login',function(){
82		$('#login-box').dialog('open');
83		return false;
84	});
85	
86	$('.full-text table').each(function(){
87		$(this).wrap("<div class='table-resp' />");
88	});
89	
90	$('#ac-av').html($('#lb-ava').html());
91	
92	$(".add-comm-btn").click(function(){
93		$("#add-comm-form").slideToggle(200);
94	});
95	$(".reply11").click(function(){
96		$("#add-comm-form").slideDown(200);
97	});
98	$('body').on('click','.ac-textarea textarea, .fr-wrapper',function(){
99		$('.add-comm-form').addClass('active').find('.ac-protect').slideDown(400);
100	});
101	$('.lb-soc a, .ac-soc a').on('click',function(){
102	   var href = $(this).attr('href');
103       var width  = 820;
104       var height = 420;
105       var left   = (screen.width  - width)/2;
106       var top   = (screen.height - height)/2-100;   
107
108       auth_window = window.open(href, 'auth_window', "width="+width+",height="+height+",top="+top+",left="+left+"menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
109       return false;
110	});
111    $('#dle-content > #dle-ajax-comments').appendTo($('#full-comms')); 
112
113	$('body').append('<div id="gotop"><span class="fa fa-arrow-up"></span></div>');
114	var $gotop=$('#gotop'); 
115	$(window).scroll (function () {
116		if ($(this).scrollTop () > 300) {$gotop.fadeIn(200);
117		} else {$gotop.fadeOut(200);}
118	});	
119	$gotop.click(function(){
120		$('html, body').animate({ scrollTop : 0 }, 'slow');
121	});
122	
123});
124
125
126/* end */
127;(function (factory) {
128  if (typeof define === 'function' && define.amd) {
129    // AMD. Register as an anonymous module.
130    define(['../../../engine/classes/js/jquery'], factory);
131  } else {
132    // Browser globals
133    factory(jQuery);
134  }
135}(function ($) {
136  $.timeago = function(timestamp) {
137    if (timestamp instanceof Date) {
138      return inWords(timestamp);
139    } else if (typeof timestamp === "string") {
140      return inWords($.timeago.parse(timestamp));
141    } else if (typeof timestamp === "number") {
142      return inWords(new Date(timestamp));
143    } else {
144      return inWords($.timeago.datetime(timestamp));
145    }
146  };
147  var $t = $.timeago;
148  $.extend($.timeago, {
149    settings: {
150      refreshMillis: 60000,
151      allowFuture: false,
152      localeTitle: false,
153      strings: {
154        prefixAgo: null,
155        prefixFromNow: null,
156        suffixAgo: "ago",
157        suffixFromNow: "from now",
158        seconds: "less than a minute",
159        minute: "about a minute",
160        minutes: "%d minutes",
161        hour: "about an hour",
162        hours: "about %d hours",
163        day: "a day",
164        days: "%d days",
165        month: "about a month",
166        months: "%d months",
167        year: "about a year",
168        years: "%d years",
169        wordSeparator: " ",
170        numbers: []
171      }
172    },
173    inWords: function(distanceMillis) {
174      var $l = this.settings.strings;
175      var prefix = $l.prefixAgo;
176      var suffix = $l.suffixAgo;
177      if (this.settings.allowFuture) {
178        if (distanceMillis < 0) {
179          prefix = $l.prefixFromNow;
180          suffix = $l.suffixFromNow;
181        }
182      }
183      var seconds = Math.abs(distanceMillis) / 1000;
184      var minutes = seconds / 60;
185      var hours = minutes / 60;
186      var days = hours / 24;
187      var years = days / 365;
188      function substitute(stringOrFunction, number) {
189        var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
190        var value = ($l.numbers && $l.numbers[number]) || number;
191        return string.replace(/%d/i, value);
192      }
193      var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
194        seconds < 90 && substitute($l.minute, 1) ||
195        minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
196        minutes < 90 && substitute($l.hour, 1) ||
197        hours < 24 && substitute($l.hours, Math.round(hours)) ||
198        hours < 42 && substitute($l.day, 1) ||
199        days < 30 && substitute($l.days, Math.round(days)) ||
200        days < 45 && substitute($l.month, 1) ||
201        days < 365 && substitute($l.months, Math.round(days / 30)) ||
202        years < 1.5 && substitute($l.year, 1) ||
203        substitute($l.years, Math.round(years));
204      var separator = $l.wordSeparator || "";
205      if ($l.wordSeparator === undefined) { separator = " "; }
206      return $.trim([prefix, words, suffix].join(separator));
207    },
208    parse: function(iso8601) {
209      var s = $.trim(iso8601);
210      s = s.replace(/\.\d+/,""); // remove milliseconds
211      s = s.replace(/-/,"/").replace(/-/,"/");
212      s = s.replace(/T/," ").replace(/Z/," UTC");
213      s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
214      return new Date(s);
215    },
216    datetime: function(elem) {
217      var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
218      return $t.parse(iso8601);
219    },
220    isTime: function(elem) {
221      // jQuery's `is()` doesn't play well with HTML5 in IE
222      return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
223    }
224  });
225  // functions that can be called via $(el).timeago('action')
226  // init is default when no action is given
227  // functions are called with context of a single element
228  var functions = {
229    init: function(){
230      var refresh_el = $.proxy(refresh, this);
231      refresh_el();
232      var $s = $t.settings;
233      if ($s.refreshMillis > 0) {
234        setInterval(refresh_el, $s.refreshMillis);
235      }
236    },
237    update: function(time){
238      $(this).data('timeago', { datetime: $t.parse(time) });
239      refresh.apply(this);
240    }
241  };
242  $.fn.timeago = function(action, options) {
243    var fn = action ? functions[action] : functions.init;
244    if(!fn){
245      throw new Error("Unknown function name '"+ action +"' for timeago");
246    }
247    // each over objects here and call the requested function
248    this.each(function(){
249      fn.call(this, options);
250    });
251    return this;
252  };
253  function refresh() {
254    var data = prepareData(this);
255    if (!isNaN(data.datetime)) {
256      $(this).text(inWords(data.datetime));
257    }
258    return this;
259  }
260  function prepareData(element) {
261    element = $(element);
262    if (!element.data("timeago")) {
263      element.data("timeago", { datetime: $t.datetime(element) });
264      var text = $.trim(element.text());
265      if ($t.settings.localeTitle) {
266        element.attr("title", element.data('timeago').datetime.toLocaleStr
266ing());
267      } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
268        element.attr("title", text);
269      }
270    }
271    return element.data("timeago");
272  }
273  function inWords(date) {
274    return $t.inWords(distance(date));
275  }
276  function distance(date) {
277    return (new Date().getTime() - date.getTime());
278  }
279  // fix for IE6 suckage
280  document.createElement("abbr");
281  document.createElement("time");
282}));
283// Russian
284(function() {
285  function numpf(n, f, s, t) {
286    // f - 1, 21, 31, ...
287    // s - 2-4, 22-24, 32-34 ...
288    // t - 5-20, 25-30, ...
289    var n10 = n % 10;
290    if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
291      return f;
292    } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
293      return s;
294    } else {
295      return t;
296    }
297  }
298  jQuery.timeago.settings.strings = {
299    prefixAgo: null,
300    prefixFromNow: "через",
301    suffixAgo: "назад",
302    suffixFromNow: null,
303    seconds: "меньше минуты",
304    minute: "минуту",
305    minutes: function(value) { return numpf(value, "%d минута", "%d минуты", "%d минут"); },
306    hour: "час",
307    hours: function(value) { return numpf(value, "%d час", "%d часа", "%d часов"); },
308    day: "день",
309    days: function(value) { return numpf(value, "%d день", "%d дня", "%d дней"); },
310    month: "месяц",
311    months: function(value) { return numpf(value, "%d месяц", "%d месяца", "%d месяцев"); },
312    year: "год",
313    years: function(value) { return numpf(value, "%d год", "%d года", "%d лет"); }
314  };
315})();
316 
317 
318    $("time.ago").timeago();

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.