URL modifier: Gamespy to Shenmue Dojo | Greasemonkey script

(Modding and other series related projects)

URL modifier: Gamespy to Shenmue Dojo | Greasemonkey script

Postby Giorgio » Tue Sep 23, 2014 2:04 pm

This is a script that modifies all the...
    "http://dynamic.gamespy.com/~shenmuedojo/..."
    "http://dynamic4.gamespy.com/~shenmuedojo/..."
    "http://shenmue.planets.gamespy.com/..."
    "www.planetxbox.com/shenmuedojo/..."
    "www.fileplanet.com/dl.aspx?/planetxbox/shenmuedojo/..."
...type of links to "http://www.shenmuedojo.net/..." ones.


For example > From this...
Image
...or...
Image
...To this:
Image
...or...
Image

You will need Greasemonkey for your browser (add-on: Chrome, Firefox, Opera etc), to use it.

Install script v0.5

Here's the raw code of the script:
Code: Select all
// ==UserScript==
// @name       URL modifier: Gamespy to Shenmue Dojo
// @namespace  http://saveshenmue.tumblr.com/
// @version    0.5
// @description This script modifies all the old links before the migration off of Gamespy (etc), to the "http://www.shenmuedojo.net/..." working ones.
// @copyright  2014+, Giorgio
// ==/UserScript==
/*
===============================================================
// LINKS:
// == From this... ==
// http://dynamic.gamespy.com/~shenmuedojo/...
// http://shenmue.planets.gamespy.com/...
// www.planetxbox.com/shenmuedojo/...
// www.fileplanet.com/dl.aspx?/planetxbox/shenmuedojo/...
// == ...To this: ==
// http://www.shenmuedojo.net/...
// ---
// TEXTS (applicable for forum links):
// == From this... ==
// http://dynamic.gamespy.com/~shenmuedojo/forum/viewtopic.php?...
// http://shenmue.planets.gamespy.com/forum/viewtopic.php?...
// == ...To this: ==
// http://www.shenmuedojo.net/forum/viewtopic.php?...
===============================================================
*/
window.addEventListener( "load", function() {
   
    var textReplacement = "shenmuedojo.net";
    var a = document.links;
    var i, href, innerHTML;
   
    for( i = 0; i < a.length; i++ ) {
       
        href = a[i].href;
        innerHTML = a[i].innerHTML;
       
        if( href.match(/http:\/\/dynamic.gamespy.com\/~shenmuedojo/g) ) {
           
            a[i].href = href.replace( /dynamic.gamespy.com\/~shenmuedojo/, textReplacement );               // Link replace
            a[i].innerHTML = innerHTML.replace( /http:\/\/dynamic.gamespy.com\/~shenmuedojo/g, textReplacement );      // Text replace
        }
        else if( href.match(/http:\/\/dynamic4.gamespy.com\/~shenmuedojo/g) ) {
           
            a[i].href = href.replace( /dynamic4.gamespy.com\/~shenmuedojo/, textReplacement );               // Link replace
            a[i].innerHTML = innerHTML.replace( /http:\/\/dynamic4.gamespy.com\/~shenmuedoj/g, textReplacement );      // Text replace
        }
        else if ( href.match(/http:\/\/shenmue.planets.gamespy.com/g) ) {
           
            a[i].href = href.replace( /shenmue.planets.gamespy.com/, textReplacement );                     // Link replace
            a[i].innerHTML = innerHTML.replace( /http:\/\/shenmue.planets.gamespy.com/g, textReplacement );   // Text replace
        }
        else if ( href.match(/http:\/\/www.planetxbox.com\/shenmuedojo/g) ) {
           
            a[i].href = href.replace( /www.planetxbox.com\/shenmuedojo/, textReplacement );                     // Link replace
            a[i].innerHTML = innerHTML.replace( /http:\/\/www.planetxbox.com\/shenmuedojo/g, textReplacement );   // Text replace
        }
        else if ( href.match(/http:\/\/www.fileplanet.com\/dl.aspx\?\/planetxbox\/shenmuedojo/g) ) {
           
            a[i].href = href.replace( /www.fileplanet.com\/dl.aspx\?\/planetxbox.com\/shenmuedojo/, textReplacement );                  // Link replace
            a[i].innerHTML = innerHTML.replace( /http:\/\/www.fileplanet.com\/dl.aspx\?\/planetxbox\/shenmuedojo/g, textReplacement );   // Text replace
        }
    }
}, false);


Those links were never officially updated when the servers were migrated off of Gamespy. It's useful, like, when you do research old topics with Shenmue theories.

LATEST UPDATES:
Version 0.5:
- Major fixes and optimizations in the code.
- Now it also fixes "http://dynamic.gamespy.com/~shenmuedojo/..." links.
Version 0.4:
- Various fixes and optimizations in the code.
Version 0.3:
- Now it also fixes "www.fileplanet.com/dl.aspx?/planetxbox/shenmuedojo/..." links.
Version 0.2:
- Now it also fixes "www.planetxbox.com\/shenmuedojo/..." links.
User avatar
Giorgio
"After Burner...Great!"
"After Burner...Great!"
 
Joined: February 2009
Favorite title: Shenmue
Currently playing: Yakuza series

Return to Community Projects

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000-
ShenmueDojo.net