Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Free Nodelet Hack: "No-LogOut-Links" - Fix links to other PM-domains

by LanX (Saint)
on Jan 20, 2013 at 13:45 UTC ( [id://1014289]=monkdiscuss: print w/replies, xml ) Need Help??

Dear fellow monks,

(in continuation of Re: Perlmonks 'Not logged in Error' - Proposal for fix and Re^2: Perlmonks 'Not logged in Error' - Proposal for fix (autocorrect perlmonks linking shortcuts in preview ))

If you bother about people posting hardcoded links to other PM-domains which result in "logging you out", you can fix that with this nodelet hack:

<!-- sample hard-link to be fixed, only for testing --> [http://www.perlmonks.com|www.perlmonks.com] <script><!-- /* No Log-Out Links Redirect links to other perlmonk domains to current one */ (function (do_log,do_test){ var log = function (html){ if (do_log) document.writeln(html); }; var fixes=''; if (do_test){ document.links[3].hostname='www.perlmonks.com'; document.links[4].hostname='www.perlmonks.org'; document.links[5].hostname='perlmonks.net'; } var doc_host=document.location.hostname; for (var i in document.links) { var link_host = document.links[i].hostname; if ( link_host && link_host != doc_host && link_host.match(/^(www\.)?perlmonks.(org|net|com)$/) ) { fixes += '<li> #'+i+' was '+link_host+'</li>\n'; document.links[i].hostname = doc_host; } } if (fixes) { log('<h5>Fixing hostnames of PM links</h5><small><ol>'); log(fixes); log('</ol></small>'); } })(true,false); --></script>

Paste the above code into Free Nodelet Settings and submit it.

You need to activate the Free Nodelet in Nodelet Settings and don't forget other Nodelets you still need.

Only tested with Firefox so far, please report for other browsers.

Cheers Rolf

UPDATE

fixed indentation

  • Comment on Free Nodelet Hack: "No-LogOut-Links" - Fix links to other PM-domains
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: monkdiscuss [id://1014289]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-26 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found