<!-- ========================== PM LINK FIXER ========================== --> <!-- please disable after successful testing --> <h5> Testlinks </h5> [cpan://Data::Dump] <p> [mod://Data::Dump] <p> [http://www.perlmonks.net|www.perlmonks.net] <p> <script><!-- /* redirect links - avoid log out: redirect perlmonks domains to current one! - cpan -> metacpan */ (function (do_log){ var log = function (html){ if (do_log) document.writeln(html); } var fixes=''; var doc_host=document.location.hostname; for (var i in document.links) { var link_host = document.links[i].hostname; var link_href = document.links[i].href; var link_search = document.links[i].pathname; var link = document.links[i]; /* redirect links from other perlmonks domains to current one! * +/ 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; } /* redirect links from cpan to metacpan */ if ( link_host && link_host == 'search.cpan.org' ) { fixes += '<li> #'+i+' fixing '+link.href+'</li>\n'; if ( link.pathname == '/perldoc' ) { link.hostname = 'metacpan.org'; link.pathname = '/module/'+ link.search.split('?')[1]; link.search=''; link.protocol='https:'; } else if ( link.pathname == '/search' ) { link.hostname = 'metacpan.org'; link.search='?q'+link.search.split('&query')[1]; } } } if (fixes) { log('<h5>Fixed Links</h5><small><ol>'); log(fixes); log('</ol></small>'); } })(true); --></script>
Logging and Testlinks should be disabled after successful testing.
Cheers Rolf
(addicted to the Perl Programming Language)
In reply to Re^3: Proposal - Update shortcuts pointing to cpan.org to link to mcpan.org # Nodelet Hack
by LanX
in thread Proposal - Update shortcuts pointing to cpan.org to link to mcpan.org
by marto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |