1(function ($, window, document, undefined) { 2 var pluginName = "amChannel", 3 defaults = {}; 4 5 function Plugin(element, options) { 6 this.element = element; 7 this.$element = $(element); 8 this.settings = $.extend({}, defaults, options); 9 this._defaults = defaults; 10 this._name = pluginName; 11 this.days = {}; 12 this.currentShow = false; 13 this.init(); 14 } 15 16 $.extend(Plugin.prototype, { 17 init: function init() { 18 var self = this; 19 $(this.element).addClass("amp-channel"); 20 this.resetStage(); 21 this.refreshTimer = setInterval(function () { 22 self.updateChannel(); 23 }, 60000); 24 this.updateChannel(); 25 }, 26 resetStage: function resetStage() { 27 if (this.stage) this.stage.remove(); 28 this.stage = $("<div></div>").appendTo(this.element); 29 }, 30 render: function render() { 31 var self = this; 32 var show = this.getCurrentShowId(); 33 34 if (this.currentShow.id !== show.id || this.currentShow.revision !== show.revision) { 35 $.getJSON( 36 self.settings.apiServer + "/v1/broadcasts/show/" + show.id, 37 { 38 location: $("meta[name=location-id]").attr("content") || false 39 }, 40 function (json, textStatus) { 41 self.resetStage(); 42 $(self.stage).amShow({ 43 scenes: json, 44 overlay: self.days.overlay || false 45 }); 46 } 47 ); 48 } 49 50 if (this.currentShow && !show) { 51 self.resetStage(); 52 } 53 54 this.currentShow = show; 55 }, 56 getCurrentShowId: function getCurrentShowId() { 57 var show = false; 58 var self = this; 59 var now = moment(); 60 var today = now.format("dddd"); 61 var date = now.format("MM/DD/YYYY"); 62 var min = (parseInt(now.format("H")) * 60 + parseInt(now.format("m"))) * 60; 63 64 if (this.days && this.days.specials && this.days.specials[date]) { 65 $.each(this.days.specials[date], function (index, val) { 66 if (min >= val.start && min < val.end) { 67 show = val; 68 } 69 }); 70 } 71 72 if (!show && this.days[today]) { 73 $.each(self.days[today], function (index, val) { 74 if (min >= val.start && min < val.end) { 75 show = val; 76 } 77 }); 78 } 79 80 return show; 81 }, 82 updateChannel: function updateChannel() { 83 var self = this; 84 $.getJSON( 85 self.settings.apiServer + "/v1/broadcasts/channel/" + this.settings.channel, 86 function (json, textStatus) { 87 self.days = json; 88 self.render(); 89 } 90 ); 91 } 92 }); 93 94 $.fn[pluginName] = function (options) { 95 return this.each(function () { 96 if (!$.data(this, "plugin_" + pluginName)) { 97 $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 98 } 99 }); 100 }; 101})(jQuery, window, document); 102 103(function ($, window, document, undefined) { 104 var pluginName = "amShow", 105 defaults = { 106 overlay: false, 107 scenes: [] 108 }; 109 110 function Plugin(element, options) { 111 this.element = element; 112 this.$element = $(element); 113 this.settings = $.extend({}, defaults, options); 114 this._defaults = defaults; 115 this._name = pluginName; 116 this._waitForContentCount = 0; 117 this._sceneShouldBeFinished = 0; 118 this._maxOutAnimationDuration = 0; 119 this._playerCreated = 0; 120 this._widgetCache = []; 121 this.init(); 122 } 123 124 $.extend(Plugin.prototype, { 125 init: function init() { 126 var self = this; 127 self.currentScene = 0; 128 this.$element.addClass("amp-show"); 129 this.$element.css({ 130 backgroundColor: "#232323", 131 width: "100%", 132 height: "100%", 133 position: "absolute", 134 top: "0", 135 left: "0" 136 }); 137 this.render(); 138 }, 139 checkHTML: function checkHTML(html) { 140 if (typeof html !== "undefined") { 141 if (html.length > 0) { 142 var d = $("<div />"); 143 d.innerHTML = html; 144 return d.innerHTML.length > 0; 145 } 146 } 147 148 return false; 149 }, 150 getWidgetContent: function getWidgetContent(layer, id, loc, frame) { 151 var self = this; 152 loc = loc || $("meta[name=location-id]").attr("content"); 153 var ret = ""; 154 var d = { 155 contentonly: "yes", 156 id: id, 157 style: "broadcast" 158 }; 159 160 if (loc && loc.length > 0) { 161 d.location = loc; 162 } 163 164 if (frame && frame == 0) { 165 d.bodyonly = true; 166 } 167 168 $.ajax({ 169 url: "/widget", 170 dataType: "html", 171 data: d 172 }) 173 .done(function (html) { 174 if (parseInt(id) > 0) { 175 if (!self._widgetCache[id]) self._widgetCache[id] = ""; 176 177 if (self.checkHTML(html)) { 178 self._widgetCache[id] = $(html); 179 layer.html(self._widgetCache[id].clone()); 180 self.initWidget(layer); 181 } 182 } 183 }) 184 .fail(function () { 185 if (typeof self._widgetCache[id] !== "undefined") { 186 layer.html(self._widgetCache[id].clone()); 187 self.initWidget(layer); 188 } 189 }); 190 }, 191 initVideos: function initVideos(layer) { 192 var self = this; 193 $(".video-content", layer).each(function (index, el) { 194 if ($(this).find("video").length > 0) return; 195 $(this).css({ 196 width: "100%", 197 height: "100%" 198 }); 199 $(this).empty(); 200 var val = $(this).data("details"); 201 202 if (val.src && val.src.length > 0) { 203 var src = val.src; 204 if (val.src.indexOf("https://s3.us-east-2.amazonaws.com/co.uploads/") !== -1) { 205 src = val.src.replace("https://s3.us-east-2.amazonaws.com/co.uploads/", "https://media.libnet.info/"); 206 } 207 var $v = $('<video src="' + src + '"/>'); 208 $v.on("play", function () { 209 self._waitForContentCount++; 210 }); 211 $v.on("pause", function () { 212 self._waitForContentCount--; 213 }); 214 $v.on("ended", function () { 215 self._waitForContentCount--; 216 self.nextScene(); 217 }); 218 $v.css({ 219 width: "100%", 220 height: "100%" 221 }); 222 223 if (val.controls) { 224 $v.attr("controls", "controls"); 225 } 226 227 if (val.loop) { 228 $v.attr("loop", "loop"); 229 } 230 231 $v.attr("preload", val.preload); 232 var video = $v[0]; 233 video.muted = val.muted; 234 video.poster = val.src 235 .replace(".mp4", ".jpg") 236 .replace("co.uploads", "co.uploads.thumbnails") 237 .replace("/video/", "/thumbnails/"); 238 239 if (val.autoplay) { 240 video.muted = true; 241 video.play(); 242 } 243 244 $(this).append($v); 245 } else { 246 $(this).addClass("background").append("<div>Please select a video in the properties</div>"); 247 } 248 }); 249 }, 250 initWidget: function initWidget(layer) { 251 var self = this; 252 var settings = layer.data("settings"); 253 if (!settings) return; 254 $(".ame-events-slideshow", layer).removeClass("ame-events-slideshow").addClass("ame-events-slideshow-embedded"); 255 var $slideShow = $(".ame-events-slideshow-embedded", layer); 256 257 if ($slideShow.length > 0) { 258 self._waitForContentCount++; 259 $slideShow.removeAttr("data-cycle-next").removeAttr("data-cycle-prev").removeAttr("data-cycle-pause-on-hover"); 260 $(".ame-events-slideshow-button", layer).remove(); 261 $(".ame-events-slideshow-image, .ame-events-slideshow-info", $slideShow).height(self.$element.height()); 262 $slideShow 263 .cycle({ 264 loop: 1 265 }) 266 .one("cycle-finished", function (event) { 267 setTimeout(function () { 268 self._waitForContentCount--; 269 self.nextScene(); 270 }, 0); 271 }) 272 .on("cycle-after", function (event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 273 self.updateFonts(); 274 }); 275 } 276 277 var $events = $(".ame-brodcast-events", layer); 278 279 if ($events.length > 0) { 280 if (!$events.data("done")) { 281 $events.data("done", true); 282 self._waitForContentCount++; 283 var pageTotal = $(".ame-brodcast-event-page", $events).length; 284 $("[data-event-page=0]", $events).first().addClass("page-active"); 285 var currentPage = 0; 286 var looper = setInterval(function () { 287 currentPage++; 288 289 if (currentPage >= pageTotal) { 290 clearInterval(looper); 291 self._waitForContentCount--; 292 self.nextScene(); 293 } else { 294 $("[data-event-page]", $events).removeClass("page-active"); 295 $("[data-event-page=" + currentPage + "]", $events) 296 .first() 297 .addClass("page-active"); 298 self.updateFonts(); 299 } 300 }, 10000); 301 } 302 } 303 304 var $nyplcollections = $("ul.nyplcollection", layer); 305 306 if ($nyplcollections.length > 0) { 307 if (!$nyplcollections.data("done")) { 308 var render = function render(item) { 309 $(title).text(item.data.title); 310 $(creator).text(item.data.creator); 311 $(dateCreated).text(item.data.dateCreated); 312 $(division).text(item.data.division); 313 $(imageId).text("Image ID:" + item.data.imageId); 314 $(">div", image).css({ 315 "background-image": 'url("https://images.nypl.org/index.php?id=' + item.data.imageId + '&t=w")' 316 }); 317 $(">div", qrcode).css({ 318 "background-image": 319 'url("https://chart.googleapis.com/chart?cht=qr&chl=' + 320 encodeURIComponent(item.data.url) + 321 '&chs=150x150&chf=bg,s,58595b&chco=58595b&chld=L|0")' 322 }); 323 self.updateFonts(); 324 }; 325 326 var setItem = function setItem(item) { 327 if (!item.data) { 328 $.getJSON("/nyplitem?id=" + item.id).then(function (data) { 329 if (data.numResults.$ === "0") { 330 item.notFound = true; 331 pos++; 332 setItem(items[pos]); 333 return; 334 } 335 336 var capture = Array.isArray(data.capture) ? data.capture.shift() : data.capture; 337 var division = Array.isArray(data.mods.location) 338 ? data.mods.location 339 .filter(function (l) { 340 l.type === "division"; 341 }) 342 .map(function (c) { 343 return c.physicalLocation.$; 344 }) 345 .shift() 346 : data.mods.location.physicalLocation.$; 347 var originInfo = Array.isArray(data.mods.originInfo) ? data.mods.originInfo[0] : data.mods.originInfo; 348 var name = Array.isArray(data.mods.name) ? data.mods.name[0] : data.mods.name; 349 if (name) name = name.namePart.$; 350 var titleInfo = Array.isArray(data.mods.titleInfo) ? data.mods.titleInfo[0] : data.mods.titleInfo; 351 item.data = { 352 title: titleInfo.title.$, 353 dateCreated: originInfo.dateCreated ? originInfo.dateCreated.$ : originInfo.dateIssued.$, 354 creator: name, 355 division: division, 356 imageUUID: capture.uuid.$, 357 imageId: capture.imageID.$, 358 url: "https://digitalcollections.nypl.org/items/" + capture.uuid.$ + "#/?uuid=" + capture.uuid.$ 359 }; 360 render(item); 361 }); 362 } else { 363 render(item); 364 } 365 }; 366 367 $nyplcollections.data("done", true); 368 self._waitForContentCount++; 369 $nyplcollections.parent().hide(); 370 var items = []; 371 $("li", $nyplcollections).each(function (idx, item) { 372 items.push({ 373 id: $(item).data("id") 374 }); 375 }); 376 var pos = 0; 377 var stage = $("<div>") 378 .addClass("nyplcollection-stage") 379 .css({ 380 position: "relative", 381 height: "100%", 382 width: "100%" 383 }) 384 .appendTo(layer); 385 var image = $('<div class="nyplcollection-image"><div></div></div>').appendTo(stage); 386 var info = $('<div class="nyplcollection-info"><div></div></div>').appendTo(stage); 387 var description = $('<div class="nyplcollection-description"><div></div></div>').appendTo(info); 388 var title = $('<div class="nyplcollection-title"></div>').appendTo(description); 389 var creator = $('<div class="nyplcollection-creator"></div>').appendTo(description); 390 var dateCreated = $('<div class="nyplcollection-date-created"></div>').appendTo(description); 391 var division = $('<div class="nyplcollection-division"></div>').appendTo(description); 392 var imageId = $('<div class="nyplcollection-image-id"></div>').appendTo(description);
393 var footer = $('<div class="nyplcollection-footer"></div>').appendTo(stage); 394 var qrcode = $('<div class="nyplcollection-qrcode"><div></div></div>').appendTo(footer); 395 $( 396 '<div class="nyplcollection-message"><div class="nyplcollection-message-title">Explore NYPL\'s Digital Collections</div><div>Get free access to more than 900,000 items digitized from our world-renowned collections, including prints, photographs, maps, manuscripts, video, and more, with new materials added every day.</div></div>' 397 ).appendTo(footer); 398 setItem(items[pos]); 399 var looper = setInterval( 400 function () { 401 pos++; 402 403 if (pos >= items.length) { 404 clearInterval(looper); 405 self._waitForContentCount--; 406 self.nextScene(); 407 } else { 408 setItem(items[pos]); 409 } 410 }, 411 parseInt($nyplcollections.data("delay")) 412 ); 413 } 414 } 415 416 var $scroller = $(".ams-scrolling-box", layer); 417 418 if ($scroller.length > 0) { 419 if (!$scroller.data("done")) { 420 $scroller.data("done", true); 421 $scroller.height($scroller.closest(".layer").height()); 422 $scroller.mCustomScrollbar({ 423 axis: "y", 424 theme: "rounded-dark", 425 callbacks: { 426 onOverflowY: function onOverflowY() { 427 self._waitForContentCount++; 428 var sh = $(">div", this)[0].scrollHeight; 429 var h = $scroller.height(); 430 setTimeout(function () { 431 $scroller.mCustomScrollbar("scrollTo", "bottom", { 432 scrollInertia: Math.floor(sh / h) * 15000, 433 scrollEasing: "linear" 434 }); 435 }, 2000); 436 }, 437 onTotalScroll: function onTotalScroll() { 438 setTimeout(function () { 439 self._waitForContentCount--; 440 self.nextScene(); 441 }, 2000); 442 } 443 } 444 }); 445 } 446 } 447 448 $(".headingtext", layer).css("color", settings.headingColour || '"rgb(255, 255, 255)"'); 449 $(".subheadingtext", layer).css("color", settings.subHeadingColour || '"rgb(255, 255, 255)"'); 450 $(".bodytext", layer).css("color", settings.textColour || '"rgb(255, 255, 255)"'); 451 452 try { 453 $(".twitter", layer).each(function () { 454 var username = $(this).attr("id"); 455 if (username.length === 0) return; 456 $(this).tweet({ 457 modpath: "/tw/index.php", 458 username: username, 459 avatar_size: 48, 460 count: 5, 461 loading_text: "loading twitter feed..." 462 }); 463 }); 464 } catch (e) {} 465 466 try { 467 var self = this; 468 $(".video_player").each(function () { 469 function videoIdFromURL(url) { 470 var regExp = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/; 471 var match = url.match(regExp); 472 473 if (match && match[2].length == 11) { 474 return match[2]; 475 } else { 476 return false; 477 } 478 } 479 480 var config_obj = $(this).data("video"); 481 482 if (typeof config_obj.video_service !== "undefined" && config_obj.video_service == "Vimeo") { 483 var this_widget = $(this)[0].parentNode.parentNode; 484 var vidHeight = $(this_widget).css("height"); 485 var vidWidth = $(this_widget).css("width"); 486 var tag = document.createElement("script"); 487 tag.src = "https://player.vimeo.com/api/player.js"; 488 var firstScriptTag = document.getElementsByTagName("script")[0]; 489 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 490 491 var waitForVimeo = function waitForVimeo(callback) { 492 var checkVimeo = function checkVimeo() { 493 if (typeof window.Vimeo === "undefined") { 494 return false; 495 } else { 496 return true; 497 } 498 }; 499 500 if (checkVimeo()) { 501 callback(); 502 } else { 503 var interval = setInterval(function () { 504 if (checkVimeo()) { 505 clearInterval(interval); 506 callback(); 507 } 508 }, 700); 509 } 510 }; 511 512 waitForVimeo(function () { 513 var result = config_obj.vimeo_url.match( 514 /(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_-]+)?/i 515 ); 516 517 if (!(result && Array.isArray(result) && result[1])) { 518 return; 519 } 520 521 if (self._playerCreated > 0) { 522 return; 523 } else { 524 self._playerCreated++; 525 } 526 527 var video_id = result[1]; 528 var options = { 529 id: video_id, 530 width: vidWidth, 531 height: vidHeight, 532 loop: false 533 }; 534 var player = new Vimeo.Player("player", options); 535 player.on("loaded", function () { 536 if (typeof config_obj.vimeo.start !== "undefined" && config_obj.vimeo.start > 0) { 537 player.setCurrentTime(config_obj.vimeo.start); 538 } else { 539 player.setCurrentTime(0); 540 } 541 542 if (config_obj.vimeo.autostart == "1") { 543 player.play(); 544 } 545 }); 546 player.on("play", function (e) { 547 self._waitForContentCount++; 548 var endPoint = e.duration; 549 550 if (typeof config_obj.vimeo.end !== "undefined" && config_obj.vimeo.end) { 551 endPoint = config_obj.vimeo.end; 552 } 553 554 player 555 .addCuePoint(endPoint, { 556 customKey: "customValue" 557 }) 558 .then(function (id) {}) 559 ["catch"](function (error) {}); 560 }); 561 player.on("cuepoint", function (e) { 562 player 563 .removeCuePoint(e.id) 564 .then(function (id) { 565 player.pause(); 566 self._playerCreated--; 567 self._waitForContentCount--; 568 self.nextScene(); 569 }) 570 ["catch"](function (error) {}); 571 }); 572 573 if (config_obj.vimeo.captions == "1") { 574 player 575 .enableTextTrack("en") 576 .then(function (track) {}) 577 ["catch"](function (error) {}); 578 } else if (config_obj.vimeo.captions == "0") { 579 player 580 .disableTextTrack() 581 .then(function () {}) 582 ["catch"](function (error) {}); 583 } 584 585 if (config_obj.vimeo.mute == "1") { 586 player.setVolume(0); 587 } 588 }); 589 } else if (typeof config_obj.video_service === "undefined" || config_obj.video_service == "YouTube") { 590 if (self._playerCreated > 0) { 591 return; 592 } else { 593 self._playerCreated++; 594 } 595 596 config_obj.yt["playlist"] = videoIdFromURL(config_obj.youtube_url); 597 var tag = document.createElement("script"); 598 tag.src = "https://www.youtube.com/player_api"; 599 var firstScriptTag = document.getElementsByTagName("script")[0]; 600 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 601 var this_widget = $(this)[0].parentNode.parentNode; 602 603 var play_yt = function play_yt() { 604 var vidHeight = $(this_widget).css("height"); 605 var vidWidth = $(this_widget).css("width"); 606 var player = new YT.Player("player", { 607 enablejsapi: "1", 608 playerVars: config_obj.yt, 609 height: vidHeight, 610 width: vidWidth, 611 videoId: videoIdFromURL(config_obj.youtube_url), 612 events: { 613 onApiChange: function onApiChange(event) {}, 614 onReady: function onReady(event) { 615 self._waitForContentCount++; 616 }, 617 onStateChange: function onStateChange(event) { 618 if (event.data == YT.PlayerState.PLAYING) { 619 if (typeof config_obj.caption_size !== "undefined" && config_obj.caption_size !== 0) { 620 if (typeof player.setOption == "function") { 621 player.setOption("captions", "fontSize", config_obj.caption_size); 622 } 623 } 624 } 625 626 if (event.data == YT.PlayerState.ENDED) { 627 if (config_obj.youtube_loop != "1") { 628 self._waitForContentCount--; 629 630 if (typeof player.stopVideo() == "function") { 631 player.stopVideo(); 632 } 633 634 self._playerCreated--; 635 self.nextScene(); 636 } 637 } 638 } 639 } 640 }); 641 }; 642 } 643 644 if (window.initialPlay == false) { 645 play_yt(); 646 } 647 648 window.onYouTubePlayerAPIReady = function () { 649 window.initialPlay = false;
650 play_yt(); 651 }; 652 }); 653 } catch (e) {} 654 655 self.updateFonts(); 656 }, 657 checkVisibleScenes: function checkVisibleScenes() { 658 var self = this; 659 var nextVisibleScene = -1; 660 $(self.settings.scenes).each(function (i) { 661 var startTime = self.settings.scenes[i].startTime; 662 var endTime = self.settings.scenes[i].endTime; 663 startTime = typeof startTime === "undefined" ? false : startTime; 664 endTime = typeof endTime === "undefined" ? false : endTime; 665 666 if (startTime && endTime) { 667 if (moment().isBetween(startTime, endTime)) { 668 if (nextVisibleScene === -1) { 669 nextVisibleScene = i; 670 } 671 } 672 } else if (startTime && !endTime) { 673 if (moment().isSameOrAfter(startTime)) { 674 if (nextVisibleScene === -1) { 675 nextVisibleScene = i; 676 } 677 } 678 } else if (!startTime && endTime) { 679 if (moment().isSameOrBefore(endTime)) { 680 if (nextVisibleScene === -1) { 681 nextVisibleScene = i; 682 } 683 } 684 } else if (!startTime && !endTime) { 685 if (nextVisibleScene === -1) { 686 nextVisibleScene = i; 687 } 688 } 689 }); 690 return nextVisibleScene; 691 }, 692 nextScene: function nextScene() { 693 var self = this; 694 var scene = JSON.parse(JSON.stringify(this.settings.scenes[this.currentScene])); 695 696 if (scene.holdScene) { 697 return; 698 } 699 700 if (self._waitForContentCount > 0) { 701 return; 702 } 703 704 if (this._sceneShouldBeFinished == 0) { 705 return; 706 } 707 708 if ($(".deferredOut").length) { 709 $(".deferredOut") 710 .each(function (index, element) { 711 $(element) 712 .addClass("animated") 713 .addClass($(element).data("outAnimation"), function () { 714 $(this).removeClass("deferredOut"); 715 }); 716 }) 717 .promise() 718 .done(function () { 719 setTimeout(function () { 720 self.nextScene(); 721 }, self._maxOutAnimationDuration * 1000); 722 }); 723 return; 724 } 725 726 self._waitForContentCount = 0; 727 self.currentScene++; 728 if (self.currentScene >= self.settings.scenes.length) self.currentScene = 0; 729 var startTime = self.settings.scenes[self.currentScene].startTime; 730 var endTime = self.settings.scenes[self.currentScene].endTime; 731 startTime = typeof startTime === "undefined" ? false : startTime; 732 endTime = typeof endTime === "undefined" ? false : endTime; 733 734 if (startTime && endTime) { 735 if (moment().isBetween(startTime, endTime)) { 736 self.render(); 737 } else { 738 self.nextScene(); 739 } 740 } else if (startTime && !endTime) { 741 if (moment().isSameOrAfter(startTime)) { 742 self.render(); 743 } else { 744 self.nextScene(); 745 } 746 } else if (!startTime && endTime) { 747 if (moment().isSameOrBefore(endTime)) { 748 self.render(); 749 } else { 750 self.nextScene(); 751 } 752 } else if (!startTime && !endTime) { 753 self.render(); 754 } else { 755 self.nextScene(); 756 } 757 }, 758 updateFonts: function updateFonts() { 759 var self = this; 760 $(">div", self.element).each(function (index, el) { 761 $(el).css("font-size", self._getFontSize() + "px"); 762 }); 763 }, 764 _getFontSize: function _getFontSize() { 765 var self = this; 766 return (self.$element.innerWidth() / 350) * 8; 767 }, 768 addLayers: function addLayers(layers) { 769 var self = this; 770 var length = 0; 771 $.each(layers, function (index, val) { 772 if (!val.duration) val.duration = 5; 773 if (!val.delay) val.delay = 0; 774 if (!val.animationDuration) val.animationDuration = 0.5; 775 var t = val.animationDuration + val.delay + val.duration + 0.5; 776 if (t > length) length = t;
777 var layer = $('<div class="layer"></div>'); 778 779 if (val.type == "background") { 780 layer.prependTo(self.element); 781 } else { 782 layer.appendTo(self.element); 783 } 784 785 layer.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () { 786 layer.css("opacity", val.css.opacity || 1).removeClass(val.inAnimation); 787 }); 788 layer.attr("id", val.id); 789 layer.css(val.css); 790 layer.data("settings", val); 791 layer.css({ 792 opacity: 0, 793 position: "absolute", 794 overflow: "hidden", 795 "animation-duration": val.animationDuration + "s" 796 }); 797 layer.attr("data-type", val.type); 798 799 switch (val.type) { 800 case "text": 801 layer.html(decodeURIComponent(val.text)); 802 layer.css("font-size", self._getFontSize() + "px"); 803 break; 804 805 case "widget": 806 self.getWidgetContent(layer, val.widget, val.location || false, val.frame || 1); 807 break; 808 809 case "video": 810 $('<div class="video-content"/>').data("details", val).appendTo(layer); 811 self.initVideos(layer); 812 break; 813 814 default: 815 break; 816 } 817 818 if (val.url && val.url.length > 0) { 819 layer.css("cursor", "pointer").on("click", function (event) { 820 event.preventDefault(); 821 window.open(val.url, "_blank"); 822 }); 823 } 824 825 if (val.inAnimation && val.inAnimation !== "none") { 826 setTimeout(function () { 827 layer.addClass("animated").addClass(val.inAnimation); 828 }, val.delay * 1000); 829 } else { 830 layer.css("opacity", val.css.opacity || 1); 831 } 832 833 if (val.outAnimation && val.outAnimation !== "none") { 834 setTimeout( 835 function () { 836 if (self._waitForContentCount > 0) { 837 if (val.animationDuration > self._maxOutAnimationDuration) { 838 self._maxOutAnimationDuration = val.animationDuration; 839 } 840 841 layer.addClass("deferredOut").data("outAnimation", val.outAnimation); 842 } else { 843 layer.addClass("animated").addClass(val.outAnimation); 844 } 845 }, 846 (val.duration + val.delay) * 1000 847 ); 848 } 849 }); 850 return length; 851 }, 852 render: function render() { 853 var self = this; 854 var scene = JSON.parse(JSON.stringify(this.settings.scenes[this.currentScene])); 855 var nextScene = self.checkVisibleScenes(); 856 857 if (nextScene != -1) { 858 if (nextScene >= this.currentScene) { 859 this.currentScene = nextScene; 860 scene = JSON.parse(JSON.stringify(this.settings.scenes[this.currentScene])); 861 } 862 } else { 863 scene = JSON.parse( 864 '{"id":"FS5BC","layers":[{"id":"U418s","type":"text","css":{"width":"54.28%","height":"54.07%","top":"17.99%","left":"19.97%","color":"rgb(0,0,0)"},"text":"%3Cp%3E%3Cspan%20style%3D%22color%3A%20%23ffffff%3B%22%3ENo%20scenes%20are%20scheduled%20to%20be%20visible%20in%20this%20broadcast.%3C%2Fspan%3E%3C%2Fp%3E"},{"id":"jT7aG","type":"background","css":{"width":"100%","height":"100%","top":"0%","left":"0%","backgroundColor":"transparent","backgroundRepeat":"no-repeat","backgroundPosition":"0% 0%","backgroundImage":"","backgroundSize":"20%","display":"none"}}],"pos":1}' 865 ); 866 $(".ame-events-slideshow-embedded", this.$element).cycle("destroy"); 867 this.$element.empty(); 868 var length = this.addLayers(scene.layers.reverse()); 869 870 if (this.settings.overlay) { 871 this.addLayers(this.settings.overlay); 872 } 873 874 return; 875 } 876 877 self._sceneShouldBeFinished = 0; 878 $(".ame-events-slideshow-embedded", this.$element).cycle("destroy"); 879 this.$element.empty(); 880 var length = this.addLayers(scene.layers.reverse()); 881 882 if (this.settings.overlay) { 883 this.addLayers(this.settings.overlay); 884 } 885 886 setTimeout(function () { 887 self._sceneShouldBeFinished = 1; 888 889 if (self._waitForContentCount < 1) { 890 self.nextScene(); 891 } 892 }, length * 1000); 893 } 894 }); 895 896 $.fn[pluginName] = function (options) { 897 return this.each(function () { 898 if (!$.data(this, "plugin_" + pluginName)) { 899 $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 900 } 901 }); 902 }; 903})(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.