Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Senkusha - toukokuu 02, 2005, 10:00:29 AP

Otsikko: Blink Tag?
Kirjoitti: Senkusha - toukokuu 02, 2005, 10:00:29 AP
Where would I add the ability to support the <blink> html tag?
Otsikko: Re: Blink Tag?
Kirjoitti: shanks - toukokuu 02, 2005, 03:40:14 IP
In subs.php

Find
'~\[s\](.+?)\[/s\]~i' => isset($disabled['s']) ? '$1' : '<del>$1</del>',

Add after
'~\[blink\](.+?)\[/blink\]~i' => isset($disabled['blink']) ? '$1' : '<blink>$1</blink>',

I have no idea how it works, but it does  :D
Otsikko: Re: Blink Tag?
Kirjoitti: Senkusha - toukokuu 03, 2005, 12:17:58 IP
I tried adding that, but it does not work.
Otsikko: Re: Blink Tag?
Kirjoitti: shanks - toukokuu 03, 2005, 03:18:45 IP
Are you using [blink] and [/blink], or <blink> and </blink>?

For this to work you have to use [blink] and [/blink].

-shanks
Otsikko: Re: Blink Tag?
Kirjoitti: Senkusha - toukokuu 04, 2005, 06:22:08 IP
I found the problem.  the Blink tag is not directly supported by IE.  So, instead, I had to use the tag in combination with the following JavaScript:


<script type="text/javascript">
function blinkIt() {
if (!document.all) return;
else {
   for(i=0;i<document.all.tags(\'blink\').length;i++){
      s=document.all.tags(\'blink\')[i];
      s.style.visibility=(s.style.visibility==\'visible\')?\'hidden\':\'visible\';
   }
}
}
</script>


And then, I had to change the following:


<body onload="setInterval(\'blinkIt()\',500)">


This was all done in the index.template.php file.

With this code, I can control how fast it the blinks blink by changing the parameter in the setInterval funtion.  What would  be even more cool, would be an optional argument in the [blink] tag itself to set the speed.  I'm not sure if SMF supports optional attributes though.
Otsikko: Re: Blink Tag?
Kirjoitti: RomanyX - tammikuu 10, 2006, 05:10:58 IP
Senkusha, I'd love to see this tag developed further.

SMF does support optional attributes. See Sheepy's Enhanced Move Tag (http://mods.simplemachines.org/index.php?a=download;mod=221;id=11473) for a great example. :D

Also, please let me know if you are interested in coming up with javascripts to make some other tags universal.  ???