Youtube macro
Posted by: Fred
Date: April 26, 2008 06:35AM

As it seems hundreds of thousands of websites are getting
infested with javascript based exploits from China.
See here :
http://www.heise-online.co.uk/news/Hundreds-of-thousands-of-web-pages-infected-with-malicious-JavaScript--/110610
here :
http://www.f-secure.com/weblog/archives/00001427.html
or here :
http://www.f-secure.com/weblog/archives/00001427.html

As many trusted sites, even United Nations (un.org) and the UK government(.gov.uk) are said to be affected, not even NoScript can provide security, because
the whitelisted sites may also be infected.

I use javascript rarely, but as it is sometimes necessary, for example
to watch youtube videos, I think that a workaround macro to watch
these videos without turning on javascript would be welcome.
The site kissyoutube.com makes that possible. Youtube videos are
played there without javascript, and a relocation is useful.
The videos can then also be downloaded there, if requested.

Close the browser.
In notepad create a .kmm file containing :

watchyoutube{
opennew("http://www.kissyoutube.com/watch?url=";. $LinkURL)
}

and save it as watchyoutube.kmm inside the folder "macros"
within the K-Meleon main folder (not as .txt).

Then open from /default/settings the file menus.cfg and search
for the line LinkPopup{
Beyond that enter the line

macros(watchyoutube, watchyoutube)

and save the file as menu.cfg to its origin (not as .txt).

After a browser restart the link right click menu
should contain an entry "watchyoutube".

An other possibility is to copy the link and paste it
into the address bar. Change then the address from
for example
http://www.youtube.com/watch?v=TSdeDJUxF-0
(copy and watch the link in notepad or in the address bar)
(last part depends on the selected video)
to
http://www.youtube.com/v/TSdeDJUxF-0
(copy and watch the link in notepad or in the address bar)
and hit enter.
The video will play without javascript.

Fred

Re: Youtube macro
Posted by: desga2
Date: April 26, 2008 10:58AM

You can do this last with a macro:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Only Youtube videos without JS ----------------------------
#
# Dependencies        : -
# Resources        : -
# Preferences        : -
#
# ----------------------------------------------------------------------

Only_video{
$_video_addres="";
$_video_addres=gsub("watch?","",$LinkURL);
$_video_addres=gsub("=","/",$_video_addres);
opennew($_video_addres);
}

# ----- PRIVATE

_Only_video_BuildMenu{
# Link Popup context menu
$__m=_("Open Only &Video");
setmenu(LinkOpenExternal,macro,$__m,Only_video);
}

$OnInit=$OnInit."_Only_video_BuildMenu;";

# -----------------------------------------------------------------------
$macroModules=$macroModules."Only_video;";

P.S; Fred, when write code rememember the semicolon (winking smiley at the end of lines and use [ code ] [ /code ] tags. And remember that you can use setmenu() in macros to define menus intead of modify 'menus.cfg' file.

Thanks.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 04/26/2008 10:58AM by desga2.

Re: Youtube macro
Posted by: Fred
Date: April 26, 2008 11:51AM

Thank you for writing the second macro.
It does not depend on external sites and
provides a bigger flash window.
Yes, I forgot one semicolon at the end, but it does not
matter, because it's the only line in this case.
I am trying to get familiar with the setmenu() method,
but as I mostly still use browser variations
with the older architecture, where setmenu was not
yet implemented, I still tend to use the older menu editing.
But I know that it is easier with setmenu, because
there is only one kmm file to write, and it will
build the menu as well. I hope not to forget OnInit,
or else it would not build the menu.
Regards
Fred

Re: Youtube macro
Posted by: desga2
Date: April 27, 2008 06:08PM

Both codes submited to MacroLibrary.

K-Meleon in Spanish

Re: Youtube macro
Posted by: Fred
Date: April 27, 2008 06:13PM

Thank you and regards.

Fred

Re: Youtube macro
Posted by: Panzer
Date: May 05, 2008 06:19PM

It gives me the error:

Bad character in macro name. In file kissyoutube.kmm at line 1

What did I do wrong?

Re: Youtube macro
Posted by: Fred
Date: May 06, 2008 12:57AM

Try this for a macro kissyoutube.kmm :

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- youtube videos without JS ----------------------------
#
# Dependencies        : -
# Resources        : -
# Preferences        : -
#
# ----------------------------------------------------------------------

YouTube_video{

opennew("http://www.kissyoutube.com/watch?url=";. $LinkURL);
}

# ----- PRIVATE

_YouTube_BuildMenu{
# Link Popup context menu
$__t="Kissyoutube";
setmenu(LinkOpenExternal,macro,$__t,YouTube_video);
}

$OnInit=$OnInit."_YouTube_BuildMenu;";

# -----------------------------------------------------------------------
$macroModules=$macroModules."kissyoutube;";

Hope that it works ok.
Fred

Re: Youtube macro
Posted by: desga2
Date: May 06, 2008 01:49AM

I did few changes in kissyoutube.kmm macro to changed "DocumentOpenExternal" to "LinkOpenExternal". But i don't think that this solved your problem.
Macro code works fine to me.
"Bad character in macro name at line 1"
Showed this message what is it the bad character?
In my macro code the macro name in line one is "Kissyoutube" you can change this name but i can't see any bad character in this name (you could changed capital 'K' to normal 'k' in all macro code references to this name).
If you changed this named this could be why not work.
You only can use (recommended) normal characters (0-9 and a-z and _) to named macros not simbols ({}[]!".$%&/\)

K-Meleon in Spanish



Edited 1 time(s). Last edit at 05/06/2008 01:50AM by desga2.

Re: Youtube macro
Posted by: Fred
Date: May 06, 2008 01:57AM

I think that he copied the title
~Kissyoutube.kmm
from the macro page
and made it the first line of the macro,
which caused the error message then.

Fred

Re: Youtube macro
Posted by: desga2
Date: May 06, 2008 11:17AM

@ Fred:
Ok, i think this also and i changed it.
This '~' (tilde character) is to avoid that names or words as "KissYoutube" (with capitals in middle) are confused with wiki pages links.
(In this case the character is showed because name haven't capitals in middle, this is my copy&paste error)

K-Meleon in Spanish



Edited 1 time(s). Last edit at 05/06/2008 11:20AM by desga2.

Re: Youtube macro
Posted by: Panzer
Date: May 08, 2008 05:50PM

It happened once before. But only now did I found what is wrong. When I saved .kmm, I used unicode and not ANSI encoding.

Not it is working. Thank you all.

Re: Youtube macro
Posted by: JujuLand
Date: May 08, 2008 08:02PM

@desga,

It's curious that the ~ character have been taken with a copy-paste, it's as you said to avoid a wikiword, and the only explanation can be that Panzer has copied the wiki source and not the page.

You can also use ! instead of ~

Hum, I understand that ~ is more spanish than ! smiling smiley

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Re: Youtube macro
Posted by: desga2
Date: May 09, 2008 11:07AM

@ JujuLand:

As i wrote, the problem was a copy&paste error (i copied from other code and modified it), there isn't key to type '~' character in spanish keyboard, it's more easy type '!' character because there is a key combination (Shift+1).
In spanish '~' tilde is only used to type 'ñ' and there is a key in spanish keyboards to type it.
In others keyboards you need use '~' + 'n' to generate a 'ñ' character or use extended ASCII character Alt+164 (ñ) or Alt+165 (Ñ), tilde is Alt+126 (~). smiling smiley

K-Meleon in Spanish



Edited 1 time(s). Last edit at 05/09/2008 11:14AM by desga2.

Re: Youtube macro
Posted by: foobarly
Date: May 10, 2008 03:45PM

FYI, portuguese (iberian) keyboards use a slow ~ and certain vowels to create accentuated characters -- slow meaning it doesn't show immediatly, you have to press another key for it to show.

Portuguese special characters
- with tilde: ã Ã õ Õ
- with acute: á Á é É í Í ó Ó ú Ú
- with grave: à À
- with caret: â Â ê Ê ô Ô (AKA circumflex)
- other: ç Ç

:O

Re: Youtube macro
Posted by: JujuLand
Date: May 11, 2008 07:47AM

For me, on french keyboard, ~ and a space = ~


A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 05/11/2008 07:47AM by JujuLand.

Re: Youtube macro
Posted by: Panzer
Date: May 13, 2008 05:39PM

OnlyVideo - it gives me the error:

Bad character in macro name. In file onlyvideo.kmm at line 3

Which character is bad here?

Re: Youtube macro
Posted by: desga2
Date: May 13, 2008 06:05PM

@ Panzer:
There was a error in first line of code (or someone modified this in code). I fix it.

The first line is this:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

All in one line. This line had two enters (3 lines) beetwen 'Macros' and '(http://...)'.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 05/13/2008 06:05PM by desga2.

K-Meleon forum is powered by Phorum.