T O P I C R E V I E W |
SiSL |
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< |
11 L A T E S T R E P L I E S (Newest First) |
SiSL |
Posted - 20 October 2005 : 08:27:36 Not sure what you mean really? :( < |
MarcelG |
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....< |
SiSL |
Posted - 20 October 2005 : 05:47:00 Changed link and you know you have to add fString = doTips(fstring)
EDIT: I changed your function again Marcel (updated txt in link) now you can also use " (quote) too..
Such as:
[tip="This is "the mighty" MarcelG"]Tip here[/tip]< |
MarcelG |
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)< |
SiSL |
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< |
SiSL |
Posted - 20 October 2005 : 05:33:07 quote: Originally posted by HuwR
This can be already abused
Like that :) So I dont think it is much of thing that is "actually" would be believed by users without seeing original reply that is quoted.< |
HuwR |
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 |
Posted - 20 October 2005 : 05:11:40 Btw <span style="color: #color"> rather than text-color, text-color do not work :)< |
MarcelG |
Posted - 20 October 2005 : 05:00:10 ooooooh....this opens up so many hot possibilities!!!! < |
SiSL |
Posted - 20 October 2005 : 04:33:53 I will take a look quickly :)
PS: Same can be applied to [quote="nick"]message[/quote] I guess too :) Hmm I may go further with [quote nick="post" time="this" replyid="this"] stuff :P (btw I added stuff for people picking colors on my website)
But point there in your mod, there is no limiter like (6) characters top will be only A-F and 0-9 characters, there for need a task still removing unwanted stuff such as < > however, I guess it may work out well :) < |
MarcelG |
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...)< |