nm3clol-archived-russellcou.../mirror/www.russellcountyva.us/1700977764.js

27 lines
13 KiB
JavaScript

(function(b,d){b.ObjectRegistry=b.ObjectRegistry||{};b.ObjectRegistry.Slideshow=b.ObjectRegistry.Slideshow||{};b.ObjectRegistry.Slideshow.Register=function(a,d){b.ObjectRegistry.Slideshow.hasOwnProperty(a)&&g("WARNING \x3e Slideshow object is already registered. Rebinding new slideshow "+a+". Old one will fade into darkness.");return b.ObjectRegistry.Slideshow[a]=d};b.Slideshow=function(){this.slideCount=0;this.transitionType;this.slider=null;this.slideViewTime=this.transitionTime=1E3;this.currentSlideIndex=
0;this.uniqueID=this.autoTransition=null;this.liveEditEnabled=!1;return this};b.Slideshow.prototype.DIAGNOSTIC_MODE=!1;var g=function(a){b.Slideshow.prototype.DIAGNOSTIC_MODE&&console.log("Slideshow diagnostic[SlideshowGenerator.js] "+a)};b.Slideshow.prototype.initSlides=function(a){d("img[data-delay-load]",a).each(function(){var a=d(this),b=attrOrProps(a,"data-delay-load");attrOrProps(a,"src",b)})};b.Slideshow.prototype.initSlidePlusAndMinusOneIndex=function(a,b,f){if(0<d("img[data-delay-load]",
b).length){b=d("img[data-delayed-image]",b);var c=b.length,g=function(a,b){var c=d(a),h=attrOrProps(c,"dataset"),h=void 0==h?c.attr("data-delay-load"):h.delayLoad,f=attrOrProps(c,"src");"undefined"!==typeof b&&0!==b?c.css("height",b+"px"):c.css("height","auto");h!==f&&(void 0!==h&&""!==h&&null!==h)&&(attrOrProps(c,"src",h),c.removeAttr("data-delay-load"))};g(b[a],f);a+1>=c?g(b[0],f):g(b[a+1],f);0>a-1?g(b[c-1],f):g(b[a-1],f)}else a=d("img",b),0!==f?a.css("height",f+"px"):a.css("height","auto")};b.Slideshow.prototype.generate=
function(a,h,f,c,m,k){g("Generating Slideshow for "+a);b.ObjectRegistry.Slideshow.Register(a,this);var e=this.mapUi(a);this.slider=this.createSlider(e);this.slider.$slider.removeClass("slide");this.initSlidePlusAndMinusOneIndex(0,e.$slider,k);null===h?(this.transitionTime=1E3*e.values.transitionTiming,this.slideViewTime=1E3*e.values.slideTiming):(this.transitionTime=1E3*h,this.slideViewTime=1E3*f);this.transitionType=e.transitionType;this.slideCount=e.$slides.length;this.currentSlideIndex=this.transitionType===
this.TransitionType.Slide?1:0;this.uniqueID=a;this.liveEditEnabled=c;a=100/this.slideCount;1<this.slideCount&&e.$slides.first().addClass("showing");if(this.transitionType===this.TransitionType.Slide)this.slider.createOverlapImagesForFirstAndLastSlides(),this.slideCount=e.$slides.length,a=100/this.slideCount,e.$slides.removeClass("hidden"),e.$slider.css("left","-100%");else if(this.transitionType===this.TransitionType.Fade)for(e.$slides.slice(1).animate({opacity:0},0),e.$slides.removeClass("hidden"),
h=0;h<this.slideCount;h++){f=a*h;if(/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/.test(navigator.userAgent)||-1<navigator.userAgent.indexOf("Edge"))f=(Math.floor(100*a)/100).toFixed(2)*h;d(e.$slides[h]).css("left","-"+f+"%")}e.$slider.css("width",this.slideCount+"00%");e.$slides.css("width",a+"%");e.$pages.first().addClass("active");e.$slides.addClass("slideshowOptions nonEmpty");this.autoTransition=function(){var a=this;this.isDisposed()||e.$slider.animate({delay:1},this.slideViewTime,function(){g("Begin Slide Transition Cycle ( Slide View Time: "+
a.slideViewTime+" ms, Transition Time: "+a.transitionTime+" ms )");a.next(a.autoTransition)})};m||this.autoTransition();this.bindUx()};b.Slideshow.prototype.isDisposed=function(){return this!==b.ObjectRegistry.Slideshow[this.uniqueID]};b.Slideshow.prototype.pause=function(){this.slider.$slider.stop(!0);this.slider.$slides.stop(!0);this.autoTransition=null};b.Slideshow.prototype.paused=!1;b.Slideshow.prototype.pausedSlideIndex=0;b.Slideshow.prototype.onPause=function(){this.paused||(this.paused=!0,
this.pausedSlideIndex=this.currentSlideIndex,this.slider.$slider.stop(!0),this.slider.$slides.stop(!0),this.autoTransition=null)};b.Slideshow.prototype.onResume=function(){if(this.paused){this.paused=!1;var a=this;this.autoTransition=function(){a.isDisposed()||a.slider.$slider.animate({delay:1},a.slideViewTime,function(){g("Begin Slide Transition Cycle ( Slide View Time: "+a.slideViewTime+" ms, Transition Time: "+a.transitionTime+" ms )");a.next(a.autoTransition)})};this.transitionToSlide(this.pausedSlideIndex,
null,function(){a.autoTransition()})}};b.Slideshow.prototype.transitionToSlide=function(a,b,f){g("Transition to "+a);var c=this,m=function(){if(!c.isDisposed()){g("Fade Animation Complete for slide "+c.currentSlideIndex+" to "+a+" - Update Indexes and Classes. Invoke Next Transition");c.slider.$slider.find(".showing").removeClass("showing");c.slider.$pager.find(".active").removeClass("active");d(c.slider.$pages[a]).addClass("active");d(c.slider.$slides[a]).addClass("showing");c.currentSlideIndex=
a;for(var b=0,b=0;b<c.slider.$slides.length;b++)b!=a&&d(c.slider.$slides[b]).stop(!0).animate({opacity:0},0);"function"===typeof f&&f.call(c)}},k=function(){if(!c.isDisposed()){var b=d(c.slider.$slides[a]);g("Dot Update Invoked for "+a+" corresponding to id "+attrOrProps(b,"id")+".");d("#dot"+attrOrProps(b,"id")).parent("ol").children("li").removeClass("active");d("#dot"+attrOrProps(b,"id")).addClass("active")}};if(this.transitionType===this.TransitionType.Slide){a>this.slideCount-2?a=1:1>a&&(a=this.slideCount-
2);g("(Slide) Current Slide: "+this.currentSlideIndex+"; Target Slide: "+a);b=this.GetSlideDirectionTransitionType(a,b);k();var e=0,l=0;switch(b){case this.SlideTransitionDirectionType.FirstToLast:e=0;g("First Slide to Last Slide Transition");this.slider.$slider.animate({left:"0%"},this.transitionTime,function(){var a=c.slider.$slides.length-2;/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/.test(navigator.userAgent)&&(e=100/c.slider.$slides.length%c.slider.$slides[a].style.width.replace("%","")*
a*a);l=100*a-e;c.slider.$slider.css("left","-"+l+"%");c.slider.$slider.find(".showing").removeClass("showing");c.slider.$pager.find(".active").removeClass("active");d(c.slider.$pages[a]).addClass("active");d(c.slider.$slides[a]).addClass("showing");c.currentSlideIndex=a;"function"===typeof f&&f.call(c)});break;case this.SlideTransitionDirectionType.LastToFirst:e=0;/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/.test(navigator.userAgent)&&(e=100/c.slider.$slides.length%c.slider.$slides[c.currentSlideIndex].style.width.replace("%",
"")*a*a);l=100*(c.currentSlideIndex+1)-e;this.slider.$slider.animate({left:"-"+l+"%"},this.transitionTime,function(){g("Last Slide to First Slide Transition");c.slider.$slider.css("left","-100%");c.slider.$slider.find(".showing").removeClass("showing");c.slider.$pager.find(".active").removeClass("active");d(c.slider.$pages[1]).addClass("active");d(c.slider.$slides[1]).addClass("showing");c.currentSlideIndex=1;"function"===typeof f&&f.call(c)});break;default:e=0,/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/.test(navigator.userAgent)&&
(e=100/c.slider.$slides.length%c.slider.$slides[c.currentSlideIndex].style.width.replace("%","")*a*a),l=100*a-e,this.slider.$slider.animate({left:"-"+l+"%"},this.transitionTime,function(){g("Inner Slide Transition");c.slider.$slider.find(".showing").removeClass("showing");c.slider.$pager.find(".active").removeClass("active");d(c.slider.$pages[c.currentSlideIndex]).addClass("active");d(c.slider.$slides[c.currentSlideIndex]).addClass("showing");c.currentSlideIndex=a;"function"===typeof f&&f.call(c)})}}else this.transitionType===
this.TransitionType.Fade&&(g("(Fade) Current Slide: "+this.currentSlideIndex+"; Target Slide: "+a),a>this.slideCount-1?a=0:0>a&&(a=this.slideCount-1),d(this.slider.$slides).css("zindex",1),d(this.slider.$slides).animate({opacity:0},this.transitionTime,k),d(this.slider.$slides[a]).stop(!0).css("zindex",2).animate({opacity:1},this.transitionTime,m));c.initSlidePlusAndMinusOneIndex(a,c.slider.$slider)};b.Slideshow.prototype.next=function(a){this.transitionToSlide(this.currentSlideIndex+1,this.DirectionType.Forward,
a)};b.Slideshow.prototype.previous=function(a){this.transitionToSlide(this.currentSlideIndex-1,this.DirectionType.Backward,a)};b.Slideshow.prototype.dotClick=function(a){a=this.mapDotClickUi(a);this.transitionToSlide(a.selectedSlideIndex,this.DirectionType.Omni)};b.Slideshow.prototype.TransitionType={Fade:0,Slide:1};b.Slideshow.prototype.DirectionType={Forward:0,Backward:1,Omni:2};b.Slideshow.prototype.SlideTransitionDirectionType={Inside:0,FirstToLast:1,LastToFirst:2};b.Slideshow.prototype.GetSlideDirectionTransitionType=
function(a,b){return 1>=this.currentSlideIndex&&a===this.slideCount-2&&b===this.DirectionType.Backward?this.SlideTransitionDirectionType.FirstToLast:1===a&&this.currentSlideIndex>=this.slideCount-2&&b===this.DirectionType.Forward?this.SlideTransitionDirectionType.LastToFirst:this.SlideTransitionDirectionType.Inside};b.Slideshow.prototype.mapUi=function(a){var b={$slideshow:d(".cpSliderJS"+a).closest(".widget.slideShow"),$slider:d(".cpSliderJS"+a),$slides:d(".cpSliderJS"+a).find("li"),$pager:d(".pagerJS"+
a),$pages:d(".pagerJS"+a).find("li"),transitionType:d(".cpSliderJS"+a).hasClass("slide")?this.TransitionType.Slide:this.TransitionType.Fade,NotifySlidesAdded:function(){b.$slides=d(".cpSliderJS"+a).find("li")},values:{}};b.values.transitionTiming=b.$slideshow.children("input.transitionTiming").val();b.values.slideTiming=b.$slideshow.children("input.slideTiming").val();return b};b.Slideshow.prototype.createSlider=function(a){var b={$slider:a.$slider,$slides:a.$slides,$pager:a.$pager,$pages:a.$pages,
setSlide:function(b){a.$slider.hasClass("slide")&&a.$slider.css("left","-"+b.toString()+"00%")},getCurrentlyShownSlide:function(){return a.$slider.find(".showing")},createOverlapImagesForFirstAndLastSlides:function(){var d=a.$slider.find("li");d.first().clone().insertAfter(a.$slider.find("li").last());d.last().clone().insertBefore(a.$slider.find("li").first());a.NotifySlidesAdded();b.$slides=a.$slides}};return b};b.Slideshow.prototype.mapDotClickUi=function(a){return{$dots:a.parents(".pager").children("li"),
$selectedDot:a.parent("li"),$selectedImage:d("#"+attrOrProps(a,"data-targetImageli")),$images:d("#"+attrOrProps(a,"data-targetImageli")).parent("ol").children("li"),selectedSlideIndex:this.transitionType===this.TransitionType.Slide?parseInt(a.html()):parseInt(a.html()-1)}};b.Slideshow.prototype.bindUx=function(){var a=this;d(".prevJS"+this.uniqueID).unbind("click").click(function(){a.pause();a.previous()});d(".dotJS"+this.uniqueID).unbind("click").click(function(){a.pause();a.dotClick(d(this))});
d(".nextJS"+this.uniqueID).unbind("click").click(function(){a.pause();a.next()});d(".ssPause-btn").unbind("click").click(function(){a.onPause();d(".ssPlay-btn").removeClass("isHidden");d(".ssPause-btn").addClass("isHidden")});d(".ssPlay-btn").unbind("click").click(function(){a.onResume();d(".ssPause-btn").removeClass("isHidden");d(".ssPlay-btn").addClass("isHidden")});a.liveEditEnabled&&(a.slider.$slides.add("p.slideshowOptions.empty.placeholder").unbind("click").click(function(a){a=d(this).closest(".widget.slideShow");
var b=ContentCollectionInstance.PageID,c=ContentCollectionInstance.ModuleID,g=a.data("widgetid"),k=a.find(".hdnSlideshowUniqueID").val();callbackfnSlideshowSave=null;parentID_Slideshow=attrOrProps(a,"id");ContentCollectionInstance.SlideshowWidgetID=g;$popUp_Slideshow=openCpModal({title:"Slideshow",className:"newCP adminWrap cpPopOver admin modalSlideshow",isFrontEnd:!1,useIframe:!1,draggable:!0,url:"/Slideshow/SlideshowConfiguration/"+k+("?pageID\x3d"+b+"\x26moduleID\x3d"+c)})}),d(".widget.slideShow").siblings("a.handle.options").each(function(){var a=
d(this);a.data("cpPopover")&&a.data("cpPopover").destroy();var b=attrOrProps(a.parents('[data-cprole$\x3d"ontentContainer"]'),"id"),c=a.parents(".pageContent").filter(":first").data("containerid"),b="/ContentWidgets/SlideshowOptions?widgetID\x3d"+a.data("widgetid")+"\x26pageID\x3d"+ContentCollectionInstance.PageID+"\x26contentContainerExternalID\x3d"+b+"\x26moduleID\x3d"+ContentCollectionInstance.ModuleID+"\x26contentContainerID\x3d"+c;a.cpPopover({url:b,className:"options adminWrap",onClose:function(a,
b){a.preventDefault();window.CommonPopoverInstance.hide(b);d(document.activeElement).change()}})}))}})(this,"undefined"==typeof $?window.parent.$:$);function SlideshowColorPicker(b,d,g){this.$spectrumInput=$(b);this.$colorInput=$(d);this.defaultColor=g;this.startingColor=this.$colorInput&&this.$colorInput.val()?this.$colorInput.val():this.defaultColor}
SlideshowColorPicker.prototype.init=function(){var b=this;b.$spectrumInput.spectrum("destroy").spectrum({color:b.startingColor,showInput:!0,showPalette:!0,showPaletteOnly:!1,showSelectionPalette:!0,preferredFormat:"hex",change:function(d){d=d.toHexString();b.setValueSpectrum(d)}});b.setValueSpectrum(b.startingColor);b.$spectrumInput.parent().delegate(".clearValue","click",function(d){d&&(d.stopPropagation?d.stopPropagation():d.cancelBubble=!0);b.clearValueSpectrum()})};
SlideshowColorPicker.prototype.setValueSpectrum=function(b){this.$colorInput.val(b);this.$spectrumInput.spectrum("set",b);this.$spectrumInput.siblings("a.clearValue").remove();b&&b!==this.defaultColor&&this.$spectrumInput.next().after('\x3ca class\x3d"clearValue" title\x3d"Clear Color" href\x3d"#" onclick\x3d"return false;" style\x3d""\x3eClear\x3c/a\x3e')};
SlideshowColorPicker.prototype.clearValueSpectrum=function(){this.$spectrumInput.siblings("a.clearValue").fadeOut(300);this.$colorInput.val("");this.setValueSpectrum(this.defaultColor)};