1/* 2 * jQuery Touch Optimized Sliders "R"Us 2.1.1 3 * 4 * Copyright (c) Fred Heusschen 5 * www.frebsite.nl 6 * 7 * Plugin website: 8 * tosrus.frebsite.nl 9 * 10 * Dual licensed under the MIT and GPL licenses. 11 * http://en.wikipedia.org/wiki/MIT_License 12 * http://en.wikipedia.org/wiki/GNU_General_Public_License 13 */ 14!function(s){function i(){o=function(s){return t+"-"+s},d=function(s){return t+"-"+s},r=function(s){return s+"."+t},s.each([o,d,r],function(s,i){i.add=function(s){s=s.split(" ");for(var e in s)i[s[e]]=i(s[e])}}),o.add("touch desktop scale-1 scale-2 scale-3 wrapper opened opening fixed inline hover slider slide loading noanimation fastanimation"),d.add("slide anchor"),r.add("open opening close closing prev next slideTo sliding click pinch scroll resize orientationchange load loading loaded transitionend webkitTransitionEnd"),a={complObject:function(i,e){return s.isPlainObject(i)||(i=e),i},complBoolean:function(s,i){return"boolean"!=typeof s&&(s=i),s},complNumber:function(i,e){return s.isNumeric(i)||(i=e),i},complString:function(s,i){return"string"!=typeof s&&(s=i),s},isPercentage:function(s){return"string"==typeof s&&"%"==s.slice(-1)},getPercentage:function(s){return parseInt(s.slice(0,-1))},resizeRatio:function(s,i,e,t,n){var o=i.width(),d=i.height();e&&o>e&&(o=e),t&&d>t&&(d=t),n>o/d?d=o/n:o=d*n,s.width(o).height(d)},transitionend:function(s,i,e){var t=!1,n=function(){t||i.call(s[0]),t=!0};s.one(r.transitionend,n),s.one(r.webkitTransitionEnd,n),setTimeout(n,1.1*e)},setViewportScale:function(){if(l.viewportScale){var s=l.viewportScale.getScale();"undefined"!=typeof s&&(s=1/s,l.$body.removeClass(o["scale-1"]).removeClass(o["scale-2"]).removeClass(o["scale-3"]).addClass(o["scale-"+Math.max(Math.min(Math.round(s),3),1)]))}}},l={$wndw:s(window),$html:s("html"),$body:s("body"),scrollPosition:0,viewportScale:null,viewportScaleInterval:null},l.$body.addClass(s[e].support.touch?o.touch:o.desktop),l.$wndw.on(r.scroll,function(s){l.$body.hasClass(o.opened)&&(window.scrollTo(0,l.scrollPosition),s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation())}),!l.viewportScale&&s[e].support.touch&&"undefined"!=typeof FlameViewportScale&&(l.viewportScale=new FlameViewportScale,a.setViewportScale(),l.$wndw.on(r.orientationchange+" "+r.resize,function(){l.viewportScaleInterval&&(clearTimeout(l.viewportScaleInterval),l.viewportScaleInterval=null),l.viewportScaleInterval=setTimeout(function(){a.setViewportScale()},500)})),s[e]._c=o,s[e]._d=d,s[e]._e=r,s[e]._f=a,s[e]._g=l}var e="tosrus",t="tos",n="2.1.1";if(!s[e]){var o={},d={},r={},a={},l={};s[e]=function(s,i,e){return this.$node=s,this.opts=i,this.conf=e,this.vars={},this.nodes={},this.slides={},this._init(),this},s[e].prototype={_init:function(){var i=this;this._complementOptions(),this.vars.fixed="window"==this.opts.wrapper.target,this.nodes.$wrpr=s('<div class="'+o.wrapper+'" />'),this.nodes.$sldr=s('<div class="'+o.slider+'" />').appendTo(this.nodes.$wrpr),this.nodes.$wrpr.addClass(this.vars.fixed?o.fixed:o.inline).addClass(o("fx-"+this.opts.effect)).addClass(o(this.opts.slides.scale)).addClass(this.opts.wrapper.classes),this.nodes.$wrpr.on(r.open+" "+r.close+" "+r.prev+" "+r.next+" "+r.slideTo,function(s){arguments=Array.prototype.slice.call(arguments);var s=arguments.shift(),e=s.type;s.stopPropagation(),"function"==typeof i[e]&&i[e].apply(i,arguments)}).on(r.opening+" "+r.closing+" "+r.sliding+" "+r.loading+" "+r.loaded,function(s){s.stopPropagation()}).on(r.click,function(s){s.stopPropagation(),i.nodes.$wrpr.toggleClass(o.hover)}),s.fn.hammer&&s[e].support.touch&&this.nodes.$wrpr.hammer().on(r.pinch,function(s){l.$body.hasClass(o.opened)&&(s.gesture.preventDefault(),s.stopPropagation())}),this.nodes.$anchors=this._initAnchors(),this.nodes.$slides=this._initSlides(),this.slides.total=this.nodes.$slides.length,this.slides.visible=this.opts.slides.visible,this.slides.index=0,this.vars.opened=!0;for(var t=0;t<s[e].addons.length;t++)s.isFunction(this["_addon_"+s[e].addons[t]])&&this["_addon_"+s[e].addons[t]]();for(var n=0;n<s[e].ui.length;n++)this.nodes.$wrpr.find("."+o[s[e].ui[n]]).length&&this.nodes.$wrpr.addClass(o("has-"+s[e].ui[n]));this.vars.fixed?(this.nodes.$wrpr.appendTo(l.$body),this.close(!0)):(this.nodes.$wrpr.appendTo(this.opts.wrapper.target),this.opts.show?(this.vars.opened=!1,this.open(0,!0)):this.close(!0))},open:function(i,e){var t=this;this.vars.opened||(this.vars.fixed&&(l.scrollPosition=l.$wndw.scrollTop(),l.$body.addClass(o.opened),a.setViewportScale()),e?this.nodes.$wrpr.addClass(o.opening).trigger(r.opening,[i,e]):setTimeout(function(){t.nodes.$wrpr.addClass(o.opening).trigger(r.opening,[i,e])},5),this.nodes.$wrpr.addClass(o.hover).addClass(o.opened)),this.vars.opened=!0,this._loadContents(),s.isNumeric(i)&&(e=e||!this.vars.opened,this.slideTo(i,e))},close:function(i){this.vars.opened&&(this.vars.fixed&&l.$body.removeClass(o.opened),i?this.nodes.$wrpr.removeClass(o.opened):a.transitionend(this.nodes.$wrpr,function(){s(this).removeClass(o.opened)},this.conf.transitionDuration),this.nodes.$wrpr.removeClass(o.hover).removeClass(o.opening).trigger(r.closing,[this.slides.index,i])),this.vars.opened=!1},prev:function(i,e){s.isNumeric(i)||(i=this.opts.slides.slide),this.slideTo(this.slides.index-i,e)},next:function(i,e){s.isNumeric(i)||(i=this.opts.slides.slide),this.slideTo(this.slides.index+i,e)},slideTo:function(i,t){if(!this.vars.opened)return!1;if(!s.isNumeric(i))return!1;var n=!0;if(0>i){var d=0==this.slides.index;this.opts.infinite?i=d?this.slides.total-this.slides.visible:0:(i=0,d&&(n=!1))}if(i+this.slides.visible>this.slides.total){var l=this.slides.index+this.slides.visible>=this.slides.total;this.opts.infinite?i=l?0:this.slides.total-this.slides.visible:(i=this.slides.total-this.slides.visible,l&&(n=!1))}if(this.slides.index=i,this._loadContents(),n){var h=0-this.slides.index*this.opts.slides.width+this.opts.slides.offset;
14this.slides.widthPercentage&&(h+="%"),t&&(this.nodes.$sldr.addClass(o.noanimation),a.transitionend(this.nodes.$sldr,function(){s(this).removeClass(o.noanimation)},5));for(var p in s[e].effects)if(p==this.opts.effect){s[e].effects[p].call(this,h,t);break}this.nodes.$wrpr.trigger(r.sliding,[i,t])}},_initAnchors:function(){var i=this,t=s();if(this.$node.is("a"))for(var n in s[e].media)t=t.add(this.$node.filter(function(){return s[e].media[n].filterAnchors.call(i,s(this).attr("href"))}));return t},_initSlides:function(){return this[this.$node.is("a")?"_initSlidesFromAnchors":"_initSlidesFromContent"](),this.nodes.$sldr.children().css("width",this.opts.slides.width+(this.slides.widthPercentage?"%":"px"))},_initSlidesFromAnchors:function(){var i=this;this.nodes.$anchors.each(function(e){var t=s(this),n=s('<div class="'+o.slide+" "+o.loading+'" />').data(d.anchor,t).appendTo(i.nodes.$sldr);t.data(d.slide,n).on(r.click,function(s){s.preventDefault(),i.open(e)})})},_initSlidesFromContent:function(){var i=this;this.$node.children().each(function(){var t=s(this);s('<div class="'+o.slide+'" />').append(t).appendTo(i.nodes.$sldr);for(var n in s[e].media)if(s[e].media[n].filterSlides.call(i,t)){s[e].media[n].initSlides.call(i,t),t.parent().addClass(o(n));break}})},_loadContents:function(){var s=this;switch(this.opts.slides.load){case"all":this._loadContent(0,this.slides.total);break;case"visible":this._loadContent(this.slides.index,this.slides.index+this.slides.visible);break;case"near-visible":default:this._loadContent(this.slides.index,this.slides.index+this.slides.visible),setTimeout(function(){s._loadContent(s.slides.index-s.slides.visible,s.slides.index),s._loadContent(s.slides.index+s.slides.visible,s.slides.index+2*s.slides.visible)},this.conf.transitionDuration)}},_loadContent:function(i,t){var n=this;this.nodes.$slides.slice(i,t).each(function(){var i=s(this);if(0==i.children().length){var t=i.data(d.anchor).attr("href");for(var a in s[e].media)if(s[e].media[a].filterAnchors.call(n,t)){s[e].media[a].initAnchors.call(n,i,t),i.addClass(o(a));break}i.trigger(r.loading,[i.data(d.anchor)])}})},_complementOptions:function(){if("undefined"==typeof this.opts.wrapper.target&&(this.opts.wrapper.target=this.$node.is("a")?"window":this.$node),"window"!=this.opts.wrapper.target&&"string"==typeof this.opts.wrapper.target&&(this.opts.wrapper.target=s(this.opts.wrapper.target)),this.opts.show=a.complBoolean(this.opts.show,"window"!=this.opts.wrapper.target),s.isNumeric(this.opts.slides.width))this.slides.widthPercentage=!1,this.opts.slides.visible=a.complNumber(this.opts.slides.visible,1);else{var i=a.isPercentage(this.opts.slides.width)?a.getPercentage(this.opts.slides.width):!1;this.slides.widthPercentage=!0,this.opts.slides.visible=a.complNumber(this.opts.slides.visible,i?Math.floor(100/i):1),this.opts.slides.width=i?i:Math.ceil(1e4/this.opts.slides.visible)/100}this.opts.slides.slide=a.complNumber(this.opts.slides.slide,this.opts.slides.visible),this.opts.slides.offset=a.isPercentage(this.opts.slides.offset)?a.getPercentage(this.opts.slides.offset):a.complNumber(this.opts.slides.offset,0)}},s.fn[e]=function(t,n,o,d){l.$wndw||i(),t=s.extend(!0,{},s[e].defaults,t),t=s.extend(!0,{},t,s[e].support.touch?o:n),d=s.extend(!0,{},s[e].configuration,d);var r=new s[e](this,t,d);return this.data(e,r),r.nodes.$wrpr},s[e].support={touch:"ontouchstart"in window.document},s[e].defaults={infinite:!1,effect:"slide",wrapper:{classes:""},slides:{offset:0,scale:"fit",load:"near-visible",visible:1}},s[e].configuration={transitionDuration:400},s[e].debug=function(){},s[e].deprecated=function(s,i){"undefined"!=typeof console&&"undefined"!=typeof console.warn&&console.warn(e+": "+s+" is deprecated, use "+i+" instead.")},s[e].effects={slide:function(s){this.nodes.$sldr.css("left",s)},fade:function(i){a.transitionend(this.nodes.$sldr,function(){s(this).css("left",i).css("opacity",1)},this.conf.transitionDuration),this.nodes.$sldr.css("opacity",0)}},s[e].version=n,s[e].media={},s[e].addons=[],s[e].ui=[]}}(jQuery); 15/* 16 * jQuery Touch Optimized Sliders "R"Us 17 * Buttons addon 18 * 19 * Copyright (c) Fred Heusschen 20 * www.frebsite.nl 21 */ 22!function(s){function e(e,n){return s('<a class="'+t[e]+n+'" href="#"><span></span></a>')}function n(s,e,n,t){e.on(o.click,function(e){e.preventDefault(),e.stopPropagation(),s.trigger(o[n],[t])})}var t,i,o,d,p,l="tosrus",r="buttons",a=!1;s[l].prototype["_addon_"+r]=function(){a||(t=s[l]._c,i=s[l]._d,o=s[l]._e,d=s[l]._f,p=s[l]._g,t.add("prev next close disabled"),a=!0);var u=this,h=this.opts[r];this.nodes.$prev=null,this.nodes.$next=null,this.nodes.$clse=null,("boolean"==typeof h||"string"==typeof h&&"inline"==h)&&(h={prev:h,next:h}),"undefined"==typeof h.close&&(h.close=this.vars.fixed),this.nodes.$slides.length<2&&(h.prev=!1,h.next=!1),s.each({prev:"prev",next:"next",close:"clse"},function(i,d){h[i]&&("string"==typeof h[i]&&"inline"==h[i]?u.vars.fixed&&"close"!=i&&u.nodes.$slides.on(o.loading,function(){var o=e(i," "+t.inline)["prev"==i?"prepe
22ndTo":"appendTo"](this);n(u.nodes.$wrpr,o,i,1),("prev"==i&&s(this).is(":first-child")||"next"==i&&s(this).is(":last-child"))&&o.addClass(t.disabled)}):("string"==typeof h[i]&&(h[i]=s(h[i])),u.nodes["$"+d]=h[i]instanceof s?h[i]:e(i,"").appendTo(u.nodes.$wrpr),n(u.nodes.$wrpr,u.nodes["$"+d],i,null)))}),this.opts.infinite||(this.updateButtons(),this.nodes.$wrpr.on(o.sliding,function(){u.updateButtons()}))},s[l].prototype.updateButtons=function(){this.nodes.$prev&&this.nodes.$prev[(this.slides.index<1?"add":"remove")+"Class"](t.disabled),this.nodes.$next&&this.nodes.$next[(this.slides.index>=this.slides.total-this.slides.visible?"add":"remove")+"Class"](t.disabled)},s[l].defaults[r]={prev:!s[l].support.touch,next:!s[l].support.touch},s[l].addons.push(r),s[l].ui.push("prev"),s[l].ui.push("next"),s[l].ui.push("close")}(jQuery); 23/* 24 * jQuery Touch Optimized Sliders "R"Us 25 * Caption addon 26 * 27 * Copyright (c) Fred Heusschen 28 * www.frebsite.nl 29 */ 30!function(t){var a,i,s,e,n,d="tosrus",r="caption",o=!1;t[d].prototype["_addon_"+r]=function(){o||(a=t[d]._c,i=t[d]._d,s=t[d]._e,e=t[d]._f,n=t[d]._g,a.add("caption uibg"),i.add("caption"),o=!0);var p=this,c=this.opts[r];t.isArray(c)&&t[d].deprecated('An array for the option "caption"','the option "caption.attributes"'),c.add&&this.vars.fixed&&("string"==typeof c.target&&(c.target=t(c.target)),c.target instanceof t?this.nodes.$capt=c.target:(this.nodes.$capt=t('<div class="'+a.caption+'" />').appendTo(this.nodes.$wrpr),this.nodes.$uibg||(this.nodes.$uibg=t('<div class="'+a.uibg+'" />').prependTo(this.nodes.$wrpr))),c.attributes=c.attributes||[],this.nodes.$anchors.each(function(){var a=t(this),s=a.data(i.slide);s.data(i.caption,"");for(var e=0,n=c.attributes.length;n>e;e++){var d=a.attr(c.attributes[e]);if(d&&d.length){s.data(i.caption,d);break}}}),this.nodes.$wrpr.on(s.sliding,function(){var t=p.nodes.$sldr.children().eq(p.slides.index).data(i.caption)||"";p.nodes.$capt.text(t)[t.length>0?"removeClass":"addClass"](a.disabled)}))},t[d].defaults[r]={add:!1,target:null,attributes:["title","rel"]},t[d].addons.push(r),t[d].ui.push("caption")}(jQuery); 31/* 32 * jQuery Touch Optimized Sliders "R"Us 33 * Drag addon 34 * 35 * Copyright (c) Fred Heusschen 36 * www.frebsite.nl 37 */ 38!function(e){if(e.fn.hammer){var t,s,r,n,i,a="tosrus",o="drag",d=!1;e[a].prototype["_addon_"+o]=function(){d||(t=e[a]._c,s=e[a]._d,r=e[a]._e,n=e[a]._f,i=e[a]._g,r.add("dragstart dragend dragleft dragright swipeleft swiperight"),d=!0);var l=this;if(this.opts[o]&&"slide"==this.opts.effect&&this.nodes.$slides.length>1){var f=0,g=!1,u=!1;this.nodes.$wrpr.hammer().on(r.dragstart,function(e){e.stopPropagation(),e.gesture&&(e.gesture.preventDefault(),l.nodes.$sldr.addClass(t.noanimation))}).on(r.dragleft+" "+r.dragright,function(e){e.stopPropagation(),e.gesture&&(e.gesture.preventDefault(),f=e.gesture.deltaX,g=e.gesture.direction,u=!1,("left"==g&&l.slides.index+l.slides.visible>=l.slides.total||"right"==g&&0==l.slides.index)&&(f/=2.5),l.nodes.$sldr.css("margin-left",Math.round(f)))}).on(r.swipeleft+" "+r.swiperight,function(e){e.stopPropagation(),e.gesture&&(e.gesture.preventDefault(),u=!0)}).on(r.dragend,function(e){if(e.stopPropagation(),e.gesture){if(e.gesture.preventDefault(),l.nodes.$sldr.removeClass(t.noanimation).addClass(t.fastanimation),n.transitionend(l.nodes.$sldr,function(){l.nodes.$sldr.removeClass(t.fastanimation)},l.conf.transitionDuration/2),l.nodes.$sldr.css("margin-left",0),"left"==g||"right"==g){if(u)var s=l.slides.visible;else var i=l.nodes.$slides.first().width(),s=Math.floor((Math.abs(f)+i/2)/i);s>0&&l.nodes.$wrpr.trigger(r["left"==g?"next":"prev"],[s])}g=!1}})}},e[a].defaults[o]=e[a].support.touch,e[a].addons.push(o)}}(jQuery); 39/* 40 * jQuery Touch Optimized Sliders "R"Us 41 * Keys addon 42 * 43 * Copyright (c) Fred Heusschen 44 * www.frebsite.nl 45 */ 46!function(e){var t,o,s,n,r,a="tosrus",p="keys",d=!1;e[a].prototype["_addon_"+p]=function(){d||(t=e[a]._c,o=e[a]._d,s=e[a]._e,n=e[a]._f,r=e[a]._g,s.add("keyup"),d=!0);var c=this,i=this.opts[p];"boolean"==typeof i&&i&&(i={prev:37,next:39,close:27}),e.isPlainObject(i)&&(this.nodes.$slides.length<2&&(i.prev=!1,i.next=!1),e(document).on(s.keyup,function(e){if(c.vars.opened){var t=!1;switch(e.keyCode){case i.prev:t=s.prev;break;case i.next:t=s.next;break;case i.close:t=s.close}t&&(e.preventDefault(),e.stopPropagation(),c.nodes.$wrpr.trigger(t))}}))},e[a].defaults[p]=!1,e[a].addons.push(p)}(jQuery); 47/* 48 * jQuery Touch Optimized Sliders "R"Us 49 * Pagination addon 50 * 51 * Copyright (c) Fred Heusschen 52 * www.frebsite.nl 53 */ 54 55 (function( $ ) { 56 57 var _PLUGIN_ = 'tosrus', 58 _ADDON_ = 'pagination'; 59 60 var _addonInitiated = false, 61 _c, _d, _e, _f, _g; 62 63 $[ _PLUGIN_ ].prototype[ '_addon_' + _ADDON_ ] = function() 64 { 65 if ( !_addonInitiated ) 66 { 67 _c = $[ _PLUGIN_ ]._c; 68 _d = $[ _PLUGIN_ ]._d; 69 _e = $[ _PLUGIN_ ]._e; 70 _f = $[ _PLUGIN_ ]._f; 71 _g = $[ _PLUGIN_ ]._g; 72 73 _c.add( 'pagination selected uibg bullets thumbnails' ); 74 75 _addonInitiated = true; 76 } 77 78 var that = this, 79 pagr = this.opts[ _ADDON_ ]; 80 81 82 // DEPRECATED 83 if ( typeof pagr == 'boolean' ) 84 { 85 $[ _PLUGIN_ ].deprecated( 'A boolean for the option "pagination"', 'the option "pagination.add"' ); 86 } 87 if ( typeof pagr == 'string' ) 88 { 89 $[ _PLUGIN_ ].deprecated( 'A string for the option "pagination"', 'the option "pagination.target"' ); 90 } 91 if ( pagr instanceof $ ) 92 { 93 $[ _PLUGIN_ ].deprecated( 'A jQuery object for the option "pagination"', 'the option "pagination.target"' ); 94 } 95 // /DEPRECATED 96 97 98 if ( this.nodes.$slides.length < 2 ) 99 { 100 pagr.add = false; 101 } 102 103 if ( pagr.add ) 104 { 105 if ( typeof pagr.target == 'string' ) 106 { 107 pagr.target = $(pagr.target); 108 } 109 if ( pagr.target instanceof $ ) 110 { 111 this.nodes.$pagr = pagr.target; 112 } 113 else 114 {
115 this.nodes.$pagr = $('<div class="' + _c.pagination + ' ' + _c[ pagr.type ] + '" />').appendTo( this.nodes.$wrpr ); 116 if ( !this.nodes.$uibg ) 117 { 118 this.nodes.$uibg = $('<div class="' + _c.uibg + '" />').prependTo( this.nodes.$wrpr ); 119 } 120 } 121 122 if ( typeof pagr.anchorBuilder != 'function' ) 123 { 124 switch( pagr.type ) 125 { 126 case 'thumbnails': 127 if ( this.vars.fixed ) 128 { 129 pagr.anchorBuilder = function( index ) 130 { 131 return '<a href="#" style="background-image: url(' + $(this).data( _d.anchor ).attr( 'href' ) + ');"></a>'; 132 }; 133 } 134 else 135 { 136 pagr.anchorBuilder = function( index ) 137 { 138 return '<a href="#" style="background-image: url(' + $(this).find( 'img' ).attr( 'src' ) + ');"></a>'; 139 }; 140 } 141 break; 142 143 case 'bullets': 144 default: 145 pagr.anchorBuilder = function( index ) 146 { 147 return '<a href="#"></a>'; 148 }; 149 break; 150 } 151 } 152 153 this.nodes.$slides 154 .each( 155 function( index ) 156 { 157 $(pagr.anchorBuilder.call( this, index + 1 ) ) 158 .appendTo( that.nodes.$pagr ) 159 .on( _e.click, 160 function( e ) 161 { 162 e.preventDefault(); 163 e.stopPropagation(); 164 165 that.nodes.$wrpr.trigger( _e.slideTo, [ index ] ); 166 } 167 ); 168 } 169 ); 170 171 this.updatePagination(); 172 this.nodes.$wrpr 173 .on( _e.sliding, 174 function( e, slide, direct ) 175 { 176 that.updatePagination(); 177 } 178 ); 179 } 180 }; 181 182 $[ _PLUGIN_ ].prototype.updatePagination = function() 183 { 184 if ( this.nodes.$pagr ) 185 { 186 this.nodes.$pagr 187 .children() 188 .removeClass( _c.selected ) 189 .eq( this.slides.index ) 190 .addClass( _c.selected ); 191 } 192 }; 193 194 // Defaults 195 $[ _PLUGIN_ ].defaults[ _ADDON_ ] = { 196 add : false, 197 type : 'bullets', 198 target : null, 199 anchorBuilder : null 200 }; 201 202 // Add to plugin 203 $[ _PLUGIN_ ].addons.push( _ADDON_ ); 204 $[ _PLUGIN_ ].ui.push( 'pagination' ); 205 $[ _PLUGIN_ ].ui.push( 'bullets' ); 206 $[ _PLUGIN_ ].ui.push( 'thumbnails' ); 207 208 209})( jQuery ); 210/* 211 * jQuery Touch Optimized Sliders "R"Us 212 * HTML media 213 * 214 * Copyright (c) Fred Heusschen 215 * www.frebsite.nl 216 */ 217!function(i){var n="tosrus",e="html";i[n].media[e]={filterAnchors:function(n){return"#"==n.slice(0,1)&&i(n).is("div")},initAnchors:function(e,t){i('<div class="'+i[n]._c("html")+'" />').append(i(t)).appendTo(e),e.removeClass(i[n]._c.loading).trigger(i[n]._e.loaded)},filterSlides:function(i){return i.is("div")},initSlides:function(){}}}(jQuery); 218/* 219 * jQuery Touch Optimized Sliders "R"Us 220 * Images media 221 * 222 * Copyright (c) Fred Heusschen 223 * www.frebsite.nl 224 */ 225!function(i){var n="tosrus",o="image";i[n].media[o]={filterAnchors:function(n){return i.inArray(n.toLowerCase().split(".").pop().split("?")[0],["jpg","jpe","jpeg","gif","png"])>-1},initAnchors:function(o,r){i('<img border="0" />').on(i[n]._e.load,function(r){r.stopPropagation(),o.removeClass(i[n]._c.loading).trigger(i[n]._e.loaded)}).appendTo(o).attr("src",r)},filterSlides:function(i){return i.is("img")},initSlides:function(){}}}(jQuery); 226/* 227 * jQuery Touch Optimized Sliders "R"Us 228 * Vimeo media 229 * 230 * Copyright (c) Fred Heusschen 231 * www.frebsite.nl 232 */ 233!function(i){function t(t){function l(i){m.length&&m[0].contentWindow.postMessage('{ "method": "'+i+'" }',"*")}c||(o=i[s]._c,e=i[s]._d,n=i[s]._e,a=i[s]._f,r=i[s]._g,e.add("ratio maxWidth maxHeight"),c=!0);var m=t.children(),f=t.data(i[s]._d.anchor)||i(),h=f.data(e.ratio)||this.opts[d].ratio,u=f.data(e.maxWidth)||this.opts[d].maxWidth,g=f.data(e.maxHeight)||this.opts[d].maxHeight;t.removeClass(o.loading).trigger(n.loaded).on(n.loading,function(){a.resizeRatio(m,t,u,g,h)}),this.nodes.$wrpr.on(n.sliding,function(){l("pause")}).on(n.closing,function(){l("unload")}),r.$wndw.on(n.resize,function(){a.resizeRatio(m,t,u,g,h)})}var o,e,n,a,r,s="tosrus",d="vimeo",c=!1;i[s].media[d]={filterAnchors:function(i){return i.toLowerCase().indexOf("vimeo.com/")>-1},initAnchors:function(o,e){e=e.split("vimeo.com/")[1].split("?")[0]+"?api=1",i('<iframe src="http://player.vimeo.com/video/'+e+'" frameborder="0" allowfullscreen />').appendTo(o),t.call(this,o)},filterSlides:function(i){return i.is("iframe")&&i.attr("src")?i.attr("src").toLowerCase().indexOf("vimeo.com/video/")>-1:!1},initSlides:function(i){t.call(this,i)}},i[s].defaults[d]={ratio:16/9,maxWidth:!1,maxHeight:!1}}(jQuery); 234/* 235 * jQuery Touch Optimized Sliders "R"Us 236 * Youtube media 237 * 238 * Copyright (c) Fred Heusschen 239 * www.frebsite.nl 240 */ 241 242(function( $ ) { 243 244 var _PLUGIN_ = 'tosrus', 245 _MEDIA_ = 'youtube'; 246 247 var _mediaInitiated = false, 248 _c, _d, _e, _f, _g; 249 250 $[ _PLUGIN_ ].media[ _MEDIA_ ] = { 251
252 // Filter anchors 253 filterAnchors: function( href ) 254 { 255 return ( href.toLowerCase().indexOf( 'youtube.com/watch?v=' ) > -1 ); 256 }, 257 258 // Create Slides from anchors 259 initAnchors: function( $s, href ) 260 { 261 var url = href; 262 href = href.split( '?v=' )[ 1 ].split( '&' )[ 0 ]; 263 264 if ( this.opts[ _MEDIA_ ].imageLink ) 265 { 266 href = 'http://img.youtube.com/vi/' + href + '/0.jpg'; 267 $('<a href="' + url + '" class="' + $[ _PLUGIN_ ]._c( 'play' ) + '" target="_blank" />') 268 .appendTo( $s ); 269 270 $('<img border="0" />') 271 .on( $[ _PLUGIN_ ]._e.load, 272 function( e ) 273 { 274 e.stopPropagation(); 275 $s.removeClass( $[ _PLUGIN_ ]._c.loading ) 276 .trigger( $[ _PLUGIN_ ]._e.loaded ); 277 } 278 ) 279 .appendTo( $s ) 280 .attr( 'src', href ); 281 } 282 else 283 { 284 $('<iframe src="http://www.youtube.com/embed/' + href + '" frameborder="0" allowfullscreen />') 285 .appendTo( $s ); 286 287 initVideo.call( this, $s ); 288 } 289 }, 290 291 // Filter slides 292 filterSlides: function( $s ) 293 { 294 if ( $s.is( 'iframe' ) && $s.attr( 'src' ) ) 295 { 296 return ( $s.attr( 'src' ).toLowerCase().indexOf( 'youtube.com/embed/' ) > -1 ); 297 } 298 return false; 299 }, 300 301 // Create slides from existing content 302 initSlides: function( $s ) 303 { 304 initVideo.call( this, $s ); 305 } 306 }; 307 308 309 // Functions 310 function initVideo( $s ) 311 { 312 if ( !_mediaInitiated ) 313 { 314 _c = $[ _PLUGIN_ ]._c; 315 _d = $[ _PLUGIN_ ]._d; 316 _e = $[ _PLUGIN_ ]._e; 317 _f = $[ _PLUGIN_ ]._f; 318 _g = $[ _PLUGIN_ ]._g; 319 320 _d.add( 'ratio maxWidth maxHeight' ); 321 322 _mediaInitiated = true; 323 } 324 325 var that = this; 326 327 var $v = $s.children(), 328 $a = $s.data( $[ _PLUGIN_ ]._d.anchor ) || $(); 329 330 var ratio = $a.data( _d.ratio ) || this.opts[ _MEDIA_ ].ratio, 331 maxWidth = $a.data( _d.maxWidth ) || this.opts[ _MEDIA_ ].maxWidth, 332 maxHeight = $a.data( _d.maxHeight ) || this.opts[ _MEDIA_ ].maxHeight; 333 334 $s.removeClass( _c.loading ) 335 .trigger( _e.loaded ) 336 .on( _e.loading, 337 function( e ) 338 { 339 _f.resizeRatio( $v, $s, maxWidth, maxHeight, ratio ); 340 } 341 ); 342 343 this.nodes.$wrpr 344 .on( _e.sliding, 345 function( e ) 346 { 347 commandVideo( 'pause' ); 348 } 349 ) 350 .on( _e.closing, 351 function( e ) 352 { 353 commandVideo( 'stop' ); 354 } 355 ); 356 357 _g.$wndw 358 .on( _e.resize, 359 function( e ) 360 { 361 _f.resizeRatio( $v, $s, maxWidth, maxHeight, ratio ); 362 } 363 ); 364 365 366 function resizeVideo() 367 { 368 var _w = $s.width(), 369 _h = $s.height(); 370 371 if ( maxWidth && _w > maxWidth ) 372 { 373 _w = maxWidth; 374 } 375 if ( maxHeight && _h > maxHeight ) 376 { 377 _h = maxHeight; 378 } 379 380 if ( _w / _h < ratio ) 381 { 382 _h = _w / ratio; 383 } 384 else 385 { 386 _w = _h * ratio; 387 } 388 389 $v.width( _w ).height( _h ); 390 } 391 392 function commandVideo( fn ) 393 { 394 if ( $v.length ) 395 { 396 $v[ 0 ].contentWindow.postMessage( '{ "event": "command", "func": "' + fn + 'Video" }', '*' ); 397 } 398 } 399 } 400 401 402 // Defaults 403 $[ _PLUGIN_ ].defaults[ _MEDIA_ ] = { 404 ratio : 16 / 9, 405 maxWidth : false, 406 maxHeight : false, 407 imageLink : $[ _PLUGIN_ ].support.touch 408 }; 409 410 411})( 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.