http://www.perlmonks.org?node_id=1014289

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