MassDrop Automatic Guest Mode

When opening a Massdrop URL, check to see if "?mode=guest_open" is appended to the URL, and if not, append it. This will allow unregistered users to browse Massdrop.

2016-01-28 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

// ==UserScript==
// @name        MassDrop Automatic Guest Mode
// @namespace   Symmetry
// @match       *://*.massdrop.com/*
// @run-at      document-start
// @description When opening a Massdrop URL, check to see if "?mode=guest_open" is appended to the URL, and if not, append it. This will allow unregistered users to browse Massdrop.
// @version 0.0.1.20160128060902
// ==/UserScript==

var oldUrlPath  = window.location.search;

/*--- Test that "?mode=guest_open" is at end of URL, excepting any "hashes"
    or searches.
*/
if ( ! /\?mode=guest_open$/.test (oldUrlPath) ) {

    var newURL  = window.location.protocol + "//"
                + window.location.host
                + oldUrlPath + "?mode=guest_open"
                + window.location.search
                + window.location.hash
                ;
    /*-- replace() puts the good page in the history instead of the
        bad page.
    */
    window.location.replace (newURL);
}