Extensions :  K-Meleon Forum
All about K-Meleon extensions. 
javascriptia UPDATE V4_3.3.2014 (long bookmarklets / javascript / userscripts)
Posted by: siria
Date: August 06, 2010 10:17PM

Sometimes bookmarklets are too long for K-Meleon, which currently only can handle a few lines.
This macro allows to use longer ones, up to max 32kB (hundreds of lines), provided you have them previously saved into a file on disk ;-)

Name and ending don't matter, can be everything.
You can also use this macro to run normal javascript files (like userscripts) that contain line breaks.
You can add notes on top of such a file (e.g. origin and description of a script), if the code in it starts with "javascript:"
If javascript and popups are blocked in the browser, those scripts will ignore the blocks and work anyway.
The last called script file will be remembered in this session, there's an own command for repeating it.

To add more script files, just save them to disk, then click "Bookmark from file" to pick and run one.



.


.

Context menus
= if you right-click on a page, on a selection, or (new in version 02) on an image or a link:
. . .

So far I think it's rather easy, but now it gets a little bit more complicated, sorry. It does work out-of-the box and most people will probably never customize anything, but *IF* you want to customize the menu, especially to configure the presets in the flip out menu, edit the macro file (javascriptia.kmm)
In the macro file there's also more info and advanced CONFIGURATION, like auto-loading a script for certain URL's.

UPDATE 2011-05-21:
DOWNLOAD v2 as .kmm:
(old version deleted, see Version3 further down!)


Tested in KM 1.5.4 and 1.6beta, probably works in other versions too.

This is a pure KM-macro in one kmm-file, it doesn't change or store anything, no prefs etc., no webservices used of any kind. Just save it into your macros folder and it works after a browser restart. Or remove it from the macros folder and it's completely 'uninstalled' ;-)

Just one thing, if you edit it to customize the menu, you may prefer to put it into the USER macro folder in your profile, considering that old prob with writing rights in XP+.

__________________________
Version update:
V2, May-2011: Extended menu, there's now also a line "Inject a Script..." in the context-menu of links and images (if you right-click on them). And added "how to" example for keyboard shortcuts, if you're ready to invent your own key combinations.

Note: The new download file is named "javascriptia_v2.kmm", to avoid accidentally overwriting a possibly customized (modified) old version with it. After updating, it may first look as if your customizations were vanished, or perhaps you get double menus. Then click Edit>Configuration>Macros (or User-Defined Macros) and find your old file in the KM macros folder. You can copy over the parts that you had modified into the new version. V2.kmm only has the beginning and the end changed (the menus), but the middle part with the user stuff can be copied over.

__________________________
Version update:
V3, Feb-2014: See own post, a couple posts further down



Edited 16 time(s). Last edit at 03/04/2014 03:33AM by siria.

Attachments: javascriptia01_menu1.png (24.1 KB)   javascriptia02_menu_img.png (9.3 KB)  
Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: May 21, 2011 05:51AM

Update to version v2 smiling smiley
Nothing major, just menu lines added to the context menus of images and links. And added examples for setting keyboard shortcuts in the macro.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: May 22, 2011 02:13AM

Oops... And sorry! Had a little typo in the new version yesterday, which made that the "Help + Configuration" didn't open the macro file, argh *blush*
There was 1 download yesterday, if you read this, please download again from the new link in the first post.



Edited 1 time(s). Last edit at 05/22/2011 02:18AM by siria.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: January 07, 2014 12:56AM

New version for testing in K-Meleon 1.7alpha:

(OLD) http://www.file-upload.net/download-8489037/javascriptia_v2.1.kmm.html

No new functions in it, just a workaround for newer KM-versions.
Old ones should still work too with it, but no need to update.
Also works in win98se, provided you got KM1.7 running on it smiling smiley

Stupid workaround for KM1.7+: If javascript is disabled in the privacy menu there appears now a little popup-notice "OK", otherwise auto-toggling of JS on-off wouldn't work any more.

Just drop the kmm-file into your macros folder and restart K-Meleon.

Attention, if someone CUSTOMIZED the old version kmm, do not delete it, or your modifications are lost. For a start you can just try with both versions active, old and new. If that doesn't work correctly, open both files in an editor, search for "injectjs", and overwrite that 1 line in the old version with the corresponding part in the new version, between "#####", it's about 14 lines. 2-3 lines lower copy over the 1 line with &_pref_SyncButtons. Now you can disable or remove the new version and use only your old one again.



Edited 1 time(s). Last edit at 03/01/2014 04:27AM by siria.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: March 01, 2014 04:06AM

NEW Extended Version V4:

DOWNLOAD:
http://kmeleon.sourceforge.net/forum/file.php?9,file=765,filename=javascriptia_v4.kmm
(v4 is just a little bugfix for v3)

Added another submenu to inject a temporary (session) script from copied text in a Link-URL or selected text or from the clipboard:



