We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
Change Topic Title Color; Code Request
Topic Started: Dec 9 2009, 04:02 AM (544 Views)
Edahsrevlis
Member Avatar
Member
[ *  * ]
Board Address: http://z4.invisionfree.com/PendragonMovie/
Type of Request: Simple Script

Description: Add the ability to add hex color tags to a topic title.
Similar to [this script] which allows italic and bold tags in topic titles.

Thanks very much to anyone who can help. I'm sure many users will find it useful.
Offline Profile Goto Top
 
Holysavior-ZNR
Member Avatar
Member
[ *  *  *  *  * ]
so this is for IF or for ZB?
Offline Profile Goto Top
 
SuperSleuth
Member Avatar
Member
[ *  * ]
1.) AdminCP -> Board Wrappers -> Header & Body -> Below <% BOARD %>:
Code:
 
<script type="text/javascript"> <!--
var regEx = /\[\#([\w\d]+?)\]/, a = document.links || document.getElementsByTagName("a"), d = document.getElementsByTagName("div");
for(var n = 0; n < a.length; n ++)
if(regEx.test(a[n].innerHTML)) {
a[n].style.color = RegExp.$1;
a[n].innerHTML = a[n].innerHTML.replace(regEx, "");
}
if(/showtopic\=\d+/.test(location.href))
for(var n = 0; n < d.length; n ++)
if(d[n].className == "maintitle" && regEx.test(d[n].innerHTML)) {
d[n].style.color = RegExp.$1;
d[n].innerHTML = d[n].innerHTML.replace(regEx, "");
}
if(regEx.test(document.title))
document.title = document.title.replace(regEx, "");
if(document.REPLIER && document.REPLIER.TopicTitle) {
var t = document.REPLIER.TopicTitle, r = t.parentNode.parentNode, v = "";
if(regEx.test(t.value)) {
v = RegExp.$1;
t.value = t.value.replace(regEx, "");
}
with(r.parentNode.insertRow(r.rowIndex + 1)) {
insertCell(0); insertCell(1);
cells[0].className = "pformleft";
cells[1].className = "pformright";
cells[0].innerHTML = "Topic Color";
cells[1].innerHTML = "<input type=\"text\" size=\"40\" maxlength=\"10\" name=\"TopicColor\" value=\"" + v + "\" class=\"forminput\" />";
}
if(document.attachEvent)
document.REPLIER.attachEvent("onsubmit", function() {
if(document.REPLIER.TopicColor.value != "")
t.value = "[#" + document.REPLIER.TopicColor.value + "]" + t.value;
});
else if(document.addEventListener)
document.REPLIER.addEventListener("submit", function() {
if(document.REPLIER.TopicColor.value != "")
t.value = "[#" + document.REPLIER.TopicColor.value + "]" + t.value;
}, false);
}
// --> </script>


2.) AdminCP -> IPDynamic Lite Set-up -> Show Affiliates box content (make sure you check Yes in the section above this one):
Code:
 
<div id="recommended-sites"><script type="text/javascript"> <!--
document.getElementById("recommended-sites").parentNode.parentNode.style.display = "none";
function cleanUp() {
var regEx = /\[\#([\w\d]+?)\]/, a = document.links || document.getElementsByTagName("a");
for(var n = 0; n < a.length; n ++)
if(regEx.test(a[n].innerHTML)) {
a[n].style.color = RegExp.$1;
a[n].innerHTML = a[n].innerHTML.replace(regEx, "");
}
}
setTimeout(cleanUp, 10);
// --> </script></div>

You don't need to understand how it works. Just try to make a new topic and you'll see.
If this doesn't work (it might not/have a few bugs as I'm fairly rusty), reply back and I'll see what I can do.
Offline Profile Goto Top
 
Edahsrevlis
Member Avatar
Member
[ *  * ]
It works great!
Should be an official script.

I do have one question.

Is it possible to make this an Admin only feature?
If not, I'll just have to prevent my members from editing their titles and change the colors back after they make them. To prevent a circus effect.

Thanks very much!
Offline Profile Goto Top
 
SuperSleuth
Member Avatar
Member
[ *  * ]
I'm honestly not sure how to do that, although Reid, Slayer, Mike, or Holy probably can -- and hopefully will when they see this topic.
Offline Profile Goto Top
 
GhostMasterz
Member Avatar
Member
[ *  *  * ]
can we have a same code for ZB?
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic