PageSourceSearch

https://abcourier.com/lib/js/main.js?v=1.089

js abcourier.com collected 2026-10-08 14:41:45 UTC 25,392 bytes, 705 lines download raw bytes

1var deviceIndex = 0; //usually 0 means mobile, 1 means tablet and 2 means desktop
2
3/* can be used for proportional resizing of elements and em recalibration */
4var layoutDefaultScreenSize= 1280; // the width of the Photoshop layout
5var layoutDefaultFontSize = 10; // the font size of the html element
6var layoutBreakingPoints = [736, 1024, 1280]; // these should be adjusted to match CSS
7var fontModifier = 1;
8var useREM = false; // whether to use EM and REM resizing
9
10/* holds the position and direction of the scrollbar */
11var scrollPosition = 0;
12var scrollDirection = "down";
13
14/* window width and height variables, gets updated on resize */
15var WW = 0; //includes scrollbars, matches with css
16var WH = 0;
17var DH = 0;
18var wW = 0; // no scrollbars
19
20var scrollElements = []; // list of elements registered for scrolling events
21
22$(document).ready(function (){
23		maxWait = 1000; //how long to wait for preloading
24
25		var assets = []; //list of assets to preload
26
27		$("img").each(function () {
28			assets.push($(this).attr("src"));
29		}); //default: load all images;
30
31		preload(assets, _init, onProgress); //calls _init after preloading
32
33})
34
35function onProgress(p) {
36	//	console.log(p); // fire throughout the preload, opportunity to implement something like a progress animation
37}
38
39
40function _init() {
41
42		$("html").removeClass("loading");	// content fade in
43
44		windowResize(); //trigger onResize event
45
46		$(window).bind("resize", function () {
47			windowResize();
48		});
49
50		$(window).scroll(function (scrollEvent) {
51			windowScroll(scrollEvent);
52		});
53
54	
55	// this is not used yet
56    $('body').bind('mousewheel', function(e){
57		return true;
58
59		if (!$(this).hasClass("stop-scrolling")) {
60//			runScrollAnimations();
61			return true;
62		}
63		
64		if(e.originalEvent.wheelDelta /120 > 0) {
65            scrollDirection = "up";
66        } else{
67            scrollDirection = "down";
68        }
69//		if (scrollPosition <= parseInt($(window).scrollTop()) ) scrollDirection = "down"; else scrollDirection = "up";
70//		scrollPosition = parseInt($(window).scrollTop());
71//		runScrollAnimations();
72		return true;
73    });
74
75		$("#container").click(function () {
76			return true;
77		});
78
79		if (location.hash)
80		{
81			var hash = location.hash.replace("#", "");
82			setTimeout(function () {
83				scrollToArea(hash);
84			}, 300);
85			
86
87		}
88		// in-document smooth scrolling links
89		$("a.scrolling").click(function () {
90			tmp = $(this).attr("href");
91			lk = tmp.split("#");
92			if (lk.length > 1) {
93				if(location.pathname == lk[0]) where = lk[1]; 
94				else {
95					return true;
96				}
97			} else 
98				where = lk[0];
99//			where = $(this).attr("href").replace('/#', '').replace('#', '');
100			scrollToArea(where);
101			return false;
102
103		});	
104		
105		$("div.burger").click(function () {
106			$("nav").toggleClass("active");
107			$(this).toggleClass("active");
108			return false;
109		});
110
111		$("#mainbody, .scrolling").click(function() {
112			$("nav").removeClass("active");
113			$("div.burger").removeClass("active");
114			
115		})
116	
117//
118//		//default handler for links with class "print"
119//		$(".print").click(function () {
120//			window.print();
121//			return false;
122//		})
123//
124//		//default handler for links with class "email-friend"
125//		$(".email-friend").click(function () {
126//			showEmailFriend();
127//			return false;
128//		})
129//
130//
131//		//default handler for links with class "video"
132//		$(".video").click(function () {
133//			playVideo($(this).attr("rel"));
134//			return false;
135//		});
136//
137//		//default handler for links with class "youtube"
138//		$(".youtube").click(function () {
139//			playVideo($(this).attr("rel"));
140//			return false;
141//		});
142//
143//
144		//default handler for links with class "image"
145		$(".image").fancybox({
146			'transitionIn'	:	'elastic',
147			'transitionOut'	:	'elastic'
148		});
149//
150		/* OPTIONAL HELPERS */
151		markActive();
152		
153		_formValidation();
154
155		// register elements for scrolling
156		registerScrollable();
157
158		//trigger scrolling event if page loads mid-way
159		if (scrollPosition > 0) onScroll();
160
161		detectScrolling();
162		init(); //calls init in js/main.js 
163}
164
165function windowScroll(scrollEvent) {
166	detectScrolling();
167	onScroll(scrollEvent);
168}
169
170function windowResize() {
171		w = window.innerWidth;
172		WW = window.innerWidth;
173		wW = $(window).width();
174		WH = $(window).height();
175		DH = $("body").outerHeight();
176		
177		oldDevice = deviceIndex;
178
179		for (i=0; i<layoutBreakingPoints.length ; i++ )
180		{
181			if (layoutBreakingPoints[i] <= w)
182			{
183				deviceIndex = i;
184			}
185		}
186
187		if (oldDevice != deviceIndex)
188		{
189			deviceChange(oldDevice, deviceIndex); // signifies the website moved into a different state, i.e. from desktop to tablet. Javascript may need to be executed to transform elements on the page
190		}
191
192		
193		// This is used to dynamically adjust sizes expressed in EMs. The font size of the html element will be adjusted proportionally to the layout original size. For example, if the layout was designed at 1280px, an element with font size 20px in the design will be changed to font size 10px if the page is only 640px wide.
194		if (parseInt(w) >= layoutDefaultScreenSize) w = layoutDefaultScreenSize;
195		fontModifier = (w / layoutDefaultScreenSize);
196//		console.log(layoutDefaultScreenSize);
197		f = layoutDefaultFontSize * fontModifier;
198		if (w <= layoutBreakingPoints[0]) f = layoutDefaultFontSize; // no resizing on mobile
199		
200		if (useREM) $("html").css("font-size", f);
201		
202		/* OPTIONAL HELPERS */
203		//		alignHeights();
204		//		keepRatios();
205		//		adjustPositions();
206		//		adjustMenu();
207		//		convertSlides();
208		
209		// update scrolling parameters
210		if (scrollPosition <= parseInt($(window).scrollTop()) ) scrollDirection = "down"; else scrollDirection = "up";
211		scrollPosition = parseInt($(window).scrollTop());
212		
213
214		// UPDATE scrolling elements with new data
215		for (i=0; i<scrollElements.length ; i++ )
216		{
217			obj = scrollElements[i].obj;
218			_fixed = false; if (obj.css("position") == "fixed") _fixed = true;
219			_top = _fixed ? scrollElements[i].top_static : obj.offset().top;
220			scrollElements[i].top = _top;
221			scrollElements[i].height = obj.outerHeight();
222			scrollElements[i].max = obj.outerWidth() * scrollElements[i].ratio;
223			scrollElements[i].distance = obj.outerWidth() * scrollElements[i].ratio - obj.outerHeight();
224			scrollElements[i].start = scrollElements[i].top -obj.attr("scroll-start") * $(window).outerHeight();
225			scrollElements[i].end = scrollElements[i].top -obj.attr("scroll-end") * $(window).outerHeight();
226			scrollElements[i].delta = scrollPosition - scrollElements[i].start;
227
228			switch (scrollElements[i].animation)
229			{
230				case "scroll-up":
231						scrollingObject = scrollElements[i].obj.find("img");
232						scrollingObject.css("top", "0px");
233						scrollElements[i].active = false;
234						scrollElements[i].complete = true;
235						break;
236				case "simple":
237						if (WW <= scrollElements[i].minwidth) {
238							if (scrollElements[i].active && scrollElements[i].active == "down") scrollElements[i].complete = "down";
239							else scrollElements[i].complete = "";
240							scrollElements[i].active = false;
241							scrollElements[i].obj.removeClass("revealed");
242						}
243						break;
244
245			}
246		}
247
248		if (WW >= 768)
249		{
250			$(".slide-body").removeClass("slide-body");
251		}
252//		console.log(scrollElements);
253
254		onResize();
255}
256
257//this function is called everytime the site changes its media query (provided the breaking points are properly defined). oldDevice and newDevice are internal IDs in the layoutBreakingPoints array.
258function deviceChange(oldDevice, newDevice) {
259	
260}
261
262
263
264/* STANDARD HELPERS */
265
266var submitInProgress = false;
267var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
268function _formValidation() {
269		$("form.validateme").submit(function () {
270
271			if (submitInProgress) return false;
272			submitInProgress = true;
273
274			fireSpecialEvent("form-attempt", $(this).attr("id"));
275
276			
277
278//			$(this).find("input[type=submit]").val("please wait ...");
279			label = $(this).find("input[type=submit]").val();
280			$(this).find("input[type=submit]").addClass("waiting").val("Sending ...");
281
282			var errors = [];
283			$(this).find(".mandatory").each(function () {
284				if ($(this).val() == "")
285				{
286					errors.push("Field is empty");
287					$(this).addClass("missing");
288				}
289				if ($(this).attr("name") == "Email") {
290					if (!re.test($(this).val())) {
291						errors.push("Invalid email address");
292						$(this).addClass("missing");
293						$(this).parent().addClass("invalid-email");
294					};	
295				}
296
297				if ($(this).is("select"))
298				{
299					$(this).next("span").addClass("missing");
300				}
301				if ($(this).is('[type="radio"]'))
302				{
303					radioname = $(this).attr("name");
304					if ($('input[name="'+radioname+'"]:checked').length <= 0)
305					{
306						errors.push("Field is empty");
307						$('input[name="'+radioname+'"]').parent().addClass("missing");
308					}
309				}
310			});
311			
312			
313
314			if ($(this).find("input.agreement-field").length > 0 )
315			{
316					if ($(this).find("input.agreement-field:checked").length == 0)
317					{
318						errors.push("Field is empty");
319						$(this).find("input.agreement-field").first().parent().addClass("missing");
320					}
321			}
322
323			if (errors.length > 0)
324			{
325				if ($(".form-anchor[data-for="+$(this).attr("id")+"]").length > 0)
326				{
327					scrollToArea($(".form-anchor[data-for="+$(this).attr("id")+"]").attr("id"));
328				}
329				
330				$(this).find("input[type=submit]").removeClass("waiting").val(label);
331				submitInProgress = false;
332				return false;
333			}
334			var redirectto = "/" + $(this).attr("data-response");
335			var myform = $(this);
336			$.post($(this).attr("action"), $(this).serialize(), function (data) {
337				if (data.ret == "ok")
338				{
339					fireSpecialEvent("form-success", myform.attr("id"));
340
341					if (myform.hasClass("loginform"))
342					{
343						
344						
345							location.href="/ccwebajax/login2017.aspx?v=2&fbf=" + data.msg;
346						
347						return false;
348					}
349					if ($("#cid").val() == 22430)
350					{
351						/* Courier */
352//						$("p.inline-response[data-for="+myform.attr("id")+"]").append('<img height="1" width="1" src="https://www.facebook.com/tr?id=1088276741302878&ev=CourierLead&noscript=1"/>');
353						fireSpecialEvent("courier-quote", myform.attr("id"));
354					}
355					if ($("#cid").val() == 22429)
356					{
357						/* Freight */
358//						$("p.inline-response[data-for="+myform.attr("id")+"]").append('<img height="1" width="1" src="https://www.facebook.com/tr?id=1088276741302878&ev=FreightLead&noscript=1"/>');
359						fireSpecialEvent("freight-quote", myform.attr("id"));
360					}
361					myform.addClass("form-done");
362					$("p.inline-response[data-for="+myform.attr("id")+"]").addClass("reveal-response");
363					$("p.hide-after-submit[data-for="+myform.attr("id")+"]").hide();
364					scrollToElement($("section[data-for="+myform.attr("id")+"]"));
365				} else {
366				
367					if (myform.hasClass("loginform"))
368					{
369					// Prevent large modal error on login
370					// Determine Reason
371					var reasonMsg = data.msg;
372					var errReason;
373					var rsnRegex = /response code: (.*?)\;/;
374					var errFind = rsnRegex.exec(reasonMsg);
375					if (errFind){ errReason = errFind[1]; }
376					switch (errReason)
377						{
378						// Suspended
379						case "303":
380						alert("Your account has been suspended\nPlease contact the Finance Department.\n\n(905)853-4444 or \[email protected]");
381						break;
382
383						// Locked
384						case "302":
385						alert("Your account has been locked for exceeding credit limit or for past due invoices.\nPlease contact the Finance Department.\n\n(905)853-4444 or \[email protected]");
386						break;
387
388
389						// Incorrect Login / Inactive
390						default:
391						alert("Login incorrect.\nEither the account number, web ID or password combination is incorrect. \nPlease try again.\n\nPlease contact us if you require further assistance.");
392						break;
393						} // end reason switch 
394
395					}else{
396					fireSpecialEvent("form-failure", myform.attr("id"));
397					
398					
399					}
400				}
401			},"json");
402
403			$(this).find("input[type=submit]").removeClass("waiting").val(label);
404			submitInProgress = false;
405			return false;
406		})
407}
408
409
410// finds all elements with class .keep-height and ensures that all its children that have a class named the same as parent's "rel" attribute have the same height when the browser resizes. I.e: <ul class="keep-height" rel="unify"><li class="unify"></li><li class="unify"></li></ul>
411// by default it only aplies to >768px sizes.
412function alignHeights() {
413	if (WW < 737) return false;
414	$(".keep-height").each(function () {
415		$("." + $(this).attr("rel")).css("min-height", 0);
416		var mh = 0;
417
418		$("." + $(this).attr("rel")).each(function () {
419			if (mh <= $(this).outerHeight()) mh = $(this).outerHeight();
420		});
421
422		$("." + $(this).attr("rel")).css("min-height", mh);
423	});
424}
425
426// adjusts the height of any element to match a given aspect ratio at any resolution. The aspect ratio is stored in the element's "rel" attribute. Optionally, a "mobile-rel" attribute can override the aspect ratio for mobile devices.
427function keepRatios() {
428
429	$(".keep-ratio").each(function () {
430		if (!deviceIndex) {
431			if ($(this).is("[rel-mobile]"))
432				$(this).height($(this).width() / parseFloat($(this).attr("rel-mobile")));
433			 else 
434				$(this).height($(this).width() / parseFloat($(this).attr("rel")));
435		} else
436		$(this).height($(this).width() / parseFloat($(this).attr("rel")));
437	});
438
439}
440
441// simple class to ensure an "a" elements gets an "active" class attached if its url matches the current location. Apply the class "mark-active" to a common parent element to trigger the functionality.
442function markActive() {
443	$(".mark-active").each(function () {
444		$(this).find("a").removeClass("active");
445		$(this).find("a").each(function () {
446
447			if ($(this).attr("href") == location.pathname || $(this).attr("href") == location.pathname + "/home" || (location.pathname.search($(this).attr("href")) >= 0 && !$(this).is("[exact-match]")))
448			{
449				$(this).addClass("active");
450			}
451		});
452	});
453}
454
455
456// automatic send to friend functionality. Will load a popup with contents from the file templates/pages/en/sen
456d-friend.html. 
457function showEmailFriend() {
458	$.get("/email-friend", function (data) {
459		message(data);
460	});
461	return false;
462}
463
464$(window).scroll(function () {
465	if (scrollPosition <= parseInt($(window).scrollTop()) ) scrollDirection = "down"; else scrollDirection = "up";
466	scrollPosition = parseInt($(window).scrollTop());
467});
468
469
470function registerScrollable() {
471	//required attributes are:  scroll-start, scroll-animation, everything else is optional and only required for certain animation types
472	$('.scrollanim').each(function () {
473		_ratio = $(this).is("[scroll-height-ratio]") ? $(this).attr("scroll-height-ratio") : 1;
474		_fixed = false; if ($(this).css("position") == "fixed") _fixed = true;
475		_top = _fixed ? parseInt($(this).css("top")) : $(this).offset().top;
476		scrollElements.push({
477			"obj": $(this),  // stores current object
478			"top": _top,  // distance to the top of the document
479			"top_static": _top,  // distance to the top of the document, value stays static when window is resized
480			"height": $(this).outerHeight(),  // element height
481			"ratio": _ratio,  // ratio of height / width, used when resizing to adjust distances
482			"max": _ratio * $(this).outerWidth(),  // total height of image (adjusted responsively). i.e. if the container is 600px tall, but the image inside is 900px, max would be 900px
483			"distance": _ratio  * $(this).outerWidth() - $(this).outerHeight(),  // how much of the image is being clipped (essentially max - height)
484			"stop": ($(this).is("[scroll-prevent]") && $(this).attr("scroll-prevent") == "true" ? true : false), // not fully implemented - will be used to "stop" scrolling of the page for the duration of the animation
485			"active": false,  // is the element being animated at this point?
486			"complete": false,  // has the animation completed
487			"step": $(this).is("[scroll-steps]") ? $(this).attr("scroll-steps") : 1,  // the animation will last so many "steps". For scrolling, each step will move the image by (distance / steps).
488			"animateby": ($(this).is("[scroll-animation-type]") && $(this).attr("scroll-animation-type") != "") ? $(this).attr("scroll-animation-type") : "step",  // whether to use the default "step" animation, or to tie the animation to the scroll distance. Leave empty to use default (steps)
489			"animation": $(this).attr("scroll-animation"),  // type of animation to use. REQUIRED.
490			"start": _top - $(this).attr("scroll-start") * $(window).outerHeight(),  // when to start the animation. REQUIRED. Value is expresed as percentage of window height, where 0 means animation will start when the top edge of the element touches the top edge of the window and 1 means animation will start when the start edge of element touches the bottom edge of the window.
491			"end": $(this).is("[scroll-end]") ? (_top - $(this).attr("scroll-end") * $(window).outerHeight()) : _top - $(this).attr("scroll-start") * $(window).outerHeight(), // when to stop animation, optional - uses the start value if not specified otherwise.
492			"minwidth": $(this).is("[scroll-min-width]") ? $(this).attr("scroll-min-width") : 768, // don't animate if window width is below this threshold. Optional, default value is 768 or higher.
493			"delta": scrollPosition - $(this).attr("scroll-start") * $(window).outerHeight()
494		});
495	})
496//	console.log(scrollElements);
497}
498
499
500function runScrollAnimations() {
501//	console.log("animating");
502	for (i=0; i<scrollElements.length ; i++ )
503	{
504	
505		if (scrollElements[i].active)
506		{
507//			log("ACTIVE : " + scrollElements[i].ratio + "; " + scrollElements[i].animation);
508			obj = scrollElements[i].obj;
509//			console.log("max dist:  " + scrollElements[i].distance)
510//			console.log("old dist:  " + scrolledDistance)
511//			console.log("direction:  " + scrollDirection)
512
513			switch (scrollElements[i].animation)
514			{
515				case "scroll-up":
516
517					scrollingObject = obj.find("img");
518						scrolledDistance = parseInt(scrollingObject.css("top"));
519
520						if (Math.abs(scrolledDistance) <= scrollElements[i].distance && scrollDirection == "down")
521						{
522							scrolledDistance = Math.abs(scrolledDistance);
523							if (scrollElements[i].animateby == "step") scrolledDistance += scrollElements[i].distance/scrollElements[i].step; else scrolledDistance = scrollElements[i].delta;
524							if (scrolledDistance >= scrollElements[i].distance)
525							{
526								if (scrollElements[i].stop) $("body").removeClass("stop-scrolling");
527								scrollElements[i].active = false;
528								scrollElements[i].complete = "down";
529								scrolledDistance = scrollElements[i].distance;
530//								log("COMPLETE (down): " + scrollElements[i].ratio + "; " + scrollElements[i].animation);
531							}
532							scrolledDistance = - scrolledDistance;
533//							console.log("scrolling image up by:  " + scrolledDistance);
534						}
535
536						if (scrolledDistance < 0 && scrollDirection == "up")
537						{
538							if (scrollElements[i].animateby == "step") scrolledDistance += Math.ceil(scrollElements[i].distance/ scrollElements[i].step); else {
539								scrolledDistance = scrollElements[i].delta;				
540							}
541//							if (i==3) console.log("1scrolling image down by  " + scrolledDistance);
542
543							if ( scrolledDistance >= scrollElements[i].distance && scrollElements[i].animateby != "step" )
544							{
545								break;
546							}
547
548							if (scrollElements[i].animateby != "step") scrolledDistance = - scrolledDistance;
549
550
551							if (scrolledDistance >= 0)
552							{
553								if (scrollElements[i].stop) $("body").removeClass("stop-scrolling");
554								scrollElements[i].active = false;
555								scrollElements[i].complete = "up";
556								scrolledDistance = 0;
557//								log("COMPLETE (up): " + scrollElements[i].ratio + "; " + scrollElements[i].animation);
558							}
559
560//							if (i==3) console.log("scrolling image down by  " + scrolledDistance);
561						}
562						scrollingObject.css("top", scrolledDistance +"px");
563						break;
564				case "reveal":
565							scrollingObject = obj.find("div.reveal");
566							elementHeight = scrollingObject.outerHeight();
567							if (scrollDirection == "down" && elementHeight < obj.outerHeight())
568							{
569//								elementHeight += obj.outerHeight() / scrollElements[i].step;
570								elementHeight = Math.min(obj.outerHeight(), scrollPosition - scrollElements[i].start);
571								if (elementHeight >= obj.outerHeight())
572								{
573									if (scrollElements[i].stop) $("body").removeClass("stop-scrolling");
574									scrollElements[i].active = false;
575									scrollElements[i].complete = "down";
576									elementHeight = obj.outerHeight();
577//									log("COMPLETE (down): reveal");
578								}
579//								console.log("reveal more image by:  " + elementHeight);
580							}
581
582							if (scrollDirection == "up" && elementHeight > 0 && scrollElements[i].active)
583							{
584//								elementHeight -= obj.outerHeight() / scrollElements[i].step;
585								elementHeight = Math.max(0, scrollPosition - scrollElements[i].start);
586								if (elementHeight <= 0)
587								{
588									if (scrollElements[i].stop) $("body").removeClass("stop-scrolling");
589									scrollElements[i].active = false;
590									scrollElements[i].complete = "up";
591									elementHeight = 0;
592//									log("COMPLETE (up): reveal");
593								}
594//								console.log("reveal less image by:  " + elementHeight);
595							}
596
597							scrollingObject.height(elementHeight);
598
599						break;
600				case "curtain":
601						scrollingObject = obj.find("ul.curtain");
602						curtainStep = scrollingObject.attr("step");
603//						console.log(curtainStep);
604						if (scrollDirection == "down") {
605							scrollingObject.addClass("pulled");
606							scrollElements[i].active = false;
607							scrollElements[i].complete = "down";
608//							curtainStep ++;
609//							scrollingObject.find("li:nth-child("+curtainStep+")").css("opacity", 1 - 0.25 * curtainStep);
610						} 
611						if (scrollDirection == "up") {
612//							scrollingObject.find("li:nth-child("+curtainStep+")").css("opacity", 0);
613//							curtainStep --;
614							scrollingObject.removeClass("pulled");
615							scrollElements[i].active = false;
616							scrollElements[i].complete = "up";
617						} 
618//						scrollingObject.attr("step", curtainStep);
619						break;
620				case "simple":
621						if (scrollDirection == "down" && scrollElements[i].active == "down") {
622							obj.addClass("revealed");
623							scrollElements[i].active = false;
624							scrollElements[i].complete = "down";
625						} 
626						if (scrollDirection == "up" && scrollElements[i].active == "up") {
627							obj.removeClass("revealed");
628							scrollElements[i].active = false;
629							scrollElements[i].complete = "up";
630						} 
631						break;
632//				case "super-impose":
633//						if (scrollDirection == "down" && scrollElements[i].active == "down") {
634//							obj.addClass("revealed");
635//						} 
636//						if (scrollDirection == "up" && scrollElements[i].active == "up") {
637//							obj.removeClass("revealed");
638//						} 
639//						scrollElements[i].active = false;
640//						scrollElements[i].complete = "down";
641//						break;
642
643			}
644		}
645	}
646}
647
648function detectScrolling() {
649
650	if ($("body").hasClass("stop-scrolling"))
651	{
652		return false;
653	}
654//	console.log("scroll event" + scrollDirection);
655	for (i=0; i<scrollElements.length ; i++ )
656	{
657
658		scrollElements[i].delta = scrollPosition - scrollElements[i].start;
659
660		if (WW < scrollElements[i].minwidth)
661		{
662			continue;
663		}
664
665		obj = scrollElements[i].obj;
666		if (scrollElements[i].complete) {
667			if (scrollPosition < scrollElements[i].top && !scrollElements[i].active) {
668//				scrollElements[i].complete = false;
669//				obj.find("img").removeAttr("style");
670//				console.log("re-activate");
671			}
672//			continue;
673		}
674//		console.log(scrollPosition + " ; " + scrollElements[i].end);
675
676		if (scrollDirection == "down" && scrollPosition >= scrollElements[i].start && !scrollElements[i].active && scrollElements[i].complete != "down")
677		{
678//			console.log("activate (down scrolling) : " + i + " ; " +  scrollElements[i].ratio + "; " + scrollPosition);
679			scrollElements[i].active = "down";
680			if (scrollElements[i].stop) {
681				$("body").animate({scrollTop: scrollElements[i].top + 10}, 400);
682				$("body").addClass("stop-scrolling");
683				
684			}
685			continue;
686		}
687
688//		console.log(scrollPosition + " ; " + scrollDirection + " ; " + scrollElements[i].start + " ; " +  scrollElements[i].end);
689
690		if (scrollDirection == "up" && /* scrollPosition >= scrollElements[i].start && */ scrollPosition <= scrollElements[i].end && !scrollElements[i].active && scrollElements[i].complete != "up")
691		{
692//			console.log("activate (upward scrolling)" + scrollElements[i].ratio);
693			scrollElements[i].active = "up";
694			if (scrollElements[i].stop) {
695				$("body").animate({scrollTop: scrollElements[i].top + 10}, 400);
696				$("body").addClass("stop-scrolling");
697				
698			}
699			continue;
700		}
701
702	}
703//	console.log(scrollElements);
704	runScrollAnimations();
705}

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.