fixing taha.html to work

This commit is contained in:
sanj 2010-11-06 06:26:06 +05:30
parent cc7c0eaaf3
commit f838af237e
3 changed files with 8 additions and 2 deletions

View File

@ -8,7 +8,7 @@
$(this).attr("target", "_blank"); $(this).attr("target", "_blank");
var link = $(this).attr("href"); var link = $(this).attr("href");
if (link.indexOf(PADMA_URL) != -1) { if (link.indexOf(PADMA_URL) != -1) {
var linkData = parsePadmaUrl(link); var linkData = parsePadmaUrl(link, PADMA_URL);
if (linkData) { if (linkData) {
// console.log(linkData); // console.log(linkData);
var v = new padmaVideo(linkData.videoId); var v = new padmaVideo(linkData.videoId);

View File

@ -15,6 +15,7 @@ $(function() {
*/ */
function setupPadmaLink(video, data) { function setupPadmaLink(video, data) {
console.log(data);
// console.log(data); // console.log(data);
var jq = $(data.jq); var jq = $(data.jq);
var linkData = data.linkData; var linkData = data.linkData;

View File

@ -92,15 +92,20 @@ Gives a bunch of data parsed from a pad.ma url
*/ */
function parsePadmaUrl(link, padma_url) { function parsePadmaUrl(link, padma_url) {
// console.log(padma_url);
var linkStr = link.replace(padma_url, ""); var linkStr = link.replace(padma_url, "");
// console.log(linkStr);
// console.log(linkStr); // console.log(linkStr);
var r = { }; var r = { };
r.url = link; r.url = link;
// console.log(link);
if (linkStr.charAt(0) == 'V') { if (linkStr.charAt(0) == 'V') {
// console.log("Hello");
var idRegex = /V(.{1,7})/; var idRegex = /V(.{1,7})/;
var idMatch = linkStr.match(idRegex); var idMatch = linkStr.match(idRegex);
// console.log("match", idMatch); // console.log("match", idMatch);
r.videoId = idMatch[0]; r.videoId = idMatch[0];
// console.log(videoId);
var postIdStr = linkStr.replace(idMatch[0] + "/", ''); var postIdStr = linkStr.replace(idMatch[0] + "/", '');
if (postIdStr == 'info' || postIdStr == '') { if (postIdStr == 'info' || postIdStr == '') {
r.type = 'info'; r.type = 'info';