The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
Learning from SiSL's Mini-MOD: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=59909 I have modified it to add the national flag of a given country to a post. A bit of a gimic perhaps, but it got be learning!
Example: [flag="united kingdom"]
Most of my flags are work mule's, found on Snitzbitz at http://www.snitzbitz.com/mods/details.asp?Version=All&mid=142
I had to rename some of them to match the country names used by Snitz, and I've added the prefix "flag_" to all. They are stored in the images folder along with all the Snitz icons.
Also added a button to the toolbar beside the insert image button, and added some code to the javascript file to make it work. Will post details if anyone wants. Could perhaps collect all the little flags addons together in one mod if there is interest, I couldn't find a complete flag mod when I was looking.
Can be tested on http://www.charles.net.nz/forum/ Shouldn't need an account, just use the preview.
To the point: There is a problem - if a link (the link text type) is added in the same post as a flag, the flag will not be displayed. I notice the same problem while typing this post - the {code} tags do not work with links of this type. Is there a workaround?
Code also available, with line references, as a text file: http://www.charles.net.nz/steve/function_flags.txt<
Example: [flag="united kingdom"]
Most of my flags are work mule's, found on Snitzbitz at http://www.snitzbitz.com/mods/details.asp?Version=All&mid=142
I had to rename some of them to match the country names used by Snitz, and I've added the prefix "flag_" to all. They are stored in the images folder along with all the Snitz icons.
Also added a button to the toolbar beside the insert image button, and added some code to the javascript file to make it work. Will post details if anyone wants. Could perhaps collect all the little flags addons together in one mod if there is interest, I couldn't find a complete flag mod when I was looking.
Can be tested on http://www.charles.net.nz/forum/ Shouldn't need an account, just use the preview.
To the point: There is a problem - if a link (the link text type) is added in the same post as a flag, the flag will not be displayed. I notice the same problem while typing this post - the {code} tags do not work with links of this type. Is there a workaround?
Code:
function flags(fstring)
set re = new RegExp
re.pattern = "\[flag=("")([a-z\s])+("")\]" ' Pattern: [flag="any amount of letters and spaces"]
re.ignorecase = true
re.global = true
set matches = re.execute(fstring) ' find matches
if matches.count <> 0 then
for each match in matches
flagcountry = Replace(Replace(match.value,"[flag=" &chr(34),""),chr(34) & "]","")
changetext = "<img src=" & chr(34) & strImageUrl & "flag_" & flagcountry & ".gif" & chr(34)
& " alt=" & chr(34) & flagcountry & chr(34) & " title=" & chr(34) & flagcountry & chr(34) & ">"
fstring = Replace(fstring, match.value, changetext)
next
end if
flags = fstring
set re = nothing
set matches = nothing
end function