|
Post by Wormopolis on Jan 20, 2012 20:02:00 GMT -8
browsers tested: IE, Chrome and FF placement: global header and anywhere
This will put an image of a candle, and some text explaining what the candle is for on the page. clicking the candle will light it, and it will stay lit from then on. if you have better images, feel free to change them and change the image sizes in the code to make it fit. div will have class "memorycandle" so you can use CSS.
there is a global header part that needs to be above any calls to the candlemaker:
<style type="text/css"> .memorycandle {font-style: italic;} </style>
<script type="text/javascript"> <!-- // in memory candle v1.0 // by Wormopolis - www.wormocodes.com // header function
var unlitImage="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/unlit-candle.gif"; var litImage="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/lit-candle.gif"; var daysToStoreLitCandles=30;
function candleMemory(id) { exptime=new Date(); exptime.setDate(exptime.getDate()+daysToStoreLitCandles); document.cookie='candleholder_'+id+'=lit; expires='+exptime; }
function candlemaker(id, text) { keep = document.cookie.match(new RegExp('candleholder_'+id+'=lit($|;)','')); stCandleImage=keep ? litImage : unlitImage; if (keep) candleMemory(id); var cndle='<div class="memorycandle" style="background-image: url(' + stCandleImage + '); height:315; width:210" onclick="this.style.backgroundImage=\'url(' + litImage + ')\'; candleMemory(\''+ id +'\');" height="315px" width="210px">' + text + '</div>'; return cndle;
}
// --> </script>
and to make a candle appear, isert this small script anywhere you want it to show, be it in a cell, another div, or just to the page itself:
<script type="text/javascript"> <!-- // example for placing a candle. // candlemaker(id, text) // id must be unique for each candle
document.write(candlemaker("etta","Etta James - Rest In Piece")); // --> </script>
To place in a post, this needs to be in board or global footer:
<script type="text/javascript"> <!-- // Candles in posts v1.0 // by Wormopolis - www.wormocodes.com // id must be unique for each candle // header function must be present
var ubbcCandleImage="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/candle.jpg";
if (document.postForm) { var ubbctray=document.postForm.color.parentNode; ubbctray.appendChild(document.createElement('br')); var candleButton=document.createElement('a'); candleButton.href='javascript:add("[candle=ID,DESCRIPTION]")'; candleButton.title='ID must be unique for each candle'; var candleButtonImage=document.createElement('img'); candleButtonImage.border=0; candleButtonImage.src=ubbcCandleImage; candleButton.appendChild(candleButtonImage); ubbctray.appendChild(candleButton); }
if (pb_action.match(/display|recent|pmview/)) { for (tds=document.getElementsByTagName('td'), tt=0; tt<tds.length; tt++) { if (tds[tt].width=='80%' && tds[tt].className.match(/windowbg/) && tds[tt].vAlign=='top' && tds[tt].innerHTML.match(/\[candle=(.*?),(.*?)\]/)) { tds[tt].innerHTML=tds[tt].innerHTML.replace(/\[candle=(.*?),(.*?)\]/gi,function(bulk, cid, cdes) {return candlemaker(cid,cdes);}); } } } // --> </script>
|
|
|
Post by Wormopolis on Feb 10, 2012 22:46:37 GMT -8
update: added a footer code for putting candles in posts. dont burn anything down.
|
|
|
Post by rhondairv on Feb 11, 2012 21:02:11 GMT -8
Very cool!
|
|
|
Post by Wormopolis on Feb 11, 2012 23:55:29 GMT -8
no no.. fire is hot
|
|