Post by James [a_leon] on Jun 22, 2010 21:41:17 GMT -8
Global Footer
<script type="text/javascript">
<!--
/***************************************************
*
* Convert images to text - Global Footer
*
* Created By James [a_leon]
* inArray function by Bobby Hensley
*
* This script cannot be redistributed without
* permission of the creator. All rights reserved.
*
****************************************************/
Array.prototype.inArray = function (value)
{
for (var i = 0, len = this.length; i < len; i ++)
{
if (this[i] === value)
return true;
}
return false;
};
var textLinks = {
// Domain the images are hosted on. You shouldn't have to change this.
domain: "http://images.proboards.com",
// Menu button filenames
menu: ["home", "topics", "help", "search", "members", "calendar", "admin", "profile", "logout", "login", "register"],
// Admin Functions filenames
admin: ["adminfunctions", "movetopic", "moveposts", "removetopic", "lockunlock", "sticky", "stickylock", "bump", "makeannouncement", "lock", "unlock", "unsticky", "removeannouncement"],
// Thread and Post filenames
functions: ["search2", "advancedmoderation", "markasread", "newthread", "newpoll", "addpoll", "bookmark", "removebookmark", "reply", "sendtopic", "print", "quote", "modify", "delete", "share"],
// Private Message filenames
pm: ["im_inbox", "im_new", "im_delete", "im_markasread", "im_outbox", "backupmessages", "im_config"],
// Profile images
profile: ["icq", "yim", "aim", "email_sm", "message_sm"],
// Others not included above
other: ["ip", "hide", "show"],
// Wrap words
wrap: ["[", "]"],
// Images to exclude
exclude: ["adminfunctions", "ip", "new/sticky", "new/stickylock"],
// No futher modifcation needed
images: Array (),
init: function ()
{
this.createArray ();
this.replaceImages ();
},
createArray: function ()
{
this.images = this.images.concat (this.menu, this.admin, this.functions, this.pm, this.profile, this.other);
},
replaceImages: function ()
{
var forumImages = document.getElementsByTagName("img");
var titlereg = /^\[*(.+?)\]*$/i;
for (var i = 0; i < forumImages.length; i ++)
{
var imageName = forumImages.item (i).src.match (/\/(new(\/(buttons|menu))?\/)?(\w+)\.\w{3,4}$/) ? RegExp.$4 : null;
var imagePath = imageName ? "" + RegExp.$1 + RegExp.$4 + "" : null;
if (forumImages.item (i).src.match (this.domain) && this.images.inArray (imageName))
{
titlereg.test (forumImages.item (i).title);
var txtStr = this.wrap[0] + RegExp.$1 + this.wrap[1];
if (this.exclude.inArray (imageName) || this.exclude.inArray (imagePath))
continue;
var newText = document.createTextNode (txtStr);
var newFont = document.createElement ("font");
newFont.className = "textButton";
newFont.appendChild (newText);
forumImages.item (i).parentNode.replaceChild (newFont, forumImages.item (i));
i = -1;
}
}
}
}
textLinks.init ();
//-->
</script>
Okay, for some time the Convert Buttons to Text has not worked. So here's this.
To start, let me thank Bobby Hensley for help troubleshooting this code and providing me with the inArray. With that said, let me tell you about how to customize this.
Let me walk you through what you customize with this.
menu: ["home","help","search","members","calendar","admin","profile","logout","login","register"],
This array is for the names of all of the menu buttons that you want changed to text. If you do not want any given button changed to text, simply remove it from the list. If you do not want the menu changed at all, you simply change that line to this:
menu: [""],
For all arrays up until other, it is the same case as with the menu array.
With the other array, currently it is set up like this:
other: ["ip","hide","show"],
This array is for any other image filename around the forum that you'd like changed to text (it changes it to the title of the image). If you want nothing, than simply change the array to a set of blank quotes.
Next, we have this array.
wrap: ["[","]"],
This array is if you want something wrapped around the links. As of now, I have it setup so the home button changes to [home].
Lastly, we have this array.
exclude: ["adminfunctions","ip"],
This array is for any images that you want changed to text, that you do not want wrapped.
If you wish to change the style, the class applied to all of the text is "textButton".
The code is currently setup to change pretty much every button to text, you will have to modify the arrays to get it exactly how you want it. Please do not PM me for help with this, instead post it in the coding support board .
*added "moveposts" 9/8/2012
<script type="text/javascript">
<!--
/***************************************************
*
* Convert images to text - Global Footer
*
* Created By James [a_leon]
* inArray function by Bobby Hensley
*
* This script cannot be redistributed without
* permission of the creator. All rights reserved.
*
****************************************************/
Array.prototype.inArray = function (value)
{
for (var i = 0, len = this.length; i < len; i ++)
{
if (this[i] === value)
return true;
}
return false;
};
var textLinks = {
// Domain the images are hosted on. You shouldn't have to change this.
domain: "http://images.proboards.com",
// Menu button filenames
menu: ["home", "topics", "help", "search", "members", "calendar", "admin", "profile", "logout", "login", "register"],
// Admin Functions filenames
admin: ["adminfunctions", "movetopic", "moveposts", "removetopic", "lockunlock", "sticky", "stickylock", "bump", "makeannouncement", "lock", "unlock", "unsticky", "removeannouncement"],
// Thread and Post filenames
functions: ["search2", "advancedmoderation", "markasread", "newthread", "newpoll", "addpoll", "bookmark", "removebookmark", "reply", "sendtopic", "print", "quote", "modify", "delete", "share"],
// Private Message filenames
pm: ["im_inbox", "im_new", "im_delete", "im_markasread", "im_outbox", "backupmessages", "im_config"],
// Profile images
profile: ["icq", "yim", "aim", "email_sm", "message_sm"],
// Others not included above
other: ["ip", "hide", "show"],
// Wrap words
wrap: ["[", "]"],
// Images to exclude
exclude: ["adminfunctions", "ip", "new/sticky", "new/stickylock"],
// No futher modifcation needed
images: Array (),
init: function ()
{
this.createArray ();
this.replaceImages ();
},
createArray: function ()
{
this.images = this.images.concat (this.menu, this.admin, this.functions, this.pm, this.profile, this.other);
},
replaceImages: function ()
{
var forumImages = document.getElementsByTagName("img");
var titlereg = /^\[*(.+?)\]*$/i;
for (var i = 0; i < forumImages.length; i ++)
{
var imageName = forumImages.item (i).src.match (/\/(new(\/(buttons|menu))?\/)?(\w+)\.\w{3,4}$/) ? RegExp.$4 : null;
var imagePath = imageName ? "" + RegExp.$1 + RegExp.$4 + "" : null;
if (forumImages.item (i).src.match (this.domain) && this.images.inArray (imageName))
{
titlereg.test (forumImages.item (i).title);
var txtStr = this.wrap[0] + RegExp.$1 + this.wrap[1];
if (this.exclude.inArray (imageName) || this.exclude.inArray (imagePath))
continue;
var newText = document.createTextNode (txtStr);
var newFont = document.createElement ("font");
newFont.className = "textButton";
newFont.appendChild (newText);
forumImages.item (i).parentNode.replaceChild (newFont, forumImages.item (i));
i = -1;
}
}
}
}
textLinks.init ();
//-->
</script>
Okay, for some time the Convert Buttons to Text has not worked. So here's this.
To start, let me thank Bobby Hensley for help troubleshooting this code and providing me with the inArray. With that said, let me tell you about how to customize this.
Let me walk you through what you customize with this.
menu: ["home","help","search","members","calendar","admin","profile","logout","login","register"],
This array is for the names of all of the menu buttons that you want changed to text. If you do not want any given button changed to text, simply remove it from the list. If you do not want the menu changed at all, you simply change that line to this:
menu: [""],
For all arrays up until other, it is the same case as with the menu array.
With the other array, currently it is set up like this:
other: ["ip","hide","show"],
This array is for any other image filename around the forum that you'd like changed to text (it changes it to the title of the image). If you want nothing, than simply change the array to a set of blank quotes.
Next, we have this array.
wrap: ["[","]"],
This array is if you want something wrapped around the links. As of now, I have it setup so the home button changes to [home].
Lastly, we have this array.
exclude: ["adminfunctions","ip"],
This array is for any images that you want changed to text, that you do not want wrapped.
If you wish to change the style, the class applied to all of the text is "textButton".
The code is currently setup to change pretty much every button to text, you will have to modify the arrays to get it exactly how you want it. Please do not PM me for help with this, instead post it in the coding support board .
*added "moveposts" 9/8/2012