Plugin Directory

source: jetpack/trunk/_inc/build/shortcodes/js/slideshow-shortcode.min.js @ 2836264

Last change on this file since 2836264 was 2836264, checked in by wpkaren, 19 months ago

Updating trunk to version 11.7-a.7

File size: 3.7 KB
Line 
1(()=>{function e(e,t,i){this.element=e,this.images=[],this.controls={},this.transition=t||"fade",this.autostart=i}e.prototype.showLoadingImage=function(e){if(e){this.loadingImage_=document.createElement("div"),this.loadingImage_.className="jetpack-slideshow-loading";var t=document.createElement("img");t.src=jetpackSlideshowSettings.spinner,this.loadingImage_.appendChild(t),this.loadingImage_.appendChild(this.makeZeroWidthSpan()),this.element.append(this.loadingImage_)}else this.loadingImage_&&(this.loadingImage_.parentNode.removeChild(this.loadingImage_),this.loadingImage_=null)},e.prototype.init=function(){this.showLoadingImage(!0);for(var e=this,t=0;t<this.images.length;t++){var i=this.images[t],s=document.createElement("img");s.src=i.src,s.title=void 0!==i.title?i.title:"",s.alt=void 0!==i.alt?i.alt:"",s.align="middle",s.setAttribute("itemprop","image"),s.nopin="nopin";var n=document.createElement("div");n.className="jetpack-slideshow-slide-caption",n.setAttribute("itemprop","caption description"),n.innerHTML=i.caption;var a=document.createElement("div");a.className="jetpack-slideshow-slide",a.setAttribute("itemprop","associatedMedia"),a.setAttribute("itemscope",""),a.setAttribute("itemtype","https://schema.org/ImageObject"),0===t&&(s.complete?setTimeout((function(){e.finishInit_()}),1):jQuery(s).load((function(){e.finishInit_()}))),a.appendChild(s),s.removeAttribute("width"),s.removeAttribute("height"),a.appendChild(this.makeZeroWidthSpan()),a.appendChild(n),this.element.append(a)}},e.prototype.makeZeroWidthSpan=function(){var e=document.createElement("span");return e.className="jetpack-slideshow-line-height-hack",-1!==window.navigator.userAgent.indexOf("MSIE ")?e.appendChild(document.createTextNode(" ")):e.innerHTML="&nbsp;",e},e.prototype.finishInit_=function(){this.showLoadingImage(!1),this.renderControls_();var e=this;if(this.images.length>1){this.element.cycle({fx:this.transition,prev:this.controls.prev,next:this.controls.next,timeout:jetpackSlideshowSettings.speed,slideExpr:".jetpack-slideshow-slide",onPrevNextEvent:function(){return e.onCyclePrevNextClick_.apply(e,arguments)}});var t=this.element;this.autostart||(t.cycle("pause"),jQuery(this.controls.stop).removeClass("running"),jQuery(this.controls.stop).addClass("paused")),jQuery(this.controls.stop).click((function(){var e=jQuery(this);return e.hasClass("paused")?(e.addClass("running"),e.removeClass("paused"),t.cycle("resume",!0)):(t.cycle("pause"),e.removeClass("running"),e.addClass("paused")),!1}))}else this.element.children(":first").show(),this.element.css("position","relative");this.initialized_=!0},e.prototype.renderControls_=function(){if(!this.controlsDiv_){var e=document.createElement("div");e.className="jetpack-slideshow-controls";for(var t=["prev","stop","next"],i=0;i<t.length;i++){var s=t[i],n="label_"+s,a=document.createElement("a");a.href="#",a.className="button-"+s,a.setAttribute("aria-label",jetpackSlideshowSettings[n]),a.setAttribute("role","button"),e.appendChild(a),this.controls[s]=a}this.element.append(e),this.controlsDiv_=e}},e.prototype.onCyclePrevNextClick_=function(e,t){if(jetpackSlideshowSettings.blog_id){var i=this.images[t].id;(new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?host="+escape(document.location.host)+"&rand="+Math.random()+"&blog="+jetpackSlideshowSettings.blog_id+"&subd="+jetpackSlideshowSettings.blog_subdomain+"&user_id="+jetpackSlideshowSettings.user_id+"&post="+i+"&ref="+escape(document.location)}},function(t){function i(){t(".jetpack-slideshow-noscript").remove(),t(".jetpack-slideshow").each((function(){var i=t(this);if(!i.data("processed")){var s=new e(i,i.data("trans"),i.data("autostart"));s.images=i.data("gallery"),s.init(),i.data("processed",!0)}}))}t(document).ready(i),t("body").on("post-load",i)}(jQuery)})();
Note: See TracBrowser for help on using the repository browser.