General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
reveal links href
Posted by: disrupted
Date: April 20, 2009 03:05PM

shows links url in tooltip.. not entirely sure what this can be good for but fireslut has similar extension

available at kmext

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

# ---------- link reveal----------

revealer{
open("javascript: (function popup(){var links = document.evaluate('//a[@href]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (i=0; i < links.snapshotLength; i++){links.snapshotItem(i).title += ' ' +links.snapshotItem(i).href;}})();");
}

revealer_BuildMenu{
setmenu("Page &Properties", macro, "Reveal Links", revealer, 2);
}

$OnInit=$OnInit."revealer_BuildMenu;";

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


access from page contextmenu>page properties>reveal links

e.g. link without reveal


link after reveal is injected




Edited 1 time(s). Last edit at 08/11/2010 06:31PM by disrupted.

Options: ReplyQuote
Re: reveal links href
Posted by: caktus
Date: April 21, 2009 07:50AM

@ disrupted.

I can't get it to work. Tried coping everything in green to the User-Defined Macros folder as linkreveal.kmm
I also tried the code at the link you provided but still no luck. As you implied, it may not be particularly useful. But it would be handy.


BTW, anytime I try to creat and account with Yahoo! mail or any other big name free email hosts I can never come up with a reasonable user name that is available which makes registering a real PITA. I wish they would just offer an available user name and stop ruining my life!:mad:

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: reveal links href
Posted by: disrupted(unlogged)
Date: April 21, 2009 11:25AM

you need to have javascript enabled.. i updated the macro to automatically enable js for the target page, download the macro again..

also, i'm not sure but there might be a conflict with noscript.. first try the new macro, if it's working then it's ok..if not, then try removing/disabling noscript and use this instead:

http://kmeleonbrowser.org/forum/read.php?1,91203

this policy manager is much more advanced than noscript as it lets you assign different policies for different sites(including but not limited to disabling javascript) and it doesn't conflict with internal macro commands.. for example, if you disable js with it for global policy(all websites).. macros that need to enable js will still function.
i don't have much experience with noscript on kmeleon but i know it's a bitch and not fully compatible.

p.s. when a site starts annoying me with creating usernames.. i just start using profanity in the new handle.. usually those 've not been already taken grinning smiley

Options: ReplyQuote
Re: reveal links href
Posted by: caktus
Date: April 21, 2009 07:11PM

Thanks dirupted. I too have stopped using noscript, probably for the same reasons. And thanks for the info regarding code in the forums. I will downloads it from [http://kmeleonbrowser.org/forum/read.php?1,91203 ]
The policy manager sounds very interesting.

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: reveal links href
Posted by: caktus
Date: April 21, 2009 08:22PM

@ disrupted

With js globally disabled when I add sites to policies Manager, the Policies Manager indicates that js is disabled for that site and the ”Enable” radio button is grayed out. And all Advanced JavaScript settings are grayed out. The only way to make all Policy Manager options available is to ad the sites while js is globally enabled. It seems that all Policies Manager options should be available with js globally disabled.

Am I doing something wrong or is this a bug or am I just expecting too much?

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: reveal links href
Posted by: jsnj
Date: April 21, 2009 09:16PM

Quote
disrupted
shows links url in tooltip.. not entirely sure what this can be good for

A replacement for the status bar since link info is pretty much all I use the status bar for. However, I can't get it to automatically function on background tabs. The onload function I added below only seems to work on the active/focused tab. Can't JS be injected on background tabs?


$OnLoad=$OnLoad."revealer;";

Options: ReplyQuote
Re: reveal links href
Posted by: disrupted
Date: April 21, 2009 10:08PM

charlie, if you disable js for global, you'll need to create a new policy in which js is enabled and you can add sites to that new policy

here's example where i have js diabled in global then i made a new policy i called it trusted zone and i can add sites to it.

just use policies manager like you'd use ie in security zones.. in ie internet zone, you can not add sites as well(just like global) but you can add sites to other zones.






jsnj..yes the reveal link would only activate on the page where the command is executed.. i think it can be loaded onload as you've said.. but this i don't know how.. macro gurus(alain, jamesd, gunter, desga and kko) can make it happen



Edited 1 time(s). Last edit at 04/21/2009 10:16PM by disrupted.

Options: ReplyQuote
Re: reveal links href
Posted by: caktus
Date: April 22, 2009 06:35AM

Thank you disrupted. I guess just needed a little coaching.

One more thing. What is "Allow to access these properties with other sites' scripts"? Is it like a referer permission?

Charlie

~~If it ain't broke, why screw it up?~~


Options: ReplyQuote
Re: reveal links href
Posted by: disrupted(unlogged)
Date: April 22, 2009 01:15PM

i have no idea.. but it must be a good thing tongue sticking out smiley

Options: ReplyQuote
Re: reveal links href
Posted by: jsnj
Date: April 22, 2009 05:46PM

Quote
disrupted

jsnj..yes the reveal link would only activate on the page where the command is executed.. i think it can be loaded onload as you've said.. but this i don't know how.. macro gurus(alain, jamesd, gunter, desga and kko) can make it happen

Here's what I'm using. The OnLoad function actually works better in this macro when tabs are disabled. Seems to work for background windows but not background tabs. An OnActivateTab function would work better for this macro but there'd still be a bug since switching between tabs would inject the JS code over again on that page whenever that tab is activated and the link info would appear multiple times in the popup tooltip. So I guess it can be considered a bug in the OnLoad function with background tabs since it works w/background windows. I also used the injectJS function for the macro since that works even when JS is disabled. BTW, I found what I think is a better bookmarklet for this macro since it works in frames, but unfortunately I can't get it to work in the macro. If anyone can, let me know. It's the "Show Links Dest" on the following page. Subsimple Links Bookmarklets

Attachments: LinkReveal.kmm (913 bytes)  
Options: ReplyQuote
Re: reveal links href
Posted by: desga2
Date: April 22, 2009 07:46PM
Options: ReplyQuote
Re: reveal links href
Posted by: jsnj
Date: April 22, 2009 09:00PM


Thanks, Just did. Two things:

1)Applying the location "alltabs" didn't make a difference unfortunately. It still only works on the focused tab. Back in the "layer" days so to speak, all window events affected layers the same since layers were in fact windows. I guess we can't get away with that now with tabs.:s

