rig99
05-15-2009, 07:42 AM
I'm trying to make a bookmarklet for easy use of a website that grabs a video's real location so I can watch it in VLC media player. I am not a javascript programmer but I've looked some stuff up and this should work shouldn't it? So far I have this:
var t, vidurl, mathcode;
start();
function start() {
vidurl=window.location;
window.location="http://clipnabber.com";
setTimeout("end()",100);}
function end() {
alert("in end");
mathcode=document.getElementById("Math").innerHTML;
alert(mathcode);
vidurl=vidurl.replace(/\&/g,"%26");
vidurl=vidurl.replace(/#/g,"%23");
vidurl=vidurl.replace(/=/g,"%3D");
vidurl=vidurl.replace(/\?/g,"%3F");
vidurl=vidurl.replace(/.html/g,"dothtml");
window.location="http://clipnabber.com/gethint.php?mode=1&url="+vidurl+"&sid="+mathcode;}
I added the setTimeout because I don't know how to tell if the page is loaded fully. If there is a better way I'm all ears.
Here is bookmarklet form:
javascript:var t, vidurl, mathcode; start(); function start(){vidurl=window.location; window.location="http://clipnabber.com"; setTimeout("end()",100);} function end(){alert("in end"); mathcode=document.getElementById("Math").innerHTML; alert(mathcode); vidurl=vidurl.replace(/\&/g,"%26"); vidurl=vidurl.replace(/#/g,"%23"); vidurl=vidurl.replace(/=/g,"%3D"); vidurl=vidurl.replace(/\?/g,"%3F"); vidurl=vidurl.replace(/.html/g,"dothtml"); window.location="http://clipnabber.com/gethint.php?mode=1&url="+vidurl+"&sid="+mathcode;}
When I test it the alert box saying "in end" will show but then it stops. I can't get the alert box showing the mathcode to show and it won't go to the new location either. In the firefox error console it says "Error: uncaught exception: unknown (can't convert to string)".
I tried changing alert(mathcode) to alert(String(mathcode)) hoping that would do it but had no success. Please help, I'm not sure what I'm doing wrong here.
var t, vidurl, mathcode;
start();
function start() {
vidurl=window.location;
window.location="http://clipnabber.com";
setTimeout("end()",100);}
function end() {
alert("in end");
mathcode=document.getElementById("Math").innerHTML;
alert(mathcode);
vidurl=vidurl.replace(/\&/g,"%26");
vidurl=vidurl.replace(/#/g,"%23");
vidurl=vidurl.replace(/=/g,"%3D");
vidurl=vidurl.replace(/\?/g,"%3F");
vidurl=vidurl.replace(/.html/g,"dothtml");
window.location="http://clipnabber.com/gethint.php?mode=1&url="+vidurl+"&sid="+mathcode;}
I added the setTimeout because I don't know how to tell if the page is loaded fully. If there is a better way I'm all ears.
Here is bookmarklet form:
javascript:var t, vidurl, mathcode; start(); function start(){vidurl=window.location; window.location="http://clipnabber.com"; setTimeout("end()",100);} function end(){alert("in end"); mathcode=document.getElementById("Math").innerHTML; alert(mathcode); vidurl=vidurl.replace(/\&/g,"%26"); vidurl=vidurl.replace(/#/g,"%23"); vidurl=vidurl.replace(/=/g,"%3D"); vidurl=vidurl.replace(/\?/g,"%3F"); vidurl=vidurl.replace(/.html/g,"dothtml"); window.location="http://clipnabber.com/gethint.php?mode=1&url="+vidurl+"&sid="+mathcode;}
When I test it the alert box saying "in end" will show but then it stops. I can't get the alert box showing the mathcode to show and it won't go to the new location either. In the firefox error console it says "Error: uncaught exception: unknown (can't convert to string)".
I tried changing alert(mathcode) to alert(String(mathcode)) hoping that would do it but had no success. Please help, I'm not sure what I'm doing wrong here.