PageSourceSearch

https://www.stjohndublin.org/_js/rotator.js?t=20150827140033

js stjohndublin.org collected 2026-10-02 15:05:08 UTC 6,045 bytes, 227 lines download raw bytes

1/*
2	Rotator JS
3	Requires jQuery version >= 1.7.
4*/
5$( '#cycle-1' ).on({
6	'cycle-bootstrap': function( e, optionHash, API){
7		API.initSlideshow = function() {
8			var opts = this.opts();
9	        var pauseObj = opts.container;
10	        var slideOpts;
11	        opts.API.calcFirstSlide();
12
13	        if ( opts.container.css('position') == 'static' )
14	            opts.container.css('position', 'relative');
15
16	        $(opts.slides[opts.currSlide]).css('top',0).fadeIn(1500);
17	        opts.API.stackSlides( opts.slides[opts.currSlide], opts.slides[opts.nextSlide], !opts.reverse );
18
19	        if ( opts.pauseOnHover ) {
20	            // allow pauseOnHover to specify an element
21	            if ( opts.pauseOnHover !== true )
22	                pauseObj = $( opts.pauseOnHover );
23
24	            pauseObj.hover(
25	                function(){ opts.API.pause( true ); }, 
26	                function(){ opts.API.resume( true ); }
27	            );
28	        }
29
30	        // stage initial transition
31	        if ( opts.timeout ) {
32	            slideOpts = opts.API.getSlideOpts( opts.nextSlide );
33	            opts.API.queueTransition( slideOpts, slideOpts.timeout + opts.delay );
34	        }
35
36	        opts._initialized = true;
37	        opts.API.updateView( true );
38	        opts.API.trigger('cycle-initialized', [ opts ]);
39	        opts.API.postInitSlideshow();
40		}
41   	},
42	'cycle-initialized': function( event, opts ) {
43		//$('.customSentinel').css('display','none');
44	}
45});
46
47$(document).ready(function() {
48
49	var mobile = false;
50	if($(window).width()<946){ //Corrosponds with SASS $nav-break
51		mobile = true;
52	}
53
54
55	// Parallax Goodness
56    // $('#cycle-1 .slide').each(function(){
57    //     var $bgobj = $(this), // assigning the object
58    //     	speed = 5;
59     
60    //     $(window).scroll(function() {
61    //         var yPos = -($(window).scrollTop() / speed); 
62             
63    //         // Put together our final background position
64    //         var coords = '50% '+ yPos + 'px';
65 
66    //         // Move the background
67    //         $bgobj.css({ backgroundPosition: coords }, 700);
68    //     }); 
69    // });    
70
71
72	//$('#cycle-2 .slide[data-position*="1"]').addClass('current');
73	
74	// Parallax Goodness + arrow
75	// $('#cycle-1').on({
76	// 	'cycle-before': function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
77			
78	// 		// Determine Direction
79	// 		// Animate background position utilizes custom plugin therefore has atypical options
80	// 		if( forwardFlag ){ 
81	// 			$(this).animate({backgroundPosition: "-=100 0"}, 700); 
82	// 		} else {
83	// 			$(this).animate({backgroundPosition: "+=100 0"}, 700); 
84	// 		}
85
86
87	// 		if(optionHash){
88	// 			$('#cycle-2 .slide').removeClass('current');
89
90	// 		}
91
92	// 	},
93	// 	'cycle-after': function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag){
94	// 		if(optionHash){
95	// 			//console.log(optionHash);
96	// 			var pos = optionHash.position;
97
98	// 			$('#cycle-2 .slide[data-position*="'+pos+'"]').addClass('current');
99	// 		}	
100	// 	}
101	// })
102
103
104
105	// Progress Bar
106	var progress = $('#progress'),
107    slideshow = $( '#cycle-1' );
108
109	slideshow.on( 'cycle-initialized cycle-before', function( e, opts ) {
110	    progress.stop(true).css( 'width', 0 );
111	});
112
113	slideshow.on( 'cycle-initialized cycle-after', function( e, opts ) {
114	    if ( ! slideshow.is('.cycle-paused') )
115	        progress.animate({ width: '100%' }, opts.timeout, 'linear' );
116	});
117
118	slideshow.on( 'cycle-paused', function( e, opts ) {
119	   progress.stop(); 
120	});
121
122	slideshow.on( 'cycle-resumed', function( e, opts, timeoutRemaining ) {
123	    progress.animate({ width: '100%' }, timeoutRemaining, 'linear' );
124	});
125
126
127
128	// Video Slide
129	$('.video-slide').click(function(e){
130
131		e.preventDefault();
132		var a = $(this);
133
134		if(a.data('video-type')=='embed'){
135
136			var embed_src = updateURLParam(a.data('embed-src'),'autoplay',0);
137
138			if(!mobile){
139				var mediaTitle = a.data('title');
140				$.colorbox({
141					iframe: true,
142					href: embed_src,
143					width: 800,
144					height: 497,
145					title: mediaTitle,
146					onOpen: function(){
147						$('.cycle-slideshow').cycle('pause');
148					},
149					onCleanup: function(){
150						$('.cycle-slideshow').cycle('resume');
151					}
152				});
153			} else {
154				window.open(embed_src);
155			}
156
157		} else if(a.data('video-type')=='file') {
158
159			var mediaURL = a.data('file-url');
160
161			if(!mobile){
162				var mediaTitle = a.data('title');
163				var mediaImg = encodeURIComponent(a.data('image'));
164				var mediaWidth = 800;
165				var mediaHeight = 497;
166				var mediaExt = mediaURL.substr((mediaURL.lastIndexOf('.')+1)).toLowerCase();
167				var JWformats = new Array('mp3', 'aac', 'm4a', 'f4a', 'flv', 'mp4', 'm4v', 'f4v', 'mov');
168				if($.inArray(mediaExt, JWformats)>-1){
169					var popupURL =
170						'/_popup/popup.php'
171						+'?file='+mediaURL
172						+'&title='+mediaTitle
173						+'&mediaWidth='+mediaWidth
174						+'&mediaHeight='+mediaHeight
175						+'&image='+mediaImg;
176					$.colorbox({
177						iframe: true,
178						href: popupURL,
179						innerWidth: mediaWidth,
180						innerHeight: mediaHeight,
181						title: mediaTitle,
182						onOpen: function(){
183							$('.cycle-slideshow').cycle('pause');
184						},
185						onCleanup: function(){
186							$('.cycle-slideshow').cycle('resume');
187						}
188					});
189				}
190			} else {
191				window.open(mediaURL);
192			}
193		}
194
195	});
196});
197
198
199
200
201function getURLParam(url, param){
202  param = param.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
203  var regexS = "[\\?&]" + param + "=([^&#]*)";
204  var regex = new RegExp(regexS);
205  var results = regex.exec(url);
206  if(results == null) {
207    return "";
208  } else {
209    return decodeURIComponent(results[1].replace(/\+/g, " "));
210  }
211}
212
213function updateURLParam(url, param, val) {
214	var re = new RegExp("([?|&])" + param + "=.*?(&|$)", "i"),separator = url.indexOf('?') !== -1 ? "&" : "?";
215	if (url.match(re)) {
216		var url_new = url.replace(re, '$1' + param + "=" + val + '$2');
217	} else {
218		var url_new = url + separator + param + "=" + val;
219	}
220	return url_new;
221}
222
223function setComputedWidth(elem){
224	elem.css('width','100%');
225	var width = elem.width();
226	elem.css('width',width);
227}

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.