General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Youtube macro help
Posted by: mslayer
Date: August 13, 2009 01:24AM

I've been coding this:
createLow{

$_currentURL = $URL;
#alert( $_currentURL  );

$position=index( $_currentURL,"www.youtube.");
if $position!=-1{
			$nope=index( $_currentURL,"fmt=" );
			if $nope==-1{
				#alert( $_currentURL );
				open( $_currentURL."&fmt=0" );
			}
		}
		
#end createLow
	}


$OnLoad=$OnLoad."createLow;";
#_______________________________________
$macroModules=$macroModules."LowYoutube;";
When the youtube page finish loading, re-loads with the fmt added in the url. It's to change the video quality. My code seems to work OK, but I need to modify the way it works, I would like to do not wait until it finishes loading, anybody knows of an event that could help me?

Options: ReplyQuote
Re: Youtube macro help
Posted by: desga2
Date: August 13, 2009 06:24AM

You can define a new context menu option to links.
For example; "Open Youtube video", and open Youtube links with right click context menu.

K-Meleon in Spanish

Options: ReplyQuote
Re: Youtube macro help
Posted by: mslayer
Date: August 13, 2009 10:57PM

Thanks, I did something easier, I modified the Only Video Macro, and that did the trick.
I have another question, is there a way to stop the loading of a web-page?

Options: ReplyQuote
Re: Youtube macro help
Posted by: JamesD
Date: August 14, 2009 12:14AM

To stop page loading in a macro you can use this ID COMMAND.
ID_NAV_STOP
Stop loading.

In the macro it would look like this.

id(ID_NAV_STOP);

Options: ReplyQuote
Re: Youtube macro help
Posted by: mslayer
Date: August 14, 2009 10:52PM

Quote
JamesD
To stop page loading in a macro you can use this ID COMMAND.
ID_NAV_STOP
Stop loading.

In the macro it would look like this.

id(ID_NAV_STOP);
Thanks JamesD. Do you know if there is a way to check the $URL in a loop, I mean without waiting for an specific event?
One more question, anybody have done a macro using injectCSS()?

Options: ReplyQuote
Re: Youtube macro help
Posted by: JamesD
Date: August 14, 2009 11:57PM

Quote
mslayer
Do you know if there is a way to check the $URL in a loop, I mean without waiting for an specific event?
I am not sure what you mean? Is the macro loading the URL into the tab or window, or do you call the macro from a menu? We have the OnLoad event but that is triggered when the loading is complete.

Options: ReplyQuote
Re: Youtube macro help
Posted by: mslayer
Date: August 15, 2009 12:25AM

Quote
JamesD
Quote
mslayer
Do you know if there is a way to check the $URL in a loop, I mean without waiting for an specific event?
I am not sure what you mean? Is the macro loading the URL into the tab or window, or do you call the macro from a menu? We have the OnLoad event but that is triggered when the loading is complete.
Sorry I wasn't clear, the OnLoad event works great (I'm using this method) but I need to wait for the page to load. Since I'm trying to modify the url, it would be cool to do not wait.

Options: ReplyQuote
Re: Youtube macro help
Posted by: JamesD
Date: August 15, 2009 01:55AM

I am not sure if you want the macro to stop the loading or you want to stop the loading yoursefl after you see what kind of page is loading. On my Klassic skin tool bar the third button from the left will stop the loading of the page.

Is the loading of the page started from clicking on a link or some other method?

Options: ReplyQuote
Re: Youtube macro help
Posted by: mslayer
Date: August 15, 2009 02:23AM

Quote
JamesD
I am not sure if you want the macro to stop the loading or you want to stop the loading yoursefl after you see what kind of page is loading. On my Klassic skin tool bar the third button from the left will stop the loading of the page.

Is the loading of the page started from clicking on a link or some other method?
I wanted to Stop the loading if the url wasn't modified, then modify it and finally re-load with the new url. Everything automatic, with no user interaction. But the problem is that $URL contains the url of the tab that you are viewing.
This would work like this:
You open a youtube page, the macro detects that there isn't a fmt= parameter defined in the url. Stop loading the page. Add the fmt= parameter. Re-load the page.
That was my idea, but probably is not doable.

Options: ReplyQuote
Re: Youtube macro help
Posted by: desga2
Date: August 15, 2009 09:17AM

You can use some accelerator to do this;
Type URL in address bar, and press accelerator (for example Ctrl+Enter or Alt+Enter or Ctrl+Alt+Enter or Shift+Enter), this accelerator (defined by default) you can modify to call your macro.
Your macro change URL if this is needed and open the URL.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 08/15/2009 09:18AM by desga2.

Options: ReplyQuote
Re: Youtube macro help
Posted by: JamesD
Date: August 15, 2009 10:29AM

The part about no user interaction won't work. There is nothing to tell the macro that the condition is such that it needs to run. OnLoad only happens when loading is complete. As desga2 says, you can use accelerator keys or you could create a button for the user to press to start the macro process.

Options: ReplyQuote
Re: Youtube macro help
Posted by: mslayer
Date: August 15, 2009 05:58PM

mmm... I see...
OK, I think I will leave the code by now. But anybody knows if I can edit a website with injectCSS()? I could not find any macro examples using this function.

Options: ReplyQuote
Re: Youtube macro help
Posted by: desga2
Date: August 15, 2009 08:16PM

Threads about injectCSS():
http://kmeleonbrowser.org/forum/read.php?1,92090
http://kmeleonbrowser.org/forum/read.php?1,90592
http://kmeleonbrowser.org/forum/read.php?1,92094

Also you can search in MacroLibrary.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 08/15/2009 08:17PM by desga2.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.