There are 2 previous versions of this script.
// ==UserScript==
// @name Lift Guest Viewing Limit (vBulletin)
// @namespace http://userscripts.org/scripts/show/36032
// @description Remove the viewing limit for guest/unregistered users imposed by the LGV addon of vBulletin forum software
// @include http://*/showthread.php?*
// @include http://*/showpost.php?*
// ==/UserScript==
// Extends the String object with a trim funcion
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
// Deletes the cookie with the passed name
function deleteCookie(cookieName) {
document.cookie = cookieName + "=; expires=" + (new Date(Date.now() - 1)).toGMTString() + "; path=/";
}
// Enumerates all the cookies which apply to the current document
// Returns null if there isn't any applicable cookie
function enumerateCookies() {
// Separates the cookie string into an array
var arrCookies = document.cookie.split(";");
if (arrCookies[0] === "") return null;
// Returns the trimmed array of cookies
return arrCookies.map(function(s) {return s.trim();});
}
// Enumerates all the cookies to test if one that follows the name pattern is present
// If it is, deletes it
var allCookies = enumerateCookies();
if (allCookies === null) return;
allCookies.forEach(function(s) {
var nameMatch = s.match(/^([^=]*userlgv)=\d+/i);
if (nameMatch !== null) deleteCookie(nameMatch[1]);
});
