1/* external code */ 2// only activate the parallax when we reach it. 3 4(function($) { 5 var l = location.href.replace(/#.*/, ''); 6 var g = $.localScroll = function(a) { 7 $('body').localScroll(a) 8 }; 9 g.defaults = { 10 duration: 1e3, 11 axis: 'y', 12 event: 'click', 13 stop: true, 14 target: window, 15 reset: true 16 }; 17 g.hash = function(a) { 18 if (location.hash) { 19 a = $.extend({}, g.defaults, a); 20 a.hash = false; 21 if (a.reset) { 22 var e = a.duration; 23 delete a.duration; 24 $(a.target).scrollTo(0, a); 25 a.duration = e 26 } 27 i(0, location, a) 28 } 29 }; 30 $.fn.localScroll = function(b) { 31 b = $.extend({}, g.defaults, b); 32 return b.lazy ? this.bind(b.event, function(a) { 33 var e = $([a.target, a.target.parentNode]).filter(d)[0]; 34 if (e) i(a, e, b) 35 }) : this.find('a,area').filter(d).bind(b.event, function(a) { 36 i(a, this, b) 37 }).end().end(); 38 39 function d() { 40 return !!this.href && !!this.hash && this.href.replace(this.hash, '') == l && (!b.filter || $(this).is(b.filter)) 41 } 42 }; 43 44 function i(a, e, b) { 45 var d = e.hash.slice(1), 46 f = document.getElementById(d) || document.getElementsByName(d)[0]; 47 if (!f) return; 48 if (a) a.preventDefault(); 49 var h = $(b.target); 50 if (b.lock && h.is(':animated') || b.onBefore && b.onBefore.call(b, a, f, h) === false) return; 51 if (b.stop) h.stop(true); 52 if (b.hash) { 53 var j = f.id == d ? 'id' : 'name', 54 k = $('<a> </a>').attr(j, d).css({ 55 position: 'absolute', 56 top: $(window).scrollTop(), 57 left: $(window).scrollLeft() 58 }); 59 f[j] = ''; 60 $('body').prepend(k); 61 location = e.hash; 62 k.remove(); 63 f[j] = d 64 } 65 h.scrollTo(f, b).trigger('notify.serialScroll', [f]) 66 } 67})(jQuery); 68 69// parralax jQuery plugin 70(function( $ ){ 71 var $window = $(window); 72 var windowHeight = $window.height(); 73 74 $window.resize(function () { 75 windowHeight = $window.height(); 76 }); 77 78 $.fn.parallax = function(xpos, speedFactor, outerHeight) { 79 var $this = $(this); 80 var getHeight; 81 var firstTop; 82 var paddingTop = 0; 83 84 //get the starting position of each element to have parallax applied to it 85 $this.each(function(){ 86 firstTop = $this.offset().top; 87 }); 88 89 if (outerHeight) { 90 getHeight = function(jqo) { 91 return jqo.outerHeight(true); 92 }; 93 } else { 94 getHeight = function(jqo) { 95 return jqo.height(); 96 }; 97 } 98 99 // setup defaults if arguments aren't specified 100 if (arguments.length < 1 || xpos === null) xpos = "50%"; 101 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 102 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 103 104 // function to be called whenever the window is scrolled or resized 105 function update(){ 106 var pos = $window.scrollTop(); 107 108 $this.each(function(){ 109 var $element = $(this); 110 var top = $element.offset().top; 111 var height = getHeight($element); 112 113 // Check if totally above or totally below viewport 114 if (top + height < pos || top > pos + windowHeight) { 115 return; 116 } 117 118 $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); 119 }); 120 } 121 122 $window.on('scroll', update).resize(update); 123 124 this.destroy = function () { 125 126 $window.off('scroll', update); 127 $this.css('backgroundPosition', xpos + " " + "0px"); 128 129 }; 130 update(); 131 return this; 132 }; 133})(jQuery); 134 135 136 137/************************************************/ 138 139/* aikon code */ 140// powerconstructor to change height 141AikonParallaxManager = function () { 142 var parallaxInstance, 143 resizeHeightThrottle, 144 resizeWidthThrottle,
145 resizeCoolDown = 300, 146 forcedContainerWidth = 100, 147 debug = false, 148 that = this, 149 resizeEvents = 'resize orientationchange', 150 selectors = {}, 151 options = { 152 fontSizeAttr : 'data-ap-original-font-size', 153 heightMode : 'px', 154 breakPoint : 980, 155 mobileTextResizeMode : 'percent', 156 mobileResizePercent : 70, 157 heightPx : '200', 158 heightViewPort : '80', 159 autoResizing : false, 160 autoResizingPaddingTop : '24', 161 autoResizingPaddingBottom : '24', 162 ratio : '0.2', 163 mobileRatio : '', 164 forceFullWidth : 'false', 165 scaledClass : 'ap-scaled' 166 }; 167 168 // private functions 169 var getFontNumber = function (fontValue) { 170 return parseFloat(fontValue); 171 }; 172 var getFontUnits = function (fontValue) { 173 return fontValue.replace(/\d+/g, '').replace('.', ''); 174 }; 175 176 177 that.restoreOriginalFontSizes = function () { 178 jQuery.each(jQuery(selectors.content + ' *'), function (index, element){ 179 var $el = jQuery(element), 180 original = $el.attr(options.fontSizeAttr); 181 182 $el 183 .css('font-size', original) 184 .removeClass(options.scaledClass); 185 }); 186 }; 187 188 that.applyMobileFontSizes = function () { 189 jQuery.each(jQuery(selectors.content + ' *'), function (index, element){ 190 var $el = jQuery(element), 191 fontSize = $el.css('font-size'), 192 fontSizeNumber = getFontNumber(fontSize), 193 fontSizeUnits = getFontUnits(fontSize), 194 newFontSize = parseFloat(+fontSizeNumber / 100 * options.mobileResizePercent)+fontSizeUnits; 195 196 // if already scaled - no need to work hard. 197 if ($el.hasClass(options.scaledClass)){ 198 return; 199 } 200 201 // need to scaled the unscaled item 202 $el 203 .css('font-size', newFontSize) 204 .addClass(options.scaledClass); 205 }); 206 207 }; 208 209 that.initParallaxDisplay = function () { 210 var vw = jQuery(window).width(); 211 212 // init parallax if height is proper. 213 214 if (vw > options.breakPoint) { 215 // we are on desktop 216 if (typeof parallaxInstance == 'object'){ 217 parallaxInstance.destroy(); 218 } 219 parallaxInstance = jQuery(selectors.target).parallax("50%", options.ratio ); 220 if (options.mobileTextResizeMode == 'percent'){ 221 that.restoreOriginalFontSizes(); 222 } 223 } else { 224 if (options.enableMobile == 'true'){ 225 // we are on mobile 226 if (typeof parallaxInstance == 'object'){ 227 parallaxInstance.destroy(); 228 } 229 parallaxInstance = jQuery(selectors.target).parallax("50%", options.mobileRatio); 230 if (options.mobileTextResizeMode == 'percent'){ 231 that.applyMobileFontSizes(); 232 } 233 } else { 234 if (typeof parallaxInstance == 'object'){ 235 parallaxInstance.destroy(); 236 } 237 } 238 } 239 }; 240 241 that.setParallaxHeight = function () { 242 var targetSize, contentHeight, minHeight, vh; // view port height 243 244 // find the BASE size we need 245 switch (options.heightMode) { 246 case 'viewPort': 247 vh = jQuery(window).height(); 248 targetSize = Math.round( (vh / 100) * options.heightViewPort); 249 break; 250 case 'content': 251 targetSize = 0; 252 break; 253 case 'px': 254 default: 255 targetSize = options.heightPx; 256 break; 257 } 258 259 // if user wants to resize by content 260 if (options.autoResizing == true) { 261 contentHeight = jQuery(selectors.content).outerHeight(); 262 minHeight = + contentHeight + parseInt(options.autoResizingPaddingTop) + parseInt(options.autoResizingPaddingBottom); 263 264 // resize containers
265 if (targetSize < minHeight) { 266 targetSize = minHeight; 267 } 268 } 269 270 jQuery(selectors.target).height(targetSize); 271 jQuery(selectors.container).height(targetSize); 272 that.initParallaxDisplay(); 273 }; 274 275 that.bindOrientationEvents = function () { 276 // on resize events, do resize and init parallax 277 jQuery(window).on(resizeEvents, function(e){ 278 clearTimeout(resizeHeightThrottle); 279 resizeHeightThrottle = setTimeout(function(){ 280 that.setParallaxHeight(); 281 that.initParallaxDisplay(); 282 },resizeCoolDown); 283 }); 284 }; 285 286 that.initForceFullWidth = function (){ 287 var containerWidth , 288 marginLeft, 289 windowWidth = jQuery(window).width(); 290 291 292 293 jQuery(selectors.container).css({ 294 'position' : 'relative', 295 'width' : '100%', 296 'margin' : 'auto' 297 }); 298 299 // detect some width 300 containerWidth = jQuery(selectors.container).width(); 301 marginLeft = Math.round((( windowWidth - containerWidth )/2)) +1; 302 303 jQuery(selectors.target).css({ 304 'position' : 'absolute', 305 'overflow' : 'hidden', 306 'left' : '0', 307 308 // this is shared with bindForceFullWidthHandler(), along with calculating marginLeft 309 'width' : (windowWidth) + 'px', 310 'margin-left' : '-' + marginLeft + 'px' 311 }); 312 }; 313 314 that.bindForceFullWidthHandler = function(){ 315 jQuery(window).on(resizeEvents, function(e){ 316 clearTimeout(resizeWidthThrottle); 317 resizeWidthThrottle = setTimeout(function(){ 318 319 var windowWidth = jQuery(window).width(), 320 containerWidth = jQuery(selectors.container).width(), 321 marginLeft = Math.round((( windowWidth - containerWidth )/2)) +1; 322 323 jQuery(selectors.target).css({ 324 'width' : (windowWidth) + 'px', 325 'margin-left' : '-' + marginLeft + 'px' 326 }); 327 328 },resizeCoolDown);
329 }); 330 }; 331 332 that.logOriginalFontSizes = function () { 333 var $contents = jQuery(selectors.content + ' *'); 334 jQuery.each($contents, function (index, content) { 335 var $content = jQuery(content); 336 $content.attr(options.fontSizeAttr, $content.css('font-size')); 337 }); 338 }; 339 340 that.init = function (externalOptions) { 341 342 // populate options 343 if (externalOptions.hasOwnProperty('heightMode')){ 344 jQuery.extend(options, externalOptions); 345 } 346 347 // make selectors 348 selectors.target = '#' + options.id; 349 selectors.container = '#' + jQuery(selectors.target).parent().attr('id'); 350 selectors.content = '#' + options.id + '-content'; 351 352 // log original font sizes on elements 353 that.logOriginalFontSizes(); 354 355 // bind orientation events 356 that.bindOrientationEvents(); 357 358 // set height 359 that.setParallaxHeight (); 360 361 if (externalOptions.forceFullWidth == 'true'){ 362 that.initForceFullWidth(); 363 that.bindForceFullWidthHandler(); 364 } 365 366 // init parallax 367 that.initParallaxDisplay(); 368 369 }; 370 371 return this; 372}; 373 374// define parallax global 375window.aikonParallaxGlobal = {}; 376
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.