Logo replacement greasemonkey script

Locked
User avatar
LantisEscudo
Joined: Thu Mar 08, 2001 5:21 pm
Location: Eastern Massachusetts
Contact:
Org Profile

Logo replacement greasemonkey script

Post by LantisEscudo » Fri Aug 08, 2008 6:45 pm

I know some people don't like the current logo. Personally, I still associate the old filmstrip logo with this site, so I was just playing around with the FireFox plugin GreaseMonkey, and put together a script that let me replace the logo (both on the main site and the forum) with my preferred old one.

A couple people in the IRC channel suggested I make it available, so I added the code snippets that would allow someone to choose any of the old logos, just with a little copying and pasting, and here it is:

Download as a .js file

Code: Select all

// ==UserScript==
// @name           a-m-v.org logo replacement
// @namespace      http://www.honouproductions.net
// @description    Replaces the Org logo with the logo of your choice
// @include        http://animemusicvideos.org/*
// @include        http://www.animemusicvideos.org/*
// ==/UserScript==
// Script based on "Patriotic Google Logo" by Jesse Hathaway

// Notes:
//   *** You must define the URL of the custom logo below, or the script will display the default logo! ***

//Replace the block here with the logo you want to have appear
var newLogoURL = "http://www.animemusicvideos.org/_media/AMVLogo.png";
var newLogoWidth = 131;
var newLogoHeight = 70;
var newForumURL = "http://www.animemusicvideos.org/_media/AMVLogo.png";

/* For ancient 1999-2001 brown round logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/logo.gif";
    var newLogoWidth = 127;
    var newLogoHeight = 80;
    var newForumURL = "http://www.animemusicvideos.org/_media/logo.gif";
*/

/* For ancient 1999-2001 text logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/logo3.gif";
    var newLogoWidth = 187;
    var newLogoHeight = 80;
    var newForumURL = "http://www.animemusicvideos.org/_media/logo3.gif";
*/

// The 2002 logo available in the _media folder is the text portion of the logo only.
// The note portion is not available directly from the org.

/* For 2002 music note text logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/logo5.gif";
    var newLogoWidth = 175;
    var newLogoHeight = 62;
    var newForumURL = "http://www.animemusicvideos.org/_media/logo5.gif";
*/

/* For 2003-2004 filmstrip logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/AMVLogo.png";
    var newLogoWidth = 131;
    var newLogoHeight = 70;
    var newForumURL = "http://www.animemusicvideos.org/_media/AMVLogo.png";
*/

/* For 2005 black oval logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/AMVLogo2005.png";
    var newLogoWidth = 192;
    var newLogoHeight = 70;
    var newForumURL = "http://www.animemusicvideos.org/_media/AMVLogo2005.png";
*/

/* For 2006 paintbrush logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/AMVLogo2006.png";
    var newLogoWidth = 168;
    var newLogoHeight = 70;
    var newForumURL = "http://www.animemusicvideos.org/_media/AMVLogo2006.png";
*/

/* For 2007 flower petal logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/AMVLogo2007.png";
    var newLogoWidth = 152;
    var newLogoHeight = 80;
    var newForumURL = "http://www.animemusicvideos.org/_media/AMVLogo2007.png";
*/

/* For 2008 note cloud logo:
    var newLogoURL = "http://www.animemusicvideos.org/_media/AMVLogo2008.gif";
    var newLogoWidth = 168;
    var newLogoHeight = 70;
    var newForumURL = "http://www.animemusicvideos.org/_media/AMVLogo2008.gif";
*/

/*
    getElementsByAttribute function is:
	    Copyright Robert Nyman, http://www.robertnyman.com
	    Free to use if this text is included
	Slightly modified to work in this user script
*/
window.getElementsByAttribute = function(oElm, strTagName, strAttributeName, strAttributeValue){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
    var oCurrent;
    var oAttribute;
    for(var i=0; i<arrElements> 0){
            if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute))){
                arrReturnElements.push(oCurrent);
            }
        }
    }
    return arrReturnElements;
}

var logos = getElementsByAttribute(document.body, "img", "src", "/_media/AMVLogo2008.gif");
if(logos != "") {
	logos[0].src = newLogoURL;
	logos[0].width = newLogoWidth;
	logos[0].height = newLogoHeight;
} else {
	logos = getElementsByAttribute(document.body, "img", "src", "templates/subSilver/images/logo_phpBB.gif");
	if(logos != "") {	logos[0].src = newForumURL; }
}

User avatar
Kitsuner
Maximum Hotness
Joined: Sun Feb 16, 2003 8:38 pm
Status: Top Breeder
Location: Chicago, IL
Org Profile

Post by Kitsuner » Sat Aug 09, 2008 4:23 am

It's not just limited to the old logos, though, right? One could theoretically use a logo what wasn't selected (:amv:) or any image at all really, although I assume it has to be at least roughly the same size, am I wrong?
OtakuGray wrote:Sometimes anime can branch out to a younger audience and this is one of those times where you wish children would just go die.
Stirspeare wrote:<Stirspeare> Lopez: Vanquish my virginity and flood me with kit. ["Ladies..."]

User avatar
LantisEscudo
Joined: Thu Mar 08, 2001 5:21 pm
Location: Eastern Massachusetts
Contact:
Org Profile

Post by LantisEscudo » Sat Aug 09, 2008 9:07 am

Theoretically, yeah. You just need to replace the URLs and the width/height values with the ones you want. I only did the research for the official ones.

I'm not certain how large an image you can use, but I didn't test it with anything larger than 192 pixels wide or 80 pixels tall.

Locked

Return to “Site Help & Feedback”