2)KM's stability hasn't changed in this particular case.


Do you have any ideas on how this particular feature can be implemented properly in KM if not with this macro? It's one Opera feature I always liked. Status bar is pretty much a waste of space IMO especially in KM since we can't add any permanent info or buttons to it, but I use it for link info.

Options: ReplyQuote
Re: reveal links href
Posted by: jsnj
Date: April 23, 2009 01:42AM

Well, here's what I'm using now in case anyone else wants the feature. It still only works on the focused tab, but until a better way is found it'll have to do. This version adds an option to toggle whether links are revealed automatically. The option is located under View, below status bar. It's unchecked at default. Clicking it will automatically activate the feature on all new focused tabs and if tabs are disabled, all windows(background too). It can still be manually activated on background tabs in the Page Properties context menu.

Attachments: LinkReveal.kmm (1.5 KB)  
Options: ReplyQuote
Re: reveal links href
Posted by: siria
Date: August 11, 2010 06:19PM

Just compared the last version in the attachment above and the version on the extensions-site kmext:

######## Last Code here, modified by jsnj:

_ToggleAutoReveal{
menuchecked=getpref(BOOL,$pref_LinkReveal);
togglepref(BOOL,$pref_LinkReveal); &_reveal;
}

_revealer{
$_auto= getpref(BOOL, $pref_LinkReveal)=="false" ? 0:&_reveal;
}
_reveal{
$URLBAR=="about:blank"? 0:(injectJS("(function popup(){var links = document.evaluate('//a[@href]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (i=0; i < links.snapshotLength; i++){links.snapshotItem(i).title += ' ' +links.snapshotItem(i).href;}})();"));
}

######## Code on extensions site kmext:

revealer{
$_jscurrent=getpref(BOOL,$pref_JavaScript);
setpref(BOOL,$pref_JavaScript, true);
open("javascript:(function popup(){var links = document.evaluate('//a[@href]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (i=0; i < links.snapshotLength; i++){links.snapshotItem(i).title += ' ' +links.snapshotItem(i).href;}})();");
}

#######


What I don't understand is why such a huge step backwards, securitywise? :-(

Jsnj's code uses "injectJS" and works fine whether a user has javascript ON or OFF, it doesn't change that user setting.
But the version on kmext uses only the "open" command and always toggles Javascript ON automatically when used, secretly overruling the user settings, without even giving him a notice of this highly risky action!