KM1.6 or older: Can now finally inject scripts in Cross-site-frames, if the mouse hovers over it or if text is selected in it. Of course not the whole page, but before those frames didn't work at all.
An example for testing, on this site at the bottom is an embedded frame from amazon.
www.schlagerportal.com/singlevorstellung/nicole-ein-neuer-tag-260214

KM1.7 Bugfix/workaround (works partly, not yet in cross-site-frames, and if Javascript is blocked there's a little popup message needed as pause.)

KM 1.8 / 74: Would anyone like to test if it runs there too? Do the current betas also have the injectJS bug as 1.7? At the moment the macro is set to use the 1.7-workaround for newer versions also, but that can be changed by editing the "version number" limit in it.

The macro should now also work if JS policy manager default setting is "noAccess" (temporary auto-toggle), although other settings may still block it.

Have now shortened the flipout menu in the bookmarks/favorites/hotlist to 1 line. But that's only the default setting, if anyone prefers the previous 3-line version it can be changed again by editing the macro, set or remove the # signs at the setmenu lines.

If anyone has an older version running already, please rename it to _kmm or whatever to disable it. If your old version has customizations in it, just copy over that block into the new kmm.

PS: GREAT that attachments work now and can be edited and deleted again!!



Edited 6 time(s). Last edit at 03/04/2014 05:57AM by siria.

Attachments: javascriptia03_menu1.png (43 KB)   javascriptia_v4.kmm (18 KB)  
Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: Zero3K
Date: March 03, 2014 02:49AM

What kind of userscripts are useable with it?

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: March 03, 2014 04:35AM

Uhm - javascripts, obviously...
Not sure what you mean?

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: March 03, 2014 06:03AM

Just went looking for some example as test, and found this nice one:
It's one of the many youtube downloaders. But unlike most others, this one is below the 32kB limit yet, just so barely! (at the moment yet, version 1.7.18)

http://userscripts.org/scripts/show/25105

The script is linked with the green install button in the right upper corner. Save the link to disk and then open it with this macro.



Edited 2 time(s). Last edit at 03/03/2014 06:27AM by siria.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: Zero3K
Date: March 03, 2014 06:10AM

Please add a dialog box that will popup to allow easy adding of a url to a list containing sites that will automatically use a certain userscript with no more user input needed. Thanks in advance.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: Zero3K
Date: March 03, 2014 11:56PM

Btw, how do I set it to automatically inject "C:\Program Files\K-Meleon\userjs\chat_filter.user.js" into http://www.twitch.tv/twitchplayspokemon via its AUTO-LOAD by URL function?



Edited 1 time(s). Last edit at 03/03/2014 11:56PM by Zero3K.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: March 04, 2014 02:35AM

NEW UPDATE to version 4 (nothing new, just a little bugfix for v3)

@Zero3K:
For automatic stuff I think there are far more comfortable and famous extensions out there , although I never looked for them, so don't know which name. Lots of extensions can be found on kmext.sf.net

This macro here was in the beginning just meant as a little basic one, although it started growing bit by bit. The prob is I'm no programmer and can do only macrolanguage, that restricts inputs to simple 1-liners and menus, or to editing the macro file directly.
But I'm afraid the crude v3-method for automatic loading is really WAY too complicated.

Will try to simplify it in the next days, but cannot promise.
The configuration will still have to be done inside the macro file, but really a lot easier - IF it works as I have in mind now.

Meanwhile please download version 4 above, it already has prepared a menu for your chatfilter script.
To activate it, open the macro file in a text editor (please tell if it also works via macro menu: Help+Configuration?)
Go to Line 100 and Line 120 and remove the # signs at the beginning of the line, save and restart browser.



Edited 1 time(s). Last edit at 03/04/2014 02:36AM by siria.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: Zero3K
Date: March 04, 2014 05:00AM

Hmm, how about having it remember if AUTO-LOAD is enabled or not?

EDIT: I got the AUTO-LOAD function to work with the script I mentioned. The only issue is that its being injected more than once which is causing its options menu to display more options than it actually has with all of them being unchecked.



Edited 1 time(s). Last edit at 03/04/2014 09:33AM by Zero3K.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: Zero3K
Date: March 09, 2014 01:09AM

Any luck on improving the auto load function? Btw, yours is the only macro which can load UserJS into websites that works with the latest beta of K-Meleon 74.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: March 09, 2014 01:29AM

Stay tuned... I'll need a beta tester grinning smiley
Oh wll, this looks like turning into one of my 'monster macros' again, want to add this, and then that, and then it gets complicated, and the menus keep growing, and.. and... It's slowly progressing, can now also execute css-files, but the rest will take some more time yet sorry.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: March 16, 2014 09:56PM

Finally - almost ready!! At least for a beta stage, my little tests seem to work on KM1.6 and 1.7, that is on win98 of course cool smiley
Just a bit rough code cleaning to do yet, then will post my test version, late today or tomorrow evening.

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: Zero3K
Date: March 21, 2014 10:55AM

Well, where is it?

Options: ReplyQuote
Re: javascriptia (long bookmarklets / javascript / userscript from disk)
Posted by: siria
Date: March 21, 2014 03:53PM

Sorry, still very busy working on it. Always when you think you're finally done, oh well... Couldn't resist adding yet another nice feature, which made me discover yet more bugs, now trying to bugfix those while struggling with KM17 own bugs with injectJS... it's a mess, but keep progressing, slowly.
As we say here: Mühsam ernährt sich das Eichhörnchen - ächz ;-)

