1 2WS.Namespace.Create("WS.Editor.Slideshow.UI", (function() 3{ 4 var Transitions = { 5 None: function(oldSlide, newSlide) 6 { 7 newSlide.css({ visibility: "", zIndex: "1", opacity: "1" }); 8 this.transitionCompleteDelegate(); 9 }, 10 11 SlideLeft: function(oldSlide, newSlide) 12 { 13 newSlide.css({ left: "100%", visibility: "", zIndex: "1", opacity: "1" }); 14 newSlide.velocity({ left: "0" }, 1000, this.transitionCompleteDelegate); 15 }, 16 17 SlideRight: function(oldSlide, newSlide) 18 { 19 newSlide.css({ left: "-100%", visibility: "", zIndex: "1", opacity:"1" }); 20 newSlide.velocity({ left: "0" }, 1000, this.transitionCompleteDelegate); 21 }, 22 23 SlideTop: function(oldSlide, newSlide) 24 { 25 newSlide.css({ top: "100%", visibility: "", zIndex: "1", opacity: "1" }); 26 newSlide.velocity({ top: "0" }, 1000, this.transitionCompleteDelegate); 27 }, 28 29 SlideBottom: function(oldSlide, newSlide) 30 { 31 newSlide.css({ top: "-100%", visibility: "", zIndex: "1", opacity: "1" }); 32 newSlide.velocity({ top: "0" }, 1000, this.transitionCompleteDelegate); 33 }, 34 35 FadeIn: function(oldSlide, newSlide) 36 { 37 newSlide.css({ opacity: "0", visibility: "", zIndex: "1" }); 38 newSlide.velocity({ opacity: "1" }, 1000, this.transitionCompleteDelegate); 39 }, 40 41 FadeOut: function(oldSlide, newSlide) 42 { 43 newSlide.css({ opacity: "1", visibility: "" }); 44 oldSlide.css({ opacity: "1", zIndex: "1" }); 45 oldSlide.velocity({ opacity: "0" }, 1000, this.transitionCompleteDelegate); 46 } 47 }; 48 49 var ExecuteTransition = function(index) 50 { 51 var EffectDelegate = Transitions[this.settings.Transition.Effect]; 52 if (EffectDelegate) 53 { 54 this.slideObjects[index].Load(); // Load slide if not already loaded 55 this.previousIndex = this.index; 56 this.index = index; 57 if (this.navigation) this.navigation.Update();
58 EffectDelegate.call(this, this.slides.eq(this.previousIndex), this.slides.eq(index)); 59 } 60 }; 61 62 var TransitionComplete = function() 63 { 64 this.slides.eq(this.previousIndex).css({ visibility: "hidden", zIndex: "", opacity: "0" }); 65 this.slides.eq(this.index).css("z-index", ""); 66 this.previousIndex = null; 67 this.slideObjects[(this.index + 1) % this.slides.length].Load(); // Pre-load next slide 68 SetupAutoPlay.call(this); 69 } 70 71 var SetupAutoPlay = function() 72 { 73 if (this.settings.AutoPlay && (this.index + 1 < this.slides.length || this.settings.Repeat)) 74 { 75 this.autoPlayTimer = window.setTimeout(this.autoPlayDelegate, this.settings.Transition.Delay * 1000); 76 } 77 }; 78 79 var Navigation = function(control) 80 { 81 this.control = control; 82 this.Arrows = control.element.find(".wsNavigation.wsArrows > div"); 83 this.Dots = control.element.find(".wsNavigation.wsDots > div"); 84 85 var me = this; 86 this.Arrows.on("click", function() 87 { 88 if (me.control.previousIndex == null) 89 { 90 if (me.control.autoPlayTimer) 91 { 92 window.clearTimeout(me.control.autoPlayTimer); 93 me.control.autoPlayTimer = null; 94 } 95 96 var index = me.control.index + 1; 97 if (me.Arrows.index(this) == 0) index -= 2; 98 if (index < 0) index = me.control.slides.length - 1; 99 ExecuteTransition.call(me.control, index % me.control.slides.length); 100 } 101 }); 102 103 this.Dots.on("click", function() 104 { 105 if (me.control.previousIndex == null && !$(this).hasClass("wsCurrent")) 106 { 107 if (me.control.autoPlayTimer) 108 { 109 window.clearTimeout(me.control.autoPlayTimer); 110 me.control.autoPlayTimer = null; 111 } 112 113 var index = me.Dots.index(this); 114 ExecuteTransition.call(me.control, index); 115 } 116 }); 117 }; 118 119 (function(methods) 120 { 121 methods.Update = function() 122 { 123 this.Arrows.eq(0).css("visibility", this.control.index > 0 || this.control.settings.Repeat ? "" : "hidden"); 124 this.Arrows.eq(1).css("visibility", this.control.index < this.control.slides.length - 1 || this.control.settings.Repeat ? "" : "hidden"); 125 this.Dots.removeClass("wsCurrent").eq(this.control.index).addClass("wsCurrent"); 126 }; 127 })(Navigation.prototype); 128 129 var Content = (function () { 130 131 var _class = function (element, id, type, data) { 132 133 var me = this; 134 this.Element = element; 135 this.Id = id; 136 this.Type = type; 137 this.Data = data; 138 }; 139 140 (function (methods) { 141 methods.GetWidth = function () { 142 return this.Element.width(); 143 }; 144 145 methods.GetHeight = function () { 146 return this.Element.height(); 147 }; 148 })(_class.prototype); 149 150 return _class; 151 })(); 152 153 var Slide = (function() 154 { 155 var _class = function(element, data, flagged) 156 { 157 this.element = element; 158 this.data = data; 159 this.flagged = flagged; 160 this.loaded = false; 161 }; 162 163 (function(methods) 164 { 165 methods.Load = function() 166 { 167 if (!this.loaded) 168 { 169 if (this.data.BackgroundCSS) this.element.attr("style", this.element.attr("style") + ";" + this.data.BackgroundCSS); 170 var contentElements = this.element.children(".Block"); 171 for (var i = 0; i < contentElements.length; i++) 172 { 173 var DataContent = $.grep(this.data.Contents, function (e) { return e.Id == contentElements.eq(i).attr("id").replace("ct_", ""); }); 174 175 if (DataContent != null && DataContent != undefined && DataContent != 'undefined' && DataContent.length) 176 { 177 if (DataContent[0].BlockLevelStyle) contentElements.eq(i).attr("style", contentElements.eq(i).attr("style") + ";" + DataContent[0].BlockLevelStyle); 178 if (window.WS && window.WS.IsMobile) contentElements.eq(i).css("z-index", "auto"); 179 if (DataContent[0].WrapperLevelStyle) contentElements.eq(i).children(".Block_Wrapper").attr("style", DataContent[0].WrapperLevelStyle); 180 181 182 var content = new Content(contentElements.eq(i), DataContent[0].Id, DataContent[0].Type, DataContent[0].Data); 183 if (pageData.flagged !== undefined) new window.ContentLoader(content.Element); 184 else if (content.Data) new ContentHandlers.PreviewContentLoader(content); 185 else new ContentHandlers.ExternalContentLoader(content, content.Element, this.flagged); 186 } 187 } 188 189 this.loaded = true; 190 } 191 }; 192 })(_class.prototype); 193 194 return _class; 195 })(); 196 197 var _class = function(control, element, data, flagged) 198 { 199 this.settings = data.Settings; 200 this.element = element; 201 this.slides = element.children(".wsSlide"); 202 this.index = 0; 203 this.previousIndex = null; 204 this.transitionCompleteDelegate = (function(control) { return function() { TransitionComplete.call(control); }; })(this); 205 this.autoPlayTimer = null; 206 this.autoPlayDelegate = null; 207 this.navigation = null; 208 if (this.slides.length > 1 && data.Settings.Navigation.Type != "None") this.navigation = new Navigation(this); 209 210 this.slideObjects = []; 211 for (var i = 0; i < data.Slides.length; i++) 212 { 213 this.slideObjects.push(new Slide(this.slides.eq(i), data.Slides[i], flagged)); 214 } 215 216 this.slideObjects[0].Load(); 217 218 var fixedContentElements = element.children(".wsFixedSlide").children(".Block"); 219 for (var i = 0; i < data.FixedContents.length; i++) 220 { 221 fixedContentElements.eq(i).children(".Block_Wrapper").attr("style", data.FixedContents[i].WrapperLevelStyle); 222 var content = new Content(fixedContentElements.eq(i), data.FixedContents[i].Id, data.FixedContents[i].Type, data.FixedContents[i].Data); 223 224 if (pageData.flagged !== undefined) new window.ContentLoader(content.Element); 225 else if (content.Data) new ContentHandlers.PreviewContentLoader(content); 226 else new ContentHandlers.ExternalContentLoader(content, content.Element, flagged); 227 } 228 229 this.slides.eq(0).css("visibility", ""); 230 if (this.slides.length > 1) this.slideObjects[1].Load(); // Pre-load next slide 231 if (data.Settings.AutoPlay && this.slides.length > 1) 232 { 233 var me = this; 234 this.autoPlayDelegate = function() 235 { 236 me.autoPlayTimer = null; 237 ExecuteTransition.call(me, (me.index + 1) % me.slides.length); 238 }; 239 240 SetupAutoPlay.call(this); 241 } 242 243 if (control.onLoaded) control.onLoaded(this); 244 }; 245 246 return _class; 247})());
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.