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) {
|
2011-01-01 15:06:46 +00:00
|
|
|
|
2012-02-15 09:35:45 +00:00
|
|
|
var linkData = parsePadmaUrl(link, PADMA_URL);
|
2012-02-15 12:51:47 +00:00
|
|
|
// console.log(linkData.type);
|
2012-02-15 09:35:45 +00:00
|
|
|
// if (linkData && $.inArray(linkData.type, ['info', 'tcRange', 'editor', 'tc', 'layer'])) {
|
|
|
|
if (linkData && $.inArray(linkData.type, ['tcRange', 'info']) != -1) {
|
2011-01-01 15:06:46 +00:00
|
|
|
$(that).addClass('padmaLink');
|
2011-01-02 09:22:15 +00:00
|
|
|
|
2010-11-14 01:57:18 +00:00
|
|
|
var videoId = linkData.videoId;
|
2012-02-15 09:35:45 +00:00
|
|
|
// console.log(linkData);
|
2011-01-01 15:06:46 +00:00
|
|
|
/*
|
2010-11-14 01:57:18 +00:00
|
|
|
var cacheVideo = padmaVideo.getFromCache(videoId);
|
|
|
|
if (cacheVideo) {
|
|
|
|
var videoObj = cacheVideo;
|
|
|
|
} else {
|
|
|
|
var videoObj = new padmaVideo(videoId);
|
|
|
|
}
|
2011-01-01 15:06:46 +00:00
|
|
|
*/
|
|
|
|
var videoObj = new padmaVideo(videoId);
|
2011-01-02 09:22:15 +00:00
|
|
|
$(this).data({
|
|
|
|
'videoObj': videoObj
|
|
|
|
});
|
2010-11-14 01:57:18 +00:00
|
|
|
|
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, {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2011-01-02 09:22:15 +00:00
|
|
|
if ($('#leftBar').length > 0) {
|
|
|
|
var playlist = new PadmaPlaylist($('#leftBar'));
|
|
|
|
}
|
|
|
|
// FOO = new PadmaPlaylist($('#essay'));
|
2010-11-05 22:51:50 +00:00
|
|
|
});
|
|
|
|
// D = parsePadmaUrl;
|
|
|
|
})(jQuery);
|