From 9019a05ab1afe39e693cc6549949ed711084c957 Mon Sep 17 00:00:00 2001 From: sanj Date: Sat, 1 Jan 2011 20:36:46 +0530 Subject: [PATCH] padmatexts: --- padma.layers.js | 12 ++++++++++++ padma.links.js | 9 +++++++-- test.js | 37 +++++++++++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/padma.layers.js b/padma.layers.js index b531678..c2e1d1e 100644 --- a/padma.layers.js +++ b/padma.layers.js @@ -126,6 +126,18 @@ padmaVideo.prototype.getLayersAtTimecode = function(tc) { return layers; } +padmaVideo.prototype.getLayerById = function(id) { + var that = this; + var id = $.trim(id); + for (var i=0; i < that.layers.length; i++) { + var thisLayer = that.layers[i]; + if (thisLayer.id == id) { + return thisLayer; + } + } + return false; +} + function filterLayersByTracks(layers, tracks) { var matchedLayers = [] for (var i=0; i < layers.length; i++) { diff --git a/padma.links.js b/padma.links.js index de725ee..83f0457 100644 --- a/padma.links.js +++ b/padma.links.js @@ -15,17 +15,22 @@ $(this).attr("target", "_blank"); var link = href; if (link.indexOf(PADMA_URL) != -1) { - $(that).addClass('padmaLink'); + var linkData = parsePadmaUrl(link, PADMA_URL); - if (linkData) { + if (linkData && $.inArray(linkData.type, ['info', 'tcRange', 'editor', 'tc', 'layer'])) { //Don't fetch data twice if video id already exists + $(that).addClass('padmaLink'); var videoId = linkData.videoId; +/* var cacheVideo = padmaVideo.getFromCache(videoId); if (cacheVideo) { var videoObj = cacheVideo; } else { var videoObj = new padmaVideo(videoId); } +*/ + var videoObj = new padmaVideo(videoId); + // console.log(linkData); videoObj.getAllData(setupPadmaLink, {'linkData': linkData, 'jq': that}); diff --git a/test.js b/test.js index f313733..33771c3 100644 --- a/test.js +++ b/test.js @@ -74,10 +74,39 @@ var $padmaQuery = jQuery.noConflict(); sidebarAnimateIn(); } padmaContainer.empty(); - var sidebarWrap = $('
').attr("id", "padmaSidebarWrapper").css({'position': 'relative'}).appendTo($container); - var videoElem = $('