var raico_homeUrl = 'http://www.rateicons.com/', raico_cid = 0, raico_label = 'Emo-rate it:', // raico_loc = (!parent.document.location ? document.location : (parent.document.location != document.location ? parent.document.location : document.location ) ).toString(); raico_loc = document.location.toString(); var raico_emos = {"1": {"file":"angry" , "label":"Makes me angry!","modern" : "true","classic" : "true","orange" : "true"},"2": {"file":"undecided" , "label":"Not sure what to think","modern" : "true","classic" : "true","orange" : "true"},"3": {"file":"smiley" , "label":"This is funny","modern" : "true","classic" : "true","orange" : "true"},"4": {"file":"sad" , "label":"Makes me sad","modern" : "true","classic" : "true","orange" : "true"},"5": {"file":"cool" , "label":"This is cool!","modern" : "false","classic" : "true","orange" : "true"},"8": {"file":"hilarious" , "label":"This is hilarious!","modern" : "true","classic" : "true","orange" : "true"},"9": {"file":"cry" , "label":"Makes me cry...","modern" : "true","classic" : "false","orange" : "true"},"10": {"file":"love" , "label":"I love it!","modern" : "true","classic" : "false","orange" : "true"}}; //injecting our css document.writeln(''); if (navigator.appName == 'Microsoft Internet Explorer') document.writeln(''); if (navigator.vendor && navigator.vendor.indexOf('Apple') >= 0) document.writeln(''); if (typeof raico_show != 'function') { function raico_show( options , write ) { var surl, buffer = '', write = (write == null ? true : false), raid = options['id'] || raico_cid++, style = options['style'] || raico_settings['style'] || 'def', rtext = options['label'] || raico_settings['label'] || raico_label, clear = options['clear'] || raico_settings['clear'] || true, dtype = options['dtype'] || raico_settings['dtype'] || 'small', emopack = options['pack'] || raico_settings['pack'] || "classic"; var raico_v = (document.location.toString().indexOf('http://www.rateicons.com/embed.php') == -1 ? raico_get_cookie('raico_0_'+raid) : null); buffer += '
'+(rtext != 'false' ? (raico_v > 0 ? 'Emo-rated!' : ''+rtext+'') : '')+' '; for (var i = 0; i < raico_options.length; i++) { surl = "javascript:raico_svote('"+raid+"','"+(options['id'] || 0)+"','"+raico_options[i]['id']+"','"+fix_sq(options['title']||'')+"','" +fix_sq(options['url'] || raico_settings['url'] || raico_loc || '')+"')"; if (raico_emos[raico_options[i]['id']] && raico_emos[raico_options[i]['id']][emopack] == 'true') { if (dtype == 'small') { buffer += ""; } else if (dtype == 'full') { buffer += "
"+raico_emos[raico_options[i]['id']].label+"
"; } } } buffer += ""; buffer += '
'; if (clear) buffer +='
'; if (write) { document.writeln(buffer); if (raico_v != null) raico_svisual(raid, raico_v); } else return(buffer); } function raico_svote( raid, id, voted, title, url) { // send vote cross-domain via iframe document.getElementById('raico_fr_'+raid).innerHTML = ''; // set cookie to remember this vote raico_set_cookie('raico_0_'+raid, voted, 365, '/', location.hostname); raico_svisual( raid, voted); } function raico_svisual ( raid, voted ) { for (i=0; i < raico_options.length; i++) { var iid = 'raico_i_'+raid+'_'+raico_options[i]['id']; if (document.getElementById(iid)) { document.getElementById(iid).className = ( raico_options[i]['id'] == voted ? 'active' : 'dis'); } } } function raico_get_cookie( name ) { var start = document.cookie.indexOf( name + "=" ); var len = start + name.length + 1; if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) { return null; } if ( start == -1 ) return null; var end = document.cookie.indexOf( ';', len ); if ( end == -1 ) end = document.cookie.length; return unescape( document.cookie.substring( len, end ) ); } function raico_set_cookie( name, value, expires, path, domain, secure ) { var today = new Date(); today.setTime( today.getTime() ); if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name+'='+escape( value ) + ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString() ( ( path ) ? ';path=' + path : '' ) + ( ( domain ) ? ';domain=' + domain : '' ) + ( ( secure ) ? ';secure' : '' ); } function addslashes(str) { str=str.replace(/\'/g,'\\\''); str=str.replace(/\"/g,'\\"'); str=str.replace(/\\/g,'\\\\'); str=str.replace(/\0/g,'\\0'); str=str.replace(/\\\\/g,'\\'); return str; } function stripslashes(str) { str=str.replace(/\\'/g,'\''); str=str.replace(/\\"/g,'"'); str=str.replace(/\\\\/g,'\\'); str=str.replace(/\\0/g,'\0'); return str; } function fix_sq (str) { if (str != null) { str=str.replace(/\'/g,'‘'); return str; } else return null; } /* hooks for blog platforms */ function raico_hook () { if ( pname == 'typepad' ) { // checking if running in preview if (document.location.toString().indexOf('/design/widgets') > 0) { raico_show({}); } else { // hook rateicons to blog posts var articles = getElementsByClass('entry',null,'div'); for (var i=0; i < articles.length; i++) { var tmp = getElementsByClass('entry-content',articles[i],'div'); var tmp2 = getElementsByClass('entry-header',articles[i],'h3'); if (tmp[0] && tmp2[0]) { var raid = articles[i].id.replace('entry-',''); tmp[0].innerHTML += raico_show({'id' : raid , 'title' : tmp2[0].innerHTML.replace(/(<([^>]+)>)/ig,"") },false); var raico_v = raico_get_cookie('raico_0_'+raid); if (raico_v != null) raico_svisual(raid, raico_v); } } } } else if ( pname == 'blogger' ) { // hook rateicons to blog posts var articles = getElementsByClass('post',null,'div'); for (var i=0; i < articles.length; i++) { var tmp = getElementsByClass('post-body',articles[i],'div'); var tmp2 = getElementsByClass('post-title',articles[i],'h3'); if (tmp[0] && tmp2[0]) { var raid = articles[i].getElementsByTagName('a')[0].name.substr(-6); tmp[0].innerHTML += raico_show({'id' : raid , 'title' : tmp2[0].innerHTML.replace(/(<([^>]+)>)/ig,"") },false); var raico_v = raico_get_cookie('raico_0_'+raid); if (raico_v != null) raico_svisual(raid, raico_v); } } } else { alert ("I'm lost..."); } } function getElementsByClass(searchClass,node,tag) { var node = (node == null ? document : node); var tag = (tag == null ? '*' : tag); var classElements = new Array(); var els = node.getElementsByTagName(tag); // use "*" for all elements var elsLen = els.length; var pattern = new RegExp("\\b"+searchClass+"\\b"); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } //Setup the event function DomReady(fn) { //W3C if(document.addEventListener) { document.addEventListener("DOMContentLoaded", fn, false); } //IE else { document.onreadystatechange = function(){readyState(fn)} } } //IE execute function function readyState(fn) { //dom is ready for interaction if(document.readyState == "interactive") { fn(); } } function raicoKillCookie(options) { var raid = options['id'] || (raico_cid); // alert("raico_set_cookie('raico_0_"+raid+"', '', \"expires=Thu, 01-Jan-1970 00:00:01 GMT\", '/', location.hostname);"); raico_set_cookie('raico_0_'+raid, '', -1, '/', location.hostname); } //create onDomReady Event window.onDomReady = DomReady; }