2010-11-05 22:51:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
(function($) {
|
2010-11-23 15:21:01 +00:00
|
|
|
var PADMA_URL = padmaConfig.links_url;
|
2010-11-05 22:51:50 +00:00
|
|
|
$(function() {
|
|
|
|
$("a").each(function() {
|
|
|
|
var that = this;
|
2010-11-13 19:26:17 +00:00
|
|
|
if ($(this).attr("href") === undefined) {
|
2010-11-13 19:14:32 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-11-14 01:57:18 +00:00
|
|
|
var href = $(this).attr("href");
|
|
|
|
if (href.indexOf('#') != -1) {
|
|
|
|
return;
|
|
|
|
}
|
2010-11-05 22:51:50 +00:00
|
|
|
$(this).attr("target", "_blank");
|
2010-11-14 01:57:18 +00:00
|
|
|
var link = href;
|
2010-11-05 22:51:50 +00:00
|
|
|
if (link.indexOf(PADMA_URL) != -1) {
|
2010-11-06 00:36:13 +00:00
|
|
|
$(that).addClass('padmaLink');
|
2010-11-05 22:51:50 +00:00
|
|
|
var linkData = parsePadmaUrl(link, PADMA_URL);
|
|
|
|
if (linkData) {
|
2010-11-14 01:57:18 +00:00
|
|
|
//Don't fetch data twice if video id already exists
|
|
|
|
var videoId = linkData.videoId;
|
|
|
|
var cacheVideo = padmaVideo.getFromCache(videoId);
|
|
|
|
if (cacheVideo) {
|
|
|
|
var videoObj = cacheVideo;
|
|
|
|
} else {
|
|
|
|
var videoObj = new padmaVideo(videoId);
|
|
|
|
}
|
|
|
|
|
2010-11-05 22:51:50 +00:00
|
|
|
// console.log(linkData);
|
2010-11-23 10:29:45 +00:00
|
|
|
videoObj.getAllData(setupPadmaLink, {'linkData': linkData, 'jq': that});
|
2010-11-05 22:51:50 +00:00
|
|
|
// v.getVideoData(setupSidenotes, {'linkData': linkData, 'jq': that});
|
|
|
|
// getPadmaData(linkData, that, {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// D = parsePadmaUrl;
|
|
|
|
})(jQuery);
|