Options: ReplyQuote
Re: StyleScriptia v5 (sucessor to javascriptia)
Posted by: siria
Date: March 31, 2014 12:25AM

Baah... thought I'd never get that darn thing finished, it's really turned into a monster macro again, and am long since running out of time!! Kinda stupid idea to create a macro needing avascripts without knowing even basics about that weird language. But at LAST - ready!!

Have renamed it now to StyleScriptia(+Rename), because it can load JS+CSS now and can rename page titles.
All automatically or manually as a user wishes.
Also created some toolbar buttons incl. a special "Flex" one which can change it's function during a session.
And a "Flex" keyboard shortcut too.
Tried to work around the KM1.7 bugs and the flip-page-back double-injection bugs, but only partly successful :-/

Has 3 files now:
StyleScriptia.kmm (main macro)
StyleScriptia_userconfig.kmm (for user rules and other settings)
StyleScriptia_HELP.txt
+ toolbar images.

Please unzip it directly into the KM-folder, or alternatively sort the files manually into the macros folder, and the image into KM/skins/default.

For the beta the userconfig still contains a TON of example rules for testing, more or less silly ones, probably a bit too many for most people, but oh well. And I DID a lot of testing, but the prob is it has grown into a card house, slightly over my own head: changing a tiny bit code at one corner can crumble the whole thing, and not sure if last minute additions may not have affected any older functions again. Anyway, hope it works...

Download the attachment to this post:

Attachments: StyleScriptia_v5.zip (31.6 KB)  
Options: ReplyQuote
Re: StyleScriptia v5 (sucessor to javascriptia)
Posted by: Zero3K
Date: March 31, 2014 04:34AM

The TwitchPlaysPokemon script doesn't work with the latest version of it.

Options: ReplyQuote
Re: StyleScriptia v5 (sucessor to javascriptia)
Posted by: siria
Date: March 31, 2014 03:19PM

Hmm, it should, there's no really fundamental change in injecting JS from files, at least not intentional, except one little thing which can be toggled off in the debug-submenu for testing. Just a but hard to analyze from the distance since I cannot test that specific script myself.

Does it not work only from the userconfig? Because I forgot to adapt your specific folder and filename, oops. Can you please update that yourself in the userconfig.kmm?
$_file="C:\\Program Files\\K-Meleon\\userjs\\chat_filter.user.js"
Then restart the browser and try again.

Or does it also not work if you definitely get the correct path via "Userstyle: File JS" and picking the file manually, what ignores what's in the userconfig?

Does that manual way produce any error popups?
Does the error console say anything and what? (make sure to switch on JS+KMM errors)

If that doesn't help, toggle in the menu "Help+Config>debug>toggle function()" and try again manually (Userstyle: File JS)

Options: ReplyQuote
Re: StyleScriptia v5 (sucessor to javascriptia)
Posted by: siria
Date: August 28, 2014 04:03PM

FINALLY found a solution for that annoying 32kB limit!!
The (minor) catch is that users must simply split their long files on disk, but IMO rather easy using 7z (Start run: 7zFM.exe), navigating it to your scripts folder, then right-clicking on the long files. Or other tools can do it too, or even do it manually without any tools, just make sure the endings of the split files are .001 / .002 / etc.
Will just take a bit yet until the new macro version is finished...

Options: ReplyQuote
Re: StyleScriptia v5 (sucessor to javascriptia)
Posted by: rodocop
Date: August 30, 2014 04:25AM

siria,
the question from Russia (not my own) is: does your current StyleScriptia understand and automatically handle long scripts divided by your method?

Or we need to wait for a new version?


Try K-Meleon-1.6db+NS by dugbug // KM-16-S2014 by Fred // 1.6beta2.6 by JamesD

K-Meleon Twin+ Download for modern browsers =//= Download for old ones =//= Discuss it!!!

New KM74 for test and feedback! Get it there!


Options: ReplyQuote
Re: StyleScriptia v5 (sucessor to javascriptia)
Posted by: siria
Date: August 30, 2014 07:29AM

No sorry, only the next version. But I'm working at it...

Options: ReplyQuote


K-Meleon forum is powered by Phorum.