The other differences are secondary, just nice-to-have the (switchable) automatic function in the jsnj-version, while the kmext-version only allows to call the tooltips page by page per menu each time. But toggling javascript on *permanently* without any notice is a no-go in my opinion :-(

Another thing is that bug in injectJS, which actually does the same when javascript is injected on a chrome page (error console), there's some security function in KM that forbids this and that interruption seems to make injectJS 'forget' to toggle JS off again, or such, but at least that's not intentionally, just a bug :-/

Options: ReplyQuote
Re: reveal links href
Posted by: disrupted
Date: August 11, 2010 06:38PM

js doesn't actually need to be enabled when injecting js or open inject js as macro injecting overrides js settings either way.. that line was probably left out inadvertently due to policy manager testing which is missing another line after the inject to restore user setting back: setpref(bool,$pref_JavaScript, $_jscurrent)
it has been omitted from the macro now, thanks for finding it

Options: ReplyQuote
Re: reveal links href
Posted by: siria
Date: August 11, 2010 07:20PM

Well, for speed you sure get 100 points grinning smiley

But the youtubeservices suffer from the same problem, even the newest version contains 3 times that risky line that toggles JS on, while the one which toggles off again afterwards is missing:
setpref(BOOL,$pref_JavaScript, true);
At the moment I wonder in how many more macros it was forgotten :-/ But that's where the privacy toolbar comes in very handy again, at least that button is always in full sight grinning smiley

Options: ReplyQuote
Re: reveal links href
Posted by: siria
Date: August 11, 2010 07:41PM

Hum, the new uploaded LinkReveal looks just as before, nothing changed...

Oops... and just found the new youtubeservices 1.8 from earlier today.
6 toggles for javascript ON and 3 toggles for Java ON without any 'off' later :cool:
"Short text" too... okay I stop, you'll find them yourself :-)



Edited 2 time(s). Last edit at 08/11/2010 07:52PM by siria.

Options: ReplyQuote
Re: reveal links href
Posted by: disrupted
Date: August 11, 2010 09:45PM

you're probably downloading it from cache..clear the cache and try again

i've revised all macros and fixed ones with errors, clear cache and try youtube 1.8

thank you so much sirira, really appreciate it
http://kmeleonbrowser.org/forum/read.php?9,109499

Options: ReplyQuote
Re: reveal links href
Posted by: siria
Date: August 12, 2010 08:17AM

Oops again... Yes it was the cache!! Should've known better, perhaps will remember next time that old trap, grmpf.

Big Thank You for fixing, and even the whole archive, WHOW!! :-))
I'm really quite paranoid about javascript, and most people don't have any idea how dangerous that really is, with scripts contained in websites, mails, and meanwhile even in lots of pdf's. Good thing there are user settings, so I switch it on only shortly, if really needed, and certainly want to be aware of a toggle.

Regarding scripts called by macros, must say I've strugled long and hard before, mostly dabbling with my own stuff, and am not so sure at all that they can overrule all blocks automatically. Seemed to remember that injectJS had proven stronger there, but meant to verify first before posting again yesterday. And of course nothing I did worked anymore, sigh! Had picked the youtube macro and modified it a little, to disable the automatic function which keeps whisking me away to deturl, and instead wanted to put deturl as a normal menu entry to the others. Along with a copy that used "injectJS" instead, just for comparing. Really no big deal knowing macrolanguage a bit, or so I thought! Oh well... But as usual nothing worked anymore at first, and there I was again, sitting there for hours searching the reasons, sigh :-( Noticed after half an hour that I was blind and had overlooked that now there's a separate css sheet needed, that was my own fault, but at any rate, the real stuff:

If JS button is blocked, there happens nothing except the white CSS border on top. If JS is allowed, deturl whisks me away from the video itself and jumps to their website, probably some bug in their script.
But anyway, for their script the JS-block isn't overruled automatically, although that definitely works in other tiny scripts I'm using, like renaming page or image titles etc., like LinkReveal here. So at the moment my theory is that it seems to depend mostly from the kind of commands in the scripts themselves, for the very harmless ones KM ignores the JS block and lets them pass if called by a macro, and for other commands which may be more powerful KM keeps sticking to the user-set JS block... In such cases I'm considering a macro toggle too, just not secretly permanently of course ;-)



Edited 1 time(s). Last edit at 08/12/2010 08:20AM by siria.

Options: ReplyQuote
Re: reveal links href
Posted by: Matt
Date: August 14, 2010 11:04AM

Siria, the reason why I included pref to turn js (and java) on in youtubers.kmm is quite simple: some services do NOT work with js turned off. Users who deactivated js could complain that i.e. grab nad run doesn't work. Try for yourself and you will be redirected to > http://www.cpalead.com/nojava.php

Including setpref(BOOL,$pref_JavaScript, false) makes no difference; js will be turned off in less than a second and you have to activate js per hand in order to use keephd, video2mp3 and other services. I don't know another way to turn off js using macro after video download/convertion is finished than F7 or privacy bar.


PS I don't like surfing with js enabled; it slows down K-M due to old engine (I mean the 1.5.x line, not 1.6) not to mention security risks.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.