1/** 2 * Single Page Nav Plugin 3 * Copyright (c) 2014 Chris Wojcik <[email protected]> 4 * Dual licensed under MIT and GPL. 5 * @author Chris Wojcik 6 * @version 1.0.3+2+1 7 */ 8 9// Utility 10if(typeof Object.create!=='function'){Object.create=function(obj){function F(){}F.prototype=obj;return new F()}}(function($,window,document,undefined){"use strict";var SinglePageNav={init:function(options,container){this.options=$.extend({},$.fn.singlePageNav.defaults,options);this.container=container;this.$container=$(container);this.$links=this.$container.find('a');if(this.options.filter!==''){this.$links=this.$links.filter(this.options.filter)}this.$window=$(window);this.$htmlbody=$('html, body');this.$links.on('click.singlePageNav',$.proxy(this.handleClick,this));this.didScroll=false;this.checkPosition();this.setTimer()},handleClick:function(e){var self=this,link=e.currentTarget,$elem=$(link.hash);e.preventDefault();if($elem.length){self.clearTimer();if(typeof self.options.beforeStart==='function'){self.options.beforeStart()}self.setActiveLink(link.hash);self.scrollTo($elem,function(){if(self.options.updateHash&&history.pushState){history.pushState(null,null,link.hash)}self.setTimer();if(typeof self.options.onComplete==='function'){self.options.onComplete()}})}},scrollTo:function($elem,callback){var self=this;var target=self.getCoords($elem).top;var called=false;self.$htmlbody.stop().animate({scrollTop:target},{duration:self.options.speed,easing:self.options.easing,complete:function(){if(typeof callback==='function'&&!called){callback()}called=true}})},setTimer:function(){var self=this;self.$window.on('scroll.singlePageNav',function(){self.didScroll=true});self.timer=setInterval(function(){if(self.didScroll){self.didScroll=false;self.checkPosition()}},250)},clearTimer:function(){clearInterval(this.timer);this.$window.off('scroll.singlePageNav');this.didScroll=false},checkPosition:function(){var scrollPos=this.$window.scrollTop();var currentSection=this.getCurrentSection(scrollPos);if(currentSection!==null){this.setActiveLink(currentSection)}},getCoords:function($elem){return{top:Math.round($elem.offset().top)-this.options.offset}},setActiveLink:function(href){var $activeLink=this.$container.find("a[href$='"+href+"']");if(!$activeLink.hasClass(this.options.currentClass)){this.$links.removeClass(this.options.currentClass);$activeLink.addClass(this.options.currentClass);if($(".scroll-nav a").hasClass("act-link"))$(".scroll-nav a.act-link").each(function(){var a=$(this).data("bgscr"),b=$(this).data("bgtex");var ua=window.navigator.userAgent;var msie=ua.indexOf("MSIE ");if(msie>0||!!navigator.userAgent.match(/Trident.*rv\:11\./)){$(".bg-title span").html(b)}else{$(".bg-title span").html(b).shuffleLetters({})}$(".column-image").addClass("scrbg");setTimeout(function(){$(".bg-scroll").css("background-image","url("+a+")");$(".column-image").removeClass("scrbg")},700)})}},getCurrentSection:function(scrollPos){var i,hash,coords,section;for(i=0;i<this.$links.length;i++){hash=this.$links[i].hash;if($(hash).length){coords=this.getCoords($(hash));if(scrollPos>=coords.top-this.options.threshold){section=hash}}}return section||((this.$links.length===0)?(null):(this.$links[0].hash))}};$.fn.singlePageNav=function(options){return this.each(function(){var singlePageNav=Object.create(SinglePageNav);singlePageNav.init(options,this)})};$.fn.singlePageNav.defaults={offset:0,threshold:120,speed:400,currentClass:'current',easing:'swing',updateHash:false,filter:'',onComplete:false,beforeStart:false}})(jQuery,window,document); 11// ScrollToFixed 12(function(a){a.isScrollToFixed=function(b){return !!a(b).data("ScrollToFixed")};a.ScrollToFixed=function(d,i){var l=this;l.$el=a(d);l.el=d;l.$el.data("ScrollToFixed",l);var c=false;var G=l.$el;var H;var E;var e;var y;var D=0;var q=0;var j=-1;var f=-1;var t=null;var z;var g;function u(){G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");f=-1;D=G.offset().top;q=G.offset().left;if(l.options.offsets){q+=(G.offset().left-G.position().left)}if(j==-1){j=q}H=G.css("position");c=true;if(l.options.bottom!=-1){G.trigger("preFixed.ScrollToFixed");w();G.trigger("fixed.ScrollToFixed")}}function n(){var I=l.options.limit;if(!I){return 0}if(typeof(I)==="function"){return I.apply(G)}return I}function p(){return H==="fixed"}function x(){return H==="absolute"}function h(){return !(p()||x())}function w(){if(!p()){t.css({display:G.css("display"),width:G.outerWidth(true),height:G.outerHeight(true),"float":G.css("float")});cssOptions={"z-index":l.options.zIndex,position:"fixed",top:l.options.bottom==-1?s():"",bottom:l.options.bottom==-1?"":l.options.bottom,"margin-left":"0px"};if(!l.options.dontSetWidth){cssOptions.width=G.width()}G.css(cssOptions);G.addClass(l.options.baseClassName);if(l.options.className){G.addClass(l.options.className)}H="fixed"}}function b(){var J=n();var I=q;if(l.options.removeOffsets){I="";J=J-D}cssOptions={position:"absolute",top:J,left:I,"margin-left":"0px",bottom:""};if(!l.options.dontSetWidth){cssOptions.width=G.width()}G.css(cssOptions);H="absolute"}
vendor: 5,753 bytes, lines 12-58
12function k(){if(!h()){f=-1;t.css("display","none");G.css({"z-index":y,width:"",position:E,left:"",top:e,"margin-left":""});G.removeClass("scroll-to-fixed-fixed");if(l.options.className){G.removeClass(l.options.className)}H=null}}function v(I){if(I!=f){G.css("left",q-I);f=I}}function s(){var I=l.options.marginTop;if(!I){return 0}if(typeof(I)==="function"){return I.apply(G)}return I}function A(){if(!a.isScrollToFixed(G)){return}var K=c;if(!c){u()}else{if(h()){D=G.offset().top;q=G.offset().left}}var I=a(window).scrollLeft();var L=a(window).scrollTop();var J=n();if(l.options.minWidth&&a(window).width()<l.options.minWidth){if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}else{if(l.options.maxWidth&&a(window).width()>l.options.maxWidth){if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}else{if(l.options.bottom==-1){if(J>0&&L>=J-s()){if(!x()||!K){o();G.trigger("preAbsolute.ScrollToFixed");b();G.trigger("unfixed.ScrollToFixed")}}else{if(L>=D-s()){if(!p()||!K){o();G.trigger("preFixed.ScrollToFixed");w();f=-1;G.trigger("fixed.ScrollToFixed")}v(I)}else{if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}}}else{if(J>0){if(L+a(window).height()-G.outerHeight(true)>=J-(s()||-m())){if(p()){o();G.trigger("preUnfixed.ScrollToFixed");if(E==="absolute"){b()}else{k()}G.trigger("unfixed.ScrollToFixed")}}else{if(!p()){o();G.trigger("preFixed.ScrollToFixed");w()}v(I);G.trigger("fixed.ScrollToFixed")}}else{v(I)}}}}}function m(){if(!l.options.bottom){return 0}return l.options.bottom}function o(){var I=G.css("position");if(I=="absolute"){G.trigger("postAbsolute.ScrollToFixed")}else{if(I=="fixed"){G.trigger("postFixed.ScrollToFixed")}else{G.trigger("postUnfixed.ScrollToFixed")}}}var C=function(I){if(G.is(":visible")){c=false;A()}};var F=function(I){(!!window.requestAnimationFrame)?requestAnimationFrame(A):A()};var B=function(){var J=document.body;if(document.createElement&&J&&J.appendChild&&J.removeChild){var L=document.createElement("div");if(!L.getBoundingClientRect){return null}L.innerHTML="x";L.style.cssText="position:fixed;top:100px;";J.appendChild(L);var M=J.style.height,N=J.scrollTop;J.style.height="3000px";J.scrollTop=500;var I=L.getBoundingClientRect().top;J.style.height=M;var K=(I===100);J.removeChild(L);J.scrollTop=N;return K}return null};var r=function(I){I=I||window.event;if(I.preventDefault){I.preventDefault()}I.returnValue=false};l.init=function(){l.options=a.extend({},a.ScrollToFixed.defaultOptions,i);y=G.css("z-index");l.$el.css("z-index",l.options.zIndex);t=a("<div />");H=G.css("position");E=G.css("position");e=G.css("top");if(h()){l.$el.after(t)}a(window).bind("resize.ScrollToFixed",C);a(window).bind("scroll.ScrollToFixed",F);if("ontouchmove" in window){a(window).bind("touchmove.ScrollToFixed",A)}if(l.options.preFixed){G.bind("preFixed.ScrollToFixed",l.options.preFixed)}if(l.options.postFixed){G.bind("postFixed.ScrollToFixed",l.options.postFixed)}if(l.options.preUnfixed){G.bind("preUnfixed.ScrollToFixed",l.options.preUnfixed)}if(l.options.postUnfixed){G.bind("postUnfixed.ScrollToFixed",l.options.postUnfixed)}if(l.options.preAbsolute){G.bind("preAbsolute.ScrollToFixed",l.options.preAbsolute)}if(l.options.postAbsolute){G.bind("postAbsolute.ScrollToFixed",l.options.postAbsolute)}if(l.options.fixed){G.bind("fixed.ScrollToFixed",l.options.fixed)}if(l.options.unfixed){G.bind("unfixed.ScrollToFixed",l.options.unfixed)}if(l.options.spacerClass){t.addClass(l.options.spacerClass)}G.bind("resize.ScrollToFixed",function(){t.height(G.height())});G.bind("scroll.ScrollToFixed",function(){G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");A()});G.bind("detach.ScrollToFixed",function(I){r(I);G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");a(window).unbind("resize.ScrollToFixed",C);a(window).unbind("scroll.ScrollToFixed",F);G.unbind(".ScrollToFixed");t.remove();l.$el.removeData("ScrollToFixed")});C()};l.init()};a.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1000,baseClassName:"scroll-to-fixed-fixed"};a.fn.scrollToFixed=function(b){return this.each(function(){(new a.ScrollToFixed(this,b))})}})(jQuery); 13 14/** 15 /* 16 * 17 * jQuery Sliding Menu Plugin 18 * Mobile app list-style navigation in the browser 19 * 20 * Written by Ali Zahid 21 * http://alizahid.github.io/jquery-sliding-menu/ 22 * 23 */ 24 25// TheRoof fix change $.fn.menu to $.fn.slidingMenu -> need to be replace with https://alizahid.github.io/slinky/ 26(function($) { 27 var usedIds = []; 28 // $.fn.menu = function(options) { 29 $.fn.slidingMenu = function(options) { 30 var selector = this.selector; 31 var settings = $.extend({ 32 dataJSON: false, 33 backLabel: '' 34 }, options); 35 return this.each(function() { 36 var self = this, 37 menu = $(self), 38 data; 39 if (menu.hasClass('sliding-menu')) { 40 return 41 } 42 var menuWidth = menu.width(); 43 if (settings.dataJSON) { 44 data = processJSON(settings.dataJSON) 45 } else { 46 data = process(menu) 47 } 48 menu.empty().addClass('sliding-menu'); 49 var rootPanel; 50 if (settings.dataJSON) { 51 $(data).each(function(index, item) { 52 var panel = $('<ul></ul>'); 53 if (item.root) { 54 rootPanel = '#' + item.id 55 } 56 panel.attr('id', item.id); 57 panel.addClass('menu-panel'); 58 panel.width(menuWidth);
59 $(item.children).each(function(index, item) { 60 var link = $('<a></a>'); 61 link.attr('class', item.styleClass); 62 link.attr('href', item.href); 63 link.text(item.label); 64 var li = $('<li></li>'); 65 li.append(link); 66 panel.append(li) 67 }); 68 menu.append(panel) 69 }) 70 } else { 71 $(data).each(function(index, item) { 72 var panel = $(item); 73 if (panel.hasClass('menu-panel-root')) { 74 rootPanel = '#' + panel.attr('id') 75 } 76 panel.width(menuWidth); 77 menu.append(item) 78 }) 79 } 80 rootPanel = $(rootPanel); 81 rootPanel.addClass('menu-panel-root'); 82 var currentPanel = rootPanel; 83 menu.height(rootPanel.height()); 84 var wrapper = $('<div></div>').addClass('sliding-menu-wrapper').width(data.length * menuWidth); 85 menu.wrapInner(wrapper); 86 wrapper = $('.sliding-menu-wrapper', menu); 87 $('a', self).on('click', function(e) { 88 var href = $(this).attr('href'), 89 label = $(this).text(); 90 if (wrapper.is(':animated')) { 91 e.preventDefault(); 92 return 93 } 94 if (href == '#') { 95 e.preventDefault() 96 } else if (href.indexOf('#menu-panel') == 0) { 97 var target = $(href), 98 isBack = $(this).hasClass('back'), 99 marginLeft = parseInt(wrapper.css('margin-left')); 100 if (isBack) { 101 if (href == '#menu-panel-back') { 102 target = currentPanel.prev() 103 } 104 wrapper.stop(true, true).animate({ 105 marginLeft: marginLeft + menuWidth 106 }, 'fast') 107 } else { 108 target.insertAfter(currentPanel); 109 if (settings.backLabel === true) { 110 $('.back', target).text(label) 111 } else { 112 $('.back', target).text(settings.backLabel) 113 } 114 wrapper.stop(true, true).animate({ 115 marginLeft: marginLeft - menuWidth 116 }, 'fast') 117 } 118 currentPanel = target; 119 menu.stop(true, true).animate({ 120 height: target.height() 121 }, 'fast'); 122 e.preventDefault() 123 } 124 }); 125 return this 126 }); 127 128 function process(data) { 129 var ul = $('ul', data), 130 panels = []; 131 $(ul).each(function(index, item) { 132 var panel = $(item), 133 handler = panel.prev(), 134 id = getNewId(); 135 if (handler.length == 1) { 136 handler.addClass('nav').attr('href', '#menu-panel-' + id) 137 } 138 panel.attr('id', 'menu-panel-' + id); 139 if (index == 0) { 140 panel.addClass('menu-panel-root') 141 } else { 142 panel.addClass('menu-panel'); 143 var li = $('<li></li>'), 144 back = $('<a></a>').addClass('back').attr('href', '#menu-panel-back'); 145 panel.prepend(back) 146 } 147 panels.push(item) 148 }); 149 return panels 150 } 151 152 function processJSON(data, parent) { 153 var root = { 154 id: 'menu-panel-' + getNewId(), 155 children: [], 156 root: (parent ? false : true) 157 }, 158 panels = []; 159 if (parent) { 160 root.children.push({ 161 styleClass: 'back', 162 href: '#' + parent.id 163 }) 164 } 165 $(data).each(function(index, item) { 166 root.children.push(item); 167 if (item.children) { 168 var panel = processJSON(item.children, root); 169 item.href = '#' + panel[0].id; 170 item.styleClass = 'nav'; 171 panels = panels.concat(panel) 172 } 173 }); 174 return [root].concat(panels) 175 } 176 177 function getNewId() { 178 var id; 179 do { 180 id = Math.random().toString(36).substring(3, 8) 181 } while (usedIds.indexOf(id) >= 0); 182 usedIds.push(id); 183 return id 184 } 185 } 186}(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.