Nightwalker
Full Member
Everything Happens at Night
Posts: 138
Nightwalker said 0 great things
|
Post by Nightwalker on Sept 22, 2010 16:54:57 GMT -8
Write a code...
|
|
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 23, 2010 3:14:26 GMT -8
But I dont know how!
|
|
Nightwalker
Full Member
Everything Happens at Night
Posts: 138
Nightwalker said 0 great things
|
Post by Nightwalker on Sept 29, 2010 16:37:15 GMT -8
Wormo you should make this code work with usergroups...is that possible?
|
|
|
Post by Wormopolis on Sept 29, 2010 17:34:02 GMT -8
well.. do you mean smear everyone's name in a particular user group, or smear the title of the user group in a mini profile?
|
|
Nightwalker
Full Member
Everything Happens at Night
Posts: 138
Nightwalker said 0 great things
|
Post by Nightwalker on Sept 29, 2010 18:55:41 GMT -8
everyone in a usergroup
|
|
wildgoosespeeder
Code Helper
Tiers are for strangers!
Posts: 530
wildgoosespeeder said 161 great things
|
Post by wildgoosespeeder on Sept 29, 2010 19:42:08 GMT -8
<script type="text/javascript"> <!-- // colorSmear display names v1.1 // by Wormopolis - www.wormocodes.com
function nameSmear(uname,stcolor,endcolor) { for (lnks=document.links, d=0; d<lnks.length; d++) { if (!lnks[d].className.match(/nosmear/) && lnks[d].href.match(new RegExp('profile&user='+uname,'g'))) { 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 nameSmear("username","startcolor","endcolor");
nameSmear("test","03FF12","103399");
// --> </script>
I just noticed a potential flaw with this code. What if someone had a username of "testa" or "test2" for example? This code would apply it to those usernames too! Just do: new RegExp('profile&user='+uname+'$','g')
|
|
|
Post by Wormopolis on Sept 30, 2010 0:35:24 GMT -8
yeah I wrote that before I really understood regexp all that well. good catch. I will add that into the OP.
|
|
|
Post by Wormopolis on Sept 30, 2010 0:44:20 GMT -8
try this.. if it works I will add it to the OP <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("group1","03FF12","103399");
// --> </script>
|
|
Nightwalker
Full Member
Everything Happens at Night
Posts: 138
Nightwalker said 0 great things
|
Post by Nightwalker on Sept 30, 2010 13:59:03 GMT -8
I believe that works
Tested it with one and two user groups and didn't have a problem. Is there anything else i should test?
Thanks wormo we might use this on Nightcodes...
|
|
|
Post by Wormopolis on Sept 30, 2010 16:09:12 GMT -8
make sure it works with a possibility like someone having a group1 and a group11 to make sure it doesnt try to make both the same.
|
|
Nightwalker
Full Member
Everything Happens at Night
Posts: 138
Nightwalker said 0 great things
|
Post by Nightwalker on Sept 30, 2010 18:29:26 GMT -8
ok just a sec...
No it does not work with "1" and "11"
|
|
|
|
Post by Wormopolis on Sept 30, 2010 22:57:27 GMT -8
oooh.. I do. just have to implement some sort of popup to input colors.
|
|
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 Oct 1, 2010 6:46:46 GMT -8
Well, is there any code where you can coloursmear the thread title?
|
|
wildgoosespeeder
Code Helper
Tiers are for strangers!
Posts: 530
wildgoosespeeder said 161 great things
|
Post by wildgoosespeeder on Oct 1, 2010 15:45:55 GMT -8
I made a few fixes to the colorSmear tag code. When you press , , or , the tag wouldn't parse in the Topic Summary table. That's been fixed thanks to this boolean: !document.postForm && tds.innerHTML.match(/\[smear=(.+?).+?)\](.+?)\[\/smear\]/gi) || document.postForm && (tds.width=="100%" && tds.className.match(/windowbg2/) && tds.innerHTML.match(/\[smear=(.+?).+?)\](.+?)\[\/smear\]/gi) && tds.parentNode.parentNode.parentNode.cellPadding=="4" || tds.height=="100%" && tds.width=="80%" && tds.vAlign=="top" && tds.align=="left" && tds.className.match(/windowbg(2)?/) && tds.innerHTML.match(/\[smear=(.+?).+?)\](.+?)\[\/smear\]/gi))I also changed the tag syntax to [smear=FE1261:1120DD][/smear] to make it look more like typical UBBC tags. This is just my prefrence. I also added my own coding style to hopefully make things execute faster. The way this code runs will parse in locations that default ProBoards UBBC tags do. <script language="javascript"> // Revised colorSmear UBBC Tag by wildgoosespeeder // Original Concept By Wormopolis - [url]www.wormocodes.com[/url] // must have colorSmear function in Global Header above this script
if(!location.href.match(/action=(headersfooters|boardmodify|categorymodify|settings|membergroupmodify|modifyprofile&user=|modifycalendarentry)/)) { var tds=document.getElementsByTagName("td"); var i=tds.length; while(--i) { if(!document.postForm && tds[i].innerHTML.match(/\[smear=(.+?):(.+?)\](.+?)\[\/smear\]/gi) || document.postForm && (tds[i].width=="100%" && tds[i].className.match(/windowbg2/) && tds[i].innerHTML.match(/\[smear=(.+?):(.+?)\](.+?)\[\/smear\]/gi) && tds[i].parentNode.parentNode.parentNode.cellPadding=="4" || tds[i].height=="100%" && tds[i].width=="80%" && tds[i].vAlign=="top" && tds[i].align=="left" && tds[i].className.match(/windowbg(2)?/) && tds[i].innerHTML.match(/\[smear=(.+?):(.+?)\](.+?)\[\/smear\]/gi))) { tds[i].innerHTML = tds[i].innerHTML.replace(/\[smear=(.+?):(.+?)\](.+?)\[\/smear\]/gi,colorSmear(RegExp.$1,RegExp.$3.replace(/<br>/gi,'\n'),RegExp.$2).replace(/\n/g,'<br>')); } } } </script>
|
|