1/* 2 * ScrollToFixed 3 * https://github.com/bigspotteddog/ScrollToFixed 4 * 5 * Copyright (c) 2011 Joseph Cava-Lynch 6 * MIT license 7 */ 8;(function(e){e.isScrollToFixed=function(t){return!!e(t).data("ScrollToFixed")};e.ScrollToFixed=function(t,n){function m(){s.trigger("preUnfixed.ScrollToFixed");x();s.trigger("unfixed.ScrollToFixed");h=-1;f=s.offset().top;l=s.offset().left;if(r.options.offsets){l+=s.offset().left-s.position().left}if(c==-1){c=l}o=s.css("position");i=true;if(r.options.bottom!=-1){s.trigger("preFixed.ScrollToFixed");E();s.trigger("fixed.ScrollToFixed")}}function g(){var e=r.options.limit;if(!e)return 0;if(typeof e==="function"){return e.apply(s)}return e}function y(){return o==="fixed"}function b(){return o==="absolute"}function w(){return!(y()||b())}function E(){if(!y()){p.css({display:s.css("display"),width:(s.outerWidth(true)*100/s.parent().width()).toFixed(2)-.04+"%",height:s.outerHeight(true),"float":s.css("float")});cssOptions={position:"fixed",top:r.options.bottom==-1?N():"",bottom:r.options.bottom==-1?"":r.options.bottom,"margin-left":"0px"};if(!r.options.dontSetWidth){cssOptions["width"]=s.width()}s.css(cssOptions);s.addClass(r.options.baseClassName);if(r.options.className){s.addClass(r.options.className)}o="fixed"}}function S(){var e=g();var t=l;if(r.options.removeOffsets){t="";e=e-f}cssOptions={position:"absolute",top:e,left:t,"margin-left":"0px",bottom:""};if(!r.options.dontSetWidth){cssOptions["width"]=s.width()}s.css(cssOptions);o="absolute"}function x(){if(!w()){h=-1;p.css("display","none");s.css({width:"",position:u,left:"",top:a,"margin-left":""});s.removeClass("scroll-to-fixed-fixed");if(r.options.className){s.removeClass(r.options.className)}o=null}}function T(e){if(e!=h){s.css("left",l-e);h=e}}function N(){var e=r.options.marginTop;if(!e)return 0;if(typeof e==="function"){return e.apply(s)}return e}function C(){if(!e.isScrollToFixed(s))return;var t=i;if(!i){m()}var n=e(window).scrollLeft();var o=e(window).scrollTop();var a=g();if(r.options.minWidth&&e(window).width()<r.options.minWidth){if(!w()||!t){L();s.trigger("preUnfixed.ScrollToFixed");x();s.trigger("unfixed.ScrollToFixed")}}else if(r.options.maxWidth&&e(window).width()>r.options.maxWidth){if(!w()||!t){L();s.trigger("preUnfixed.ScrollToFixed");x();s.trigger("unfixed.ScrollToFixed")}}else if(r.options.bottom==-1){if(a>0&&o>=a-N()){if(!b()||!t){L();s.trigger("preAbsolute.ScrollToFixed");S();s.trigger("unfixed.ScrollToFixed")}}else if(o>=f-N()){if(!y()||!t){L();s.trigger("preFixed.ScrollToFixed");E();h=-1;s.trigger("fixed.ScrollToFixed")}T(n)}else{if(!w()||!t){L();s.trigger("preUnfixed.ScrollToFixed");x();s.trigger("unfixed.ScrollToFixed")}}}else{if(a>0){if(o+e(window).height()-s.outerHeight(true)>=a-(N()||-k())){if(y()){L();s.trigger("preUnfixed.ScrollToFixed");if(u==="absolute"){S()}else{x()}s.trigger("unfixed.ScrollToFixed")}}else{if(!y()){L();s.trigger("preFixed.ScrollToFixed");E()}T(n);s.trigger("fixed.ScrollToFixed")}}else{T(n)}}}function k(){if(!r.options.bottom)return 0;return r.options.bottom}function L(){var e=s.css("position");if(e=="absolute"){s.trigger("postAbsolute.ScrollToFixed")}else if(e=="fixed"){s.trigger("postFixed.ScrollToFixed")}else{s.trigger("postUnfixed.ScrollToFixed")}}var r=this;r.$el=e(t);r.el=t;r.$el.data("ScrollToFixed",r);var i=false;var s=r.$el;var o;var u;var a;var f=0;var l=0;var c=-1;var h=-1;var p=null;var d;var v;var A=function(e){if(s.is(":visible")){i=false;C()}};var O=function(e){C()};var M=function(){var e=document.body;if(document.createElement&&e&&e.appendChild&&e.removeChild){var t=document.createElement("div");if(!t.getBoundingClientRect)return null;t.innerHTML="x";t.style.cssText="position:fixed;top:100px;";e.appendChild(t);var n=e.style.height,r=e.scrollTop;e.style.height="3000px";e.scrollTop=500;var i=t.getBoundingClientRect().top;e.style.height=n;var s=i===100;e.removeChild(t);e.scrollTop=r;return s}return null};var _=function(e){e=e||window.event;if(e.preventDefault){e.preventDefault()}e.returnValue=false};r.init=function(){r.options=e.extend({},e.ScrollToFixed.defaultOptions,n);r.$el.css("z-index",r.options.zIndex);p=e("<div />");o=s.css("position");u=s.css("position");a=s.css("top");if(w())r.$el.after(p);e(window).bind("resize.ScrollToFixed",A);e(window).bind("scroll.ScrollToFixed",O);
8if(r.options.preFixed){s.bind("preFixed.ScrollToFixed",r.options.preFixed)}if(r.options.postFixed){s.bind("postFixed.ScrollToFixed",r.options.postFixed)}if(r.options.preUnfixed){s.bind("preUnfixed.ScrollToFixed",r.options.preUnfixed)}if(r.options.postUnfixed){s.bind("postUnfixed.ScrollToFixed",r.options.postUnfixed)}if(r.options.preAbsolute){s.bind("preAbsolute.ScrollToFixed",r.options.preAbsolute)}if(r.options.postAbsolute){s.bind("postAbsolute.ScrollToFixed",r.options.postAbsolute)}if(r.options.fixed){s.bind("fixed.ScrollToFixed",r.options.fixed)}if(r.options.unfixed){s.bind("unfixed.ScrollToFixed",r.options.unfixed)}if(r.options.spacerClass){p.addClass(r.options.spacerClass)}s.bind("resize.ScrollToFixed",function(){p.height(s.height())});s.bind("scroll.ScrollToFixed",function(){s.trigger("preUnfixed.ScrollToFixed");x();s.trigger("unfixed.ScrollToFixed");C()});s.bind("detach.ScrollToFixed",function(t){_(t);s.trigger("preUnfixed.ScrollToFixed");x();s.trigger("unfixed.ScrollToFixed");e(window).unbind("resize.ScrollToFixed",A);e(window).unbind("scroll.ScrollToFixed",O);s.unbind(".ScrollToFixed");p.remove();r.$el.removeData("ScrollToFixed")});A()};r.init()};e.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1e3,baseClassName:"scroll-to-fixed-fixed"};e.fn.scrollToFixed=function(t){return this.each(function(){new e.ScrollToFixed(this,t)})}})(jQuery) 9 10jQuery(function($){ 11 var $scrollEl = ($.browser.mozilla || $.browser.msie) ? $('html') : $('body'); 12 if(screen.width>767){ 13 $(window).load(function(){ 14 $('#icemegamenu').closest('.row-container').parent().scrollToFixed({minWidth: 768}); 15 }) 16 } 17 /////////////////// 18 $('.icemegamenu li>a.iceMenuTitle').hover(function(){ 19 $(this).addClass('hover'); 20 }, 21 function(){ 22 $(this).removeClass('hover'); 23 }); 24 if($('body').hasClass('desktop_mode') || ($('body').hasClass('mobile') && screen.width>767)){ 25 $('.icemegamenu li').not('.parent').find('>a.iceMenuTitle[href^="#"]').click(function(){ 26 var a=$(this); 27 animate_body(a); 28 }) 29 $('.icemegamenu li.parent>a.iceMenuTitle[href^="#"]').click(function(){ 30 var a=$(this); 31 if(a.closest("li").hasClass("hover")){ 32 hide_submenu(a); 33 animate_body(a); 34 } 35 else{ 36 $('.icemegamenu li.parent[class^="iceMenuLiLevel"]').not(a.closest("li").parents("li")).not(a.closest("li")).removeClass("hover"); 37 a.closest("li").addClass("hover").attr("data-hover","true"); 38 a.closest("li").find(">ul.icesubMenu").addClass("visible"); 39 return false 40 } 41 }) 42 $('.icemegamenu li.parent>a').not('[href]').click(function(){ 43 var a=$(this); 44 if(a.closest("li").hasClass("hover")){ 45 if(!a.attr('href')){ 46 a.removeClass('hover'); 47 a.closest("li").attr('data-hover','false'); 48 hide_submenu(a, 0); 49 } 50 } 51 else{ 52 $('.icemegamenu li.parent[class^="iceMenuLiLevel"]').not(a.closest("li").parents("li")).not(a.closest("li")).removeClass("hover"); 53 a.closest("li").addClass("hover").attr("data-hover","true"); 54 a.closest("li").find(">ul.icesubMenu").addClass("visible"); 55 return false 56 } 57 }) 58 $('.icemegamenu li[class^="iceMenuLiLevel"]').not('.parent').find('>a.iceMenuTitle[href]').not('[href^="#"]').click(function(){ 59 var a=$(this); 60 if(window.location.href.split("#")[0]==a.attr('href')) { 61 animate_body(a); 62 return false; 63 } 64 }) 65 $('.icemegamenu li.parent[class^="iceMenuLiLevel"]').find('>a.iceMenuTitle[href]').not('[href^="#"]').click(function(){ 66 var a=$(this); 67 if(a.closest("li").hasClass("hover")){ 68 if(window.location.href.split("#")[0]==a.attr('href')){ 69 hide_submenu(a); 70 animate_body(a); 71 return false; 72 } 73 } 74 else{ 75 $('.icemegamenu li.parent[class^="iceMenuLiLevel"]').not(a.closest("li").parents("li")).not(a.closest("li")).removeClass("hover"); 76 a.closest("li").addClass("hover").attr("data-hover","true"); 77 a.closest("li").find(">ul.icesubMenu").addClass("visible"); 78 return false; 79 } 80 }) 81 } 82 else{ 83 $('.icemegamenu li.parent[class^="iceMenuLiLevel"]').hover(function(){ 84 $('#icemegamenu li.parent[class^="iceMenuLiLevel"]').not($(this).parents('li')).not($(this)).removeClass('hover'); 85 $(this).addClass('hover').attr('data-hover','true'); 86 $(this).find('>ul.icesubMenu').addClass('visible'); 87 }, 88 function(){
89 $(this).attr('data-hover','false'); 90 a = $(this).find('>a'); 91 hide_submenu(a); 92 }) 93 $('.icemegamenu li.iceMenuLiLevel_1>a.iceMenuTitle[href^="#"]').click(function(){ 94 var a=$(this); 95 animate_body(a); 96 }) 97 $('.icemegamenu li[class^="iceMenuLiLevel"]>a.iceMenuTitle[href]').click(function(){ 98 var a=$(this); 99 if(window.location.href.split("#")[0]==a.attr('href')) { 100 animate_body(a); 101 return false; 102 } 103 104 }) 105 } 106 function hide_submenu(a, delay){ 107 delay = typeof delay !== 'undefined' ? delay : 800; 108 a.delay(delay).queue(function(b){ 109 if(a.closest("li").attr("data-hover")=="false"){ 110 a.closest("li").removeClass("hover").delay(250).queue(function(c){ 111 if(a.closest("li").attr("data-hover")=="false"){ 112 a.closest("li").find(">ul.icesubMenu").removeClass("visible") 113 } 114 c() 115 }) 116 } 117 b() 118 }); 119 } 120 if($('.icemegamenu li[class^="iceMenuLiLevel"]>a.iceMenuTitle[href^="#"]').length && $('.icemegamenu li[class^="iceMenuLiLevel"]>a.iceMenuTitle[href^="#"]').attr('href')!='#'){ 121 $(window).scroll($.throttle(500,function(){change_menu_item()})); 122 $(window).load(function(){ 123 change_menu_item(); 124 if($(this).scrollTop()>24){ 125 $("body:first").addClass("scrolled") 126 } 127 else{ 128 $("body:first").removeClass("scrolled") 129 } 130 }); 131 var idArray=[], 132 click_scroll=false, 133 init_hash=window.location.hash, 134 lastScrollTop=0; 135 $('.icemegamenu li[class^="iceMenuLiLevel"]>a.iceMenuTitle[href^="#"]').each(function(a){ 136 idArray[a]=$(this).attr("href"); 137 }); 138 139 function change_menu_item(){ 140 if(!click_scroll){ 141 var a=$(window).scrollTop(), 142 d=""; 143 y = $(document).height(); 144 if(!init_hash||init_hash==""){ 145 for(var b=0,c=idArray.length;b<c;b++){ 146 if($('a[name="'+idArray[b].substring(1)+'"]').length){ 147 if(a+($(window).height()-$(".scroll-to-fixed-fixed").outerHeight())/2>=$('a[name="'+idArray[b].substring(1)+'"]').offset().top && y>a+($(window).height()-$(".scroll-to-fixed-fixed").outerHeight())/2-$('a[name="'+idArray[b].substring(1)+'"]').offset().top){ 148 d=idArray[b]; 149 y=a+($(window).height()-$(".scroll-to-fixed-fixed").outerHeight())/2-$('a[name="'+idArray[b].substring(1)+'"]').offset().top 150 } 151 } 152 } 153 lastScrollTop=a; 154 if(window.location.hash!=d&&d!=""){ 155 if(history.pushState){ 156 history.pushState(null,null,d) 157 } 158 $('.icemegamenu li[class^="iceMenuLiLevel"]').removeClass("hover").find(">a.iceMenuTitle").removeClass("icemega_active").removeClass('hover'); 159 $("a.iceMenuTitle[href="+d+"]").addClass("icemega_active") 160 } 161 if(a == 0){ 162 if(history.pushState && window.location.hash){ 163 history.pushState(null,null,'#') 164 } 165 $('.icemegamenu li[class^="iceMenuLiLevel"]').removeClass("hover").find(">a.iceMenuTitle").removeClass("icemega_active").removeClass('hover'); 166 if(window.location.hash){ 167 $("a.iceMenuTitle[href=\""+window.location.href+"\"]").addClass("icemega_active") 168 } 169 else{ 170 $("a.iceMenuTitle[href=\""+window.location.href.split('#')[0]+"\"]").addClass("icemega_active") 171 } 172 } 173 } 174 else{ 175 if($("a.iceMenuTitle[href="+init_hash+"]").length){ 176 $('.icemegamenu li[class^="iceMenuLiLevel"]').removeClass("hover").find(">a.iceMenuTitle").removeClass("icemega_active").removeClass('hover'); 177 $("a.iceMenuTitle[href="+init_hash+"]").addClass("icemega_active"); 178 } 179 if($('a[name="'+init_hash.substring(1)+'"]').length){ 180 click_scroll=true; 181 $scrollEl.delay(100).queue(function(z){ 182 $scrollEl.animate({ 183 scrollTop: $('a[name="'+init_hash.substring(1)+'"]').offset().top-$(".scroll-to-fixed-fixed").outerHeight() 184 },400,function(){ 185 $(this).delay(200).queue(function(e){ 186 click_scroll=false; 187 init_hash=false; 188 $(this).delay(1200).queue(function(f){ 189 if(typeof $.fn.lazy=="function"){ 190 $(".lazy_container img").lazy({ 191 bind:"event",effect:"fadeIn",effectTime:500 192 }) 193 } 194 f() 195 });
196 e() 197 }) 198 }) 199 z() 200 }) 201 } 202 } 203 return false 204 } 205 } 206 function animate_body(a){ 207 if(window.location.href.split("#")[0]!=a.attr('href')){ 208 if($('a[name="'+a.attr("href").substring(1)+'"]').length){ 209 click_scroll=true; 210 $('.icemegamenu li[class^="iceMenuLiLevel"]').removeClass("hover").find(">a.iceMenuTitle").removeClass("icemega_active").removeClass('hover'); 211 a.addClass("icemega_active"); 212 if(history.pushState){ 213 history.pushState(null,null,a.attr("href")) 214 } 215 $scrollEl.animate({ 216 scrollTop: $('a[name="'+a.attr("href").substring(1)+'"]').offset().top-$(".scroll-to-fixed-fixed").outerHeight() 217 },400,function(){ 218 $(this).delay(200).queue(function(b){ 219 click_scroll=false; 220 $(this).delay(1200).queue(function(c){ 221 if(typeof $.fn.lazy=="function"){ 222 $("img.lazy").lazy({ 223 bind:"event",effect:"fadeIn",effectTime:500 224 }) 225 } 226 c() 227 });
228 b() 229 }) 230 }) 231 } 232 } 233 if(window.location.href.split("#")[0]==a.attr('href')){ 234 click_scroll=true; 235 $('.icemegamenu li[class^="iceMenuLiLevel"]').removeClass("hover").find(">a.iceMenuTitle").removeClass("icemega_active").removeClass('hover'); 236 a.addClass("icemega_active"); 237 if(history.pushState){ 238 history.pushState(null,null,'#') 239 } 240 $scrollEl.animate({ 241 scrollTop: 0 242 },400,function(){ 243 $(this).delay(200).queue(function(b){ 244 click_scroll=false; 245 $(this).delay(1200).queue(function(c){ 246 if(typeof $.fn.lazy=="function"){ 247 $("img.lazy").lazy({ 248 bind:"event",effect:"fadeIn",effectTime:500 249 }) 250 } 251 c() 252 }); 253 b() 254 }) 255 }) 256 } 257 return false; 258 } 259 } 260 });
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.