PageSourceSearch

https://cug.org/wp-content/themes/lydia/style/js/bg-video-parallax.js?ver=7.1.2

js cug.org collected 2026-10-02 06:09:21 UTC 4,953 bytes, 4 lines download raw bytes

1/*-----------------------------------------------------------------------------------*/
2/*  03. BACKGROUND VIDEO PARALLAX
3/*-----------------------------------------------------------------------------------*/
4!function(i,t,o,s){"use strict";function e(t,o){function s(){e.options.originalVideoW=e.options.$video[0].videoWidth,e.options.originalVideoH=e.options.$video[0].videoHeight,e.initialised||e.init()}var e=this;this.element=t,this.options=i.extend({},r,o),this._defaults=r,this._name=n,this.options.$video=i(t),this.detectBrowser(),this.shimRequestAnimationFrame(),this.options.has3d=this.detect3d(),this.options.$videoWrap.css({position:"relative",overflow:"hidden","z-index":"10"}),this.options.$video.css({position:"absolute","z-index":"1"}),this.options.$video.on("canplay canplaythrough",s),this.options.$video[0].readyState>3&&s()}var n="backgroundVideo",r={$videoWrap:i("#video-wrap"),$outerWrap:i(t),$window:i(t),minimumVideoWidth:400,preventContextMenu:!1,parallax:!0,parallaxOptions:{effect:1.5},pauseVideoOnViewLoss:!1};e.prototype={init:function(){var i=this;this.initialised=!0,this.lastPosition=-1,this.ticking=!1,this.options.$window.resize(function(){i.positionObject()}),this.options.parallax&&this.options.$window.on("scroll",function(){i.update()}),this.options.pauseVideoOnViewLoss&&this.playPauseVideo(),this.options.preventContextMenu&&this.options.$video.on("contextmenu",function(){return!1}),this.options.$window.trigger("resize")},requestTick:function(){var i=this;this.ticking||(t.requestAnimationFrame(i.positionObject.bind(i)),this.ticking=!0)},update:function(){this.lastPosition=t.pageYOffset,this.requestTick()},detect3d:function(){var i,e,n=o.createElement("p"),r={WebkitTransform:"-webkit-transform",OTransform:"-o-transform",MSTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};o.body.insertBefore(n,o.body.lastChild);for(i in r)n.style[i]!==s&&(n.style[i]="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)",e=t.getComputedStyle(n).getPropertyValue(r[i]));return n.parentNode.removeChild(n),e!==s?"none"!==e:!1},detectBrowser:function(){var i=navigator.userAgent.toLowerCase();i.indexOf("chrome")>-1||i.indexOf("safari")>-1?(this.options.browser="webkit",this.options.browserPrexix="-webkit-"):i.indexOf("firefox")>-1?(this.options.browser="firefox",this.options.browserPrexix="-moz-"):-1!==i.indexOf("MSIE")||i.indexOf("Trident/")>0?(this.options.browser="ie",this.options.browserPrexix="-ms-"):i.indexOf("Opera")>-1&&(this.options.browser="opera",this.options.browserPrexix="-o-")},scaleObject:function(){var i,t,o;return this.options.$videoWrap.width(this.options.$outerWrap.width()),this.options.$videoWrap.height(this.options.$outerWrap.height()),i=this.options.$window.width()/this.options.originalVideoW,t=this.options.$window.height()/this.options.originalVideoH,o=i>t?i:t,o*this.options.originalVideoW<this.options.minimumVideoWidth&&(o=this.options.minimumVideoWidth/this.options.originalVideoW),this.options.$video.width(o*this.options.originalVideoW),this.options.$video.height(o*this.options.originalVideoH),{xPos:-(parseInt(this.options.$video.width()-this.options.$window.width())/2),yPos:parseInt(this.options.$video.height()-this.options.$window.height())/2}},positionObject:function(){var i=this,o=t.pageYOffset,s=this.scaleObject(this.options.$video,i.options.$videoWrap),e=s.xPos,n=s.yPos;n=this.options.parallax?o>=0?this.calculateYPos(n,o):this.calculateYPos(n,0):-n,i.options.has3d?(this.options.$video.css(i.options.browserPrexix+"transform3d","translate3d(-"+e+"px, "+n+"px, 0)"),this.options.$video.css("transform","translate3d("+e+"px, "+n+"px, 0)")):(this.options.$video.css(i.options.browserPrexix+"transform","translate(-"+e+"px, "+n+"px)"),this.options.$video.css("transform","translate("+e+"px, "+n+"px)")),this.ticking=!1},calculateYPos:function(i,t){var o,s;return o=parseInt(this.options.$videoWrap.offset().top),s=o-t,i=-(s/this.options.parallaxOptions.effect+i)},disableParallax:function(){this.options.$window.unbind(".backgroundVideoParallax")},playPauseVideo:function(){var i=this;this.options.$window.on("scroll.backgroundVideoPlayPause",function(){i.options.$window.scrollTop()<i.options.$videoWrap.height()?i.options.$video.get(0).play():i.options.$video.get(0).pause()})},shimRequestAnimationFrame:function(){for(var i=0,o=["ms","moz","
4webkit","o"],s=0;s<o.length&&!t.requestAnimationFrame;++s)t.requestAnimationFrame=t[o[s]+"RequestAnimationFrame"],t.cancelAnimationFrame=t[o[s]+"CancelAnimationFrame"]||t[o[s]+"CancelRequestAnimationFrame"];t.requestAnimationFrame||(t.requestAnimationFrame=function(o){var s=(new Date).getTime(),e=Math.max(0,16-(s-i)),n=t.setTimeout(function(){o(s+e)},e);return i=s+e,n}),t.cancelAnimationFrame||(t.cancelAnimationFrame=function(i){clearTimeout(i)})}},i.fn[n]=function(t){return this.each(function(){i.data(this,"plugin_"+n)||i.data(this,"plugin_"+n,new e(this,t))})}}(jQuery,window,document);

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.