|
Post by Wormopolis on Sept 10, 2009 3:05:16 GMT -8
Browser Tested: IE, Chrome and FF placement: function in global header This function needs to be in global header in order for the other 5 codes to work:
<script type="text/Javascript"> <!-- // colorSmear v2.01 // by Wormopolis - [url]www.wormocodes.com[/url] // Keep header intact - do not repost
// global header function
function intToHex(num_i) { res=(num_i.toString(16).length>1? num_i.toString(16): "0"+num_i.toString(16)); return res.toUpperCase(); }
function hexToInt(num_h) { tot=0; num_h=num_h.toUpperCase(); for (a=num_h.length-1; a>=0; a--) { if (num_h.charAt(a).match(/\d/)) tot+=(Math.pow(16, num_h.length-1-a)*parseInt(num_h.charAt(a))); else tot+=(Math.pow(16, num_h.length-1-a)*(num_h.charCodeAt(a)-55)); } return tot; }
function colorSmear(startColor, txt, endColor, mode) { txt=txt.replace(/\n/,'<br>'); rg=/(<\/?((\w|\W)\s?)*?>)/; if (txt.match(rg)) { stilltest=rg.exec(txt); var keepspot=stilltest.index; txt=txt.replace(rg,''); var keeptag=stilltest[0]; txt=colorSmear(startColor, txt, endColor,mode); txttemp=txt.split('<font color='); txttemp2=txttemp[keepspot].split('>'); txttemp2[txttemp2.length-1]=keeptag+txttemp2[txttemp2.length-1]; txttemp[keepspot]=txttemp2.join('>'); txt=txttemp.join('<font color='); return txt; } else { st_red=startColor.substr(0,2); en_red=endColor.substr(0,2); st_green=startColor.substr(2,2); en_green=endColor.substr(2,2); st_blue=startColor.substr(4,2); en_blue=endColor.substr(4,2); redspan=hexToInt(en_red)-hexToInt(st_red); greenspan=hexToInt(en_green)-hexToInt(st_green); bluespan=hexToInt(en_blue)-hexToInt(st_blue); red_strt=hexToInt(st_red); green_strt=hexToInt(st_green); blue_strt=hexToInt(st_blue);
//first character uses startColor params reslt="<font color='"+startColor+"'>"+txt.charAt(0)+"</font>";
if (arguments[3] && arguments[3]=='1') { if (txt.length>2) { for (sm=1; sm<txt.length-1; sm++) { tmp0=(txt.length-1)/2.0; tmp=tmp0-(Math.abs(sm-tmp0)); red_comp=Math.round(red_strt+(tmp*(redspan/tmp0))); green_comp=Math.round(green_strt+(tmp*(greenspan/tmp0))); blue_comp=Math.round(blue_strt+(tmp*(bluespan/tmp0))); nwColor=""+intToHex(red_comp)+intToHex(green_comp)+intToHex(blue_comp); tmp="<font color='"+nwColor+"'>"+txt.charAt(sm)+"</font>"; reslt+=tmp; } } //last character uses startColor params reslt+="<font color='"+startColor+"'>"+txt.charAt(txt.length-1)+"</font>"; return reslt; } else if (arguments[3] && arguments[3]=='2') { if (txt.length>2) { nwred=intToHex(parseInt(st_red,16)|parseInt(en_red,16)); nwgreen=intToHex(parseInt(st_green,16)|parseInt(en_green,16)); nwblue=intToHex(parseInt(st_blue,16)|parseInt(en_blue,16)); nwMidColor=""+nwred+nwgreen+nwblue; reslt+=colorSmear(startColor, txt.substr(1,parseInt(txt.length/2)-1), nwMidColor); if (txt.length>4) reslt+=colorSmear(nwMidColor, txt.substr(parseInt(txt.length/2),Math.ceil(txt.length/2)-1), endColor); } //last character uses endColor params reslt+="<font color='"+endColor+"'>"+txt.charAt(txt.length-1)+"</font>"; return reslt; } else { if (txt.length>2) { for (sm=1; sm<txt.length-1; sm++) { red_comp=Math.round(red_strt+(sm*(redspan/(txt.length-1)))); green_comp=Math.round(green_strt+(sm*(greenspan/(txt.length-1)))); blue_comp=Math.round(blue_strt+(sm*(bluespan/(txt.length-1)))); nwColor=""+intToHex(red_comp)+intToHex(green_comp)+intToHex(blue_comp); tmp="<font color='"+nwColor+"'>"+txt.charAt(sm)+"</font>"; reslt+=tmp; } } //last character uses endColor params reslt+="<font color='"+endColor+"'>"+txt.charAt(txt.length-1)+"</font>"; return reslt; }
} }
// --> </script>
colorSmear in Posts placement: global or board footer Creates a new UBBC that will let you transform text into 1 color blending into another. UBBC is real easy: [smear:COLORHEX]Content to apply color blending to[/smear:COLORHEX] the first colorhex is the starting color, the second colorhex is the ending color. NEW: optional mode in end tag. [/smear:COLOR:MOD] where MOD is 0 = default smear or just use regualr end tag 1 = double smear. smears from start color to end color back to start color 2 = over smear. smears from start color to both colors added together to end color also now attached to window load in order to speed up document <script type="text/javascript"> <!-- // colorSmear UBBC in posts // v1.75 // signature inclusion // Quick Reply button inclusion // UBBC button credit to wildgoosespeeder // By Wormopolis - www.wormocodes.com // addUBBC function from Proboards
// use [smear:COLOR1][/smear:COLOR2(:mod)] in post around text // mod is optional. mode 1 is default. mode 2 will go from first color to second and back to first // COLOR1 and COLOR2 are hex colors // must have colorSmear function in Global Header above this script
var buttonImage="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/e7xdog.png"; var includeSigs=true; //set false if you want to exclude signatures from smearing var includeInQuickReply=true; //set to false if you dont want a button there;
if (document.postForm) { btnTray=document.postForm.color.parentNode.parentNode; nwBtn=document.createElement('a'); nwBtn.href='javascript:add("[smear:FF0000]","[/smear:00FF00]")'; nwBtnImg=nwBtn.appendChild(document.createElement('img')); nwBtnImg.border='0'; nwBtnImg.src=buttonImage; btnTray.appendChild(document.createElement('br')); btnTray.appendChild(document.createElement('br')); btnTray.appendChild(nwBtn); } if (pb_action=='display' && includeInQuickReply && !location.href.match(/board=imgcom/)) { for (txa=document.getElementsByTagName('textarea'), tt=txa.length-1; tt>=0; tt--) { if ( txa[tt].name && txa[tt].name=='message' && txa[tt].accessKey && txa[tt].accessKey=='q' ) { txa[tt].id='QRtextarea'; nwBtn=document.createElement('a'); nwBtn.href='javascript:addUBBC("QRtextarea","[smear:FF0000]","[/smear:00FF00]")'; nwBtnImg=nwBtn.appendChild(document.createElement('img')); nwBtnImg.border='0'; nwBtnImg.src=buttonImage; var qrarea=txa[tt].parentNode.parentNode; qrarea.parentNode.insertBefore(nwBtn, qrarea); qrarea.parentNode.insertBefore(document.createElement('br'), qrarea); break; } } } if (!pb_action.match(/headersfooters|modifyprofile/)) { function smearDelay() { for (tds=document.getElementsByTagName('td'), i=0; i<tds.length; i++) { if ( tds[i].width=="80%" && tds[i].className.match(/windowbg/) && tds[i].vAlign=="top" && tds[i].innerHTML.match(/\[smear:(.*?)\](.*?)\[\/smear:(.*?):?(\d)?\]/i) && !tds[i].innerHTML.match(/\[norunubbc\]/) && !location.href.match(/thread=295/)) {
postCell=tds[i].getElementsByTagName('table')[0].rows[1].cells[0]; postCell.innerHTML=postCell.innerHTML.replace(/\[smear:(.*?)\](.*?)\[\/smear:(.*?)(:(\d))?\]/gi,function (ign, c1, str, c2, mo, m){ return colorSmear(c1,str.replace(/<br>/gi,'\n'),c2, m);}); if (includeSigs) { sigCell=tds[i].getElementsByTagName('table')[0].rows[2].cells[0]; sigCell.innerHTML=sigCell.innerHTML.replace(/\[smear:(.*?)\](.*?)\[\/smear:(.*?)(:(\d))?\]/gi,function (ign, c1, str, c2, mo, m){ return colorSmear(c1,str.replace(/<br>/gi,'\n'),c2,m);}); if (pb_action=='viewprofile') { for (trs=tds[i].getElementsByTagName('tr'), r=0; r<trs.length; r++) { if (trs[r].innerHTML.match(/\[smear:(.*?)\](.*?)\[\/smear:(.*?)\]/i)) { trs[r].innerHTML=trs[r].innerHTML.replace(/\[smear:(.*?)\](.*?)\[\/smear:(.*?)(:(\d))?\]/gi,function (ign, c1, str, c2, mo, m){ return colorSmear(c1,str.replace(/<br>/gi,'\n'),c2,m);}); } } } } } } }
if (window.addEventListener) { window.addEventListener('load', smearDelay, true); } else { window.attachEvent('onload', smearDelay); } }
function addUBBC(targeted,open, end){ // modified from proboards source var isIE = (document.attachEvent&&!window.opera)? true : false; var tArea=document.getElementById(targeted); var sct = tArea.scrollTop; var open = (open)? open : ""; var end = (end)? end : ""; var sl; if(isIE){ tArea.focus(); var curSelect = document.selection.createRange(); if(arguments[3]){ curSelect.text = open + arguments[3] + "]" + curSelect.text + end; } else { curSelect.text = open + curSelect.text + end; } } else if(!isIE && typeof tArea.selectionStart != "undefined"){ var selStart = tArea.value.substr(0, tArea.selectionStart); var selEnd = tArea.value.substr(tArea.selectionEnd, tArea.value.length); var curSelection = tArea.value.replace(selStart, "").replace(selEnd, ""); if(arguments[3]){ sl = selStart + open + arguments[3] + "]" + curSelection + end; tArea.value = sl + selEnd; } else { sl = selStart + open + curSelection + end; tArea.value = sl + selEnd; } tArea.setSelectionRange(sl.length, sl.length); tArea.focus(); tArea.scrollTop = sct; } else { tArea.value += (arguments[3])? open + arguments[3] + "]" + end : open + end; } }
//--> </script>
preview: wormocodes.proboards.com/index.cgi?board=graphreqaswell&action=display&thread=270
colorSmear on Username placement: global footer allows you to convert someone's displayname into 2 blending colors. you must use their USERNAME when adding into the code. NEW: optional 4th argument for using one of the new modes 1 = doublesmear 2 = oversmear <script type="text/javascript"> <!-- // colorSmear display names v1.3 // by Wormopolis - [url]www.wormocodes.com[/url]
function nameSmear(uname,stcolor,endcolor,mode) { for (lnks=document.links, d=0; d<lnks.length; d++) { if (!lnks[d].className.match(/nosmear/) && lnks[d].className.match(/group/) && lnks[d].href.match(new RegExp('profile&user='+uname+'$','g'))) { tmpv=lnks[d].innerHTML.replace(/<\/?font(.*?)>/gi,''); tmpret=colorSmear(stcolor,tmpv,endcolor,mode); lnks[d].innerHTML=tmpret; } } }
// must have colorSmear function in Global Header above this script // use format nameSmear("username","startcolor","endcolor");
nameSmear("user1","888888","ff8888"); nameSmear("user2","FF0000","FFFFFF",1);
// --> </script>
Board Titles ColorSmear placement: global footer
<script type="text/javascript"> <!-- // colorsmear on board titles // v1.1 for (ft=document.getElementsByTagName('font'), f=0; f<ft.length; f++) { if ((ft[f].parentNode.className=='welcomebg' || ft[f].parentNode.colSpan!=3) && !document.postForm && (!ft[f].className || (ft[f].className && !ft[f].className=='code')) && !pb_action.match(/headersfooters|modifyprofile/) && ft[f].innerHTML.match(/\[smear:(.*?)\](.*?)\[\/smear:(.*?)\]/i)) { stColor=RegExp.$1; txt=RegExp.$2; edColor=RegExp.$3; getback=colorSmear(stColor, txt, edColor); ft[f].innerHTML=ft[f].innerHTML.replace(/\[smear:(.*?)\](.*?)\[\/smear:(.*?)\]/i,getback); } }
// --> </script>
Custom Title colorSmear placement: global footer code: <script type="text/javascript"> <!-- // colorSmear custom titles v1.0 // by Wormopolis // must have colorSmear function in Global Header above this script // keep header intact
var customTitleArray=new Array(); customTitleArray['admin']=['00FF12','FFFF00']; customTitleArray['littlestwolf']=['00FF12','003399'];
//customTitleArray[username]=[start color, end color];
// no need to edit below
function customSmear() { for (tds=document.getElementsByTagName('td'), d=0; d<tds.length; d++) { if (tds[d].width=='20%' && tds[d].className.match(/windowbg/) && tds[d].vAlign=='top') { for (lnks=tds[d].getElementsByTagName('a'), e=0; e<lnks.length; e++) { if (lnks[e].href.match(/action=viewprofile&user=(.*?)$/)) { //username found var uname=RegExp.$1; if (customTitleArray[uname]) { var stcolor=customTitleArray[uname][0], endcolor=customTitleArray[uname][1]; srch=lnks[e].parentNode; while (srch && (srch.nodeName!='#text' || !srch.nodeValue.match(/member is/))) srch=srch.nextSibling; if (srch && srch.previousSibling.previousSibling.nodeName=='#text') { var ct=srch.previousSibling.previousSibling; var nwct=document.createElement('span'); nwct.innerHTML=colorSmear(stcolor, ct.nodeValue, endcolor); ct.parentNode.replaceChild(nwct, ct); } } } } } } } customSmear();
// --> </script>
Usergroup colorSmear placement: global footer code: <script type="text/javascript"> <!-- // colorSmear usergroups v1.0 // by Wormopolis - [url]www.wormocodes.com[/url] // idea by Nightwalker
function nameSmearUG(groupid,stcolor,endcolor) { for (lnks=document.links, d=0; d<lnks.length; d++) { if (!lnks[d].className.match(/nosmear/) && lnks[d].className.match(new RegExp(groupid+'$','i'))) { tmpv=lnks[d].innerHTML.replace(/<\/?font(.*?)>/gi,''); tmpret=colorSmear(stcolor,tmpv,endcolor); lnks[d].innerHTML=tmpret; } } }
// must have colorSmear function in Global Header above this script // use format nameSmearUG("groupID","startcolor","endcolor");
nameSmearUG("group3","03FF12","103399");
// --> </script>
|
|
Matt
Junior Member
Yep, I like making websites. Websites made: 5
Posts: 61
Matt said 0 great things
|
Post by Matt on Sept 10, 2009 4:05:48 GMT -8
AWSOME!! Thanks Worm!!
|
|
lilac
Not New Member
Posts: 5
lilac said 0 great things
|
Post by lilac on Nov 14, 2009 5:13:46 GMT -8
I don't understand the username one.
|
|
|
Post by Wormopolis on Nov 14, 2009 10:43:02 GMT -8
username code bug fix: group colors from PB stripped off before function runs.
|
|
|
Post by Wormopolis on Nov 14, 2009 10:44:37 GMT -8
I don't understand the username one. basically, you put the colorsmear function in your global header, and the username one in your global footer. then the username code needs to be edited with each name you want to apply it to. see the "namesmear" function call at the bottom?
|
|
|
Post by Wormopolis on Dec 5, 2009 19:32:12 GMT -8
Version update 1.2: fixed bug that wouldnt parse HTML tags embedded in text.
|
|
|
Post by Wormopolis on Jan 12, 2010 3:03:17 GMT -8
new code added for covering board titles.
|
|
littlestwolf
Not New Member
Custom Titles can be smeared!
Posts: 3
littlestwolf said 0 great things
|
Post by littlestwolf on Sept 11, 2010 7:05:09 GMT -8
Awwwesome code, but I was wondering, is there a way to smear the custom titles?
|
|
Flame
Not New Member
I don't know much about the codes and terms of the computer world. Please be patient with me.[Sj1:0]
Posts: 20
Flame said 0 great things
|
Post by Flame on Sept 12, 2010 2:52:11 GMT -8
I don't know how to coloursmear my name. Can anyone help me?
|
|
|
Post by Wormopolis on Sept 12, 2010 3:00:07 GMT -8
only if you promise to resize those images in your signature... HUGE CAT!
the first code needs to be in global headers. the third code needs to be in global footers.
to edit the third code, see this line: nameSmear("test","03FF12","103399");
the first parameter is the username (not display name), the second is the start color, the third is the end color.
so if you are admin it would be nameSmear("admin","FF0000","00FFFF");
and your name would go from red to teal.
if you are wondering how user can do this for themselves, this wont be possible because there just isnt enough room in the display name to have all the info it would need. You will need to add in additional namesmear calls to accomodate each user
nameSmear("bob","864856","FFFF00"); nameSmear("dave","03FF12","103399"); nameSmear("mary","111111","00FF00");
|
|
littlestwolf
Not New Member
Custom Titles can be smeared!
Posts: 3
littlestwolf said 0 great things
|
Post by littlestwolf on Sept 12, 2010 3:14:42 GMT -8
I got skipped over :[
is there a way to smear the custom titles?
|
|
|
Post by Wormopolis on Sept 12, 2010 3:32:48 GMT -8
I got skipped over :[ is there a way to smear the custom titles? sorry about that.... THAT is a good question... the harder part will be figuring out what a custom title is. if you go by the fact that there is something under a name in the miniprofile, then post ranks would be affected to.. I will have to put some thought into this...
|
|
littlestwolf
Not New Member
Custom Titles can be smeared!
Posts: 3
littlestwolf said 0 great things
|
Post by littlestwolf on Sept 12, 2010 16:53:06 GMT -8
Thats alright ^^ In case I was confusing, (very possible), this is the custom title I'm talking about...
|
|
|
Post by Wormopolis on Sept 12, 2010 19:36:27 GMT -8
Actually might not be as hard as I thought since custom title is always UNDER the stars, unless they dont have one then is shows their online status...
|
|
Flame
Not New Member
I don't know much about the codes and terms of the computer world. Please be patient with me.[Sj1:0]
Posts: 20
Flame said 0 great things
|
Post by Flame on Sept 13, 2010 3:21:11 GMT -8
I took off my cat. Can you help do it for me now?
|
|