Author |
Topic |
|
SiSL
Average Member
Turkey
671 Posts |
Posted - 19 October 2005 : 16:24:55
|
This mini-mod actually helps you use any HEX color on your forum code.
Example: [color="#FF00FF"]Text here[/color="#FF00FF"]
Add this function somewhere in your inc_func_common.asp
Function doColorCode(fstring)
set re = new RegExp
re.pattern = "\[color=("")(\#)([a-f0-9]{6})+("")\]"
re.ignorecase = true
re.global = true
set matches = re.execute(fstring) ' find matches
if matches.count <> 0 then
for each match in matches
changetext = Replace(Replace(match.value,"[color=" &chr(34),"<span style=""color: "),chr(34) & "]",chr(34) & ">")
fstring = Replace(fstring, match.value, changetext)
next
end if
re.pattern = "\[\/color=("")(\#)([a-f0-9]{6})+("")\]"
re.ignorecase = true
re.global = true
set matches = re.execute(fstring) ' find matches
if matches.count <> 0 then
for each match in matches
changetext = Replace(Replace(match.value,"[/color=" & chr(34) ,"</span style=""color: "),chr(34) & "]",chr(34) & ">")
fstring = Replace(fstring, match.value, changetext)
next
end if
doColorCode = fstring
set re = nothing
set matches = nothing
end function
Find following line in inc_func_common.asp
fString = extratags(fString)
Add following right above it:
fString = doColorCode(fstring)
And that's it :)
I would love someone can actually write a "Prompt" mode addition to it, but I guess best way is to make an iframe visible on an icon and let users pick colors :)
You can see a working demo at with using [renk="#FF0000"]test[/renk] (because renk = color in my language :P)
http://www.amedia.org/forum/ User: demo Password: test
EDIT: Updated Font Tags with SPAN< |
CHIP Online Forum
My Mods Select All Code | Fix a vulnerability for your private messages | Avatar Categories W/ Avatar Gallery Mod | Complaint Manager Admin Level Revisited | Merge Forums | No More Nested Quotes Mod
|
Edited by - SiSL on 20 October 2005 05:15:51 |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 20 October 2005 : 04:29:22
|
Nifty mod you've got there SiSL!!!!! Impressive! Quick question though about using the font tag ; I've been told by many people already that the <font> tag is 'deprecated'. In other words ; we shoulnd't use it anymore... So, you might want to use <SPAN style="text-color: #EAEAAE">
With that in mind you could also whipp up a nice 'magic marker' mod from this mod. For instance : [marker="#123456"]blabla[/marker] which then is transformed into something like this: <SPAN style="background-color: #123456">blabla</span>.
(I see you know how to create a regular expression, so I alsmost do not dare to ask, but do you think you could remodel this mod to a regular expression ánd so that it uses the [tip=""][/tip] instead of [tip=**][/tip] syntax ? It would be very much appreciated if you could have a look at that mod, to see if it's possible! However, it's not easy to define a recurring pattern between the ""'s, as it's free format text....of any length...)< |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 20 October 2005 04:31:32 |
|
|
SiSL
Average Member
Turkey
671 Posts |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
|
SiSL
Average Member
Turkey
671 Posts |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 20 October 2005 : 05:21:45
|
I'm not sure I agree with the [quote = "nick"] approach as people could abuse it and start wrongly attributing comments to other users< |
|
|
SiSL
Average Member
Turkey
671 Posts |
|
SiSL
Average Member
Turkey
671 Posts |
Posted - 20 October 2005 : 05:35:53
|
quote: Originally posted by MarcelG
(I see you know how to create a regular expression, so I alsmost do not dare to ask, but do you think you could remodel this mod to a regular expression ánd so that it uses the [tip=""][/tip] instead of [tip=**][/tip] syntax ? It would be very much appreciated if you could have a look at that mod, to see if it's possible! However, it's not easy to define a recurring pattern between the ""'s, as it's free format text....of any length...)
Here you go (with that, you cannot use " (quote) in tips tho..
EDIT: code makes it problem, here is link
I guess one of downsides of this, cursor don't really follow [tip][/tip] line. it changes front [tip] to yours and final tip to </span>
and oops, sorry, fixed the link< |
CHIP Online Forum
My Mods Select All Code | Fix a vulnerability for your private messages | Avatar Categories W/ Avatar Gallery Mod | Complaint Manager Admin Level Revisited | Merge Forums | No More Nested Quotes Mod
|
Edited by - SiSL on 20 October 2005 05:43:55 |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 20 October 2005 : 05:43:14
|
quote: Originally posted by SiSL Here you go (with that, you cannot use " (quote) in tips tho.. EDIT: code makes it problem, here is link
Thanks, but that link isn't working (it points to forum.snitz.com)< |
portfolio - linkshrinker - oxle - twitter |
|
|
SiSL
Average Member
Turkey
671 Posts |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 20 October 2005 : 06:20:46
|
Great!!! Thanks! Now just finding a way to replace all instances of tip=** by tip=""
By the way, looking at the function, I see that it makes no difference for images being used inbetween the tip-tag. Do you reckon you could update the function to leave out the span style in case the text between the tip-tags is an image (e.g. starts with [img] or [bimg=left] or [img=left] or [img=right] or [bimg=right], and ends with [/img], or [/img=left] or [/bimg=left] or [/bimg=right] or [/img=right] (upper/lowercase) ?)
Sorry to take this topic completely offtrack by the way....< |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 20 October 2005 06:21:26 |
|
|
SiSL
Average Member
Turkey
671 Posts |
|
|
Topic |
|