PageSourceSearch

https://facetia.ru/sites/all/themes/framework/js/script.js?rg73sl

js facetia.ru collected 2026-10-02 08:00:56 UTC 5,699 bytes, 182 lines download raw bytes

1(function ($) {
2	
3$(document).ready(function(){
4	
5	console.log('ready');
6	
7	//Cufon.replace(".alexandra");
8	
9	// форма поиска (с beethoven.ru)
10	/*$("#block-search-form a").click(function(){
11			console.log('click');
12			$("#search-block-form .container-inline").show();			
13			$("#search-block-form input.form-text").focus().blur(function() {				
14				$("body").click(function(e) {						
15					console.log(e.target.id);						
16					if (e.target.id == "edit-submit") return true;						
17					else if (e.target.className != "form-text") {	
18						$("#search-block-form .container-inline").hide();
19						return true;
20					}						
21				});
22			});			
23			return false;
24	});*/
25	
26	var nextUrl = $('.page-next').attr('href');
27	var prevUrl = $('.page-previous').attr('href');
28	//var upUrl = $('.page-up').attr('href');
29	
30	
31		
32	/*$('body').swipe({
33		swipe:function(event, direction, distance, duration, fingerCount, fingerData) {
34			
35			console.log("You swiped " + direction );
36			
37			if (direction=='left' && !!nextUrl) document.location.href = nextUrl;
38			else if (direction=='right' && !!prevUrl) document.location.href = prevUrl;
39			//else if (direction=='up' && !!upUrl) document.location.href = upUrl;
40        },
41        threshold:150
42	});*/
43	
44	
45	function swipedetect(el, callback){
46  
47		var touchsurface = el,
48		swipedir,
49		startX,
50		startY,
51		distX,
52		distY,
53		threshold = 150, //required min distance traveled to be considered swipe
54		restraint = 100, // maximum distance allowed at the same time in perpendicular direction
55		allowedTime = 500, // maximum time allowed to travel that distance
56		elapsedTime,
57		startTime,
58		handleswipe = callback || function(swipedir){}
59	  
60		touchsurface.addEventListener('touchstart', function(e){
61			var touchobj = e.changedTouches[0]
62			swipedir = 'none'
63			dist = 0
64			startX = touchobj.pageX
65			startY = touchobj.pageY
66			startTime = new Date().getTime() // record time when finger first makes contact with surface
67			//e.preventDefault()
68		}, false)
69	  
70		touchsurface.addEventListener('touchmove', function(e){
71			e.preventDefault() // prevent scrolling when inside DIV
72		}, false)
73	  
74		touchsurface.addEventListener('touchend', function(e){
75			var touchobj = e.changedTouches[0]
76			distX = touchobj.pageX - startX // get horizontal dist traveled by finger while in contact with surface
77			distY = touchobj.pageY - startY // get vertical dist traveled by finger while in contact with surface
78			elapsedTime = new Date().getTime() - startTime // get time elapsed
79			if (elapsedTime <= allowedTime){ // first condition for awipe met
80				if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint){ // 2nd condition for horizontal swipe met
81					swipedir = (distX < 0)? 'left' : 'right' // if dist traveled is negative, it indicates left swipe
82				}
83				else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint){ // 2nd condition for vertical swipe met
84					swipedir = (distY < 0)? 'up' : 'down' // if dist traveled is negative, it indicates up swipe
85				}
86			}
87			handleswipe(swipedir)
88			//e.preventDefault()
89		}, false)
90	}
91	  
92	//USAGE:
93
94	var el = document.getElementById('swipezone');
95	swipedetect(el, function(swipedir){
96		// swipedir contains either "none", "left", "right", "top", or "down"
97		//el.innerHTML = 'Swiped <span style="color:yellow;margin: 0 5px;">' + swipedir +'</span>';
98		console.log(!!nextUrl); 
99		if (swipedir=='left' && !!nextUrl) document.location.href = nextUrl;
100		else if (swipedir=='right' && !!prevUrl) document.location.href = prevUrl;
101	});
102
103});
104
105	
106	
107	
108// Smooth scroll blocking
109document.addEventListener( 'DOMContentLoaded', function() {
110	if ( 'onwheel' in document ) {
111		window.onwheel = function( event ) {
112			if( typeof( this.RDSmoothScroll ) !== undefined ) {
113				try { window.removeEventListener( 'DOMMouseScroll', this.RDSmoothScroll.prototype.onWheel ); } catch( error ) {}
114				event.stopPropagation();
115			}
116		};
117	} else if ( 'onmousewheel' in document ) {
118		window.onmousewheel= function( event ) {
119			if( typeof( this.RDSmoothScroll ) !== undefined ) {
120				try { window.removeEventListener( 'onmousewheel', this.RDSmoothScroll.prototype.onWheel ); } catch( error ) {}
121				event.stopPropagation();
122			}
123		};
124	}
125
126	try { $('body').unmousewheel(); } catch( error ) {}
127});
128
129
130$(function(){
131// IPad/IPhone
132  var viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]'),
133  ua = navigator.userAgent,
134
135  gestureStart = function () {viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";},
136
137  scaleFix = function () {
138    if (viewportmeta && /iPhone|iPad/.test(ua) && !/Opera Mini/.test(ua)) {
139      viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
140      document.addEventListener("gesturestart", gestureStart, false);
141    }
142  };
143  
144  scaleFix();
145  // Menu Android
146  if(window.orientation!=undefined){
147  var regM = /ipod|ipad|iphone/gi,
148   result = ua.match(regM)
149  if(!result) {
150   $('.sf-menu li').each(function(){
151    if($(">ul", this)[0]){
152     $(">a", this).toggle(
153      function(){
154       return false;
155      },
156      function(){
157       window.location.href = $(this).attr("href");
158      }
159     );
160    } 
161   })
162  }
163 }
164});
165var ua=navigator.userAgent.toLocaleLowerCase(),
166 regV = /ipod|ipad|iphone/gi,
167 result = ua.match(regV),
168 userScale="";
169if(!result){
170 userScale=",user-scalable=0"
171}
172document.write('<meta name="viewport" content="width=device-width,initial-scale=1.0'+userScale+'">')
173
174var currentYear = (new Date).getFullYear();
175  $(document).ready(function() {
176  $("#copyright-year").text( (new Date).getFullYear() );
177  });
178
179  $(function(){
180	  $('.sf-menu').superfish({autoArrows: true})
181  })
182}(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.