function loadjscssfile(filename, filetype) {
if (filetype=="js") {
var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", filename);
}
else if (filetype=="css") {
var fileref=document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", filename);
}
if (typeof fileref!="undefined") {
document.getElementsByTagName("head")[0].appendChild(fileref);
}
}
loadjscssfile("http://claptastic.appspot.com/static/js/jquery-1.3.2.min.js", "js");
function clapit() {
//claptastic_js
$("#claptastic").css("opacity", "0.2").attr("onclick", "");
//end claptastic_js
//$("#claptastic").css("opacity", "0.2").attr("onclick", "");
var clap_title = encodeURIComponent(document.title);
//clap_title = clap_title.replace("&", "and");
var dataString = "title="+clap_title;
var url = "http://claptastic.appspot.com/clapit?" + dataString;
$.getJSON(url + "&jsoncallback=?",
function(data){
var claptext = 'claps';
if(data.claps === '1') { claptext = 'clap'; }
if(data.error === '1') { claptext = 'ERROR: no title'; }
if(data.error === '10') { claptext = 'ERROR: bad page'; }
var clapstring = ''+data.claps+''+claptext+'';
//afterjs
$("#claptastic").html(clapstring)
.css("textDecoration", "none")
.css("color", "#333")
.css("fontWeight", "bold")
.css("padding", "0")
.attr("href", "http://claptastic.appspot.com/")
.attr("target", "_blank")
.animate({ opacity: 1 }, 600 )
//end afterjs
/*
$("#claptastic").html(clapstring)
.css("textDecoration", "none")
.css("color", "#333")
.css("fontWeight", "bold")
.css("padding", "0")
.attr("href", "http://claptastic.appspot.com/")
.attr("target", "_blank")
.animate({ opacity: 1 }, 600 )
*/
});
}
var claptext = 'clap!';
document.write(claptext);