From 7790d02af7eb1fcfcce8dcd38259cdf92a5f5523 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 10 Aug 2013 10:53:59 +0000 Subject: [PATCH] only load embed player if it was not removed already --- static/js/embedPanel.js | 8 ++++++-- static/js/embedPlayer.js | 14 +++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/static/js/embedPanel.js b/static/js/embedPanel.js index ab68aea0..2731e56b 100644 --- a/static/js/embedPanel.js +++ b/static/js/embedPanel.js @@ -45,8 +45,12 @@ pandora.ui.embedPanel = function() { return that; }; - that.reloadPanel = function() { - that.setElement(pandora.$ui.embedPanel = pandora.ui.embedPanel()); + //only add reloadPanel if not defined by embed element + that.reloadPanel = that.reloadPanel || function(data) { + if (Ox.isUndefined(data) || data.value != data.previousValue) { + pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel()); + return pandora.$ui.ui.embedPanel; + } return that; }; diff --git a/static/js/embedPlayer.js b/static/js/embedPlayer.js index 8d8606c8..3fb4ee24 100644 --- a/static/js/embedPlayer.js +++ b/static/js/embedPlayer.js @@ -22,6 +22,7 @@ pandora.ui.embedPlayer = function() { width: window.innerWidth }, options = getOptions(), + removed = false, video, $innerPanel, $outerPanel, $title, $player, $controls, $timeline, $annotations; @@ -30,7 +31,9 @@ pandora.ui.embedPlayer = function() { 'duration', 'durations', 'layers', 'parts', 'posterFrame', 'rightslevel', 'size', 'title', 'videoRatio' ]}, function(result) { - + if (removed) { + return; + } video = Ox.extend(result.data, pandora.getVideoOptions(result.data)); var isFrame = options['in'] !== void 0 && ( @@ -320,6 +323,15 @@ pandora.ui.embedPlayer = function() { options.showAnnotations && $annotations.options({position: position}); } + that.reloadPanel = function(data) { + if (Ox.isUndefined(data) || data.value != data.previousValue) { + removed = true; + pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel()); + return pandora.$ui.ui.embedPanel; + } + return that; + }; + that.resizePanel = function() { var sizes = getSizes(); $player.options({width: window.innerWidth, height: sizes.videoHeight});