// This script file contains 2 major sections, one for the AJAX chat, and one for the FAT
// technique. The AJAX chat script part is below the FAT part
// @name The Fade Anything Technique
// @namespace http://www.axentric.com/aside/fat/
// @version 1.0-RC1
// @author Adam Michela
var Fat = {
make_hex : function (r,g,b)
{
r = r.toString(16); if (r.length == 1) r = '0' + r;
g = g.toString(16); if (g.length == 1) g = '0' + g;
b = b.toString(16); if (b.length == 1) b = '0' + b;
return "#" + r + g + b;
},
fade_all : function ()
{
var a = document.getElementsByTagName("*");
for (var i = 0; i < a.length; i++)
{
var o = a[i];
var r = /fade-?(\w{3,6})?/.exec(o.className);
if (r)
{
if (!r[1]) r[1] = "";
if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]);
}
}
},
fade_element : function (id, fps, duration, from, to)
{
if (!fps) fps = 30;
if (!duration) duration = 3000;
if (!from || from=="#") from = "#FFFF33";
if (!to) to = this.get_bgcolor(id);
var frames = Math.round(fps * (duration / 1000));
var interval = duration / frames;
var delay = interval;
var frame = 0;
if (from.length < 7) from += from.substr(1,3);
if (to.length < 7) to += to.substr(1,3);
var rf = parseInt(from.substr(1,2),16);
var gf = parseInt(from.substr(3,2),16);
var bf = parseInt(from.substr(5,2),16);
var rt = parseInt(to.substr(1,2),16);
var gt = parseInt(to.substr(3,2),16);
var bt = parseInt(to.substr(5,2),16);
var r,g,b,h;
while (frame < frames)
{
r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
h = this.make_hex(r,g,b);
setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);
frame++;
delay = interval * frame;
}
setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);
},
set_bgcolor : function (id, c)
{
var o = document.getElementById(id);
o.style.backgroundColor = c;
},
get_bgcolor : function (id)
{
var o = document.getElementById(id);
while(o)
{
var c;
if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
if (o.currentStyle) c = o.currentStyle.backgroundColor;
if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
o = o.parentNode;
}
if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
return c;
}
}
function jal_apply_filters(s) {
return filter_smilies(make_links((s)));
}
var smilies=[[':arrow:', 'icon_arrow.gif'],
[':D', 'icon_biggrin.gif'],
[':grin:', 'icon_biggrin.gif'],
[':-D', 'icon_biggrin.gif'],
[':-?', 'icon_confused.gif'],
[':???:', 'icon_confused.gif'],
[':?', 'icon_confused.gif'],
[':cool:', 'icon_cool.gif'],
['8-)', 'icon_cool.gif'],
['8)', 'icon_cool.gif'],
[':cry:', 'icon_cry.gif'],
['8-O', 'icon_eek.gif'],
[':shock:', 'icon_eek.gif'],
['8O', 'icon_eek.gif'],
[':evil:', 'icon_evil.gif'],
[':!:', 'icon_exclaim.gif'],
[':idea:', 'icon_idea.gif'],
[':lol:', 'icon_lol.gif'],
[':-x', 'icon_mad.gif'],
[':mad:', 'icon_mad.gif'],
[':x', 'icon_mad.gif'],
[':mrgreen:', 'icon_mrgreen.gif'],
[':-|', 'icon_neutral.gif'],
[':neutral:', 'icon_neutral.gif'],
[':|', 'icon_neutral.gif'],
[':?:', 'icon_question.gif'],
[':razz:', 'icon_razz.gif'],
[':-P', 'icon_razz.gif'],
[':P', 'icon_razz.gif'],
[':oops:', 'icon_redface.gif'],
[':roll:', 'icon_rolleyes.gif'],
[':-(', 'icon_sad.gif'],
[':(', 'icon_sad.gif'],
[':sad:', 'icon_sad.gif'],
[':-)', 'icon_smile.gif'],
[':)', 'icon_smile.gif'],
[':smile:', 'icon_smile.gif'],
[':eek:', 'icon_surprised.gif'],
[':o', 'icon_surprised.gif'],
[':-o', 'icon_surprised.gif'],
[':twisted:', 'icon_twisted.gif'],
[';)', 'icon_wink.gif'],
[';-)', 'icon_wink.gif'],
[':wink:', 'icon_wink.gif']];
function make_links (s) {
target="";
if (s.indexOf(this.location.href)==-1) target=' target="_blank"'; var re = /((http|https|ftp):\/\/[^ ]*)/gi;
text = s.replace(re,"«link»");
return text;
}
var PathToSmiley="http://b1v.lv/wp-includes/images/smilies/";
function filter_smilies(s) {
for (var i = 0; i < smilies.length; i++) {
var replace = '';
var search = smilies[i][0].replace(/(\(|\)|\$|\?|\*|\+|\^|\[|\.|\|)/gi, "\\$1");
re = new RegExp(search, 'gi');
s = s.replace(re, replace);
}
var re =/([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+(\.[-a-z0-9]+)*\.[a-z]{2,6})/gi;
s = s.replace(re,"«email»");
return s;
}
// XHTML live Chat
// author: alexander kohlhofer
// version: 1.0
// http://www.plasticshore.com
// http://www.plasticshore.com/projects/chat/
// please let the author know if you put any of this to use
// XHTML live Chat (including this script) is published under a creative commons license
// license: http://creativecommons.org/licenses/by-nc-sa/2.0/
var jal_loadtimes;
var jal_org_timeout = 8000;
var jal_timeout = jal_org_timeout;
var GetChaturl = "/wp-content/plugins/wordspew/wordspew.php?jalGetChat=yes";
var SendChaturl = "/wp-content/plugins/wordspew/wordspew.php?jalSendChat=yes";
var httpReceiveChat;
var httpSendChat;
var jalSound;
///////////////////////////////////////
//
// Generic onload by Brothercake
// http://www.brothercake.com/
//
///////////////////////////////////////
//onload function
//setup onload function
if(typeof window.addEventListener != 'undefined')
{
//.. gecko, safari, konqueror and standard
window.addEventListener('load', initJavaScript, false);
}
else if(typeof document.addEventListener != 'undefined')
{
//.. opera 7
document.addEventListener('load', initJavaScript, false);
}
else if(typeof window.attachEvent != 'undefined')
{
//.. win/ie
window.attachEvent('onload', initJavaScript);
}
function initJavaScript() {
if (!document.getElementById('chatbarText')) { return; }
document.forms['chatForm'].elements['chatbarText'].setAttribute('autocomplete','off'); //this non standard attribute prevents firefox' autofill function to clash with this script
// initiates the two objects for sending and receiving data
checkStatus(''); //sets the initial value and state of the input comment
checkName(); //checks the initial value of the input name
checkUrl();
jalSound = (jal_getCookie("jalSound")==null || jal_getCookie("jalSound")==1) ? 1 : 0;
jal_loadtimes = 1;
httpReceiveChat = getHTTPObject();
httpSendChat = getHTTPObject();
setTimeout('receiveChatText()', jal_timeout); //initiates the first data query
document.getElementById('shoutboxname').onblur = checkName;
document.getElementById('shoutboxU').onblur = checkUrl;
document.getElementById('chatbarText').onfocus = function () { checkStatus('active'); }
document.getElementById('chatbarText').onblur = function () { checkStatus(''); }
document.getElementById('submitchat').onclick = sendComment;
document.getElementById('chatForm').onsubmit = function () { return false; }
// When user mouses over shoutbox
document.getElementById('chatoutput').onmouseover = function () {
if (jal_loadtimes > 9) {
jal_loadtimes = 1;
receiveChatText();
}
jal_timeout = jal_org_timeout;
}
var obj = "";
ActualSmile="";
style="";
lib="-";
if (jal_getCookie("jalSmiley")==1) {
style="display:none";
lib="+"
}
obj+=""+lib+" Smileys :";
obj+="