var victor = { init: function(){ $("#victor-sayText-textarea").val(""); window.setTimeout(victor.cycleexpressions, 15000); }, say: function(text, expression){ //sayText (txt,voice,lang,engine,[effect], [effLevel]) if(!expression) sayText(""+text+"", 8, 1, 2, "S", 2 ); else sayText(text, 5, 1, 2, "S", 2 ); }, speak: function(){ victor.say( $("#victor-sayText-textarea").val() ); }, cycleexpressions: function(){ victor.express(Math.ceil(Math.random()*22)); window.setTimeout(victor.cycleexpressions, (Math.random()*5000)+10000); }, express: function(type){ if(type == "aha" || type == 1) victor.es("\\_Aha"); if(type == "laugh" || type == 2) victor.es("\\_Laugh_02"); if(type == "mm" || type == 3) victor.es("\\_Mmm_01"); if(type == "wow" || type == 4) victor.es("\\_Wow"); if(type == "laugh" || type == 5) victor.es("\\_Laugh_03", 2, 1.5); if(type == "whistle" || type == 6) victor.es("\\_Whistle_03", 7, 1.5); if(type == "whistle 2" || type == 7) victor.es("\\_Whistle_04", 7, 1.5); if(type == "ah" || type == 8) victor.es("\\_Ah_01", 7, 1.5); if(type == "cough" || type == 9) victor.es("\\_Cough_01", 7, 1.5); if(type == "hm" || type == 10) victor.es("\\_Hm_01", 3, 2); if(type == "hurrah" || type == 11) victor.es("\\_Hurrah", 7, 1); if(type == "kiss" || type == 12) victor.es("\\_Kiss_02", 7, 1); if(type == "short laugh" || type == 13) victor.es("\\_Laugh_01"); if(type == "evil laugh" || type == 14) victor.es("\\_Laugh_04", 2, 3); if(type == "long evil laugh" || type == 15) victor.es("\\_Laugh_05", 2, 4); if(type == "oops" || type == 16) victor.es("\\_Oops", 6, 1); if(type == "ouch" || type == 17) victor.es("\\_Pain_01", 4, 1); if(type == "phoarr" || type == 18) victor.es("\\_Phoarr", 6, 1); if(type == "raspberry" || type == 19) victor.es("\\_Raspberry_01", 6, 1.5); if(type == "clear throat" || type == 20) victor.es("\\_Throat_01", 3, 1); if(type == "uhuh" || type == 21) victor.es("\\_Uhuh_02", 3, 1); if(type == "woh" || type == 22) victor.es("\\_Woh_02", 7, 2.5); }, es: function(sound, typeId, duration, amp){ setFacialExpression(typeId, duration, amp); victor.say(sound, true); }, preview: function(){ victor.speak(); setGaze(90, 4); }, random: function(){ var text = [ "Go Blue!", "The Big Chill at The Big House, December 11, 2010", "Hail To The Victors", "Leaders and Best", "Maize and Blue", "Buy your tickets for The Big Chill at The Big House today", "He shoots, he scores!" ]; $("#victor-sayText-textarea").val( text[Math.floor(Math.random()*text.length)] ); }, send: function(){ $("#victor-send").dialog({ //title: "SEND", resizable: false, modal: true, draggable: false, buttons: { send: victor.sendtofriend } }); $("#victor-send-url") .val( (window.location.href.indexOf("?") != -1) ? window.location.href.substring(0, window.location.href.indexOf("?")) + "?" + $.param({ t: victor.encode($("#victor-sayText-textarea").val()) }) : window.location.href + "?" + $.param({ t: victor.encode($("#victor-sayText-textarea").val()) }) ) .click(function(){ $(this).select(); }); }, sendtofriend: function(){ $.ajax({ url: "victor-sendtofriend.php", type: "POST", data: $("#victor-send-tofriend").serialize() + "&t=" + $("#victor-sayText-textarea").val(), success: function(data){ $("#victor-send-msg").html(data); $("#victor-send-friendsemail, #victor-send-friendsname").val(""); } }); return false; }, loaded: function(){ victor.init(); victor.say( "Arbry's present The Big Chill at the Big House. Michigan versus Michigan State. December eleventh 2010. Let's play hockey!" ); }, cuss: function(str){ return str .replace(/^fuck |^damn |^shit |^dam |^bitch |^ass |^asshole |^cock |^dickpenis |^vagina |^cunt |^shit |^shithead |^fuck |^fucker |^motherfucker |^mothafucka |^muthafucka |^pussy |^slut |^douche |^douchebag |^scrotum |^tits |^boobs |^breasts |^clitoris |^clit |^anus |^bitch |^fucking |^fuckin |^fucked |^fucks |^anal |^bitches |^whore |^prostitute |^cocksucker |^nipple |^gay |^homo |^homosexual |^fag |^fagget |^faggit |^sex |^blow me /gi, "**** ") .replace(/ fuck$| damn$| shit$| dam$| bitch$| ass$| asshole$| cock$| dickpenis$| vagina$| cunt$| shit$| shithead$| fuck$| fucker$| motherfucker$| mothafucka$| muthafucka$| pussy$| slut$| douche$| douchebag$| scrotum$| tits$| boobs$| breasts$| clitoris$| clit$| anus$| bitch$| fucking$| fuckin$| fucked$| fucks$| anal$| bitches$| whore$| prostitute$| cocksucker$| nipple$| gay$| homo$| homosexual$| fag$| fagget$| faggit$| sex$| blow me$/gi, " ****") .replace(/^fuck$|^damn$|^shit$|^dam$|^bitch$|^ass$|^asshole$|^cock$|^dickpenis$|^vagina$|^cunt$|^shit$|^shithead$|^fuck$|^fucker$|^motherfucker$|^mothafucka$|^muthafucka$|^pussy$|^slut$|^douche$|^douchebag$|^scrotum$|^tits$|^boobs$|^breasts$|^clitoris$|^clit$|^anus$|^bitch$|^fucking$|^fuckin$|^fucked$|^fucks$|^anal$|^bitches$|^whore$|^prostitute$|^cocksucker$|^nipple$|^gay$|^homo$|^homosexual$|^fag$|^fagget$|^faggit$|^sex$|^blow me$/gi, "****"); }, _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode : function (input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = this._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, // public method for decoding decode : function (input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = this._utf8_decode(output); return output; }, // private method for UTF-8 encoding _utf8_encode : function (string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, _utf8_decode : function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } } vh_sceneLoaded = victor.loaded; $(function(){ $("#victor-input-preview").click(victor.preview) $("#victor-input-random").click(victor.random); $("#victor-input-send").click(victor.send); $("#victor-sayText-textarea").keyup(function(){ var val = victor.cuss($(this).val()); $(this).val(val); if(val.length > 250) $(this).val(val.substring(0, val.length-1)); }) });