Is possible.
First you need to collect 800 graemlins and rename them so that the graemlin name matches filename, for example graemlin for :happydance: should be happydance.gif (all lower case)
upload them to the images/graemlins directory
then you need to index them all and put 'em in the javascript array.
First make subdirectory jscripts in ubbthreads directory
Here is the perl script to automate it:
#!/usr/bin/perl
$path_to_tas = "/yourfullscriptpath/ubbthreads/images/graemlins/";
print "Content-type: text/html\n\n";
open FS, "ls $path_to_tas|";
@all_ = <FS>;
close FS;
@relevant_ = sort {lc($a) cmp lc($b)}(grep (/\.gif$/i, @all_));
open SF, ">/yourfullscriptpath/ubbthreads/jscripts/graemlins_array.js";
print SF "dl=new Array();\n";
$g_counter=0;
foreach $smile_ (@relevant_){
chomp ($smile_);
$sname = $smile_;
$sname =~ s/\.gif//;
print SF "dl[$g_counter]='$sname';\n";
$g_counter++;
}
close SF;
print "Done!";
exit;
This will create graemlins_array.js file in jscripts directory and fill it something like:
dl=new Array();
dl[0]='aak';
dl[1]='abduction';
dl[2]='admin';
dl[3]='afro';
dl[4]='agent';
dl[5]='agree';
dl[6]='airbaloon';
.....
make another file in the same directory and call it graemlins_select.js. The content of this file:
gpath='/ubbthreads/images/graemlins/';
current='';
d='';
skip = new Array();
for(f=0;f<document.replier.instant.length;f++){skip[document.replier.instant[f].src.split('.gif')[0].split(gpath)[1]]='omit';}
grandom=dl[Math.round(Math.random()*dl.length)];
d+='<table cellpadding="0" cellspacing="0"><tr><td><br /><br /><br /><select class="formboxes" name="egselect" onchange="ShowSmiley(this.options[this.selectedIndex].value);">\n';
d+='<option selected value="'+grandom+'"> Extra Graemlins\n';
for(i=0;i<dl.length;i++){
if (skip[dl[i]] == 'omit') {d+='';}
else {d+='<option value="'+dl[i]+'"> :'+dl[i]+':\n';}
}
d+='</select> &nbsp;&#9658;&nbsp;<br /><br /><br />\n';
d+='</td><td><img id="egimg" src="'+gpath+grandom+'.gif" style="cursor:pointer; cursor:hand;" onclick="AddIt(current)" alt=":'+grandom+':" title=":'+grandom+':" /></td></tr></table>\n';
document.write(d);
function ShowSmiley(i){
document.getElementById('egimg').src=gpath+i+'.gif';
document.getElementById('egimg').alt=':'+i+':';
document.getElementById('egimg').title=':'+i+':';
current=i;
}
function AddIt(sm){
insertAtCaret(document.replier.Body, ' :'+sm+':');
document.replier.Body.focus();
}
Now you need to call these scripts from ubbt_instant_ubbcode.tmpl template:
add
<script type="text/javascript" src="http://yoursite/ubbthreads/jscripts/graemlins_array.js"></script>
<script type="text/javascript" src="http://yoursite/ubbthreads/jscripts/graemlins_select.js"></script>
after
$graemlinlist
Now a little modification needs to be done to the ubbt_inc.php
replace
$graemlinlist .= <<<EOF
<a href="javascript:void(0)" onclick="insertAtCaret(document.replier.Body, ' $code'); document.replier.Body.focus();"><img src="{$config['images']}/graemlins/$image" border="0" alt="$altcode" title="$altcode" /></a> &nbsp;
EOF;
with
$graemlinlist .= <<<EOF
<a href="javascript:void(0)" onclick="insertAtCaret(document.replier.Body, ' $code'); document.replier.Body.focus();"><img name="instant" src="{$config['images']}/graemlins/$image" border="0" alt="$altcode" title="$altcode" /></a> &nbsp;
EOF;
add
$Body = preg_replace('/<img.*?src="\/ubbthreads\/images\/graemlins\/(\w+)\.gif" \/>/', ':$1:', $Body);
AFTER
$Body = str_replace("<img src=\"{$config['images']}/graemlins/$image\" alt=\"\" />","$string",$Body);
then add
if (preg_match_all ("/:(\w+):/i",$Body,$matches,PREG_PATTERN_ORDER)){
$m_length = count($matches[1]);
for ($m=0;$m<$m_length;$m++){
$file_to_check = $matches[1][$m];
if (!file_exists("/usr/home/web/users/a0004302/html/snew/ubbthreads/images/graemlins/".$matches[1][$m].".gif")){
$Body = str_replace(":".$matches[1][$m].":","[".$matches[1][$m]."]",$Body);
} else {
$Body = str_replace(":".$matches[1][$m].":","<img border=\"0\" alt=\"[".$matches[1][$m]."]\" title=\"".$matches[1][$m]."\" src=\"/ubbthreads/images/graemlins/".$matches[1][$m].".gif\" />",$Body);
}
}
}
AFTER
else {
@eval("\$string = $code;");
$string = preg_quote($string,'/');
$Body = preg_replace("/(:|\[)$string(:|\])/i","<img src=\"{$config['images']}/graemlins/$image\" alt=\"\" />",$Body);
}
}
I think this is it.
What it does is it loads all the graemlins you have in the <select>element less the instant graemlins displayed and shows the clickable image when you select a graemlin from the list.
Any of the extra graemlins could be used as normal ones
:extragraemlin:
ubbt_inc modication is for converting ubb code to html code and back.
The last bit: IF YOU DO NOT FULLY UNDERSTAND HOW THE ABOVE MODIFICATION WORKS DO NOT TRY IT!!!