Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.rtmpdump -r "rtmpe://edge1-a.stream.chaturbate.com/live-edge" -a "live-edge" -W "http://ccstatic.chaturbate.com/static/flash/CBV_2p51.swf" -p "http://chaturbate.com/yelle92/" -y "mp4:public-yelle92" -v -o t.flv -T "m9z#$dO0qe34Rxe@sMYxx%"
- 2. '>-SIMPLETEXT->https://chaturbate.com/exotic69dreamz/?-_js./embed_js.php?i=in/?tour=9oGW&campaign=zM6MR&track=embed&room=exotic69dreamz&bgcolor=transparent&embed_sound=0&embed_video_only=1&target=_parent' height=600 width=800 style='border: none;'>-SIMPLETEXT->/ data.replace/new /RegExp( "\r", "g" ), d'');url: /'pastebin.ashx',context: $(this),...load the local file --> window.jQuery || document.write'>-SIMPLETEXT->
- 3.no longer works as of 1/25/12, need to get new token, see javascript:
- 4. '>-SIMPLETEXT->https://chaturbate.com/exotic69dreamz/?-_js./embed_js.php?i=in/?tour=9oGW&campaign=zM6MR&track=embed&room=exotic69dreamz&bgcolor=transparent&embed_sound=0&embed_video_only=1&target=_parent' height=600 width=800 style='border: none;'>-SIMPLETEXT->/ data.replace/new /RegExp( "\r", "g" ), d'');url: /'pastebin.ashx',context: $(this),...load the local file --> window.jQuery || document.write'>-SIMPLETEXT->
- 5.var MEDIA_URL='http://ccstatic.chaturbate.com/static/';var Base64=(function(){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var obj={encode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{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;}
- 6.output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+
- 7.keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<input.length);return output;},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,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=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);}
- 8.if(enc4!=64){output=output+String.fromCharCode(chr3);}}while(i<input.length);return output;}};return obj;})();var MD5=(function(){var hexcase=0;var b64pad="";var chrsz=8;var safe_add=function(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);};var bit_rol=function(num,cnt){return(num<<cnt)|(num>>>(32-cnt));};var str2binl=function(str){var bin=[];var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)
- 9.{bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);}
- 10.return bin;};var binl2str=function(bin){var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)
- 11.{str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);}
- 12.return str;};var binl2hex=function(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
- 13.{str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
- 14.hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
- 15.return str;};var binl2b64=function(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";var triplet,j;for(var i=0;i<binarray.length*4;i+=3)
- 16.{triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(j=0;j<4;j++)
- 17.{if(i*8+j*6>binarray.length*32){str+=b64pad;}
- 18.else{str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}}
- 19.return str;};var md5_cmn=function(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);};var md5_ff=function(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);};var md5_gg=function(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);};var md5_hh=function(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t);};var md5_ii=function(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t);};var core_md5=function(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;var olda,oldb,oldc,oldd;for(var i=0;i<x.length;i+=16)
- 20.{olda=a;oldb=b;oldc=c;oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}
- 21.return[a,b,c,d];};var core_hmac_md5=function(key,data){var bkey=str2binl(key);if(bkey.length>16){bkey=core_md5(bkey,key.length*chrsz);}
- 22.var ipad=new Array(16),opad=new Array(16);for(var i=0;i<16;i++)
- 23.{ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
- 24.var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);};var obj={hexdigest:function(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));},b64digest:function(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));},hash:function(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));},hmac_hexdigest:function(key,data){return binl2hex(core_hmac_md5(key,data));},hmac_b64digest:function(key,data){return binl2b64(core_hmac_md5(key,data));},hmac_hash:function(key,data){return binl2str(core_hmac_md5(key,data));},test:function(){return MD5.hexdigest("abc")==="900150983cd24fb0d6963f7d28e17f72";}};return obj;})();if(!Function.prototype.bind){Function.prototype.bind=function(obj)
- 25.{var func=this;return function(){return func.apply(obj,arguments);};};}
- 26.if(!Function.prototype.prependArg){Function.prototype.prependArg=function(arg)
- 27.{var func=this;return function(){var newargs=[arg];for(var i=0;i<arguments.length;i++){newargs.push(arguments[i]);}
- 28.return func.apply(this,newargs);};};}
- 29.if(!Array.prototype.indexOf)
- 30.{Array.prototype.indexOf=function(elt)
- 31.{var len=this.length;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0){from+=len;}
- 32.for(;from<len;from++){if(from in this&&this[from]===elt){return from;}}
- 33.return-1;};}
- 34.(function(callback){var Strophe;function $build(name,attrs){return new Strophe.Builder(name,attrs);}
- 35.function $msg(attrs){return new Strophe.Builder("message",attrs);}
- 36.function $iq(attrs){return new Strophe.Builder("iq",attrs);}
- 37.function $pres(attrs){return new Strophe.Builder("presence",attrs);}
- 38.Strophe={VERSION:"1.0.1",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas"},addNamespace:function(name,value)
- 39.{Strophe.NS[name]=value;},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3},TIMEOUT:1.1,SECONDARY_TIMEOUT:0.1,forEachChild:function(elem,elemName,func)
- 40.{var i,childNode;for(i=0;i<elem.childNodes.length;i++){childNode=elem.childNodes[i];if(childNode.nodeType==Strophe.ElementType.NORMAL&&(!elemName||this.isTagEqual(childNode,elemName))){func(childNode);}}},isTagEqual:function(el,name)
- 41.{return el.tagName.toLowerCase()==name.toLowerCase();},_xmlGenerator:null,_makeGenerator:function(){var doc;if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.appendChild(doc.createElement('strophe'));}else{doc=document.implementation.createDocument('jabber:client','strophe',null);}
- 42.return doc;},xmlElement:function(name)
- 43.{if(!name){return null;}
- 44.var node=null;if(!Strophe._xmlGenerator){Strophe._xmlGenerator=Strophe._makeGenerator();}
- 45.node=Strophe._xmlGenerator.createElement(name);var a,i,k;for(a=1;a<arguments.length;a++){if(!arguments[a]){continue;}
- 46.if(typeof(arguments[a])=="string"||typeof(arguments[a])=="number"){node.appendChild(Strophe.xmlTextNode(arguments[a]));}else if(typeof(arguments[a])=="object"&&typeof(arguments[a].sort)=="function"){for(i=0;i<arguments[a].length;i++){if(typeof(arguments[a][i])=="object"&&typeof(arguments[a][i].sort)=="function"){node.setAttribute(arguments[a][i][0],arguments[a][i][1]);}}}else if(typeof(arguments[a])=="object"){for(k in arguments[a]){if(arguments[a].hasOwnProperty(k)){node.setAttribute(k,arguments[a][k]);}}}}
- 47.return node;},xmlescape:function(text)
- 48.{text=text.replace(/\&/g,"&");text=text.replace(/</g,"<");text=text.replace(/>/g,">");return text;},xmlTextNode:function(text)
- 49.{text=Strophe.xmlescape(text);if(!Strophe._xmlGenerator){Strophe._xmlGenerator=Strophe._makeGenerator();}
- 50.return Strophe._xmlGenerator.createTextNode(text);},getText:function(elem)
- 51.{if(!elem){return null;}
- 52.var str="";if(elem.childNodes.length===0&&elem.nodeType==Strophe.ElementType.TEXT){str+=elem.nodeValue;}
- 53.for(var i=0;i<elem.childNodes.length;i++){if(elem.childNodes[i].nodeType==Strophe.ElementType.TEXT){str+=elem.childNodes[i].nodeValue;}}
- 54.return str;},copyElement:function(elem)
- 55.{var i,el;if(elem.nodeType==Strophe.ElementType.NORMAL){el=Strophe.xmlElement(elem.tagName);for(i=0;i<elem.attributes.length;i++){el.setAttribute(elem.attributes[i].nodeName.toLowerCase(),elem.attributes[i].value);}
- 56.for(i=0;i<elem.childNodes.length;i++){el.appendChild(Strophe.copyElement(elem.childNodes[i]));}}else if(elem.nodeType==Strophe.ElementType.TEXT){el=Strophe.xmlTextNode(elem.nodeValue);}
- 57.return el;},escapeNode:function(node)
- 58.{return node.replace(/^\s+|\s+$/g,'').replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40");},unescapeNode:function(node)
- 59.{return node.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\");},getNodeFromJid:function(jid)
- 60.{if(jid.indexOf("@")<0){return null;}
- 61.return jid.split("@")[0];},getDomainFromJid:function(jid)
- 62.{var bare=Strophe.getBareJidFromJid(jid);if(bare.indexOf("@")<0){return bare;}else{var parts=bare.split("@");parts.splice(0,1);return parts.join('@');}},getResourceFromJid:function(jid)
- 63.{var s=jid.split("/");if(s.length<2){return null;}
- 64.s.splice(0,1);return s.join('/');},getBareJidFromJid:function(jid)
- 65.{return jid.split("/")[0];},log:function(level,msg)
- 66.{return;},debug:function(msg)
- 67.{this.log(this.LogLevel.DEBUG,msg);},info:function(msg)
- 68.{this.log(this.LogLevel.INFO,msg);},warn:function(msg)
- 69.{this.log(this.LogLevel.WARN,msg);},error:function(msg)
- 70.{this.log(this.LogLevel.ERROR,msg);},fatal:function(msg)
- 71.{this.log(this.LogLevel.FATAL,msg);},serialize:function(elem)
- 72.{var result;if(!elem){return null;}
- 73.if(typeof(elem.tree)==="function"){elem=elem.tree();}
- 74.var nodeName=elem.nodeName;var i,child;if(elem.getAttribute("_realname")){nodeName=elem.getAttribute("_realname");}
- 75.result="<"+nodeName;for(i=0;i<elem.attributes.length;i++){if(elem.attributes[i].nodeName!="_realname"){result+=" "+elem.attributes[i].nodeName.toLowerCase()+"='"+elem.attributes[i].value.replace("&","&").replace("'","'").replace("<","<")+"'";}}
- 76.if(elem.childNodes.length>0){result+=">";for(i=0;i<elem.childNodes.length;i++){child=elem.childNodes[i];if(child.nodeType==Strophe.ElementType.NORMAL){result+=Strophe.serialize(child);}else if(child.nodeType==Strophe.ElementType.TEXT){result+=child.nodeValue;}}
- 77.result+="</"+nodeName+">";}else{result+="/>";}
- 78.return result;},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(name,ptype)
- 79.{Strophe._connectionPlugins[name]=ptype;}};Strophe.Builder=function(name,attrs)
- 80.{if(name=="presence"||name=="message"||name=="iq"){if(attrs&&!attrs.xmlns){attrs.xmlns=Strophe.NS.CLIENT;}else if(!attrs){attrs={xmlns:Strophe.NS.CLIENT};}}
- 81.this.nodeTree=Strophe.xmlElement(name,attrs);this.node=this.nodeTree;};Strophe.Builder.prototype={tree:function()
- 82.{return this.nodeTree;},toString:function()
- 83.{return Strophe.serialize(this.nodeTree);},up:function()
- 84.{this.node=this.node.parentNode;return this;},attrs:function(moreattrs)
- 85.{for(var k in moreattrs){if(moreattrs.hasOwnProperty(k)){this.node.setAttribute(k,moreattrs[k]);}}
- 86.return this;},c:function(name,attrs)
- 87.{var child=Strophe.xmlElement(name,attrs);this.node.appendChild(child);this.node=child;return this;},cnode:function(elem)
- 88.{this.node.appendChild(elem);this.node=elem;return this;},t:function(text)
- 89.{var child=Strophe.xmlTextNode(text);this.node.appendChild(child);return this;}};Strophe.Handler=function(handler,ns,name,type,id,from,options)
- 90.{this.handler=handler;this.ns=ns;this.name=name;this.type=type;this.id=id;this.options=options||{matchbare:false};if(!this.options.matchBare){this.options.matchBare=false;}
- 91.if(this.options.matchBare){this.from=Strophe.getBareJidFromJid(from);}else{this.from=from;}
- 92.this.user=true;};Strophe.Handler.prototype={isMatch:function(elem)
- 93.{var nsMatch;var from=null;if(this.options.matchBare){from=Strophe.getBareJidFromJid(elem.getAttribute('from'));}else{from=elem.getAttribute('from');}
- 94.nsMatch=false;if(!this.ns){nsMatch=true;}else{var self=this;Strophe.forEachChild(elem,null,function(elem){if(elem.getAttribute("xmlns")==self.ns){nsMatch=true;}});nsMatch=nsMatch||elem.getAttribute("xmlns")==this.ns;}
- 95.if(nsMatch&&(!this.name||Strophe.isTagEqual(elem,this.name))&&(!this.type||elem.getAttribute("type")===this.type)&&(!this.id||elem.getAttribute("id")===this.id)&&(!this.from||from===this.from)){return true;}
- 96.return false;},run:function(elem)
- 97.{var result=null;try{result=this.handler(elem);}catch(e){if(e.sourceURL){Strophe.fatal("error: "+this.handler+" "+e.sourceURL+":"+
- 98.e.line+" - "+e.name+": "+e.message);}else if(e.fileName){if(typeof(console)!="undefined"){console.trace();console.error(this.handler," - error - ",e,e.message);}
- 99.Strophe.fatal("error: "+this.handler+" "+
- 100.e.fileName+":"+e.lineNumber+" - "+
- 101.e.name+": "+e.message);}else{Strophe.fatal("error: "+this.handler);}
- 102.throw e;}
- 103.return result;},toString:function()
- 104.{return"{Handler: "+this.handler+"("+this.name+","+
- 105.this.id+","+this.ns+")}";}};Strophe.TimedHandler=function(period,handler)
- 106.{this.period=period;this.handler=handler;this.lastCalled=new Date().getTime();this.user=true;};Strophe.TimedHandler.prototype={run:function()
- 107.{this.lastCalled=new Date().getTime();return this.handler();},reset:function()
- 108.{this.lastCalled=new Date().getTime();},toString:function()
- 109.{return"{TimedHandler: "+this.handler+"("+this.period+")}";}};Strophe.Request=function(elem,func,rid,sends)
- 110.{this.id=++Strophe._requestId;this.xmlData=elem;this.data=Strophe.serialize(elem);this.origFunc=func;this.func=func;this.rid=rid;this.date=NaN;this.sends=sends||0;this.abort=false;this.dead=null;this.age=function(){if(!this.date){return 0;}
- 111.var now=new Date();return(now-this.date)/1000;};this.timeDead=function(){if(!this.dead){return 0;}
- 112.var now=new Date();return(now-this.dead)/1000;};this.xhr=this._newXHR();};Strophe.Request.prototype={getResponse:function()
- 113.{var node=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){node=this.xhr.responseXML.documentElement;if(node.tagName=="parsererror"){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);Strophe.error("responseXML: "+
- 114.Strophe.serialize(this.xhr.responseXML));throw"parsererror";}}else if(this.xhr.responseText){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);Strophe.error("responseXML: "+
- 115.Strophe.serialize(this.xhr.responseXML));}
- 116.return node;},_newXHR:function()
- 117.{var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();if(xhr.overrideMimeType){xhr.overrideMimeType("text/xml");}}else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
- 118.xhr.onreadystatechange=this.func.prependArg(this);return xhr;}};Strophe.Connection=function(service)
- 119.{this.service=service;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold=1;this.wait=60;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var ptype=Strophe._connectionPlugins[k];var F=function(){};F.prototype=ptype;this[k]=new F();this[k].init(this);}}};Strophe.Connection.prototype={reset:function()
- 120.{this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*10000);},pause:function()
- 121.{this.paused=true;},resume:function()
- 122.{this.paused=false;},getUniqueId:function(suffix)
- 123.{if(typeof(suffix)=="string"||typeof(suffix)=="number"){return++this._uniqueId+":"+suffix;}else{return++this._uniqueId+"";}},connect:function(jid,pass,callback,wait,hold)
- 124.{this.jid=jid;this.pass=pass;this.connect_callback=callback;this.disconnecting=false;this.connected=false;this.authenticated=false;this.errors=0;this.wait=wait||this.wait;this.hold=hold||this.hold;this.domain=Strophe.getDomainFromJid(this.jid);var body=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":Strophe.NS.BOSH});this._changeConnectStatus(Strophe.Status.CONNECTING,null);this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),body.tree().getAttribute("rid")));this._throttledRequestHandler();},attach:function(jid,sid,rid,callback,wait,hold,wind)
- 125.{this.jid=jid;this.sid=sid;this.rid=rid;this.connect_callback=callback;this.domain=Strophe.getDomainFromJid(this.jid);this.authenticated=true;this.connected=true;this.wait=wait||this.wait;this.hold=hold||this.hold;this.window=wind||this.window;this._changeConnectStatus(Strophe.Status.ATTACHED,null);},xmlInput:function(elem)
- 126.{return;},xmlOutput:function(elem)
- 127.{return;},rawInput:function(data)
- 128.{return;},rawOutput:function(data)
- 129.{return;},send:function(elem)
- 130.{if(elem===null){return;}
- 131.if(typeof(elem.sort)==="function"){for(var i=0;i<elem.length;i++){this._queueData(elem[i]);}}else if(typeof(elem.tree)==="function"){this._queueData(elem.tree());}else{this._queueData(elem);}
- 132.this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);},flush:function()
- 133.{clearTimeout(this._idleTimeout);this._onIdle();},sendIQ:function(elem,callback,errback,timeout){var timeoutHandler=null;var that=this;if(typeof(elem.tree)==="function"){elem=elem.tree();}
- 134.var id=elem.getAttribute('id');if(!id){id=this.getUniqueId("sendIQ");elem.setAttribute("id",id);}
- 135.var handler=this.addHandler(function(stanza){if(timeoutHandler){that.deleteTimedHandler(timeoutHandler);}
- 136.var iqtype=stanza.getAttribute('type');if(iqtype==='result'){if(callback){callback(stanza);}}else if(iqtype==='error'){if(errback){errback(stanza);}}else{throw{name:"StropheError",message:"Got bad IQ type of "+iqtype};}},null,'iq',null,id);if(timeout){timeoutHandler=this.addTimedHandler(timeout,function(){that.deleteHandler(handler);if(errback){errback(null);}
- 137.return false;});}
- 138.this.send(elem);return id;},_queueData:function(element){if(element===null||!element.tagName||!element.childNodes){throw{name:"StropheError",message:"Cannot queue non-DOMElement."};}
- 139.this._data.push(element);},_sendRestart:function()
- 140.{this._data.push("restart");this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);},addTimedHandler:function(period,handler)
- 141.{var thand=new Strophe.TimedHandler(period,handler);this.addTimeds.push(thand);return thand;},deleteTimedHandler:function(handRef)
- 142.{this.removeTimeds.push(handRef);},addHandler:function(handler,ns,name,type,id,from,options)
- 143.{var hand=new Strophe.Handler(handler,ns,name,type,id,from,options);this.addHandlers.push(hand);return hand;},deleteHandler:function(handRef)
- 144.{this.removeHandlers.push(handRef);},disconnect:function(reason)
- 145.{this._changeConnectStatus(Strophe.Status.DISCONNECTING,reason);Strophe.info("Disconnect was called because: "+reason);if(this.connected){this._disconnectTimeout=this._addSysTimedHandler(3000,this._onDisconnectTimeout.bind(this));this._sendTerminate();}},_changeConnectStatus:function(status,condition)
- 146.{for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var plugin=this[k];if(plugin.statusChanged){try{plugin.statusChanged(status,condition);}catch(err){Strophe.error(""+k+" plugin caused an exception "+"changing status: "+err);}}}}
- 147.if(this.connect_callback){try{this.connect_callback(status,condition);}catch(e){Strophe.error("User connection callback caused an "+"exception: "+e);}}},_buildBody:function()
- 148.{var bodyWrap=$build('body',{rid:this.rid++,xmlns:Strophe.NS.HTTPBIND});if(this.sid!==null){bodyWrap.attrs({sid:this.sid});}
- 149.return bodyWrap;},_removeRequest:function(req)
- 150.{Strophe.debug("removing request");var i;for(i=this._requests.length-1;i>=0;i--){if(req==this._requests[i]){this._requests.splice(i,1);}}
- 151.req.xhr.onreadystatechange=function(){};this._throttledRequestHandler();},_restartRequest:function(i)
- 152.{var req=this._requests[i];if(req.dead===null){req.dead=new Date();}
- 153.this._processRequest(i);},_processRequest:function(i)
- 154.{var req=this._requests[i];var reqStatus=-1;try{if(req.xhr.readyState==4){reqStatus=req.xhr.status;}}catch(e){Strophe.error("caught an error in _requests["+i+"], reqStatus: "+reqStatus);}
- 155.if(typeof(reqStatus)=="undefined"){reqStatus=-1;}
- 156.var time_elapsed=req.age();var primaryTimeout=(!isNaN(time_elapsed)&&time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait));var secondaryTimeout=(req.dead!==null&&req.timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait));var requestCompletedWithServerError=(req.xhr.readyState==4&&(reqStatus<1||reqStatus>=500));if(primaryTimeout||secondaryTimeout||requestCompletedWithServerError){if(secondaryTimeout){Strophe.error("Request "+
- 157.this._requests[i].id+" timed out (secondary), restarting");}
- 158.req.abort=true;req.xhr.abort();req.xhr.onreadystatechange=function(){};this._requests[i]=new Strophe.Request(req.xmlData,req.origFunc,req.rid,req.sends);req=this._requests[i];}
- 159.if(req.xhr.readyState===0){Strophe.debug("request id "+req.id+"."+req.sends+" posting");req.date=new Date();try{var async=!('sync'in this&&this.sync===true);req.xhr.open("POST",this.service,async);}catch(e2){Strophe.error("XHR open failed.");if(!this.connected){this._changeConnectStatus(Strophe.Status.CONNFAIL,"bad-service");}
- 160.this.disconnect();return;}
- 161.var sendFunc=function(){req.xhr.send(req.data);};if(req.sends>1){var backoff=Math.pow(req.sends,3)*1000;setTimeout(sendFunc,backoff);}else{sendFunc();}
- 162.req.sends++;this.xmlOutput(req.xmlData);this.rawOutput(req.data);}else{Strophe.debug("_processRequest: "+
- 163.(i===0?"first":"second")+" request has readyState of "+
- 164.req.xhr.readyState);}},_throttledRequestHandler:function()
- 165.{if(!this._requests){Strophe.debug("_throttledRequestHandler called with "+"undefined requests");}else{Strophe.debug("_throttledRequestHandler called with "+
- 166.this._requests.length+" requests");}
- 167.if(!this._requests||this._requests.length===0){return;}
- 168.if(this._requests.length>0){this._processRequest(0);}
- 169.if(this._requests.length>1&&Math.abs(this._requests[0].rid-
- 170.this._requests[1].rid)<this.window-1){this._processRequest(1);}},_onRequestStateChange:function(func,req)
- 171.{Strophe.debug("request id "+req.id+"."+req.sends+" state changed to "+
- 172.req.xhr.readyState);if(req.abort){req.abort=false;return;}
- 173.var reqStatus;if(req.xhr.readyState==4){reqStatus=0;try{reqStatus=req.xhr.status;}catch(e){}
- 174.if(typeof(reqStatus)=="undefined"){reqStatus=0;}
- 175.if(this.disconnecting){if(reqStatus>=400){this._hitError(reqStatus);return;}}
- 176.var reqIs0=(this._requests[0]==req);var reqIs1=(this._requests[1]==req);if((reqStatus>0&&reqStatus<500)||req.sends>5){this._removeRequest(req);Strophe.debug("request id "+
- 177.req.id+" should now be removed");}
- 178.if(reqStatus==200){if(reqIs1||(reqIs0&&this._requests.length>0&&this._requests[0].age()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait))){this._restartRequest(0);}
- 179.Strophe.debug("request id "+
- 180.req.id+"."+
- 181.req.sends+" got 200");func(req);this.errors=0;}else{Strophe.error("request id "+
- 182.req.id+"."+
- 183.req.sends+" error "+reqStatus+" happened");if(reqStatus===0||(reqStatus>=400&&reqStatus<600)||reqStatus>=12000){this._hitError(reqStatus);if(reqStatus>=400&&reqStatus<500){this._changeConnectStatus(Strophe.Status.DISCONNECTING,null);this._doDisconnect();}}}
- 184.if(!((reqStatus>0&&reqStatus<10000)||req.sends>5)){this._throttledRequestHandler();}}},_hitError:function(reqStatus)
- 185.{this.errors++;Strophe.warn("request errored, status: "+reqStatus+", number of errors: "+this.errors);if(this.errors>4){this._onDisconnectTimeout();}},_doDisconnect:function()
- 186.{Strophe.info("_doDisconnect was called");this.authenticated=false;this.disconnecting=false;this.sid=null;this.streamId=null;this.rid=Math.floor(Math.random()*4294967295);if(this.connected){this._changeConnectStatus(Strophe.Status.DISCONNECTED,null);this.connected=false;}
- 187.this.handlers=[];this.timedHandlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];},_dataRecv:function(req)
- 188.{try{var elem=req.getResponse();}catch(e){if(e!="parsererror"){throw e;}
- 189.this.disconnect("strophe-parsererror");}
- 190.if(elem===null){return;}
- 191.this.xmlInput(elem);this.rawInput(Strophe.serialize(elem));var i,hand;while(this.removeHandlers.length>0){hand=this.removeHandlers.pop();i=this.handlers.indexOf(hand);if(i>=0){this.handlers.splice(i,1);}}
- 192.while(this.addHandlers.length>0){this.handlers.push(this.addHandlers.pop());}
- 193.if(this.disconnecting&&this._requests.length===0){this.deleteTimedHandler(this._disconnectTimeout);this._disconnectTimeout=null;this._doDisconnect();return;}
- 194.var typ=elem.getAttribute("type");var cond,conflict;if(typ!==null&&typ=="terminate"){cond=elem.getAttribute("condition");conflict=elem.getElementsByTagName("conflict");if(cond!==null){if(cond=="remote-stream-error"&&conflict.length>0){cond="conflict";}
- 195.this._changeConnectStatus(Strophe.Status.CONNFAIL,cond);}else{this._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown");}
- 196.this.disconnect();return;}
- 197.var self=this;Strophe.forEachChild(elem,null,function(child){var i,newList;newList=self.handlers;self.handlers=[];for(i=0;i<newList.length;i++){var hand=newList[i];if(hand.isMatch(child)&&(self.authenticated||!hand.user)){if(hand.run(child)){self.handlers.push(hand);}}else{self.handlers.push(hand);}}});},_sendTerminate:function()
- 198.{Strophe.info("_sendTerminate was called");var body=this._buildBody().attrs({type:"terminate"});if(this.authenticated){body.c('presence',{xmlns:Strophe.NS.CLIENT,type:'unavailable'});}
- 199.this.disconnecting=true;var req=new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),body.tree().getAttribute("rid"));this._requests.push(req);this._throttledRequestHandler();},_connect_cb:function(req)
- 200.{Strophe.info("_connect_cb was called");this.connected=true;var bodyWrap=req.getResponse();if(!bodyWrap){return;}
- 201.this.xmlInput(bodyWrap);this.rawInput(Strophe.serialize(bodyWrap));var typ=bodyWrap.getAttribute("type");var cond,conflict;if(typ!==null&&typ=="terminate"){cond=bodyWrap.getAttribute("condition");conflict=bodyWrap.getElementsByTagName("conflict");if(cond!==null){if(cond=="remote-stream-error"&&conflict.length>0){cond="conflict";}
- 202.this._changeConnectStatus(Strophe.Status.CONNFAIL,cond);}else{this._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown");}
- 203.return;}
- 204.if(!this.sid){this.sid=bodyWrap.getAttribute("sid");}
- 205.if(!this.stream_id){this.stream_id=bodyWrap.getAttribute("authid");}
- 206.var wind=bodyWrap.getAttribute('requests');if(wind){this.window=parseInt(wind,10);}
- 207.var hold=bodyWrap.getAttribute('hold');if(hold){this.hold=parseInt(hold,10);}
- 208.var wait=bodyWrap.getAttribute('wait');if(wait){this.wait=parseInt(wait,10);}
- 209.var do_sasl_plain=false;var do_sasl_digest_md5=false;var do_sasl_anonymous=false;var mechanisms=bodyWrap.getElementsByTagName("mechanism");var i,mech,auth_str,hashed_auth_str;if(mechanisms.length>0){for(i=0;i<mechanisms.length;i++){mech=Strophe.getText(mechanisms[i]);if(mech=='DIGEST-MD5'){do_sasl_digest_md5=true;}else if(mech=='PLAIN'){do_sasl_plain=true;}else if(mech=='ANONYMOUS'){do_sasl_anonymous=true;}}}else{var body=this._buildBody();this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),body.tree().getAttribute("rid")));this._throttledRequestHandler();return;}
- 210.if(Strophe.getNodeFromJid(this.jid)===null&&do_sasl_anonymous){this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"ANONYMOUS"}).tree());}else if(Strophe.getNodeFromJid(this.jid)===null){this._changeConnectStatus(Strophe.Status.CONNFAIL,'x-strophe-bad-non-anon-jid');this.disconnect();}else if(do_sasl_digest_md5){this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge1_cb.bind(this),null,"challenge",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"DIGEST-MD5"}).tree());}else if(do_sasl_plain){auth_str=Strophe.getBareJidFromJid(this.jid);auth_str=auth_str+"\u0000";auth_str=auth_str+Strophe.getNodeFromJid(this.jid);auth_str=auth_str+"\u0000";auth_str=auth_str+this.pass;this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);hashed_auth_str=Base64.encode(auth_str);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"PLAIN"}).t(hashed_auth_str).tree());}else{this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1");this.send($iq({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:Strophe.NS.AUTH}).c("username",{}).t(Strophe.getNodeFromJid(this.jid)).tree());}},_sasl_challenge1_cb:function(elem)
- 211.{var attribMatch=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/;var challenge=Base64.decode(Strophe.getText(elem));var cnonce=MD5.hexdigest(Math.random()*1234567890);var realm="";var host=null;var nonce="";var qop="";var matches;this.deleteHandler(this._sasl_failure_handler);while(challenge.match(attribMatch)){matches=challenge.match(attribMatch);challenge=challenge.replace(matches[0],"");matches[2]=matches[2].replace(/^"(.+)"$/,"$1");switch(matches[1]){case"realm":realm=matches[2];break;case"nonce":nonce=matches[2];break;case"qop":qop=matches[2];break;case"host":host=matches[2];break;}}
- 212.var digest_uri="xmpp/"+this.domain;if(host!==null){digest_uri=digest_uri+"/"+host;}
- 213.var A1=MD5.hash(Strophe.getNodeFromJid(this.jid)+":"+realm+":"+this.pass)+":"+nonce+":"+cnonce;var A2='AUTHENTICATE:'+digest_uri;var responseText="";responseText+='username='+
- 214.this._quote(Strophe.getNodeFromJid(this.jid))+',';responseText+='realm='+this._quote(realm)+',';responseText+='nonce='+this._quote(nonce)+',';responseText+='cnonce='+this._quote(cnonce)+',';responseText+='nc="00000001",';responseText+='qop="auth",';responseText+='digest-uri='+this._quote(digest_uri)+',';responseText+='response='+this._quote(MD5.hexdigest(MD5.hexdigest(A1)+":"+
- 215.nonce+":00000001:"+
- 216.cnonce+":auth:"+
- 217.MD5.hexdigest(A2)))+',';responseText+='charset="utf-8"';this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge2_cb.bind(this),null,"challenge",null,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build('response',{xmlns:Strophe.NS.SASL}).t(Base64.encode(responseText)).tree());return false;},_quote:function(str)
- 218.{return'"'+str.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"';},_sasl_challenge2_cb:function(elem)
- 219.{this.deleteHandler(this._sasl_success_handler);this.deleteHandler(this._sasl_failure_handler);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build('response',{xmlns:Strophe.NS.SASL}).tree());return false;},_auth1_cb:function(elem)
- 220.{var iq=$iq({type:"set",id:"_auth_2"}).c('query',{xmlns:Strophe.NS.AUTH}).c('username',{}).t(Strophe.getNodeFromJid(this.jid)).up().c('password').t(this.pass);if(!Strophe.getResourceFromJid(this.jid)){this.jid=Strophe.getBareJidFromJid(this.jid)+'/strophe';}
- 221.iq.up().c('resource',{}).t(Strophe.getResourceFromJid(this.jid));this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2");this.send(iq.tree());return false;},_sasl_success_cb:function(elem)
- 222.{Strophe.info("SASL authentication succeeded.");this.deleteHandler(this._sasl_failure_handler);this._sasl_failure_handler=null;if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null;}
- 223.this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null);this._sendRestart();return false;},_sasl_auth1_cb:function(elem)
- 224.{var i,child;for(i=0;i<elem.childNodes.length;i++){child=elem.childNodes[i];if(child.nodeName=='bind'){this.do_bind=true;}
- 225.if(child.nodeName=='session'){this.do_session=true;}}
- 226.if(!this.do_bind){this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}else{this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var resource=Strophe.getResourceFromJid(this.jid);if(resource){this.send($iq({type:"set",id:"_bind_auth_2"}).c('bind',{xmlns:Strophe.NS.BIND}).c('resource',{}).t(resource).tree());}else{this.send($iq({type:"set",id:"_bind_auth_2"}).c('bind',{xmlns:Strophe.NS.BIND}).tree());}}
- 227.return false;},_sasl_bind_cb:function(elem)
- 228.{if(elem.getAttribute("type")=="error"){Strophe.info("SASL binding failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}
- 229.var bind=elem.getElementsByTagName("bind");var jidNode;if(bind.length>0){jidNode=bind[0].getElementsByTagName("jid");if(jidNode.length>0){this.jid=Strophe.getText(jidNode[0]);if(this.do_session){this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2");this.send($iq({type:"set",id:"_session_auth_2"}).c('session',{xmlns:Strophe.NS.SESSION}).tree());}else{this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}}}else{Strophe.info("SASL binding failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}},_sasl_session_cb:function(elem)
- 230.{if(elem.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}else if(elem.getAttribute("type")=="error"){Strophe.info("Session creation failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}
- 231.return false;},_sasl_failure_cb:function(elem)
- 232.{if(this._sasl_success_handler){this.deleteHandler(this._sasl_success_handler);this._sasl_success_handler=null;}
- 233.if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null;}
- 234.this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;},_auth2_cb:function(elem)
- 235.{if(elem.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}else if(elem.getAttribute("type")=="error"){this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);this.disconnect();}
- 236.return false;},_addSysTimedHandler:function(period,handler)
- 237.{var thand=new Strophe.TimedHandler(period,handler);thand.user=false;this.addTimeds.push(thand);return thand;},_addSysHandler:function(handler,ns,name,type,id)
- 238.{var hand=new Strophe.Handler(handler,ns,name,type,id);hand.user=false;this.addHandlers.push(hand);return hand;},_onDisconnectTimeout:function()
- 239.{Strophe.info("_onDisconnectTimeout was called");var req;while(this._requests.length>0){req=this._requests.pop();req.abort=true;req.xhr.abort();req.xhr.onreadystatechange=function(){};}
- 240.this._doDisconnect();return false;},_onIdle:function()
- 241.{var i,thand,since,newList;while(this.removeTimeds.length>0){thand=this.removeTimeds.pop();i=this.timedHandlers.indexOf(thand);if(i>=0){this.timedHandlers.splice(i,1);}}
- 242.while(this.addTimeds.length>0){this.timedHandlers.push(this.addTimeds.pop());}
- 243.var now=new Date().getTime();newList=[];for(i=0;i<this.timedHandlers.length;i++){thand=this.timedHandlers[i];if(this.authenticated||!thand.user){since=thand.lastCalled+thand.period;if(since-now<=0){if(thand.run()){newList.push(thand);}}else{newList.push(thand);}}}
- 244.this.timedHandlers=newList;var body,time_elapsed;if(this.authenticated&&this._requests.length===0&&this._data.length===0&&!this.disconnecting){Strophe.info("no requests during idle cycle, sending "+"blank request");this._data.push(null);}
- 245.if(this._requests.length<2&&this._data.length>0&&!this.paused){body=this._buildBody();for(i=0;i<this._data.length;i++){if(this._data[i]!==null){if(this._data[i]==="restart"){body.attrs({to:this.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":Strophe.NS.BOSH});}else{body.cnode(this._data[i]).up();}}}
- 246.delete this._data;this._data=[];this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),body.tree().getAttribute("rid")));this._processRequest(this._requests.length-1);}
- 247.if(this._requests.length>0){time_elapsed=this._requests[0].age();if(this._requests[0].dead!==null){if(this._requests[0].timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait)){this._throttledRequestHandler();}}
- 248.if(time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait)){Strophe.warn("Request "+
- 249.this._requests[0].id+" timed out, over "+Math.floor(Strophe.TIMEOUT*this.wait)+" seconds since last activity");this._throttledRequestHandler();}}
- 250.clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);}};if(callback){callback(Strophe,$build,$msg,$iq,$pres);}})(function(){window.Strophe=arguments[0];window.$build=arguments[1];window.$msg=arguments[2];window.$iq=arguments[3];window.$pres=arguments[4];});
- 251.(function($){$.fn.jscontext=function(options){var settings={html:'default',bind:'right-click',closeOnMouseLeave:false,fade:false,fadeSpeed:"normal",show:null,open:null,close:null,mouseover:null,mouseleave:null,sticky:false};var methods={initMenu:function(elm,settings){$("html").mousemove(function(e){mouse.x=e.pageX;mouse.y=e.pageY;if(element.current!=undefined&&element.moveit){element.current.css("top",(mouse.y+10)+'px');element.current.css("left",(mouse.x+10)+'px');if(settings.mouseover!=null)
- 252.settings.mouseover.call();}});$("html").click(function(){if(element.close())
- 253.methods.closeMenu(null,null);});$("html").mouseleave(function(){methods.closeMenu(null,null);});switch(settings.bind){case"right-click":$(elm).bind("contextmenu",function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- 254.settings.show.call();element.moveit=false;return false;}});break;case"click":$(elm).click(function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- 255.settings.show.call();element.moveit=false;return false;}});break;case"anyclick":$(elm).bind("contextmenu",function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- 256.settings.show.call();element.moveit=false;return false;}});$(elm).click(function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- 257.settings.show.call();element.moveit=false;return false;}});break;case"hover":$(elm).hover(function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- 258.settings.show.call();if(settings.sticky)
- 259.element.moveit=true;return false;}},function(e){if(settings.sticky){if(element.close())
- 260.methods.closeMenu($(element.current).attr("id"),null);}
- 261.element.moveit=false;});break;}},openMenu:function(elm,settings){methods.createMenu(elm,settings);element.current=$("#"+elm.id+"jscontext");if(settings.html instanceof Function){element.current.html(settings.html(elm));}else{element.current.html(settings.html.clone(true));}
- 262.var jscontextBtn=$(".jscontextBtn");if(settings.open!=null)
- 263.settings.open.call();if(settings.closeOnMouseLeave&&!settings.sticky){element.current.mouseleave(function(){if(element.close())
- 264.methods.closeMenu($(element.current).attr("id"),null);});}
- 265.try{var winWidth=window.innerWidth||document.documentElement.clientWidth||document.body.offsetWidth;if(mouse.x>=winWidth-element.current.width())
- 266.element.current.css("left",mouse.x-(element.current.width()-15)+"px");}
- 267.catch(e){}},createMenu:function(elm,settings){var jscontextID=elm.id+"jscontext";var afterClose=function(){var jscontextElement=document.createElement('div');jscontextElement.id=jscontextID;jscontextElement.style.position='absolute';jscontextElement.style.display='none';if(mouse.y==undefined)
- 268.mouse.y=0;if(mouse.x==undefined)
- 269.mouse.x=0;jscontextElement.style.top=(mouse.y-(settings.sticky==true?0:15))+'px';jscontextElement.style.left=(mouse.x-(settings.sticky==true?0:15))+'px';jscontextElement.style.zIndex='9999';document.body.appendChild(jscontextElement);var jscontext=$("#"+jscontextID);jscontext.addClass("jscontextContainer");if(settings.fade){jscontext.fadeIn(settings.fadeSpeed);element.fade=true;}
- 270.else{jscontext.show();element.fade=false;}}
- 271.methods.closeMenu(null,afterClose);},closeMenu:function(elmID,afterClose){var remove=function(){if(elmID){if($("#"+elmID).length>0)
- 272.document.body.removeChild(document.getElementById(elmID));}
- 273.else{$(".jscontextContainer").remove();}}
- 274.if(element.fade){if(elmID){if($("#"+elmID).length>0)
- 275.$("#"+elmID).fadeOut(settings.fadeSpeed,remove);}
- 276.else{$(".jscontextContainer").fadeOut(settings.fadeSpeed,remove);}}
- 277.else{remove.call();}
- 278.if(settings.close!=null)
- 279.settings.close.call();if(afterClose!=null)
- 280.afterClose.call();}};return this.each(function(){if(options&&typeof options==='object'){$.extend(settings,options);methods.initMenu(this,settings);}
- 281.else if(typeof options==='string'){switch(options){case"":break;}}});};})(jQuery);jscontext=function(option){switch(option){case"close":$(".jscontextContainer").remove();break;}}
- 282.jscontextElm=function(elm){jscontextObj=$(elm);}
- 283.var element={current:null,moveit:false,fade:false,close:function(){if(element.current==null)
- 284.return true;if((mouse.x<element.current.position().left+5)||(mouse.x>(element.current.position().left+element.current.width()-5))||(mouse.y<element.current.position().top+5)||(mouse.y>(element.current.position().top+element.current.height()-5)))
- 285.return true;else
- 286.return false;}};var mouse={x:null,y:null};var jscontextObj=$();(function(jQuery){jQuery.hotkeys={version:"0.8.1",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"command",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return;}
- 287.var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");var isCommandPressed=false;handleObj.handler=function(event){var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+";}
- 288.if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+";}
- 289.if(jQuery.hotkeys.specialKeys[event.which]==="command"){isCommandPressed=true;}
- 290.if(event.metaKey&&!event.ctrlKey&&special!=="meta"&&special!=="command"){if(isCommandPressed){modif+="command+";}else{modif+="meta+";}}
- 291.if(event.shiftKey&&special!=="shift"){modif+="shift+";}
- 292.if(special){possible[modif+special]=true;}else{possible[modif+character]=true;possible[modif+jQuery.hotkeys.shiftNums[character]]=true;if(modif==="shift+"){possible[jQuery.hotkeys.shiftNums[character]]=true;}}
- 293.for(var i=0,l=keys.length;i<l;i++){if(possible[keys[i]]){isCommandPressed=false;return origHandler.apply(this,arguments);}}};}
- 294.jQuery.each(["keydown","keyup","keypress"],function(){jQuery.event.special[this]={add:keyHandler};});})(jQuery);(function($){$.fn.defchat=function(options){var settings={'domain':'localhost','username':null,'password':null,'my_username':'','textinput':this.find('input.text'),'form':this.find('form.chat-form'),'chatlist':this.find('.chat-list'),'userslist':this.find('.users-list'),'buttons':this.find('ul.buttons'),'submitbutton':this.find('.send_message_button'),'usercount':this.find('.usercount'),'subject':'','room':'mymucroom@conference.localhost','private_room':'mymucroom@conference.localhost','throttlechat':false,'throttle_message':null,'translate_message_url':null,'add_moderator_url':null,'media_url':'','ban_url':null,'silence_url':null,'is_broadcasting':false,'allow_tipping':true,'domroot':this,'font_color':'#494949','chat_font':'default','current_subject':'','login_required_callback':null,'submenu_profile_url':null,'emoticon_overlay_url':null,'tipping_current_tokens_url':null,'welcome_message':null,'welcome_warning':null,'first_post_warning':null,'parse_subject':null,'color_choices':['default','Arial, Helvetica','Bookman Old Style','"Comic Sans MS", cursive','"Courier New"','Lucida','Palantino',"Tahoma, Geneva",'"Times New Roman"'],'font_color_cookie_name':'settings_font_color','chat_font_cookie_name':'settings_chat_font','interested_in':[],'group_show_tokens_per_minute_url':null,'group_show_request_url':null,'group_show_decline_url':null,'group_show_cancel_url':null,'return_from_away_url':null,'private_show_tokens_per_minute_url':null,'private_show_request_url':null,'private_show_approve_url':null,'private_show_decline_url':null,'private_show_cancel_url':null,'scroll_on_load':true,'room_goal':{}};if(options){$.extend(settings,options);}
- 295.if(settings.is_broadcasting){settings.font_color_cookie_name='broadcast_settings_font_color';settings.chat_font_cookie_name='broadcast_settings_chat_font';}
- 296.if($.cookie(settings.font_color_cookie_name)){settings.font_color=$.cookie(settings.font_color_cookie_name);}
- 297.if($.cookie(settings.chat_font_cookie_name)){settings.chat_font=$.cookie(settings.chat_font_cookie_name);}
- 298.var default_subject=$.cookie('my_room_subject');if(!default_subject){default_subject=Strophe.getNodeFromJid(settings.room)+"'s room";}
- 299.$.extend(settings,{'user':settings.username+'@'+settings.domain,'muc_nickname':settings.username,'default_subject':default_subject,'bosh_host':'http://'+settings.domain+':5280/http-bind','roomownernick':Strophe.getNodeFromJid(settings.room),'roomowner':Strophe.getNodeFromJid(settings.room)+"@"+settings.domain});if(options){$.extend(settings,options);}
- 300.var conn=new Strophe.Connection(settings.bosh_host);function consolelog(msg){}
- 301.function get_contextual_menu_html(domele){var h=$("<div class='jscontextMenu'></div>");var nick=$(domele).data('nick');var jid=presence_monitor.participants[nick].jid;var account_name=Strophe.getNodeFromJid(jid);function add_link(cls,text,callback){var line=$("<p class='jscontextBtn "+cls+"' data-nick='"+nick+"'>"+text+"</p>");line.click(function(){jscontext('close')});line.click(callback);h.append(line);}
- 302.h.append("<p class=\"jscontextLabel\"><img src=\""+settings.media_url+"images/red-arrow-down.gif\" width=\"9\" height=\"5\" alt=\"\" />"+nick+"</p><hr>");h.append("<div class=\"submenu_profile\"></div><hr>");add_link("pm",gettext("Send private message"),function(){if(!features_unlocked()){unlock_features_required();return;}
- 303.tabs.open_pm(nick);});if(message_receiver.ignored_users.indexOf(jid)!==-1){add_link("ignore",gettext("Un-Ignore This User"),function(event){var ignorenick=$(event.target).data('nick');var ignorejid=presence_monitor.participants[ignorenick].jid;message_receiver.ignored_users=$.grep(message_receiver.ignored_users,function(a){return(a!=ignorejid);});var msg=interpolate(gettext("no longer ignoring %(username)s"),{username:ignorenick},true);add_system_message(msg,tabs.get_current_tab_domele());$('#ignored-list').find("[data-nick='"+ignorenick+"']").parent().remove();tabs._sort_ignored_users_list();ignored_user_methods.store_ignored_users();});}else{add_link("ignore",gettext("Ignore This User"),function(event){var ignorenick=$(event.target).data('nick');message_receiver.ignored_users.push(presence_monitor.participants[ignorenick].jid);var msg=interpolate(gettext("ignoring %(username)s"),{username:ignorenick},true);add_system_message(msg,tabs.get_current_tab_domele());var html="<li>"+ignorenick;html+=" (<a href='#' data-nick='"+presence_monitor.participants[ignorenick].jid;html+="' class='un-ignore'>"+gettext('Un-ignore')+"</a>)</li>";$('#ignored-list').append(html);tabs._sort_ignored_users_list();ignored_user_methods.store_ignored_users();});}
- 304.h.append("<hr>");if(presence_monitor.participants[settings.muc_nickname].role=='moderator'){add_link("",gettext("Silence for 24 hours"),function(event){var bannick=$(event.target).data('nick');var jid=presence_monitor.participants[bannick].jid;var msg=interpolate(gettext("Silence %(username)s?"),{username:bannick},true);if(confirm(msg)){msg=interpolate(gettext("Silencing %(username)s"),{username:bannick},true);add_system_message(msg,tabs.get_current_tab_domele());var account_name=Strophe.getNodeFromJid(jid);var url=settings.silence_url.replace('USERNAMESLUG',account_name);$.post(url,{'foo':'bar'});}});if(presence_monitor.participants[settings.muc_nickname].jid===settings.roomowner){add_link("",gettext("Kick/Ban"),function(event){var bannick=$(event.target).data('nick');var jid=presence_monitor.participants[bannick].jid;var msg=interpolate(gettext("Ban %(username)s?"),{username:bannick},true);if(confirm(msg)){msg=interpolate(gettext("Kicking and banning %(username)s"),{username:bannick},true);add_system_message(msg,tabs.get_current_tab_domele());var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'affiliation':'outcast','jid':jid});consolelog(iq);conn.sendIQ(iq);var account_name=Strophe.getNodeFromJid(jid);var url=settings.ban_url.replace('USERNAMESLUG',account_name);$.post(url,{'foo':'bar'});}});if(presence_monitor.participants[nick].role!='moderator'){add_link("",gettext("Promote to Moderator"),function(event){var nick=$(event.target).data('nick');var msg=interpolate("granting moderator privileges to %(username)s",{username:nick},true);message_sender._send(msg);var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'role':'moderator','nick':nick});consolelog(iq);conn.sendIQ(iq);var url=settings.add_moderator_url.replace('USERNAMESLUG',account_name);$.post(url,{'foo':'bar'});moderators[presence_monitor.participants[nick].jid]=true;});}else{add_link("",gettext("Remove Moderator Status"),function(event){var nick=$(event.target).data('nick');var msg=interpolate(gettext("revoking moderator privileges from %(username)s"),{username:nick},true);add_system_message(msg,tabs.get_current_tab_domele());var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'role':'participant','nick':nick});consolelog(iq);conn.sendIQ(iq);delete moderators[presence_monitor.participants[nick].jid];});}}}
- 305.var url=settings.submenu_profile_url.replace('USERNAMESLUG',account_name);consolelog("Loading menu from "+url);h.find(".submenu_profile").load(url);return h;}
- 306.function add_system_message(message,domele){message_receiver.add_message('<div class="text"><p>'+message+'</p></div>',domele);}
- 307.function insert_user(newhtml,nick,token_balance){var sort_key=$("select[name='sort']").val();if(sort_key==undefined){if($.cookie('room_sort_by')==undefined)
- 308.sort_key='a';else{sort_key=$.cookie('room_sort_by');}}
- 309.if(!settings.is_broadcasting){sort_key='a';}
- 310.var inserted=false;settings.userslist.find("div.text").each(function(index,domEle){var $domEle=$(domEle);var domnick=String($domEle.data('nick'));if(sort_key=='a'){new_val=nick.replace('__anonymous__','zzzz');current_val=domnick.replace('__anonymous__','zzzz');}
- 311.else{new_val=parseInt(token_balance);current_val=parseInt($domEle.data('tokenbalance'));}
- 312.if((sort_key=='a')&&(new_val<current_val)){$domEle.before(newhtml);inserted=true;return false;}
- 313.if((sort_key=='t')&&(new_val>current_val)){$domEle.before(newhtml);inserted=true;return false;}});if(!inserted){settings.userslist.append(newhtml);}}
- 314.function userjoined(event,nick,token_balance){token_balance=parseInt(token_balance);if(isNaN(token_balance)){token_balance=0;}
- 315.if(nick.indexOf('__anonymous__')!=-1){token_balance=-1;}
- 316.var color='color-3';if(settings.is_broadcasting){if(token_balance<1){color='color-3';}else{color='color-4';}}
- 317.var msg=interpolate(gettext("<span class='username "+color+"' data-nick='%(username)s'"+">%(username)s</span> joined"),{username:nick},true);if(initializer.joined&&(new Date()-initializer.joined_at>10*1000)){if(presence_monitor.num_participants<5){add_system_message(msg);}else{if(settings.is_broadcasting&token_balance>=1){add_system_message(msg);}}}
- 318.if(tabs.pm_tab_map[nick]){add_system_message(msg,tabs.pm_tab_map[nick]);}
- 319.var newhtml=$("<div class='text' data-nick='"+nick+"' data-tokenbalance='"+token_balance+"'><strong class='"+
- 320.color+"'>"+nick+"</strong></div>");if(nick!=settings.muc_nickname){newhtml.jscontext({html:get_contextual_menu_html,bind:'anyclick'});}
- 321.return insert_user(newhtml,nick,token_balance);}
- 322.$(document).bind("userjoined.defchat",userjoined);function update_participants_count(){settings.usercount.text(presence_monitor.num_participants);}
- 323.setInterval(update_participants_count,2000);function yield_ownership(event,nick,token_balance){if(nick!=settings.roomownernick){return;}
- 324.if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){return;}}
- 325.var iq=$iq({'to':settings.room,'type':'set'}).c('query',{xmlns:'http://jabber.org/protocol/muc#admin'}).c('item',{affiliation:'owner',jid:settings.roomowner});consolelog(iq.toString());conn.sendIQ(iq);}
- 326.$(document).bind("userjoined.defchat",yield_ownership);var public_methods={_set_font_size:function(){if($.cookie('room_font_size')){var size=$.cookie('room_font_size');}
- 327.else{var size='9pt';}
- 328.$("div.chat-list").css("font-size",size);},join_group_show:function(){groups_and_privates.start_group_show_clicked();},change_title:function(title){if(title==settings.current_subject){return;}
- 329.$.cookie('my_room_subject',title,{expires:365});conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(title));},select_emoticon:function(emoticon){settings.textinput.val(settings.textinput.val()+" "+emoticon);settings.textinput.focus();},is_goal_set:function(){return settings.room_goal.hasOwnProperty('amount');}};var ignored_user_methods={store_ignored_users:function(){var ignored_str="";for(var i=0;i<message_receiver.ignored_users.length;i++){ignored_str+="#"+message_receiver.ignored_users[i];}
- 330.$.cookie('ignored_users',ignored_str,{expires:30,path:'/'});},load_ignored_users:function(){var ignored_str=$.cookie('ignored_users');if(ignored_str==null)
- 331.return;var ignored_array=ignored_str.split('#');for(var i=0;i<ignored_array.length;i++){if(ignored_array[i]!=''){message_receiver.ignored_users.push(ignored_array[i]);}}}};function reassign_moderator(event,nick,token_balance){if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){return;}}
- 332.if(!moderators[presence_monitor.participants[nick].jid]){return;}
- 333.var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'role':'moderator','nick':nick});consolelog(iq.toString());conn.sendIQ(iq);}
- 334.$(document).bind("userjoined.defchat",reassign_moderator);function remove_user_from_list(nick){settings.userslist.find("[data-nick='"+nick+"']").remove();}
- 335.function userleft(event,nick){var msg=interpolate(gettext("%(username)s has disconnected"),{username:nick},true);if(presence_monitor.num_participants<5){add_system_message(msg);}
- 336.if(tabs.pm_tab_map[nick]){add_system_message(msg,tabs.pm_tab_map[nick]);}
- 337.remove_user_from_list(nick);}
- 338.$(document).bind("userleft.defchat",userleft);$(document).bind("disconnected.defchat",function(){add_system_message(gettext("chat disconnected"));});$(document).bind("connectionfailed.defchat",function(){add_system_message(gettext("unable to connect"));});$(document).bind("connecting.defchat",function(){add_system_message(gettext("connecting"));});function connected(){add_system_message(gettext("connection established"));conn.send($pres().c('priority').t('-1'));initializer.join_room();if(settings.welcome_message){add_system_message(settings.welcome_message);}
- 339.if(settings.welcome_warning){add_system_message(settings.welcome_warning);}
- 340.$(window).unload(function(){conn.sync=true;var msg=$pres({to:settings.room,type:'unavailable'});conn.send(msg);conn.disconnect();conn.flush();});}
- 341.$(document).bind("connected.defchat",connected);var tabs={pm_tab_visible:false,current_tab:'chat',pm_tab:null,pm_tab_map:{},settings_body:null,unread_pm_map:{},total_unread_pms:0,current_pm_nick:null,opened_pms:new Array(),is_blinking:false,open_pm:function(nick){tabs._show_pm_tab();tabs._remove_unread_pms_for_nick(nick);settings.domroot.find('> div').hide();tabs.get_or_create_pm_tab_for_nick(nick,false).show();tabs.current_tab='pm';tabs.current_pm_nick=nick;tabs._enable_form();settings.textinput.focus();tabs._scroll_to_bottom();},close_pm:function(nick){tabs._show_pm_tab();tabs._remove_unread_pms_for_nick(nick);settings.domroot.find('> div').hide();tabs.pm_tab_map[nick].remove();tabs.pm_tab_map[nick]=null;tabs._show_chat_tab();var newopens=new Array();for(var i=0;i<tabs.opened_pms.length;i++){if(tabs.opened_pms[i]!=nick){newopens.push(tabs.opened_pms[i]);}}
- 342.tabs.opened_pms=newopens;},on_tab_click:function(){var tab=$(this).data("tab");settings.domroot.find('> div').hide();if(tab=='users'){tabs._deactivate_tabs();$(this).closest('li').addClass('active');settings.domroot.find('> div.users-list').show();tabs.current_tab='users';tabs._disable_form();}else if(tab=='chat'){tabs._show_chat_tab();}else if(tab=='settings'){tabs._show_settings_tab();tabs._disable_form();}else{consolelog("Unknown tab "+tab);}
- 343.return false;},get_or_create_pm_tab_for_nick:function(nick,show_alert){if(tabs.pm_tab_map[nick]){return tabs.pm_tab_map[nick];}
- 344.if(show_alert){var msg=interpolate(gettext("New private conversation from <span class='username' data-nick='%(username)s'>%(username)s</span> <span class='pmalert'>(click the PM tab)</span>"),{username:nick},true);add_system_message(msg);}
- 345.tabs.opened_pms.push(nick);tabs.opened_pms.sort();tabs._create_pm_tab();if(tabs.opened_pms.length>1){tabs._set_pm_tab_jscontext();}else{tabs._set_pm_tab_direct(nick);}
- 346.tabs.pm_tab_map[nick]=$("<div class='chat-list' style='display: none;'></div>");settings.domroot.find('> div').last().after(tabs.pm_tab_map[nick]);msg=interpolate(gettext("Private conversation with %(username)s"),{username:nick},true);add_system_message(msg,tabs.pm_tab_map[nick]);return tabs.pm_tab_map[nick];},private_message_received:function(nick){if(tabs.current_tab==='pm'&&tabs.current_pm_nick==nick){return;}
- 347.if(tabs.unread_pm_map[nick]){tabs.unread_pm_map[nick]+=1;}else{tabs.unread_pm_map[nick]=1;}
- 348.tabs.total_unread_pms+=1;tabs._refresh_pm_tab_count();if(!tabs.pm_tab.hasClass('active')){if(!tabs.is_blinking){tabs._blink_pm(6,250);}}},_blink_pm:function(numblinks,timeout){if(tabs.current_tab==='pm'){tabs.is_blinking=false;return;}
- 349.if(numblinks==0){tabs.pm_tab.removeClass('active');tabs.is_blinking=false;return;}
- 350.if(!tabs.pm_tab.hasClass('active')){tabs.pm_tab.addClass('active');}else{tabs.pm_tab.removeClass('active');}
- 351.tabs.is_blinking=true;setTimeout(function(){tabs._blink_pm(numblinks-1,timeout);},timeout);},get_current_tab_domele:function(){var r=settings.domroot.find('> div.chat-list:visible');if(r.length===0){return settings.chatlist;}else{return r;}},_show_chat_tab:function(){tabs._deactivate_tabs();settings.buttons.find('li:first').addClass('active');settings.domroot.find('> div').hide();settings.domroot.find('> div.chat-list:first').show();tabs.current_tab='chat';tabs._enable_form();settings.textinput.focus();tabs._scroll_to_bottom();},_scroll_to_bottom:function(){var chat=tabs.get_current_tab_domele().get(0);chat.scrollTop=chat.scrollHeight;},_disable_form:function(){settings.textinput.blur();settings.textinput.focus(function(event){settings.textinput.unbind(event);tabs._show_chat_tab();});},_enable_form:function(){settings.textinput.unbind('focus');},_remove_unread_pms_for_nick:function(nick){if(tabs.unread_pm_map[nick]&&tabs.unread_pm_map[nick]>0){tabs.total_unread_pms=tabs.total_unread_pms-tabs.unread_pm_map[nick];tabs.unread_pm_map[nick]=0;tabs._refresh_pm_tab_count();}},_refresh_pm_tab_count:function(){var str;if(tabs.total_unread_pms==0){str="";}else{str="("+tabs.total_unread_pms+")";}
- 352.tabs.pm_tab.find('.pm_count').text(str);},_create_pm_tab:function(){if(!tabs.pm_tab_visible){tabs.pm_tab_visible=true;tabs.pm_tab=$("<li><a href='#' data-tab='pm'>"+"PM <span class='pm_count'></span></a></li>");settings.buttons.find('li:last').before(tabs.pm_tab);}},_set_pm_tab_direct:function(nick){tabs.pm_tab.unbind('click');tabs.pm_tab.bind('click',function(){tabs.open_pm(nick);return false;});},_set_pm_tab_jscontext:function(){tabs.pm_tab.unbind('click');tabs.pm_tab.jscontext({html:function(){var h=$("<div class='jscontextMenu'></div>");function add_link(nick,text,callback){var line=$("<div class=\"pmline\"><div class=\"user\" data-nick='"+nick+"'>"+text+"</div><div class=\"close\" data-nick='"+nick+"'></div></div>");line.find("div.user").click(callback);line.find("div.user").click(function(){jscontext('close');});line.find("div.close").click(function(event){tabs.close_pm($(event.target).data('nick'));jscontext('close');});h.append(line);}
- 353.h.append("<p class=\"jscontextLabel\"><img src=\""+settings.media_url+"images/orange-arrow-down.gif\" width=\"9\" height=\"5\" alt=\"\" />Private Message with:</p><hr>");for(var i=0;i<tabs.opened_pms.length;i++){var nick=tabs.opened_pms[i];var unread=tabs.unread_pm_map[nick];if(unread&&unread>0){unread=" ("+unread+")";}else{unread="";}
- 354.add_link(nick,nick+unread,function(event){var nick=$(event.target).data('nick');tabs.open_pm(nick);});}
- 355.return h;},bind:"click"});},_deactivate_tabs:function(){settings.buttons.find('li').removeClass('active');},_show_pm_tab:function(){tabs._deactivate_tabs();tabs._create_pm_tab();tabs.pm_tab.addClass('active');},_sort_ignored_users_list:function(){if($("ul#ignored-list li").size()==0){$("ul#ignored-list").hide();$("h3#ignored-title").hide();return;}
- 356.$("ul#ignored-list").show();$("#ignored-title").show();var list=$("ul#ignored-list");var listitems=list.children("li").get();listitems.sort(function(a,b){var compA=$(a).text().toUpperCase();var compB=$(b).text().toUpperCase();return(compA<compB)?-1:(compA>compB)?1:0;});$.each(listitems,function(idx,itm){list.append(itm);});},_sort_users_list:function(){var sort_key=$("select[name='sort']").val();if(sort_key==undefined){if($.cookie('room_sort_by')==undefined)
- 357.sort_key='a';else{sort_key=$.cookie('room_sort_by');}}
- 358.if(!settings.is_broadcasting){sort_key='a';}
- 359.if(sort_key=='a'){var mylist=$('div.users-list');var listitems=mylist.children('div.text').get();listitems.sort(function(a,b){var compA=String($(a).data("nick"));compA=compA.replace('__anonymous__','zzzz');var compB=String($(b).data("nick"));compB=compB.replace('__anonymous__','zzzz');return(compA<compB)?-1:(compA>compB)?1:0;})
- 360.$.each(listitems,function(idx,itm){mylist.append(itm);})}
- 361.else{var mylist=$('div.users-list');var listitems=mylist.children('div.text').get();listitems.sort(function(a,b){var compA=parseInt($(a).data("tokenbalance"));var compB=parseInt($(b).data("tokenbalance"));return(compA<compB)?1:(compA>compB)?-1:0;})
- 362.$.each(listitems,function(idx,itm){mylist.append(itm);})}},_get_font_change:function(){var html="<br/><form>";html+="<label>"+gettext('Change Font Size')+": </label>";html+=" <select id='font-change' name='font-change'>";for(var i=9;i<=20;i++){html+="<option value='"+i+"pt'>"+i+"pt</option>"}
- 363.html+="</select></form>";$("#font-change").live("change",function(){$("div.chat-list").css("font-size",$(this).val());$.cookie('room_font_size',$(this).val(),{expires:365,path:'/'});});return html;},_get_show_emoticons_stored_value:function(){if($.cookie('show_emoticon_icons')=='yes'){return true;}
- 364.if($.cookie('show_emoticon_icons')=='no'){return false;}
- 365.return true;},_store_emoticons_value:function(val){$.cookie('show_emoticon_icons',val,{expires:365,path:'/'});},_get_emoticons_display:function(){var html="<form><label>"+gettext("Show Emoticons")+": </label>";html+="<select id='show-emoticons' name='show-emoticons'>";html+="<option value='yes'";if(tabs._get_show_emoticons_stored_value()){html+=" selected='selected' ";}
- 366.html+=">"+gettext("Yes")+"</option><option value='no'";if(!tabs._get_show_emoticons_stored_value()){html+=" selected='selected' ";}
- 367.html+=">"+gettext("No")+"</option></select></form>"
- 368.$("#show-emoticons").live("change",function(){tabs._store_emoticons_value($(this).val());});return html;},_should_show_emoticon:function(){if($("#show-emoticons").length){return $("#show-emoticons").val()=="yes";}
- 369.return tabs._get_show_emoticons_stored_value();},_set_default_font_change_value:function(){var size='9pt';if($.cookie('room_font_size')){size=$.cookie('room_font_size');}
- 370.$("#font-change option[value='"+size+"']").attr("selected","selected");},_show_settings_tab:function(){tabs.current_tab='settings';settings.domroot.find('> div').hide();if(!tabs.settings_body){var html="<div class='settings-list'><form>"+"<div class='exampletext'>"+gettext("Your chat messages will look like this.")+"</div>"+"<div><br/><label>"+gettext("Chat font")+":</label> <select name='chatfont'></select></div>"+"<div><br/><label>"+gettext("Chat color")+":</label> <input type='color' id='settingscolor' name='color' value='"+settings.font_color+"' data-hex='true' data-text='hidden' style='height:20px;width:20px;'></div>"+"</form><h3 id='ignored-title'>"+gettext('Ignored users')+"</h3><ul id='ignored-list'>";for(var i=0;i<message_receiver.ignored_users.length;i++){var nick=message_receiver.ignored_users[i].split('@')[0];html+="<li>"+nick;html+=" (<a href='#' data-nick='"+message_receiver.ignored_users[i];html+="' class='un-ignore'>"+gettext('Un-ignore')+"</a>)</li>";}
- 371.html+="</ul>";html+=tabs._get_font_change();html+=tabs._get_emoticons_display();if(settings.is_broadcasting){html+='<form><br/><label>'+gettext("Sort users")+":</label> "+'<select name="sort"><option value="a"';if(($.cookie('room_sort_by')=='a')||($.cookie('room_sort_by')==undefined)){html+=' selected="selected" '}
- 372.html+='>'+
- 373.gettext('Alphabetically')+'</option>'+'<option value="t"';if($.cookie('room_sort_by')=='t'){html+=' selected="selected" '}
- 374.html+='>'+gettext('By Tokens')+'</option>'+'</select></form>';$("select[name='sort']").live("change",function(){$.cookie('room_sort_by',$(this).val(),{expires:365,path:'/'});tabs._sort_users_list();});html+="<br/><br/><a href='#' class='clear_all_banned_ips'>"+
- 375.gettext('Clear All Banned IPs')+"</a>"+"<span style='display:none' class='ban_result'>"+
- 376.gettext('Banned IPs cleared...')+"</span>";}
- 377.html+="</div>";tabs.settings_body=$(html);$("#ignored-list li a").live("click",function(){var uname=$(this).data("nick");$(this).parent().remove();message_receiver.ignored_users=$.grep(message_receiver.ignored_users,function(a){return(a!=uname);});uname=uname.split('@')[0];var msg=interpolate(gettext("no longer ignoring %(username)s"),{username:uname},true);add_system_message(msg,tabs.get_current_tab_domele());ignored_user_methods.store_ignored_users();tabs._sort_ignored_users_list();return false;});$.each(settings.color_choices,function(index,value){tabs.settings_body.find('select[name="chatfont"]').append("<option>"+value+"</option>");});tabs.settings_body.find('select[name="chatfont"]').val(settings.chat_font);settings.domroot.find('> div').last().after(tabs.settings_body);consolelog($("#settingscolor"));$('#settingscolor').mColorPicker();$('#settingscolor').bind('colorpicked',function(){if(!features_unlocked()){unlock_features_required();$('#settingscolor').val('#494949');$('#icp_settingscolor').css('background-color','#494949');}
- 378.settings.font_color=$(this).val();tabs.settings_body.find('.exampletext').css('color',settings.font_color);$.cookie(settings.font_color_cookie_name,settings.font_color,{expires:365,path:'/'});});tabs.settings_body.find('select[name="chatfont"]').change(function(){if(!features_unlocked()){tabs.settings_body.find('select[name="chatfont"]').val('default');unlock_features_required();return;}
- 379.settings.chat_font=$(this).val();if(settings.chat_font==='default'){tabs.settings_body.find('.exampletext').css('font-family','');}else{tabs.settings_body.find('.exampletext').css('font-family',settings.chat_font);}
- 380.$.cookie(settings.chat_font_cookie_name,settings.chat_font,{expires:365,path:'/'});});}
- 381.tabs.settings_body.show();tabs._sort_ignored_users_list();tabs._deactivate_tabs();settings.buttons.find('a[data-tab="settings"]').parent().addClass('active');tabs._set_default_font_change_value();}};settings.buttons.find('a').click(tabs.on_tab_click);var initializer={attempts:0,joined:false,joined_at:null,is_on_private_room:false,base_room_name:settings.room,retry_join_room:function(){if(this.attempts>0){settings.muc_nickname+='_';}
- 382.if(this.attempts>=5){consolelog("Too many failed attempts, disconnecting");conn.disconnect();}
- 383.return this.join_room();},join_room:function(){this.attempts+=1;consolelog("Joining "+settings.room+" with "+settings.muc_nickname);var pres=$pres({to:settings.room+"/"+settings.muc_nickname,token_balance:settings.token_balance}).c('x',{xmlns:"http://jabber.org/protocol/muc"});if(initializer.is_on_private_room){pres=pres.c('history',{'maxchars':'0'});}
- 384.conn.send(pres);},change_to_private_room:function(){if(initializer.is_on_private_room){return;}
- 385.message_receiver.ignore_delayed=true;initializer.leave_room();initializer.attempts=4;initializer.is_on_private_room=true;settings.room=settings.private_room;presence_monitor.reset();initializer.join_room();},leave_private_room:function(){if(!initializer.is_on_private_room){return;}
- 386.initializer.leave_room();initializer.attempts=4;initializer.is_on_private_room=false;settings.room=initializer.base_room_name;presence_monitor.reset();initializer.join_room();},leave_room:function(){conn.send($pres({to:settings.room+"/"+settings.muc_nickname,type:'unavailable'}).c('x',{xmlns:"http://jabber.org/protocol/muc"}));},on_disconnect:function(){initializer.joined=false;},on_received_my_presence:function(){initializer.joined=true;initializer.joined_at=new Date();if(!presence_monitor.participants[settings.muc_nickname]){return true;}
- 387.if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){return true;}
- 388.if(settings.current_subject===""&!public_methods.is_goal_set()){conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(settings.default_subject))}
- 389.conn.sendIQ($iq({to:settings.room,type:'get'}).c('query',{xmlns:'http://jabber.org/protocol/muc#owner'}),function(response){consolelog("Server configuration form . . .");consolelog(response);var x=$iq({to:settings.room,type:'set'}).c('query',{xmlns:'http://jabber.org/protocol/muc#owner'}).c('x',{xmlns:'jabber:x:data',type:'submit'}).c('field',{'var':'FORM_TYPE'}).c('value').t('http://jabber.org/protocol/muc#roomconfig').up().up().c('field',{'var':'muc#roomconfig_whois'}).c('value').t('anyone').up().up().c('field',{'var':'muc#roomconfig_maxusers'}).c('value').t('50000');consolelog("Configuring room "+x.toString());conn.sendIQ(x,function(response){consolelog("Configuration response . . .");consolelog(response);});});}};$(document).bind("disconnected.defchat",initializer.on_disconnect);var presence_monitor={participants:new Array(),num_participants:0,reset:function(){presence_monitor.participants=new Array();presence_monitor.num_participants=0;settings.userslist.html("");},user_is_present:function(nick){var present=presence_monitor.participants[nick];present=(present!==undefined&&present!==false);return present;},remove_participant:function(nick){presence_monitor.num_participants-=1;delete presence_monitor.participants[nick];},on_presence:function(presence){var from=$(presence).attr('from');var room=Strophe.getBareJidFromJid(from);if(room==settings.room){consolelog(presence);var nick=Strophe.getResourceFromJid(from);if(nick.substring(0,6)=='admin-'){return true;}
- 390.consolelog("Nick for "+from+" is "+nick);if($(presence).attr('type')==='error'&&!initializer.joined){if($(presence).find("status[code='409']")){initializer.retry_join_room();return true;}else{consolelog("Disconnecting because of error while connecting");conn.disconnect();return false;}}
- 391.if($(presence).attr('type')!=='unavailable'){var present=presence_monitor.user_is_present(nick);var extradata=$(presence).find('item');if(extradata.attr('jid')){presence_monitor.participants[nick]={'jid':Strophe.getBareJidFromJid(extradata.attr('jid')),'role':extradata.attr('role')};if(!present){presence_monitor.num_participants+=1;$(document).trigger('userjoined.defchat',[nick,$(presence).attr('token_balance')]);}}}else if(presence_monitor.user_is_present(nick)&&$(presence).attr('type')==='unavailable'){presence_monitor.remove_participant(nick);$(document).trigger('userleft.defchat',nick);}
- 392.if($(presence).attr('type')!=='error'&&!initializer.joined&&nick===settings.muc_nickname){initializer.on_received_my_presence();}}
- 393.return true;}};conn.addHandler(presence_monitor.on_presence,null,"presence");var message_receiver={ignored_users:new Array(),ignore_delayed:false,on_goalset:function($message){settings.room_goal.amount=$message.attr('amount');settings.room_goal.current=$message.attr('current');settings.room_goal.hightipper=$message.attr('hightipper');settings.room_goal.hightipper_amount=$message.attr('hightipper_amount');settings.room_goal.lasttipper=$message.attr('lasttipper');settings.room_goal.lasttipper_amount=$message.attr('lasttipper_amount');if(settings.room_goal.lasttipper==""){settings.room_goal.lasttipper="--";settings.room_goal.hightipper="--";}
- 394.tipping_goal.enable_goal();},on_message:function(message){consolelog(message);var $message=$(message);var subtype=$message.attr('subtype');var delayed=false;if($message.children('delay').length!=0){delayed=true;}
- 395.if(message_receiver.ignore_delayed&delayed){return true;}
- 396.if(subtype=='roomalert'){if(!delayed){message_receiver.on_roomalert($message);}
- 397.return true;}else if(subtype=='goalset'){if(!delayed){message_receiver.on_goalset($message);}
- 398.return true;}else if(subtype=='goalcancel'){if(!delayed){tipping_goal.disable_goal();}
- 399.return true;}else if(subtype=='goalreached'){if(!delayed){message_receiver.on_goalreached();}}else if(subtype=='tipalert'){message_receiver.on_tipalert($message);return true;}else if(subtype=='messagechangerequest'){if(!delayed){message_receiver.on_messagechangerequest($message);}
- 400.return true;}else if(subtype=='settingsupdate'){if(!delayed){message_receiver.on_settingsupdate($message);}
- 401.return true;}else if(subtype=='groupshowrequest'){if(!delayed){groups_and_privates.on_groupshowrequest_message($message);}
- 402.return true;}else if(subtype=='privateshowrequest'){if(!delayed){groups_and_privates.on_privateshowrequest_message($message);}
- 403.return true;}else if(subtype=='groupshowapprove'){if(!delayed){groups_and_privates.on_groupshowrequest_approvemessage($message);}
- 404.return true;}else if(subtype=='leaveprivateroom'){if(!delayed){groups_and_privates.on_leaveprivateroom_message($message);}
- 405.return true;}else if(subtype=='privateshowapprove'){if(!delayed){groups_and_privates.on_privateshowrequest_approvemessage($message);}
- 406.return true;}else if(subtype=='token_balance_update'){if(!delayed){tipping.current_balance=parseInt($(message).attr("tokenbalance_"+settings.my_username));$('.tokencount').html(tipping.current_balance);}
- 407.return true;}else if(subtype=='groupshowcancel'){if(!delayed){groups_and_privates.on_groupshowrequest_cancelmessage();}
- 408.return true;}else if(subtype=='privateshowcancel'){if(!delayed){groups_and_privates.on_privateshowrequest_cancelmessage();}
- 409.return true;}else if(subtype=='awaycancel'){if(!delayed){groups_and_privates.on_awaystatus_cancelmessage();}
- 410.return true;}
- 411.var subject=$message.children('subject').text();if(subject){var msg=interpolate(gettext("room subject changed to \"%(subject)s\""),{subject:subject},true);add_system_message("<span class='roommessagelabel'>"+msg+"</span>");$(document).trigger("subjectchanged.defchat",subject);display_subject=settings.parse_subject(subject);settings.subject.text(display_subject);settings.current_subject=subject;return true;}
- 412.var from=$message.attr('from');var nick=Strophe.getResourceFromJid(from);if(nick==null){return true;}
- 413.if(presence_monitor.participants[nick]){if(message_receiver.ignored_users.indexOf(presence_monitor.participants[nick].jid)!==-1){return true;}}
- 414.if($('.broadcaster_panel_away').is(':visible')){return true;}
- 415.message_receiver.add_message(message_receiver._format_message(message));return true;},on_goalreached:function(){if(!settings.is_broadcasting){return;}
- 416.var html="<span class='roommessagelabel'>";html+=gettext("Your goal is completed, to set a new one click Cancel goal and start over")+"</span>";add_system_message(html);},on_settingsupdate:function($message){if($message.attr('allow_privates')==='True'){$('.private_settings .value').html(gettext("Allowed"));groups_and_privates.show_private_show_controls(true);}else{$('.private_settings .value').html(gettext("Disabled"));groups_and_privates.hide_private_show_controls(true);}
- 417.if($message.attr('allow_group')==='True'){$('.group_show_disabled').hide();$('.group_show_active').show();groups_and_privates.show_group_show_controls(true);}else{$('.group_show_active').hide();$('.group_show_disabled').show();groups_and_privates.hide_group_show_controls(true);}
- 418.$('.num_users_required_for_group').html($message.attr('minimum_users_for_group_show'));return true;},on_messagechangerequest:function($message){var subject=$message.children('subject').text();if(settings.is_broadcasting){conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(subject));}
- 419.return true;},on_roomalert:function($message){var slug=$message.attr('slug');var url=$message.attr('url');var gendericon=$message.attr('gendericon');var gender=$message.attr('gender');if($.inArray(gender,settings.interested_in)<0){return;}
- 420.if(!(initializer.joined&&(new Date()-initializer.joined_at>2*1000))){return true;}
- 421.var msg=interpolate(gettext("%(roomname)s turned on their cam -- click here to visit."),{roomname:slug},true);msg=message_receiver._add_emoticons(msg);add_system_message("<span class='roomalert'><a href='"+
- 422.url+"'><<< <img src='"+settings.media_url+"images/"+gendericon+"' height=15 width=14 border=0> "+msg+" >>></a></span>",tabs.get_current_tab_domele());},on_tipalert:function($message){var from_username=$message.attr('from_username');var to_username=$message.attr('to_username');var amount=$message.attr("amount");var body=$message.find('body').text();var msg=interpolate(gettext("%(from_username)s tipped %(amount)s tokens"),{from_username:from_username,amount:amount},true);if(settings.is_broadcasting){if(!$message.find('delay').length!=0){PlayBeep();if($.trim(body)!=""){msg=msg+" -- "+body;}}}
- 423.add_system_message("<span class='tipalert'>"+msg+"</span>",tabs.get_current_tab_domele());},on_private_message:function(message,nick){if(!nick){var from=$(message).attr('from');nick=Strophe.getResourceFromJid(from);}
- 424.if(presence_monitor.participants[nick]&&presence_monitor.participants[nick].jid){if(message_receiver.ignored_users.indexOf(presence_monitor.participants[nick].jid)!==-1){return true;}}
- 425.message_receiver.add_message(message_receiver._format_message(message),tabs.get_or_create_pm_tab_for_nick(nick,true));tabs.private_message_received(nick);return true;},add_message:function(message,domele){if(!domele){domele=settings.chatlist}
- 426.var chat=domele.get(0);var at_bottom=chat.scrollTop>=chat.scrollHeight-
- 427.chat.clientHeight;domele.append(message);domele.find('div:last').find('a[rel*=facebox]').facebox();domele.find('div:last span.username').not('span[data-nick="'+settings.muc_nickname+'"]').jscontext({html:get_contextual_menu_html,bind:'anyclick'});if(at_bottom){chat.scrollTop=chat.scrollHeight;}
- 428.while(domele.find('div.text').length>200){domele.find('div.text:first').empty().remove();}},_format_message:function(message){var $message=$(message);var from=$message.attr('from');var chat_font=$message.attr('chat_font');var font_color=$message.attr('font_color');var is_mod=$message.attr('is_mod');var has_tokens=$message.attr('has_tokens');var room=Strophe.getBareJidFromJid(from);var nick=Strophe.getResourceFromJid(from);var body=$message.children('body').text();if(!body){body=$message.text();}
- 429.if(room==settings.room){body=message_receiver._add_emoticons(body);var r=$('<div class="text"><span class="username messagelabel" '+'data-nick="'+nick+'">'+nick+':</span><p>'+body+'</p></div>');if(chat_font!=='default'){r.css('font-family',chat_font);}
- 430.r.css('color',font_color);if(presence_monitor.participants[nick]){if(presence_monitor.participants[nick].jid===settings.roomowner){r.find('.messagelabel').addClass('hostmessagelabel');}else if(is_mod=='1'){r.find('.messagelabel').addClass('moderatormessagelabel');}else if(has_tokens=='1'){r.find('.messagelabel').addClass('hastokensmessagelabel');}}
- 431.return r;}},_add_emoticons:function(in_body){var body=$("<div/>").text(in_body).html();while(true){var match=body.match(/%%%\[emoticon ([^\s]+)\]%%%/);if(!match){break;}
- 432.var urlparts=match[1].split(/\|/);var str="";var show_icon=tabs._should_show_emoticon();if(!show_icon){str=":"+urlparts[0];}
- 433.else{var str="<img src='"+urlparts[1]+"' title=':"+urlparts[0]+"' height='"+urlparts[3]+"' width='"+urlparts[2]+"'>";}
- 434.if(urlparts.length==5){str="<a href='"+urlparts[4]+"' rel='facebox'>"+str+"</a>";}
- 435.else if(!show_icon){str="<a href='"+urlparts[1]+"' rel='facebox'>"+str+"</a>";}
- 436.body=body.replace(match[0],str);}
- 437.return body;}};conn.addHandler(message_receiver.on_message,null,"message","groupchat");conn.addHandler(message_receiver.on_private_message,null,"message","chat");var moderators=new Array();var message_sender={message_to_send:'',confirmed_send:false,_recent_message_log:new Array(),on_form_submit:function(){if(settings.textinput.val()==""){message_sender._reset_form();return false;}
- 438.if(settings.first_post_warning!==null){if(!message_sender.confirmed_send){if(!confirm(settings.first_post_warning)){return false;}
- 439.message_sender.confirmed_send=true;}}
- 440.if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){if(message_sender.message_to_send==settings.textinput.val()){add_system_message(gettext("duplicate message not sent"),tabs.get_current_tab_domele());message_sender._reset_form();return false;}
- 441.if(message_sender._get_recent_message_log_count()>=3&&tipping.current_balance===0){add_system_message(gettext("message not sent -- try slowing down"),tabs.get_current_tab_domele());return false;}}}
- 442.if(!initializer.joined){add_system_message('not connected');return false;}
- 443.if(settings.password==='anonymous'){if(settings.login_required_callback){settings.login_required_callback();}else{add_system_message(gettext("anonymous users cannot chat - create your free account"),tabs.get_current_tab_domele());}
- 444.return false;}
- 445.message_sender.message_to_send=settings.textinput.val();message_sender._reset_form();message_sender._translate_and_send();message_sender._recent_message_log.push(new Date());return false;},_get_recent_message_log_count:function(){message_sender._remove_old_messages_from_log();return message_sender._recent_message_log.length;},_remove_old_messages_from_log:function(){var now=new Date();message_sender._recent_message_log=$.grep(message_sender._recent_message_log,function(a){return((now-a)<(10*1000));});},_translate_and_send:function(){if(settings.translate_message_url!==null){message_sender._reset_form();$.ajax({url:settings.translate_message_url,aync:false,data:{message:message_sender.message_to_send,room:settings.roomownernick},success:function(data,textStatus,jqXHR){if(!jqXHR.getResponseHeader('X-Successful')){alert("An error occurred");return;}
- 446.if(jqXHR.getResponseHeader('X-Spam')){var m=$msg({to:'',from:settings.room+'/'+settings.username,type:'chat',font_color:settings.font_color,chat_font:settings.chat_font}).c('body').t(data);m=String(m);message_receiver.add_message(message_receiver._format_message(m),tabs.get_current_tab_domele());}else if(jqXHR.getResponseHeader('X-Denied')){m=String(m);message_receiver.add_message("<div class='text'>"+jqXHR.getResponseHeader('X-Denied')+"</div>",tabs.get_current_tab_domele());}else{message_sender._send(data);}}});}else{message_sender._send(message_sender.message_to_send);}},_send:function(message){var ismod='0';if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role=='moderator'){ismod='1';}}
- 447.var to;var type;if(tabs.current_tab==='pm'){to=settings.room+"/"+tabs.current_pm_nick;type='chat';}else{to=settings.room;type='groupchat';}
- 448.var has_tokens='0';if(tipping.current_balance>0){has_tokens='1';}
- 449.var m=$msg({to:to,type:type,font_color:settings.font_color,chat_font:settings.chat_font,is_mod:ismod,has_tokens:has_tokens}).c('body').t(message);conn.send(m);if(tabs.current_tab==='pm'){var from=settings.room+'/'+settings.muc_nickname;m=$msg({to:to,type:type,from:from,font_color:settings.font_color,chat_font:settings.chat_font,is_mod:ismod}).c('body').t(message);message_receiver.on_private_message(m.toString(),tabs.current_pm_nick);}},_reset_form:function(){settings.textinput.val('');settings.textinput.focus();}};var tipping_goal={init:function(){$("#goalform").submit(tipping_goal.on_configuration_submit);$('.cancel_goal').click(tipping_goal.on_cancel_click);$('.set_goal').click(tipping_goal.on_set_goal_clicked);$('.broadcaster_panel_goal_configuration .cancel a').click(tipping_goal.on_configuration_cancel_click);},on_set_goal_clicked:function(){groups_and_privates.change_broadcaster_panel('goal_configuration');$('#token_goal_description_input').focus();},on_configuration_cancel_click:function(){groups_and_privates.change_broadcaster_panel('default');},disable_goal:function(){settings.room_goal={};if(!settings.is_broadcasting){$(".goal_display_table").hide();}},enable_goal:function(){if(!initializer.is_on_private_room){groups_and_privates.change_broadcaster_panel('goal_display');}
- 450.$(".goal_display_table").show();$('.goal_status_disabled').hide();$('.goal_status_active').show();$('.room_goal_amount').text(settings.room_goal.amount);$('.room_goal_current').text(settings.room_goal.current);$('.room_goal_hightipper').text(settings.room_goal.hightipper);$('.room_goal_hightipper_amount').text(settings.room_goal.hightipper_amount);$('.room_goal_lasttipper').text(settings.room_goal.lasttipper);$('.room_goal_lasttipper_amount').text(settings.room_goal.lasttipper_amount);},on_configuration_submit:function(){var description=$("#goalform input[name='description']").val();var amount=parseInt($("#goalform input[name='amount']").val());if($.trim(description)==""){alert(gettext("Invalid token goal description"));return false;}
- 451.if(isNaN(amount)|amount<=0){alert(gettext("Invalid token goal amount"));return false;}
- 452.$.post($('#goalform').attr('action'),$('#goalform').serialize(),function(data){if(data!='ok'){alert(data);}});return false;},on_cancel_click:function(){if(confirm(gettext("Are you sure you want to remove this goal?"))){groups_and_privates.change_broadcaster_panel('default');$('.goal_status_active').hide();$('.goal_status_disabled').show();$.post($(this).attr('href'),{'foo':'bar'});conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(settings.default_subject))}
- 453.return false;}};tipping_goal.init();var emoticons={_emoticons_loaded:false,_popup_window:null,init:function(){settings.domroot.find(".emoticon_button").click(emoticons.on_emoticon_button_clicked);},on_emoticon_button_clicked:function(ev){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- 454.emoticons.toggle_overlay();},on_body_clicked_while_overlay_up:function(ev){if(settings.domroot.find('.emote_popup').has(ev.target).length||settings.domroot.find('.emoticon_button').is(ev.target)){return;}
- 455.emoticons.toggle_overlay();},on_popup_clicked:function(ev){if(!emoticons._popup_window||emoticons._popup_window.closed){emoticons._popup_window=window.open($(this).attr('href'),'_blank','status=0,toolbar=0,menubar=0,directories=0,resizable=1,'+'scrollbars=1,height=615,width=850');emoticons._popup_window.onload=function(){emoticons._popup_window.RunCallbackFunction=emoticons.on_popup_callback;};$(window).unload(emoticons.on_document_closing);}
- 456.emoticons.toggle_overlay();emoticons._popup_window.focus();return false;},on_document_closing:function(){if(emoticons._popup_window){if(!emoticons._popup_window.closed){emoticons._popup_window.close();}}},on_popup_callback:function(){alert("popup callback");},on_emoticon_clicked:function(){emoticons.toggle_overlay();settings.textinput.val(settings.textinput.val()+" "+
- 457.$(this).data('emoticon'));settings.textinput.focus();},toggle_overlay:function(){var ep=settings.domroot.find(".emote_popup");if(ep.is(":visible")){$("body").unbind('click',emoticons.on_body_clicked_while_overlay_up);ep.hide();}else{$("body").click(emoticons.on_body_clicked_while_overlay_up);if(emoticons._emoticons_loaded){ep.show();}else{emoticons._emoticons_loaded=true;ep.load(settings.emoticon_overlay_url,function(){ep.show();ep.find('.more a').click(emoticons.on_popup_clicked);ep.find('img.emoticon').click(emoticons.on_emoticon_clicked);});}}}};emoticons.init();var tipping={current_balance:0,init:function(){$(".tip_button").click(tipping.on_tipping_button_clicked);settings.domroot.find('.tip_popup form').submit(tipping.on_form_submit);tipping.current_balance=settings.token_balance;$(document).bind('keydown','ctrl+s',tipping.on_key_down);$(document).bind('keydown','command+s',tipping.on_key_down);},on_key_down:function(event){tipping.toggle_overlay();return false;},on_form_submit:function(){var amount=parseInt($("#id_tip_amount").val());if(isNaN(amount)|amount<1){alert(gettext("Invalid tip amount"));return false;}
- 458.if(amount>tipping.current_balance){alert(gettext("You do not have enough tokens."));return false;}
- 459.var msg=interpolate(gettext("Send %(tokens)s tokens to %(username)s?"),{username:settings.roomownernick,tokens:$("#id_tip_amount").val()},true);if(!confirm(msg)){return false;}
- 460.var $form=$(this);$.ajax({url:$(this).attr('action'),dataType:'json',data:$(this).serialize(),type:'POST',success:function(response){if(response.error){alert(response.error);}else if(response.success){$form.find("textarea").val("");tipping.toggle_overlay();tipping.current_balance=parseInt(response.token_balance);$('.tokencount').html(response.token_balance);}}});return false;},on_tipping_button_clicked:function(ev){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- 461.if(!(tabs.current_tab=='pm'|tabs.current_tab=='chat')){tabs._show_chat_tab();}
- 462.tipping.toggle_overlay();},on_body_clicked_while_overlay_up:function(ev){if(settings.domroot.find('.tip_popup').has(ev.target).length||$('.tip_button').is(ev.target)){return;}
- 463.tipping.toggle_overlay();},toggle_overlay:function(){if(!settings.allow_tipping){return;}
- 464.if(!(typeof _gaq==='undefined')){_gaq.push(['_trackPageview','/tracking/toggle_tipping_overlay/']);}
- 465.var ep=settings.domroot.find(".tip_popup");if(ep.is(":visible")){$("body").unbind('click',tipping.on_body_clicked_while_overlay_up);ep.hide();settings.textinput.focus();}else{$("body").click(tipping.on_body_clicked_while_overlay_up);$.ajax({url:settings.tipping_current_tokens_url,type:'GET',data:'foo=bar',dataType:'json',cache:false,success:function(response){tipping.current_balance=parseInt(response.token_balance);$('.tokencount').html(response.token_balance);ep.show();ep.find('#id_tip_amount').focus();ep.find('#id_tip_amount').select();}});}}};tipping.init();var keybinder={current_focus:null,init:function(){$(document).keydown(keybinder.handle_keydown);$(":input").live('focus',keybinder.on_focus);$(":input").live('blur',keybinder.on_blur);},handle_keydown:function(e){if(keybinder.current_focus!==null){return;}
- 466.if((e.keyCode>=65&&e.keyCode<=90)|(e.keyCode>=48&&e.keyCode<=57)){settings.textinput.focus().val(settings.textinput.val());}},on_blur:function(){keybinder.current_focus=null;},on_focus:function(){keybinder.current_focus=this.id;}};keybinder.init();var groups_and_privates={init:function(){$('.start_group_show,.start_group_show_link').click(groups_and_privates.start_group_show_clicked);$('.start_group_show_cancel').click(groups_and_privates.cancel_group_chat_request);$('.start_private_show').click(groups_and_privates.start_private_show_clicked);$('.start_private_show_cancel').click(groups_and_privates.cancel_private_chat_request);$('.broadcaster_panel_show_requested .accept').click(groups_and_privates.approve_private_show_clicked);$('.broadcaster_panel_show_requested .decline').click(groups_and_privates.decline_private_show_clicked);$('.broadcaster_panel_private_show .decline').click(groups_and_privates.decline_private_show_clicked);$('.broadcaster_panel_group_show_requested .accept').click(groups_and_privates.approve_group_show_clicked);$('.broadcaster_panel_group_show_requested .decline').click(groups_and_privates.decline_group_show_clicked);$('.broadcaster_panel_group_show .decline').click(groups_and_privates.decline_group_show_clicked);$('.return_from_away_mode').live('click',groups_and_privates.return_from_away_mode_clicked);},approve_private_show_clicked:function(){$.post(settings.private_show_approve_url,{'foo':'bar'});},decline_private_show_clicked:function(){if(!confirm(gettext("Are you sure?"))){return}
- 467.$.post(settings.private_show_decline_url,{'foo':'bar'});},approve_group_show_clicked:function(){$.post(settings.group_show_approve_url,{'foo':'bar'});},return_from_away_mode_clicked:function(){$.post(settings.return_from_away_url,{'foo':'bar'});},decline_group_show_clicked:function(){if(!confirm(gettext("Are you sure?"))){return}
- 468.$.post(settings.group_show_decline_url,{'foo':'bar'});},start_group_show_clicked:function(){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- 469.groups_and_privates.change_group_show_link('processing');$.post(settings.group_show_tokens_per_minute_url,{'foo':'bar'},function(data){var msg=interpolate(gettext("Enter group chat with %(modelname)s? (%(price)s tokens per minute)"),{modelname:settings.roomownernick,price:data},true);if(confirm(msg)){$.post(settings.group_show_request_url,{'chat_username':settings.muc_nickname},function(data){if(data.success){groups_and_privates.change_group_show_link('waiting');add_system_message("<span class='privatealert'>"+
- 470.gettext("Group show request has been sent.")+"</span>");}else{if(data.message){alert(data.message);}
- 471.groups_and_privates.change_group_show_link();}},'json').error(groups_and_privates.error_starting_group_show);}else{groups_and_privates.change_group_show_link();}}).error(groups_and_privates.error_starting_group_show);},on_groupshowrequest_message:function($message){var users_waiting=parseInt($message.attr('users_waiting'));var users_required=parseInt($message.attr('users_required'));if(!initializer.is_on_private_room){add_system_message("<span class='privatealert'>"+users_waiting+" of "+users_required+" users are ready to start a group show.</span>")}
- 472.$('.num_users_waiting_for_group').html($message.attr('users_waiting'));if(settings.is_broadcasting&!initializer.is_on_private_room){if(users_waiting==users_required){$('.broadcaster_panel_group_show_requested .tokens_per_minute').html($message.attr('tokens_per_minute'));groups_and_privates.change_broadcaster_panel('group_show_requested');PlayBeep();}}},start_private_show_clicked:function(){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- 473.groups_and_privates.change_private_show_link('processing');$.post(settings.private_show_tokens_per_minute_url,{'foo':'bar'},function(data){var msg=interpolate(gettext("Enter private chat with %(modelname)s? (%(price)s tokens per minute)"),{modelname:settings.roomownernick,price:data},true);if(confirm(msg)){$.post(settings.private_show_request_url,{'chat_username':settings.muc_nickname},function(data){if(data.success){groups_and_privates.change_private_show_link('waiting');add_system_message("<span class='privatealert'>"+
- 474.gettext("Private show request has been sent. Waiting on broadcaster to approve.")+"</span>");}else{if(data.message){alert(data.message);}
- 475.groups_and_privates.change_private_show_link();}},'json').error(groups_and_privates.error_starting_private_show);}else{groups_and_privates.change_private_show_link();}}).error(groups_and_privates.error_starting_private_show);},is_requesting_group_chat:function(){return $('.start_group_show_waiting').is(':visible')|$('.start_group_show_processing').is(':visible');},is_requesting_private_chat:function(){return $('.start_private_show_waiting').is(':visible');},on_groupshowrequest_approvemessage:function($message){add_system_message("<span class='privatealert'>"+
- 476.gettext("Group show has started.")+"</span>");if(initializer.is_on_private_room){return;}
- 477.$('.tokens_per_minute').html($message.attr('tokens_per_minute'));if(groups_and_privates.is_requesting_group_chat()|settings.is_broadcasting){groups_and_privates.change_group_show_link('active');groups_and_privates.change_broadcaster_panel('group_show');initializer.change_to_private_room();}},on_privateshowrequest_approvemessage:function($message){add_system_message("<span class='privatealert'>"+
- 478.gettext("Private show has started.")+"</span>");if(initializer.is_on_private_room){return;}
- 479.if(groups_and_privates.is_requesting_private_chat()|settings.is_broadcasting){groups_and_privates.change_private_show_link('active');groups_and_privates.change_broadcaster_panel('private_show');$('.tokens_per_minute').html($message.attr('tokens_per_minute'));initializer.change_to_private_room();}},change_broadcaster_panel:function(name){if(public_methods.is_goal_set()&&name=='default'){name='goal_display';}
- 480.$('.broadcaster_panel_default').hide();$('.broadcaster_panel_private_show').hide();$('.broadcaster_panel_group_show').hide();$('.broadcaster_panel_show_requested').hide();$('.broadcaster_panel_group_show_requested').hide();$('.broadcaster_panel_goal_configuration').hide();$('.broadcaster_panel_goal_display').hide();$('.broadcaster_panel_away').hide();$(".broadcaster_panel_"+name).show();},on_groupshowrequest_cancelmessage:function(){$('.num_users_waiting_for_group').html('0');if(initializer.is_on_private_room){if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('away');}
- 481.add_system_message("<span class='privatealert'>"+
- 482.gettext("Group show has finished.")+"</span>");initializer.leave_private_room();groups_and_privates.change_group_show_link();}else{if(groups_and_privates.is_requesting_group_chat()){add_system_message("<span class='privatealert'>"+
- 483.gettext("Group show has been declined.")+"</span>");groups_and_privates.change_group_show_link();}
- 484.if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('default');}}},on_awaystatus_cancelmessage:function(){if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('default');}},on_privateshowrequest_cancelmessage:function(){if(initializer.is_on_private_room){add_system_message("<span class='privatealert'>"+
- 485.gettext("Private show has finished.")+"</span>");initializer.leave_private_room();groups_and_privates.change_private_show_link();if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('away');}}else{if(groups_and_privates.is_requesting_private_chat()){add_system_message("<span class='privatealert'>"+
- 486.gettext("Private show has been declined.")+"</span>");groups_and_privates.change_private_show_link();}
- 487.if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('default');}}},on_leaveprivateroom_message:function($message){if($message.attr('username')==settings.my_username){initializer.leave_private_room();groups_and_privates.change_group_show_link();}},on_privateshowrequest_message:function($message){if(settings.is_broadcasting){var username=$message.attr('requester_username');$('.broadcaster_panel_show_requested .requester_username').html(username);$('.broadcaster_panel_show_requested .tokens_per_minute').html($message.attr('tokens_per_minute'));groups_and_privates.change_broadcaster_panel('show_requested');PlayBeep();add_system_message("<span class='privatealert'>"+username+" wants to start a private show.</span>")}},error_starting_group_show:function(){alert(gettext("There was an error requesting your show. Please try again."));groups_and_privates.change_group_show_link();},error_starting_private_show:function(){alert(gettext("There was an error requesting your show. Please try again."));groups_and_privates.change_private_show_link();},cancel_group_chat_request:function(){if(confirm(gettext("Are you sure?"))){$.post(settings.group_show_cancel_url,{'foo':'bar'});groups_and_privates.change_group_show_link();}},cancel_private_chat_request:function(){if(confirm(gettext("Are you sure?"))){$.post(settings.private_show_cancel_url,{'foo':'bar'});}},change_group_show_link:function(link){$('.start_group_show').hide();$('.start_group_show_waiting').hide();$('.start_group_show_processing').hide();$('.start_group_show_active').hide();var key='.start_group_show';if(link){key=key+"_"+link;groups_and_privates.hide_private_show_controls();}else{groups_and_privates.show_private_show_controls();}
- 488.$(key).show();},change_private_show_link:function(link){$('.start_private_show').hide();$('.start_private_show_processing').hide();$('.start_private_show_waiting').hide();$('.start_private_show_active').hide();var key='.start_private_show';if(link){key=key+"_"+link;groups_and_privates.hide_group_show_controls();}else{groups_and_privates.show_group_show_controls();}
- 489.$(key).show();},hide_private_show_controls:function(force){$('.private_show_controls').hide();if(force){$('.private_show_controls').data('forcehidden','1');}
- 490.groups_and_privates.show_group_show_controls();},show_private_show_controls:function(force){if(force|$('.private_show_controls').data('forcehidden')!='1'){$('.private_show_controls').show();}},hide_group_show_controls:function(force){$('.group_show_controls').hide();if(force){$('.group_show_controls').data('forcehidden','1');}},show_group_show_controls:function(force){if(force|$('.group_show_controls').data('forcehidden')!='1'){$('.group_show_controls').show();}}};groups_and_privates.init();public_methods._set_font_size();ignored_user_methods.load_ignored_users();settings.form.submit(message_sender.on_form_submit);settings.submitbutton.click(message_sender.on_form_submit);if(settings.throttlechat){if(settings.welcome_message){add_system_message(settings.welcome_message);}
- 491.if(settings.welcome_warning){add_system_message(settings.welcome_warning);}
- 492.add_system_message(settings.throttle_message);presence_monitor.num_participants=100;}else{consolelog("Trying to connect to "+settings.bosh_host+" with "+
- 493.settings.user+":"+settings.password);conn.connect(settings.user,settings.password,function(status,data){if(status===Strophe.Status.CONNECTED){$(document).trigger("connected.defchat");}else if(status===Strophe.Status.CONNECTING){$(document).trigger("connecting.defchat");}else if(status===Strophe.Status.DISCONNECTED){$(document).trigger("disconnected.defchat");}else if(status===Strophe.Status.CONNFAIL){$(document).trigger("connectionfailed.defchat");}else{consolelog('Defchat Unhandled status: '+status+"-"+data);}});}
- 494.if(settings.scroll_on_load){settings.textinput.focus();function isScrolledIntoView(elem)
- 495.{var docViewTop=$(window).scrollTop();var docViewBottom=docViewTop+$(window).height();var elemTop=$(elem).offset().top;var elemBottom=elemTop+$(elem).height();return((elemBottom>=docViewTop)&&(elemTop<=docViewBottom));}
- 496.if($('.top-section').length>0){if(!isScrolledIntoView($('.top-section'))){$(document).scrollTop($('.top-section').offset().top);}}}
- 497.var returnhandle=function(method){if(public_methods[method]){return public_methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else if(typeof method==='object'||!method){return public_methods.init.apply(this,arguments);}else{$.error('Method '+method+' does not exist in defchat');}};return returnhandle;};})(jQuery);function EmbedViewerSwf(swfname,modelname,fms_address,popout_url,language,mute,pr,sa,express,uid,jg)
- 498.{var params={allowScriptAccess:"always",allowFullScreen:"true",quality:"high",wmode:"opaque",id:"movie",FlashVars:"pid="+modelname+"&address="+fms_address+"&popouturl="+popout_url+"&language="+language+"&mute="+mute+"&pr="+pr+"&sa="+sa+"&uid="+uid+"&jg="+jg};if(!document.getElementById('movie')){return;}
- 499.document.getElementById('movie').innerHTML="<center><br><br><br><br><a border='0' href='http://www.adobe.com/go/getflashplayer' target='_blank'>"+"<img alt='Get Adobe Flash player' src='"+MEDIA_URL+"images/160x41_Get_Flash_Player.jpg'></a><br>"+"We've detected that you are missing the latest version of Flash Player.<br>"+"This version of the Chaturbate Viewer requires Flash Player 10.2.0 or later.<br>"+"<a href='http://www.adobe.com/go/getflashplayer'>"+"Click here to update your Flash Player for free.</a></center>";swfobject.embedSWF(swfname,'movie',"100%","100%","10.2.0",null,"",params);}
- 500.function EmbedBroadcasterSwf(swfname,modelname,fms_address,language,express,pt,captureurl,pk,pe)
- 501.{var params={allowScriptAccess:"always",allowFullScreen:"false",quality:"high",wmode:"opaque",id:"movie",FlashVars:"pid="+modelname+"&address="+fms_address+"&language="+language+"&pt="+pt+"&captureurl="+captureurl+"&pk="+pk+"&pe="+pe};if(!document.getElementById('movie')){return;}
- 502.document.getElementById('movie').innerHTML="<center><br><br><br><br><a border='0' href='http://www.adobe.com/go/getflashplayer' target='_blank'>"+"<img alt='Get Adobe Flash player' src='"+MEDIA_URL+"images/160x41_Get_Flash_Player.jpg'></a><br>"+"We've detected that you are missing the latest version of Flash Player.<br>"+"This version of the Chaturbate Broadcaster requires Flash Player 10.2.0 or later.<br>"+"<a href='http://www.adobe.com/go/getflashplayer'>"+"Click here to update your Flash Player for free.</a></center>";swfobject.embedSWF(swfname,'movie',"100%","100%","10.2.0",null,"",params);}
- 503.function EmbedBroadcasterSwf_11(swfname,modelname,fms_address,language,express,pt,captureurl,pk,pe)
- 504.{var params={allowScriptAccess:"always",allowFullScreen:"false",quality:"high",wmode:"opaque",id:"movie",FlashVars:"pid="+modelname+"&address="+fms_address+"&language="+language+"&pt="+pt+"&captureurl="+captureurl+"&pk="+pk+"&pe="+pe};if(!document.getElementById('movie')){return;}
- 505.document.getElementById('movie').innerHTML="<center><br><br><br><br><a border='0' href='http://www.adobe.com/go/getflashplayer' target='_blank'>"+"<img alt='Get Adobe Flash player' src='"+MEDIA_URL+"images/160x41_Get_Flash_Player.jpg'></a><br>"+"We've detected that you are missing the latest version of Flash Player.<br>"+"This version of the Chaturbate Broadcaster requires Flash Player 11.0.1 or later.<br>"+"<a href='http://www.adobe.com/go/getflashplayer'>"+"Click here to update your Flash Player for free.</a></center>";swfobject.embedSWF(swfname,'movie',"100%","100%","11.0.1",null,"",params);}
- 506.function EmbedDualBroadcasterSwf(swfname,swfname_11,modelname,fms_address,language,express,pt,captureurl,pk,pe)
- 507.{var version=swfobject.getFlashPlayerVersion();if(version.major>=11&&version.minor>=0&&version.release>=1)
- 508.EmbedBroadcasterSwf_11(swfname_11,modelname,fms_address,language,express,pt,captureurl,pk,pe);else
- 509.EmbedBroadcasterSwf(swfname,modelname,fms_address,language,express,pt,captureurl,pk,pe);}
- 510.var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();function SwfScale(width)
- 511.{var swfwidth=parseInt(width);var swfheight=swfwidth*0.75;document.getElementById("player").style.width=swfwidth+"px";document.getElementById("player").style.height=swfheight+"px";}
- 512.var SwfPopup=null;var PopupUpdater=null;function Popout(broadcaster,url)
- 513.{var windowName="CBVPopup";var windowOptions="width="+(498+16)+",height="+(407+16)+",status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0";document.getElementById('player').style.display='none';SwfPopup=window.open(url,windowName,windowOptions);if(PopupUpdater==null)
- 514.PopupUpdater=setInterval("SwfPopupUpdate()",1000);return SwfPopup;}
- 515.function SwfPopupUpdate()
- 516.{if(SwfPopup&&SwfPopup.closed)
- 517.{clearInterval(PopupUpdater);PopupUpdater=null;SwfPopup=null;document.getElementById('player').style.display='block';}}
- 518.function OnResizePopout()
- 519.{var winW=514,winH=423;if(document.body&&document.body.offsetWidth)
- 520.{winW=document.body.offsetWidth;winH=document.body.offsetHeight;}
- 521.if(document.compatMode=='CSS1Compat'&&document.documentElement&&document.documentElement.offsetWidth)
- 522.{winW=document.documentElement.offsetWidth;winH=document.documentElement.offsetHeight;}
- 523.if(window.innerWidth&&window.innerHeight)
- 524.{winW=window.innerWidth;winH=window.innerHeight;}
- 525.var swfW=winW-16;var swfH=swfW*0.75;if(swfH+16>winH)
- 526.SwfScale((winH-16)*1.33);else
- 527.SwfScale((winW-16));}
- 528.function GetFlashObject(movieName)
- 529.{var isIE=navigator.appName.indexOf("Microsoft")!=-1;return(isIE)?window[movieName]:document[movieName];}
- 530.function PlayBeep()
- 531.{GetFlashObject('movie').PlayBeep();}
- 532.function test_js()
- 533.{alert('test join group link');}
- 534.$(document).ready(function(){function on_key_down(){window.location=nextroomurl;return false;}
- 535.$(document).bind('keydown','ctrl+x',on_key_down);$(document).bind('keydown','command+x',on_key_down);});(function($){$(document).ready(function(){$("a.endless_more").live("click",function(){var container=$(this).closest(".endless_container");var loading=container.find(".endless_loading");$(this).hide();loading.show();var data="querystring_key="+$(this).attr("rel").split(" ")[0];$.get($(this).attr("href"),data,function(data){container.before(data);container.remove();});return false;});$("a.endless_page_link").live("click",function(){var data="querystring_key="+$(this).attr("rel").split(" ")[0];$(this).closest(".endless_page_template").load($(this).attr("href"),data);return false;});});})(jQuery);$(document).ready(function(){$.fn.mColorPicker.init.replace=false;$.fn.mColorPicker.defaults.imageFolder="http://ccstatic.chaturbate.com/static/mColorPicker/images/";$.fn.mColorPicker.init.showLogo=false;$.fn.mColorPicker.init.allowTransparency=false;});(function($){var $o;$.fn.mColorPicker=function(options){$o=$.extend($.fn.mColorPicker.defaults,options);if($o.swatches.length<10)$o.swatches=$.fn.mColorPicker.defaults.swatches
- 536.if($("div#mColorPicker").length<1)$.fn.mColorPicker.drawPicker();if($('#css_disabled_color_picker').length<1)$('head').prepend('<style id="css_disabled_color_picker" type="text/css">.mColorPicker[disabled] + span, .mColorPicker[disabled="disabled"] + span, .mColorPicker[disabled="true"] + span {filter:alpha(opacity=50);-moz-opacity:0.5;-webkit-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}</style>');$('.mColorPicker').live('keyup',function(){try{$(this).css({'background-color':$(this).val()}).css({'color':$.fn.mColorPicker.textColor($(this).css('background-color'))}).trigger('change');}catch(r){}});$('.mColorPickerTrigger').live('click',function(){$.fn.mColorPicker.colorShow($(this).attr('id').replace('icp_',''));});this.each(function(){$.fn.mColorPicker.drawPickerTriggers($(this));});return this;};$.fn.mColorPicker.currentColor=false;$.fn.mColorPicker.currentValue=false;$.fn.mColorPicker.color=false;$.fn.mColorPicker.init={replace:'[type=color]',index:0,enhancedSwatches:true,allowTransparency:true,checkRedraw:'DOMUpdated',liveEvents:false,showLogo:true};$.fn.mColorPicker.defaults={imageFolder:'images/',swatches:["#ffffff","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000","#4c2b11","#3b3b3b","#000000"]};$.fn.mColorPicker.liveEvents=function(){$.fn.mColorPicker.init.liveEvents=true;if($.fn.mColorPicker.init.checkRedraw&&$.fn.mColorPicker.init.replace){$(document).bind($.fn.mColorPicker.init.checkRedraw+'.mColorPicker',function(){$('input[data-mcolorpicker!="true"]').filter(function(){return($.fn.mColorPicker.init.replace=='[type=color]')?this.getAttribute("type")=='color':$(this).is($.fn.mColorPicker.init.replace);}).mColorPicker();});}};$.fn.mColorPicker.drawPickerTriggers=function($t){if($t[0].nodeName.toLowerCase()!='input')return false;var id=$t.attr('id')||'color_'+$.fn.mColorPicker.init.index++,hidden=false;$t.attr('id',id);if($t.attr('text')=='hidden'||$t.attr('data-text')=='hidden')hidden=true;var color=$t.val(),width=($t.width()>0)?$t.width():parseInt($t.css('width'),10),height=($t.height())?$t.height():parseInt($t.css('height'),10),flt=$t.css('float'),image=(color=='transparent')?"url('"+$o.imageFolder+"/grid.gif')":'',colorPicker='';$('body').append('<span id="color_work_area"></span>');$('span#color_work_area').append($t.clone(true));colorPicker=$('span#color_work_area').html().replace(/type="color"/gi,'').replace(/input /gi,(hidden)?'input type="hidden"':'input type="text"');$('span#color_work_area').html('').remove();$t.after((hidden)?'<span style="cursor:pointer;border:1px solid black;float:'+flt+';width:'+width+'px;height:'+height+'px;" id="icp_'+id+'"> </span>':'').after(colorPicker).remove();if(hidden){if($('#'+id).prop('class')){$('#icp_'+id).prop('class',$('#'+id).prop('class'));}
- 537.$('#icp_'+id).css({'background-color':color,'background-image':image,'display':'inline-block'}).addClass('mColorPickerTrigger');}else{$('#'+id).css({'background-color':color,'background-image':image}).css({'color':$.fn.mColorPicker.textColor($('#'+id).css('background-color'))}).after('<span style="cursor:pointer;" id="icp_'+id+'" class="mColorPickerTrigger"><img src="'+$o.imageFolder+'color.png" style="border:0;margin:0 0 0 3px" align="absmiddle"></span>').addClass('mColorPickerInput');}
- 538.$('#icp_'+id).attr('data-mcolorpicker','true');$('#'+id).addClass('mColorPicker');return $('#'+id);};$.fn.mColorPicker.drawPicker=function(){$(document.createElement("div")).attr("id","mColorPicker").css('display','none').html('<div id="mColorPickerWrapper"><div id="mColorPickerImg" class="mColor"></div><div id="mColorPickerImgGray" class="mColor"></div><div id="mColorPickerSwatches"><div class="mClear"></div></div><div id="mColorPickerFooter"><input type="text" size="8" id="mColorPickerInput"/></div></div>').appendTo("body");$(document.createElement("div")).attr("id","mColorPickerBg").css({'display':'none'}).appendTo("body");for(n=9;n>-1;n--){$(document.createElement("div")).attr({'id':'cell'+n,'class':"mPastColor"+((n>0)?' mNoLeftBorder':'')}).html(' ').prependTo("#mColorPickerSwatches");}
- 539.$('#mColorPicker').css({'border':'1px solid #ccc','color':'#fff','z-index':999998,'width':'194px','height':'184px','font-size':'12px','font-family':'times'});$('.mPastColor').css({'height':'18px','width':'18px','border':'1px solid #000','float':'left'});$('#colorPreview').css({'height':'50px'});$('.mNoLeftBorder').css({'border-left':0});$('.mClear').css({'clear':'both'});$('#mColorPickerWrapper').css({'position':'relative','border':'solid 1px gray','z-index':999999});$('#mColorPickerImg').css({'height':'128px','width':'192px','border':0,'cursor':'crosshair','background-image':"url('"+$o.imageFolder+"colorpicker.png')"});$('#mColorPickerImgGray').css({'height':'8px','width':'192px','border':0,'cursor':'crosshair','background-image':"url('"+$o.imageFolder+"graybar.jpg')"});$('#mColorPickerInput').css({'border':'solid 1px gray','font-size':'10pt','margin':'3px','width':'80px'});$('#mColorPickerImgGrid').css({'border':0,'height':'20px','width':'20px','vertical-align':'text-bottom'});$('#mColorPickerSwatches').css({'border-right':'1px solid #000'});$('#mColorPickerFooter').css({'background-image':"url('"+$o.imageFolder+"grid.gif')",'position':'relative','height':'26px'});if($.fn.mColorPicker.init.allowTransparency)$('#mColorPickerFooter').prepend('<span id="mColorPickerTransparent" class="mColor" style="font-size:16px;color:#000;padding-right:30px;padding-top:3px;cursor:pointer;overflow:hidden;float:right;">transparent</span>');if($.fn.mColorPicker.init.showLogo)$('#mColorPickerFooter').prepend('<a href="http://meta100.com/" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="float:right;" target="_blank"><img src="'+$o.imageFolder+'meta100.png" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="border:0;border-left:1px solid #aaa;right:0;position:absolute;"/></a>');$("#mColorPickerBg").click($.fn.mColorPicker.closePicker);var swatch=$.fn.mColorPicker.getCookie('swatches'),i=0;if(typeof swatch=='string')swatch=swatch.split('||');if(swatch==null||$.fn.mColorPicker.init.enhancedSwatches||swatch.length<10)swatch=$o.swatches;$(".mPastColor").each(function(){$(this).css('background-color',swatch[i++].toLowerCase());});};$.fn.mColorPicker.closePicker=function(){$(".mColor, .mPastColor, #mColorPickerInput, #mColorPickerWrapper").unbind();$("#mColorPickerBg").hide();$("#mColorPicker").fadeOut()};$.fn.mColorPicker.colorShow=function(id){var $e=$("#icp_"+id);pos=$e.offset(),$i=$("#"+id);hex=$i.attr('data-hex')||$i.attr('hex'),pickerTop=pos.top+$e.outerHeight(),pickerLeft=pos.left,$d=$(document),$m=$("#mColorPicker");if($i.attr('disabled'))return false;if(pickerTop+$m.height()>$d.height())pickerTop=pos.top-$m.height();if(pickerLeft+$m.width()>$d.width())pickerLeft=pos.left-$m.width()+$e.outerWidth();$m.css({'top':(pickerTop)+"px",'left':(pickerLeft)+"px",'position':'absolute'}).fadeIn("fast");$("#mColorPickerBg").css({'z-index':999990,'background':'black','opacity':.01,'position':'absolute','top':0,'left':0,'width':parseInt($d.width(),10)+'px','height':parseInt($d.height(),10)+'px'}).show();var def=$i.val();$('#colorPreview span').text(def);$('#colorPreview').css('background',def);$('#color').val(def);if($('#'+id).attr('data-text'))$.fn.mColorPicker.currentColor=$e.css('background-color');else $.fn.mColorPicker.currentColor=$i.css('background-color');if(hex=='true')$.fn.mColorPicker.currentColor=$.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.currentColor);$("#mColorPickerInput").val($.fn.mColorPicker.currentColor);$('.mColor, .mPastColor').bind('mousemove',function(e){var offset=$(this).offset();$.fn.mColorPicker.color=$(this).css("background-color");if($(this).hasClass('mPastColor')&&hex=='true')$.fn.mColorPicker.color=$.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color);else if($(this).hasClass('mPastColor')&&hex!='true')$.fn.mColorPicker.color=$.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color);else if($(this).attr('id')=='mColorPickerTransparent')$.fn.mColorPicker.color='transparent';else if(!$(this).hasClass('mPastColor'))$.fn.mColorPicker.color=$.fn.mColorPicker.whichColor(e.pageX-offset.left,e.pageY-offset.top+(($(this).attr('id')=='mColorPickerImgGray')?128:0),hex);$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.color);}).click(function(){$.fn.mColorPicker.colorPicked(id);});$('#mColorPickerInput').bind('keyup',function(e){try{$.fn.mColorPicker.color=$('#mColorPickerInput').val();$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.color);if(e.which==13)$.fn.mColorPicker.colorPicked(id);}catch(r){}}).bind('blur',function(){$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.currentColor);});$('#mColorPickerWrapper').bind('mouseleave',function(){$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.currentColor);});};$.fn.mColorPicker.setInputColor=function(id,color){var image=(color=='transparent')?"url('"+$o.imageFolder+"grid.gif')":'',textColor=$.fn.mColorPicker.textColor(color);if($('#'+id).attr('data-text')||$('#'+id).prop('text'))$("#icp_"+id).css({'background-color':color,'background-image':image});$("#"+id).val(color).css({'background-color':color,'background-image':image,'color':textColor}).trigger('change');$("#mColorPickerInput").val(color);};$.fn.mColorPicker.textColor=function(val){if(typeof val=='undefined'||val=='transparent')return"black";val=$.fn.mColorPicker.RGBtoHex(val);return(parseInt(val.substr(1,2),16)+parseInt(val.substr(3,2),16)+parseInt(val.substr(5,2),16)<400)?'white':'black';};$.fn.mColorPicker.setCookie=function(name,value,days){var cookie_string=name+"="+escape(value),expires=new Date();expires.setDate(expires.getDate()+days);cookie_string+="; expires="+expires.toGMTString();document.cookie=cookie_string;};$.fn.mColorPicker.getCookie=function(name){var results=document.cookie.match('(^|;) ?'+name+'=([^;]*)(;|$)');if(results)return(unescape(results[2]));else return null;};$.fn.mColorPicker.colorPicked=function(id){$.fn.mColorPicker.closePicker();if($.fn.mColorPicker.init.enhancedSwatches)$.fn.mColorPicker.addToSwatch();$("#"+id).trigger('colorpicked',[id,$('#mColorPickerInput').val()]);};$.fn.mColorPicker.addToSwatch=function(color){var swatch=[]
- 540.i=0;if(typeof color=='string')$.fn.mColorPicker.color=color.toLowerCase();$.fn.mColorPicker.currentValue=$.fn.mColorPicker.currentColor=$.fn.mColorPicker.color;if($.fn.mColorPicker.color!='transparent')swatch[0]=$.fn.mColorPicker.color.toLowerCase();$('.mPastColor').each(function(){$.fn.mColorPicker.color=$(this).css('background-color').toLowerCase();if($.fn.mColorPicker.color!=swatch[0]&&$.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color)!=swatch[0]&&$.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color)!=swatch[0]&&swatch.length<10)swatch[swatch.length]=$.fn.mColorPicker.color;$(this).css('background-color',swatch[i++])});if($.fn.mColorPicker.init.enhancedSwatches)$.fn.mColorPicker.setCookie('swatches',swatch.join('||'),365);};$.fn.mColorPicker.whichColor=function(x,y,hex){var colorR=colorG=colorB=255;if(x<32){colorG=x*8;colorB=0;}else if(x<64){colorR=256-(x-32)*8;colorB=0;}else if(x<96){colorR=0;colorB=(x-64)*8;}else if(x<128){colorR=0;colorG=256-(x-96)*8;}else if(x<160){colorR=(x-128)*8;colorG=0;}else{colorG=0;colorB=256-(x-160)*8;}
- 541.if(y<64){colorR+=(256-colorR)*(64-y)/64;colorG+=(256-colorG)*(64-y)/64;colorB+=(256-colorB)*(64-y)/64;}else if(y<=128){colorR-=colorR*(y-64)/64;colorG-=colorG*(y-64)/64;colorB-=colorB*(y-64)/64;}else if(y>128){colorR=colorG=colorB=256-(x/192*256);}
- 542.colorR=Math.round(Math.min(colorR,255));colorG=Math.round(Math.min(colorG,255));colorB=Math.round(Math.min(colorB,255));if(hex=='true'){colorR=colorR.toString(16);colorG=colorG.toString(16);colorB=colorB.toString(16);if(colorR.length<2)colorR=0+colorR;if(colorG.length<2)colorG=0+colorG;if(colorB.length<2)colorB=0+colorB;return"#"+colorR+colorG+colorB;}
- 543.return"rgb("+colorR+', '+colorG+', '+colorB+')';};$.fn.mColorPicker.RGBtoHex=function(color){color=color.toLowerCase();if(typeof color=='undefined')return'';if(color.indexOf('#')>-1&&color.length>6)return color;if(color.indexOf('rgb')<0)return color;if(color.indexOf('#')>-1){return'#'+color.substr(1,1)+color.substr(1,1)+color.substr(2,1)+color.substr(2,1)+color.substr(3,1)+color.substr(3,1);}
- 544.var hexArray=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],decToHex="#",code1=0;color=color.replace(/[^0-9,]/g,'').split(",");for(var n=0;n<color.length;n++){code1=Math.floor(color[n]/16);decToHex+=hexArray[code1]+hexArray[color[n]-code1*16];}
- 545.return decToHex;};$.fn.mColorPicker.hexToRGB=function(color){color=color.toLowerCase();if(typeof color=='undefined')return'';if(color.indexOf('rgb')>-1)return color;if(color.indexOf('#')<0)return color;var c=color.replace('#','');if(c.length<6)c=c.substr(0,1)+c.substr(0,1)+c.substr(1,1)+c.substr(1,1)+c.substr(2,1)+c.substr(2,1);return'rgb('+parseInt(c.substr(0,2),16)+', '+parseInt(c.substr(2,2),16)+', '+parseInt(c.substr(4,2),16)+')';};$(document).ready(function(){if($.fn.mColorPicker.init.replace){$('input[data-mcolorpicker!="true"]').filter(function(){return($.fn.mColorPicker.init.replace=='[type=color]')?this.getAttribute("type")=='color':$(this).is($.fn.mColorPicker.init.replace);}).mColorPicker();$.fn.mColorPicker.liveEvents();}});})(jQuery);$(document).ready(function(){var tabs={photos_url:$('.info-user a[data-tab="photos"]').attr('href'),settings_url:$('.info-user a[data-tab="settings"]').attr('href'),settings_button:$('.info-user a[data-tab="settings"]'),contest_url:$('.info-user a[data-tab="contest"]').attr('href'),tab_handles:{photos:null,settings:null,contest:null,token_stats:$(".info-user div.token_stats"),share_and_earn:$(".info-user div.share_and_earn"),leaderboard:$(".info-user div.leaderboard"),bio:$(".info-user div.bio")},init:function(){$(".info-user .buttons li a").click(tabs.on_tab_button_click);$(".private_settings .value").click(tabs.on_private_settings_clicked);$(".group_show_disabled a").click(tabs.on_groupshow_settings_clicked);},on_groupshow_settings_clicked:function(){tabs._disable_tabs();tabs.settings_button.parent().addClass('active');tabs._show_settings_tab(function(){$('#id_allow_group_shows').focus();});return false;},on_private_settings_clicked:function(){tabs._disable_tabs();tabs.settings_button.parent().addClass('active');tabs._show_settings_tab(function(){$('#id_allow_private_shows').focus();});return false;},on_tab_button_click:function(event){tabs._disable_tabs();$(this).parent().addClass('active');if($(this).data('tab')=='bio'){tabs.tab_handles.bio.show();}else if($(this).data('tab')=='photos'){tabs.refresh_photos();}else if($(this).data('tab')=='settings'){tabs.refresh_settings();}else if($(this).data('tab')=='contest'){tabs.refresh_contest();}else if($(this).data('tab')=='token_stats'){tabs._show_token_stats();}else if($(this).data('tab')=='share_and_earn'){tabs._show_share_and_earn();}else if($(this).data('tab')=='leaderboard'){tabs._show_leaderboard();}
- 546.return false;},refresh_photos:function(){if(tabs.tab_handles.photos){tabs.tab_handles.photos.remove();tabs.tab_handles.photos=null;}
- 547.tabs._show_photos_tab();},refresh_contest:function(){if(tabs.tab_handles.contest){tabs.tab_handles.contest.remove();tabs.tab_handles.contest=null;}
- 548.tabs._show_contest_tab();},refresh_settings:function(callback){if(tabs.tab_handles.settings){tabs.tab_handles.settings.remove();tabs.tab_handles.settings=null;}
- 549.tabs._show_settings_tab(callback);},_show_leaderboard:function(){tabs._load_tab(tabs.tab_handles.leaderboard,$(".info-user .buttons a[data-tab='leaderboard']").attr('href'));},_show_token_stats:function(){tabs._load_tab(tabs.tab_handles.token_stats,$(".info-user .buttons a[data-tab='token_stats']").attr('href'),function(){tabs.tab_handles.token_stats.find('.refreshstats').click(tabs._show_token_stats);tabs.tab_handles.token_stats.find('form').submit(tabs._on_token_transfer);tabs.tab_handles.token_stats.find('.account_activity').scroll(tabs._on_token_stats_scroll);});},_on_token_stats_scroll:function(){var $this=$(this);if($this.scrollTop()+300>=this.scrollHeight-$this.height()){$this.find("a.endless_more").click();}},_on_token_transfer:function(){var num_tokens=parseInt($(this).find("#id_transfer_amount").val());var token_balance=parseInt(tabs.tab_handles.token_stats.find('.token_balance').text());var cash_amount=num_tokens*0.05;if(isNaN(num_tokens)|num_tokens<1){alert("Invalid token amount.");return false;}
- 550.if(num_tokens>token_balance){alert("Insufficient tokens.");return false;}
- 551.var msg=interpolate(gettext("Convert %(num_tokens)s to \$%(cash_amount)s"),{num_tokens:num_tokens,cash_amount:cash_amount},true);return confirm(msg);},_show_share_and_earn:function(){tabs._load_tab(tabs.tab_handles.share_and_earn,$(".info-user .buttons a[data-tab='share_and_earn']").attr('href'));},_load_tab:function(tab,target,func){tab.show();tab.html(gettext("loading . . ."));if(func){tab.load(target,func);}else{tab.load(target);}},_show_photos_tab:function(){if(tabs.tab_handles.photos===null){var html="<div class='bottompanel fixedheightbottompanel photopages'>"+gettext("loading . . .")+"</div>";tabs.tab_handles.photos=$(html);tabs.tab_handles.bio.after(tabs.tab_handles.photos);tabs.tab_handles.photos.load(tabs.photos_url,function(){tabs.tab_handles.photos.scroll(tabs._on_photos_scroll);tabs.tab_handles.photos.find('.refreshphotos').click(tabs.refresh_photos);});}else{tabs.tab_handles.photos.show();}},_show_settings_tab:function(callback){if(tabs.tab_handles.settings===null){var html="<div class='bottompanel accountsettings'>"+gettext("loading . . .")+"</div>";tabs.tab_handles.settings=$(html);tabs.tab_handles.bio.after(tabs.tab_handles.settings);tabs.tab_handles.settings.load(tabs.settings_url,function(){tabs._init_settings_form();if(callback){callback();}});}else{tabs.tab_handles.settings.show();if(callback){callback();}}},_init_settings_form:function(){tabs.tab_handles.settings.find('a').attr('target','_blank');tabs.tab_handles.settings.find('form').submit(tabs._on_settings_submit);tabs.tab_handles.settings.find('#id_block_from_countries').listselect({listTitle:gettext('Able to view'),selectedTitle:gettext('Blocked countries')});tabs.tab_handles.settings.find('#id_block_from_states').listselect({listTitle:gettext('Able to view'),selectedTitle:gettext('Blocked states')});},_on_settings_submit:function(){$.ajax({type:'POST',url:$(this).attr('action'),data:$(this).serialize(),dataType:'json',cache:false,success:function(data){tabs.tab_handles.settings.html(data.html);tabs._init_settings_form();if(data.result=='success'){alert(gettext("Settings saved"));}
- 552.return false;}});return false;},_show_contest_tab:function(){if(tabs.tab_handles.contest===null){var html="<div class='bottompanel conteststats'>"+gettext("loading . . .")+"</div>";tabs.tab_handles.contest=$(html);tabs.tab_handles.bio.after(tabs.tab_handles.contest);tabs.tab_handles.contest.load(tabs.contest_url,function(){tabs.tab_handles.contest.find('.refreshstats').click(tabs.refresh_contest);});}else{tabs.tab_handles.contest.show();}},_on_photos_scroll:function(){var $this=$(this);if($this.scrollTop()+500>=this.scrollHeight-$this.height()){$this.find("a.endless_more").click();}},_disable_tabs:function(){$(".info-user .buttons li.active").removeClass('active');$(".info-user > div").hide();$(".info-user .headline").show();}};tabs.init();var bio={bio_div:$(document).find('div.bio'),init:function(){$('a.editbio').live('click',bio.on_edit_click);},on_edit_click:function(){bio.bio_div.load($(this).attr('href'),bio._init_form);return false;},on_form_submit:function(){var next=$(this).find('input[name="next"]').val();$.ajax({type:'POST',url:$(this).attr('action'),data:$(this).serialize(),dataType:'json',cache:false,success:function(data){if(data.result=='success'){bio.bio_div.load(next);}else{bio.bio_div.html(data.html);bio._init_form();}
- 553.return false;}});return false;},_init_form:function(){bio.bio_div.find('textarea').attr('rows','1');bio.bio_div.find('textarea').elastic();bio.bio_div.find('form').submit(bio.on_form_submit);bio.bio_div.find('.canceleditbio').click(bio._on_cancel_edit_click);},_on_cancel_edit_click:function(){bio.bio_div.load($(this).attr('href'));return false;}};bio.init();var follow={on_follow_click:function(){var link=$(this);if(login_required()){return false;}
- 554.$.ajax({url:link.data('followurl'),cache:false,success:function(){link.parent().removeClass('button_follow');link.parent().addClass('button_unfollow');link.html(link.data('unfollowtext'));}});return false;},on_unfollow_click:function(){var link=$(this);$.ajax({url:link.data('unfollowurl'),cache:false,success:function(){link.parent().removeClass('button_unfollow');link.parent().addClass('button_follow');link.html(link.data('followtext'));}});return false;}};$(".button_follow a").live('click',follow.on_follow_click);$(".button_unfollow a").live('click',follow.on_unfollow_click);var report={_div_overlay:$("#report_popup"),on_cancel:function(){report._clear_and_close();return false;},on_submit:function(){var $this=$(this);if($this.find('select[name="category"]').val()===""){alert(gettext("Please choose a category."));return false;}
- 555.$.ajax({type:'POST',url:$this.attr('action'),data:$this.serialize(),dataType:'json',cache:false,success:function(data){if(data['result']==='success'){report._clear_and_close();alert(gettext("Your abuse report has been submitted."));}else{alert("An error occurred.");}}});return false;},overlay_toggle:function(){if(login_required()){return false;}
- 556.report._div_overlay.toggle();if(report._div_overlay.is(":visible")){report._div_overlay.find('textarea').focus();report._div_overlay.find('textarea').select();}},init:function(){$("#report_popup_link").click(report.overlay_toggle);report._div_overlay.find(".button_abuse_cancel a").click(report.on_cancel);report._div_overlay.find(".button_abuse_report a").click(function(){report._div_overlay.find("form").submit();return false;});report._div_overlay.find("form").submit(report.on_submit);$(".disputerecording").live('click',function(){var msg=gettext("Are the reports that this is a recording false?\n\nPlease only vote if you have confirmed that this cam is live.\n\nAsk something like \"hold up 2 fingers to prove you are live\" first!");if(confirm(msg)){$.ajax({type:'POST',url:$("#report_popup form").attr('action'),data:{'category':'recordingdispute'},dataType:'json',cache:false,success:function(data){if(data['result']==='success'){report._clear_and_close();alert(gettext("Your report has been submitted."));}else{alert("An error occurred.");}}});}});},_clear_and_close:function(){report._div_overlay.hide();report._div_overlay.find('textarea').val("");}};report.init();var dismisscookiename='dsmn4';$('a.dismiss_notice').click(function(){var d=new Date;d.setTime(d.getTime()+1000*60*60*24*60);$.cookie(dismisscookiename,'1',{expires:d,path:'/'});$('.dismissable_notice').hide();return false;});if($.cookie(dismisscookiename)=='1'){$('.dismissable_notice').hide();}
- 557.$("a.deletephotolink").live('click',function(){var deletelink=$(this);if(confirm(gettext("Are you sure you want to delete?"))){$.post(deletelink.attr('href'),function(){deletelink.closest('.image_container').remove()});}
- 558.return false;});$("a.disablephotoslink, a.enablephotoslink").live('click',function(){if(confirm(gettext("Are you sure?"))){$.post($(this).attr('href'),{'foo':'bar'},function(){tabs.refresh_photos();});}
- 559.return false;});$('a[rel*=facebox]').live('mousedown',function(){$(this).facebox();});});
- RAW Paste Data
- rtmpdump -r "rtmpe://edge1-a.stream.chaturbate.com/live-edge" -a "live-edge" -W "http://ccstatic.chaturbate.com/static/flash/CBV_2p51.swf" -p "http://chaturbate.com/yelle92/" -y "mp4:public-yelle92" -v -o t.flv -T "m9z#$dO0qe34Rxe@sMYxx%"
- no longer works as of 1/25/12, need to get new token, see javascript:
- var MEDIA_URL='http://ccstatic.chaturbate.com/static/';var Base64=(function(){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var obj={encode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{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+keyStr.charAt(enc1)+keyStr.charAt(enc2)+
- keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<input.length);return output;},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,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=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);}}while(i<input.length);return output;}};return obj;})();var MD5=(function(){var hexcase=0;var b64pad="";var chrsz=8;var safe_add=function(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);};var bit_rol=function(num,cnt){return(num<<cnt)|(num>>>(32-cnt));};var str2binl=function(str){var bin=[];var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)
- {bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);}
- return bin;};var binl2str=function(bin){var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)
- {str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);}
- return str;};var binl2hex=function(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
- {str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
- hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
- return str;};var binl2b64=function(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";var triplet,j;for(var i=0;i<binarray.length*4;i+=3)
- {triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(j=0;j<4;j++)
- {if(i*8+j*6>binarray.length*32){str+=b64pad;}
- else{str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}}
- return str;};var md5_cmn=function(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);};var md5_ff=function(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);};var md5_gg=function(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);};var md5_hh=function(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t);};var md5_ii=function(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t);};var core_md5=function(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;var olda,oldb,oldc,oldd;for(var i=0;i<x.length;i+=16)
- {olda=a;oldb=b;oldc=c;oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}
- return[a,b,c,d];};var core_hmac_md5=function(key,data){var bkey=str2binl(key);if(bkey.length>16){bkey=core_md5(bkey,key.length*chrsz);}
- var ipad=new Array(16),opad=new Array(16);for(var i=0;i<16;i++)
- {ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
- var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);};var obj={hexdigest:function(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));},b64digest:function(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));},hash:function(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));},hmac_hexdigest:function(key,data){return binl2hex(core_hmac_md5(key,data));},hmac_b64digest:function(key,data){return binl2b64(core_hmac_md5(key,data));},hmac_hash:function(key,data){return binl2str(core_hmac_md5(key,data));},test:function(){return MD5.hexdigest("abc")==="900150983cd24fb0d6963f7d28e17f72";}};return obj;})();if(!Function.prototype.bind){Function.prototype.bind=function(obj)
- {var func=this;return function(){return func.apply(obj,arguments);};};}
- if(!Function.prototype.prependArg){Function.prototype.prependArg=function(arg)
- {var func=this;return function(){var newargs=[arg];for(var i=0;i<arguments.length;i++){newargs.push(arguments[i]);}
- return func.apply(this,newargs);};};}
- if(!Array.prototype.indexOf)
- {Array.prototype.indexOf=function(elt)
- {var len=this.length;var from=Number(arguments[1])||0;from=(from<0)?Math.ceil(from):Math.floor(from);if(from<0){from+=len;}
- for(;from<len;from++){if(from in this&&this[from]===elt){return from;}}
- return-1;};}
- (function(callback){var Strophe;function $build(name,attrs){return new Strophe.Builder(name,attrs);}
- function $msg(attrs){return new Strophe.Builder("message",attrs);}
- function $iq(attrs){return new Strophe.Builder("iq",attrs);}
- function $pres(attrs){return new Strophe.Builder("presence",attrs);}
- Strophe={VERSION:"1.0.1",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas"},addNamespace:function(name,value)
- {Strophe.NS[name]=value;},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3},TIMEOUT:1.1,SECONDARY_TIMEOUT:0.1,forEachChild:function(elem,elemName,func)
- {var i,childNode;for(i=0;i<elem.childNodes.length;i++){childNode=elem.childNodes[i];if(childNode.nodeType==Strophe.ElementType.NORMAL&&(!elemName||this.isTagEqual(childNode,elemName))){func(childNode);}}},isTagEqual:function(el,name)
- {return el.tagName.toLowerCase()==name.toLowerCase();},_xmlGenerator:null,_makeGenerator:function(){var doc;if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.appendChild(doc.createElement('strophe'));}else{doc=document.implementation.createDocument('jabber:client','strophe',null);}
- return doc;},xmlElement:function(name)
- {if(!name){return null;}
- var node=null;if(!Strophe._xmlGenerator){Strophe._xmlGenerator=Strophe._makeGenerator();}
- node=Strophe._xmlGenerator.createElement(name);var a,i,k;for(a=1;a<arguments.length;a++){if(!arguments[a]){continue;}
- if(typeof(arguments[a])=="string"||typeof(arguments[a])=="number"){node.appendChild(Strophe.xmlTextNode(arguments[a]));}else if(typeof(arguments[a])=="object"&&typeof(arguments[a].sort)=="function"){for(i=0;i<arguments[a].length;i++){if(typeof(arguments[a][i])=="object"&&typeof(arguments[a][i].sort)=="function"){node.setAttribute(arguments[a][i][0],arguments[a][i][1]);}}}else if(typeof(arguments[a])=="object"){for(k in arguments[a]){if(arguments[a].hasOwnProperty(k)){node.setAttribute(k,arguments[a][k]);}}}}
- return node;},xmlescape:function(text)
- {text=text.replace(/\&/g,"&");text=text.replace(/</g,"<");text=text.replace(/>/g,">");return text;},xmlTextNode:function(text)
- {text=Strophe.xmlescape(text);if(!Strophe._xmlGenerator){Strophe._xmlGenerator=Strophe._makeGenerator();}
- return Strophe._xmlGenerator.createTextNode(text);},getText:function(elem)
- {if(!elem){return null;}
- var str="";if(elem.childNodes.length===0&&elem.nodeType==Strophe.ElementType.TEXT){str+=elem.nodeValue;}
- for(var i=0;i<elem.childNodes.length;i++){if(elem.childNodes[i].nodeType==Strophe.ElementType.TEXT){str+=elem.childNodes[i].nodeValue;}}
- return str;},copyElement:function(elem)
- {var i,el;if(elem.nodeType==Strophe.ElementType.NORMAL){el=Strophe.xmlElement(elem.tagName);for(i=0;i<elem.attributes.length;i++){el.setAttribute(elem.attributes[i].nodeName.toLowerCase(),elem.attributes[i].value);}
- for(i=0;i<elem.childNodes.length;i++){el.appendChild(Strophe.copyElement(elem.childNodes[i]));}}else if(elem.nodeType==Strophe.ElementType.TEXT){el=Strophe.xmlTextNode(elem.nodeValue);}
- return el;},escapeNode:function(node)
- {return node.replace(/^\s+|\s+$/g,'').replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40");},unescapeNode:function(node)
- {return node.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\");},getNodeFromJid:function(jid)
- {if(jid.indexOf("@")<0){return null;}
- return jid.split("@")[0];},getDomainFromJid:function(jid)
- {var bare=Strophe.getBareJidFromJid(jid);if(bare.indexOf("@")<0){return bare;}else{var parts=bare.split("@");parts.splice(0,1);return parts.join('@');}},getResourceFromJid:function(jid)
- {var s=jid.split("/");if(s.length<2){return null;}
- s.splice(0,1);return s.join('/');},getBareJidFromJid:function(jid)
- {return jid.split("/")[0];},log:function(level,msg)
- {return;},debug:function(msg)
- {this.log(this.LogLevel.DEBUG,msg);},info:function(msg)
- {this.log(this.LogLevel.INFO,msg);},warn:function(msg)
- {this.log(this.LogLevel.WARN,msg);},error:function(msg)
- {this.log(this.LogLevel.ERROR,msg);},fatal:function(msg)
- {this.log(this.LogLevel.FATAL,msg);},serialize:function(elem)
- {var result;if(!elem){return null;}
- if(typeof(elem.tree)==="function"){elem=elem.tree();}
- var nodeName=elem.nodeName;var i,child;if(elem.getAttribute("_realname")){nodeName=elem.getAttribute("_realname");}
- result="<"+nodeName;for(i=0;i<elem.attributes.length;i++){if(elem.attributes[i].nodeName!="_realname"){result+=" "+elem.attributes[i].nodeName.toLowerCase()+"='"+elem.attributes[i].value.replace("&","&").replace("'","'").replace("<","<")+"'";}}
- if(elem.childNodes.length>0){result+=">";for(i=0;i<elem.childNodes.length;i++){child=elem.childNodes[i];if(child.nodeType==Strophe.ElementType.NORMAL){result+=Strophe.serialize(child);}else if(child.nodeType==Strophe.ElementType.TEXT){result+=child.nodeValue;}}
- result+="</"+nodeName+">";}else{result+="/>";}
- return result;},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(name,ptype)
- {Strophe._connectionPlugins[name]=ptype;}};Strophe.Builder=function(name,attrs)
- {if(name=="presence"||name=="message"||name=="iq"){if(attrs&&!attrs.xmlns){attrs.xmlns=Strophe.NS.CLIENT;}else if(!attrs){attrs={xmlns:Strophe.NS.CLIENT};}}
- this.nodeTree=Strophe.xmlElement(name,attrs);this.node=this.nodeTree;};Strophe.Builder.prototype={tree:function()
- {return this.nodeTree;},toString:function()
- {return Strophe.serialize(this.nodeTree);},up:function()
- {this.node=this.node.parentNode;return this;},attrs:function(moreattrs)
- {for(var k in moreattrs){if(moreattrs.hasOwnProperty(k)){this.node.setAttribute(k,moreattrs[k]);}}
- return this;},c:function(name,attrs)
- {var child=Strophe.xmlElement(name,attrs);this.node.appendChild(child);this.node=child;return this;},cnode:function(elem)
- {this.node.appendChild(elem);this.node=elem;return this;},t:function(text)
- {var child=Strophe.xmlTextNode(text);this.node.appendChild(child);return this;}};Strophe.Handler=function(handler,ns,name,type,id,from,options)
- {this.handler=handler;this.ns=ns;this.name=name;this.type=type;this.id=id;this.options=options||{matchbare:false};if(!this.options.matchBare){this.options.matchBare=false;}
- if(this.options.matchBare){this.from=Strophe.getBareJidFromJid(from);}else{this.from=from;}
- this.user=true;};Strophe.Handler.prototype={isMatch:function(elem)
- {var nsMatch;var from=null;if(this.options.matchBare){from=Strophe.getBareJidFromJid(elem.getAttribute('from'));}else{from=elem.getAttribute('from');}
- nsMatch=false;if(!this.ns){nsMatch=true;}else{var self=this;Strophe.forEachChild(elem,null,function(elem){if(elem.getAttribute("xmlns")==self.ns){nsMatch=true;}});nsMatch=nsMatch||elem.getAttribute("xmlns")==this.ns;}
- if(nsMatch&&(!this.name||Strophe.isTagEqual(elem,this.name))&&(!this.type||elem.getAttribute("type")===this.type)&&(!this.id||elem.getAttribute("id")===this.id)&&(!this.from||from===this.from)){return true;}
- return false;},run:function(elem)
- {var result=null;try{result=this.handler(elem);}catch(e){if(e.sourceURL){Strophe.fatal("error: "+this.handler+" "+e.sourceURL+":"+
- e.line+" - "+e.name+": "+e.message);}else if(e.fileName){if(typeof(console)!="undefined"){console.trace();console.error(this.handler," - error - ",e,e.message);}
- Strophe.fatal("error: "+this.handler+" "+
- e.fileName+":"+e.lineNumber+" - "+
- e.name+": "+e.message);}else{Strophe.fatal("error: "+this.handler);}
- throw e;}
- return result;},toString:function()
- {return"{Handler: "+this.handler+"("+this.name+","+
- this.id+","+this.ns+")}";}};Strophe.TimedHandler=function(period,handler)
- {this.period=period;this.handler=handler;this.lastCalled=new Date().getTime();this.user=true;};Strophe.TimedHandler.prototype={run:function()
- {this.lastCalled=new Date().getTime();return this.handler();},reset:function()
- {this.lastCalled=new Date().getTime();},toString:function()
- {return"{TimedHandler: "+this.handler+"("+this.period+")}";}};Strophe.Request=function(elem,func,rid,sends)
- {this.id=++Strophe._requestId;this.xmlData=elem;this.data=Strophe.serialize(elem);this.origFunc=func;this.func=func;this.rid=rid;this.date=NaN;this.sends=sends||0;this.abort=false;this.dead=null;this.age=function(){if(!this.date){return 0;}
- var now=new Date();return(now-this.date)/1000;};this.timeDead=function(){if(!this.dead){return 0;}
- var now=new Date();return(now-this.dead)/1000;};this.xhr=this._newXHR();};Strophe.Request.prototype={getResponse:function()
- {var node=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){node=this.xhr.responseXML.documentElement;if(node.tagName=="parsererror"){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);Strophe.error("responseXML: "+
- Strophe.serialize(this.xhr.responseXML));throw"parsererror";}}else if(this.xhr.responseText){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);Strophe.error("responseXML: "+
- Strophe.serialize(this.xhr.responseXML));}
- return node;},_newXHR:function()
- {var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();if(xhr.overrideMimeType){xhr.overrideMimeType("text/xml");}}else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
- xhr.onreadystatechange=this.func.prependArg(this);return xhr;}};Strophe.Connection=function(service)
- {this.service=service;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold=1;this.wait=60;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var ptype=Strophe._connectionPlugins[k];var F=function(){};F.prototype=ptype;this[k]=new F();this[k].init(this);}}};Strophe.Connection.prototype={reset:function()
- {this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*10000);},pause:function()
- {this.paused=true;},resume:function()
- {this.paused=false;},getUniqueId:function(suffix)
- {if(typeof(suffix)=="string"||typeof(suffix)=="number"){return++this._uniqueId+":"+suffix;}else{return++this._uniqueId+"";}},connect:function(jid,pass,callback,wait,hold)
- {this.jid=jid;this.pass=pass;this.connect_callback=callback;this.disconnecting=false;this.connected=false;this.authenticated=false;this.errors=0;this.wait=wait||this.wait;this.hold=hold||this.hold;this.domain=Strophe.getDomainFromJid(this.jid);var body=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":Strophe.NS.BOSH});this._changeConnectStatus(Strophe.Status.CONNECTING,null);this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),body.tree().getAttribute("rid")));this._throttledRequestHandler();},attach:function(jid,sid,rid,callback,wait,hold,wind)
- {this.jid=jid;this.sid=sid;this.rid=rid;this.connect_callback=callback;this.domain=Strophe.getDomainFromJid(this.jid);this.authenticated=true;this.connected=true;this.wait=wait||this.wait;this.hold=hold||this.hold;this.window=wind||this.window;this._changeConnectStatus(Strophe.Status.ATTACHED,null);},xmlInput:function(elem)
- {return;},xmlOutput:function(elem)
- {return;},rawInput:function(data)
- {return;},rawOutput:function(data)
- {return;},send:function(elem)
- {if(elem===null){return;}
- if(typeof(elem.sort)==="function"){for(var i=0;i<elem.length;i++){this._queueData(elem[i]);}}else if(typeof(elem.tree)==="function"){this._queueData(elem.tree());}else{this._queueData(elem);}
- this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);},flush:function()
- {clearTimeout(this._idleTimeout);this._onIdle();},sendIQ:function(elem,callback,errback,timeout){var timeoutHandler=null;var that=this;if(typeof(elem.tree)==="function"){elem=elem.tree();}
- var id=elem.getAttribute('id');if(!id){id=this.getUniqueId("sendIQ");elem.setAttribute("id",id);}
- var handler=this.addHandler(function(stanza){if(timeoutHandler){that.deleteTimedHandler(timeoutHandler);}
- var iqtype=stanza.getAttribute('type');if(iqtype==='result'){if(callback){callback(stanza);}}else if(iqtype==='error'){if(errback){errback(stanza);}}else{throw{name:"StropheError",message:"Got bad IQ type of "+iqtype};}},null,'iq',null,id);if(timeout){timeoutHandler=this.addTimedHandler(timeout,function(){that.deleteHandler(handler);if(errback){errback(null);}
- return false;});}
- this.send(elem);return id;},_queueData:function(element){if(element===null||!element.tagName||!element.childNodes){throw{name:"StropheError",message:"Cannot queue non-DOMElement."};}
- this._data.push(element);},_sendRestart:function()
- {this._data.push("restart");this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);},addTimedHandler:function(period,handler)
- {var thand=new Strophe.TimedHandler(period,handler);this.addTimeds.push(thand);return thand;},deleteTimedHandler:function(handRef)
- {this.removeTimeds.push(handRef);},addHandler:function(handler,ns,name,type,id,from,options)
- {var hand=new Strophe.Handler(handler,ns,name,type,id,from,options);this.addHandlers.push(hand);return hand;},deleteHandler:function(handRef)
- {this.removeHandlers.push(handRef);},disconnect:function(reason)
- {this._changeConnectStatus(Strophe.Status.DISCONNECTING,reason);Strophe.info("Disconnect was called because: "+reason);if(this.connected){this._disconnectTimeout=this._addSysTimedHandler(3000,this._onDisconnectTimeout.bind(this));this._sendTerminate();}},_changeConnectStatus:function(status,condition)
- {for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var plugin=this[k];if(plugin.statusChanged){try{plugin.statusChanged(status,condition);}catch(err){Strophe.error(""+k+" plugin caused an exception "+"changing status: "+err);}}}}
- if(this.connect_callback){try{this.connect_callback(status,condition);}catch(e){Strophe.error("User connection callback caused an "+"exception: "+e);}}},_buildBody:function()
- {var bodyWrap=$build('body',{rid:this.rid++,xmlns:Strophe.NS.HTTPBIND});if(this.sid!==null){bodyWrap.attrs({sid:this.sid});}
- return bodyWrap;},_removeRequest:function(req)
- {Strophe.debug("removing request");var i;for(i=this._requests.length-1;i>=0;i--){if(req==this._requests[i]){this._requests.splice(i,1);}}
- req.xhr.onreadystatechange=function(){};this._throttledRequestHandler();},_restartRequest:function(i)
- {var req=this._requests[i];if(req.dead===null){req.dead=new Date();}
- this._processRequest(i);},_processRequest:function(i)
- {var req=this._requests[i];var reqStatus=-1;try{if(req.xhr.readyState==4){reqStatus=req.xhr.status;}}catch(e){Strophe.error("caught an error in _requests["+i+"], reqStatus: "+reqStatus);}
- if(typeof(reqStatus)=="undefined"){reqStatus=-1;}
- var time_elapsed=req.age();var primaryTimeout=(!isNaN(time_elapsed)&&time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait));var secondaryTimeout=(req.dead!==null&&req.timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait));var requestCompletedWithServerError=(req.xhr.readyState==4&&(reqStatus<1||reqStatus>=500));if(primaryTimeout||secondaryTimeout||requestCompletedWithServerError){if(secondaryTimeout){Strophe.error("Request "+
- this._requests[i].id+" timed out (secondary), restarting");}
- req.abort=true;req.xhr.abort();req.xhr.onreadystatechange=function(){};this._requests[i]=new Strophe.Request(req.xmlData,req.origFunc,req.rid,req.sends);req=this._requests[i];}
- if(req.xhr.readyState===0){Strophe.debug("request id "+req.id+"."+req.sends+" posting");req.date=new Date();try{var async=!('sync'in this&&this.sync===true);req.xhr.open("POST",this.service,async);}catch(e2){Strophe.error("XHR open failed.");if(!this.connected){this._changeConnectStatus(Strophe.Status.CONNFAIL,"bad-service");}
- this.disconnect();return;}
- var sendFunc=function(){req.xhr.send(req.data);};if(req.sends>1){var backoff=Math.pow(req.sends,3)*1000;setTimeout(sendFunc,backoff);}else{sendFunc();}
- req.sends++;this.xmlOutput(req.xmlData);this.rawOutput(req.data);}else{Strophe.debug("_processRequest: "+
- (i===0?"first":"second")+" request has readyState of "+
- req.xhr.readyState);}},_throttledRequestHandler:function()
- {if(!this._requests){Strophe.debug("_throttledRequestHandler called with "+"undefined requests");}else{Strophe.debug("_throttledRequestHandler called with "+
- this._requests.length+" requests");}
- if(!this._requests||this._requests.length===0){return;}
- if(this._requests.length>0){this._processRequest(0);}
- if(this._requests.length>1&&Math.abs(this._requests[0].rid-
- this._requests[1].rid)<this.window-1){this._processRequest(1);}},_onRequestStateChange:function(func,req)
- {Strophe.debug("request id "+req.id+"."+req.sends+" state changed to "+
- req.xhr.readyState);if(req.abort){req.abort=false;return;}
- var reqStatus;if(req.xhr.readyState==4){reqStatus=0;try{reqStatus=req.xhr.status;}catch(e){}
- if(typeof(reqStatus)=="undefined"){reqStatus=0;}
- if(this.disconnecting){if(reqStatus>=400){this._hitError(reqStatus);return;}}
- var reqIs0=(this._requests[0]==req);var reqIs1=(this._requests[1]==req);if((reqStatus>0&&reqStatus<500)||req.sends>5){this._removeRequest(req);Strophe.debug("request id "+
- req.id+" should now be removed");}
- if(reqStatus==200){if(reqIs1||(reqIs0&&this._requests.length>0&&this._requests[0].age()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait))){this._restartRequest(0);}
- Strophe.debug("request id "+
- req.id+"."+
- req.sends+" got 200");func(req);this.errors=0;}else{Strophe.error("request id "+
- req.id+"."+
- req.sends+" error "+reqStatus+" happened");if(reqStatus===0||(reqStatus>=400&&reqStatus<600)||reqStatus>=12000){this._hitError(reqStatus);if(reqStatus>=400&&reqStatus<500){this._changeConnectStatus(Strophe.Status.DISCONNECTING,null);this._doDisconnect();}}}
- if(!((reqStatus>0&&reqStatus<10000)||req.sends>5)){this._throttledRequestHandler();}}},_hitError:function(reqStatus)
- {this.errors++;Strophe.warn("request errored, status: "+reqStatus+", number of errors: "+this.errors);if(this.errors>4){this._onDisconnectTimeout();}},_doDisconnect:function()
- {Strophe.info("_doDisconnect was called");this.authenticated=false;this.disconnecting=false;this.sid=null;this.streamId=null;this.rid=Math.floor(Math.random()*4294967295);if(this.connected){this._changeConnectStatus(Strophe.Status.DISCONNECTED,null);this.connected=false;}
- this.handlers=[];this.timedHandlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];},_dataRecv:function(req)
- {try{var elem=req.getResponse();}catch(e){if(e!="parsererror"){throw e;}
- this.disconnect("strophe-parsererror");}
- if(elem===null){return;}
- this.xmlInput(elem);this.rawInput(Strophe.serialize(elem));var i,hand;while(this.removeHandlers.length>0){hand=this.removeHandlers.pop();i=this.handlers.indexOf(hand);if(i>=0){this.handlers.splice(i,1);}}
- while(this.addHandlers.length>0){this.handlers.push(this.addHandlers.pop());}
- if(this.disconnecting&&this._requests.length===0){this.deleteTimedHandler(this._disconnectTimeout);this._disconnectTimeout=null;this._doDisconnect();return;}
- var typ=elem.getAttribute("type");var cond,conflict;if(typ!==null&&typ=="terminate"){cond=elem.getAttribute("condition");conflict=elem.getElementsByTagName("conflict");if(cond!==null){if(cond=="remote-stream-error"&&conflict.length>0){cond="conflict";}
- this._changeConnectStatus(Strophe.Status.CONNFAIL,cond);}else{this._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown");}
- this.disconnect();return;}
- var self=this;Strophe.forEachChild(elem,null,function(child){var i,newList;newList=self.handlers;self.handlers=[];for(i=0;i<newList.length;i++){var hand=newList[i];if(hand.isMatch(child)&&(self.authenticated||!hand.user)){if(hand.run(child)){self.handlers.push(hand);}}else{self.handlers.push(hand);}}});},_sendTerminate:function()
- {Strophe.info("_sendTerminate was called");var body=this._buildBody().attrs({type:"terminate"});if(this.authenticated){body.c('presence',{xmlns:Strophe.NS.CLIENT,type:'unavailable'});}
- this.disconnecting=true;var req=new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),body.tree().getAttribute("rid"));this._requests.push(req);this._throttledRequestHandler();},_connect_cb:function(req)
- {Strophe.info("_connect_cb was called");this.connected=true;var bodyWrap=req.getResponse();if(!bodyWrap){return;}
- this.xmlInput(bodyWrap);this.rawInput(Strophe.serialize(bodyWrap));var typ=bodyWrap.getAttribute("type");var cond,conflict;if(typ!==null&&typ=="terminate"){cond=bodyWrap.getAttribute("condition");conflict=bodyWrap.getElementsByTagName("conflict");if(cond!==null){if(cond=="remote-stream-error"&&conflict.length>0){cond="conflict";}
- this._changeConnectStatus(Strophe.Status.CONNFAIL,cond);}else{this._changeConnectStatus(Strophe.Status.CONNFAIL,"unknown");}
- return;}
- if(!this.sid){this.sid=bodyWrap.getAttribute("sid");}
- if(!this.stream_id){this.stream_id=bodyWrap.getAttribute("authid");}
- var wind=bodyWrap.getAttribute('requests');if(wind){this.window=parseInt(wind,10);}
- var hold=bodyWrap.getAttribute('hold');if(hold){this.hold=parseInt(hold,10);}
- var wait=bodyWrap.getAttribute('wait');if(wait){this.wait=parseInt(wait,10);}
- var do_sasl_plain=false;var do_sasl_digest_md5=false;var do_sasl_anonymous=false;var mechanisms=bodyWrap.getElementsByTagName("mechanism");var i,mech,auth_str,hashed_auth_str;if(mechanisms.length>0){for(i=0;i<mechanisms.length;i++){mech=Strophe.getText(mechanisms[i]);if(mech=='DIGEST-MD5'){do_sasl_digest_md5=true;}else if(mech=='PLAIN'){do_sasl_plain=true;}else if(mech=='ANONYMOUS'){do_sasl_anonymous=true;}}}else{var body=this._buildBody();this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),body.tree().getAttribute("rid")));this._throttledRequestHandler();return;}
- if(Strophe.getNodeFromJid(this.jid)===null&&do_sasl_anonymous){this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"ANONYMOUS"}).tree());}else if(Strophe.getNodeFromJid(this.jid)===null){this._changeConnectStatus(Strophe.Status.CONNFAIL,'x-strophe-bad-non-anon-jid');this.disconnect();}else if(do_sasl_digest_md5){this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge1_cb.bind(this),null,"challenge",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"DIGEST-MD5"}).tree());}else if(do_sasl_plain){auth_str=Strophe.getBareJidFromJid(this.jid);auth_str=auth_str+"\u0000";auth_str=auth_str+Strophe.getNodeFromJid(this.jid);auth_str=auth_str+"\u0000";auth_str=auth_str+this.pass;this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);hashed_auth_str=Base64.encode(auth_str);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"PLAIN"}).t(hashed_auth_str).tree());}else{this._changeConnectStatus(Strophe.Status.AUTHENTICATING,null);this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1");this.send($iq({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:Strophe.NS.AUTH}).c("username",{}).t(Strophe.getNodeFromJid(this.jid)).tree());}},_sasl_challenge1_cb:function(elem)
- {var attribMatch=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/;var challenge=Base64.decode(Strophe.getText(elem));var cnonce=MD5.hexdigest(Math.random()*1234567890);var realm="";var host=null;var nonce="";var qop="";var matches;this.deleteHandler(this._sasl_failure_handler);while(challenge.match(attribMatch)){matches=challenge.match(attribMatch);challenge=challenge.replace(matches[0],"");matches[2]=matches[2].replace(/^"(.+)"$/,"$1");switch(matches[1]){case"realm":realm=matches[2];break;case"nonce":nonce=matches[2];break;case"qop":qop=matches[2];break;case"host":host=matches[2];break;}}
- var digest_uri="xmpp/"+this.domain;if(host!==null){digest_uri=digest_uri+"/"+host;}
- var A1=MD5.hash(Strophe.getNodeFromJid(this.jid)+":"+realm+":"+this.pass)+":"+nonce+":"+cnonce;var A2='AUTHENTICATE:'+digest_uri;var responseText="";responseText+='username='+
- this._quote(Strophe.getNodeFromJid(this.jid))+',';responseText+='realm='+this._quote(realm)+',';responseText+='nonce='+this._quote(nonce)+',';responseText+='cnonce='+this._quote(cnonce)+',';responseText+='nc="00000001",';responseText+='qop="auth",';responseText+='digest-uri='+this._quote(digest_uri)+',';responseText+='response='+this._quote(MD5.hexdigest(MD5.hexdigest(A1)+":"+
- nonce+":00000001:"+
- cnonce+":auth:"+
- MD5.hexdigest(A2)))+',';responseText+='charset="utf-8"';this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge2_cb.bind(this),null,"challenge",null,null);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build('response',{xmlns:Strophe.NS.SASL}).t(Base64.encode(responseText)).tree());return false;},_quote:function(str)
- {return'"'+str.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"';},_sasl_challenge2_cb:function(elem)
- {this.deleteHandler(this._sasl_success_handler);this.deleteHandler(this._sasl_failure_handler);this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build('response',{xmlns:Strophe.NS.SASL}).tree());return false;},_auth1_cb:function(elem)
- {var iq=$iq({type:"set",id:"_auth_2"}).c('query',{xmlns:Strophe.NS.AUTH}).c('username',{}).t(Strophe.getNodeFromJid(this.jid)).up().c('password').t(this.pass);if(!Strophe.getResourceFromJid(this.jid)){this.jid=Strophe.getBareJidFromJid(this.jid)+'/strophe';}
- iq.up().c('resource',{}).t(Strophe.getResourceFromJid(this.jid));this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2");this.send(iq.tree());return false;},_sasl_success_cb:function(elem)
- {Strophe.info("SASL authentication succeeded.");this.deleteHandler(this._sasl_failure_handler);this._sasl_failure_handler=null;if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null;}
- this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null);this._sendRestart();return false;},_sasl_auth1_cb:function(elem)
- {var i,child;for(i=0;i<elem.childNodes.length;i++){child=elem.childNodes[i];if(child.nodeName=='bind'){this.do_bind=true;}
- if(child.nodeName=='session'){this.do_session=true;}}
- if(!this.do_bind){this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}else{this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var resource=Strophe.getResourceFromJid(this.jid);if(resource){this.send($iq({type:"set",id:"_bind_auth_2"}).c('bind',{xmlns:Strophe.NS.BIND}).c('resource',{}).t(resource).tree());}else{this.send($iq({type:"set",id:"_bind_auth_2"}).c('bind',{xmlns:Strophe.NS.BIND}).tree());}}
- return false;},_sasl_bind_cb:function(elem)
- {if(elem.getAttribute("type")=="error"){Strophe.info("SASL binding failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}
- var bind=elem.getElementsByTagName("bind");var jidNode;if(bind.length>0){jidNode=bind[0].getElementsByTagName("jid");if(jidNode.length>0){this.jid=Strophe.getText(jidNode[0]);if(this.do_session){this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2");this.send($iq({type:"set",id:"_session_auth_2"}).c('session',{xmlns:Strophe.NS.SESSION}).tree());}else{this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}}}else{Strophe.info("SASL binding failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}},_sasl_session_cb:function(elem)
- {if(elem.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}else if(elem.getAttribute("type")=="error"){Strophe.info("Session creation failed.");this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;}
- return false;},_sasl_failure_cb:function(elem)
- {if(this._sasl_success_handler){this.deleteHandler(this._sasl_success_handler);this._sasl_success_handler=null;}
- if(this._sasl_challenge_handler){this.deleteHandler(this._sasl_challenge_handler);this._sasl_challenge_handler=null;}
- this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);return false;},_auth2_cb:function(elem)
- {if(elem.getAttribute("type")=="result"){this.authenticated=true;this._changeConnectStatus(Strophe.Status.CONNECTED,null);}else if(elem.getAttribute("type")=="error"){this._changeConnectStatus(Strophe.Status.AUTHFAIL,null);this.disconnect();}
- return false;},_addSysTimedHandler:function(period,handler)
- {var thand=new Strophe.TimedHandler(period,handler);thand.user=false;this.addTimeds.push(thand);return thand;},_addSysHandler:function(handler,ns,name,type,id)
- {var hand=new Strophe.Handler(handler,ns,name,type,id);hand.user=false;this.addHandlers.push(hand);return hand;},_onDisconnectTimeout:function()
- {Strophe.info("_onDisconnectTimeout was called");var req;while(this._requests.length>0){req=this._requests.pop();req.abort=true;req.xhr.abort();req.xhr.onreadystatechange=function(){};}
- this._doDisconnect();return false;},_onIdle:function()
- {var i,thand,since,newList;while(this.removeTimeds.length>0){thand=this.removeTimeds.pop();i=this.timedHandlers.indexOf(thand);if(i>=0){this.timedHandlers.splice(i,1);}}
- while(this.addTimeds.length>0){this.timedHandlers.push(this.addTimeds.pop());}
- var now=new Date().getTime();newList=[];for(i=0;i<this.timedHandlers.length;i++){thand=this.timedHandlers[i];if(this.authenticated||!thand.user){since=thand.lastCalled+thand.period;if(since-now<=0){if(thand.run()){newList.push(thand);}}else{newList.push(thand);}}}
- this.timedHandlers=newList;var body,time_elapsed;if(this.authenticated&&this._requests.length===0&&this._data.length===0&&!this.disconnecting){Strophe.info("no requests during idle cycle, sending "+"blank request");this._data.push(null);}
- if(this._requests.length<2&&this._data.length>0&&!this.paused){body=this._buildBody();for(i=0;i<this._data.length;i++){if(this._data[i]!==null){if(this._data[i]==="restart"){body.attrs({to:this.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":Strophe.NS.BOSH});}else{body.cnode(this._data[i]).up();}}}
- delete this._data;this._data=[];this._requests.push(new Strophe.Request(body.tree(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),body.tree().getAttribute("rid")));this._processRequest(this._requests.length-1);}
- if(this._requests.length>0){time_elapsed=this._requests[0].age();if(this._requests[0].dead!==null){if(this._requests[0].timeDead()>Math.floor(Strophe.SECONDARY_TIMEOUT*this.wait)){this._throttledRequestHandler();}}
- if(time_elapsed>Math.floor(Strophe.TIMEOUT*this.wait)){Strophe.warn("Request "+
- this._requests[0].id+" timed out, over "+Math.floor(Strophe.TIMEOUT*this.wait)+" seconds since last activity");this._throttledRequestHandler();}}
- clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100);}};if(callback){callback(Strophe,$build,$msg,$iq,$pres);}})(function(){window.Strophe=arguments[0];window.$build=arguments[1];window.$msg=arguments[2];window.$iq=arguments[3];window.$pres=arguments[4];});
- (function($){$.fn.jscontext=function(options){var settings={html:'default',bind:'right-click',closeOnMouseLeave:false,fade:false,fadeSpeed:"normal",show:null,open:null,close:null,mouseover:null,mouseleave:null,sticky:false};var methods={initMenu:function(elm,settings){$("html").mousemove(function(e){mouse.x=e.pageX;mouse.y=e.pageY;if(element.current!=undefined&&element.moveit){element.current.css("top",(mouse.y+10)+'px');element.current.css("left",(mouse.x+10)+'px');if(settings.mouseover!=null)
- settings.mouseover.call();}});$("html").click(function(){if(element.close())
- methods.closeMenu(null,null);});$("html").mouseleave(function(){methods.closeMenu(null,null);});switch(settings.bind){case"right-click":$(elm).bind("contextmenu",function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- settings.show.call();element.moveit=false;return false;}});break;case"click":$(elm).click(function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- settings.show.call();element.moveit=false;return false;}});break;case"anyclick":$(elm).bind("contextmenu",function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- settings.show.call();element.moveit=false;return false;}});$(elm).click(function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- settings.show.call();element.moveit=false;return false;}});break;case"hover":$(elm).hover(function(e){var elementcurrent=$("#"+elm.id+"jscontext");if(elementcurrent.length==0){methods.openMenu(elm,settings);jscontextElm(elm);if(settings.show!=null)
- settings.show.call();if(settings.sticky)
- element.moveit=true;return false;}},function(e){if(settings.sticky){if(element.close())
- methods.closeMenu($(element.current).attr("id"),null);}
- element.moveit=false;});break;}},openMenu:function(elm,settings){methods.createMenu(elm,settings);element.current=$("#"+elm.id+"jscontext");if(settings.html instanceof Function){element.current.html(settings.html(elm));}else{element.current.html(settings.html.clone(true));}
- var jscontextBtn=$(".jscontextBtn");if(settings.open!=null)
- settings.open.call();if(settings.closeOnMouseLeave&&!settings.sticky){element.current.mouseleave(function(){if(element.close())
- methods.closeMenu($(element.current).attr("id"),null);});}
- try{var winWidth=window.innerWidth||document.documentElement.clientWidth||document.body.offsetWidth;if(mouse.x>=winWidth-element.current.width())
- element.current.css("left",mouse.x-(element.current.width()-15)+"px");}
- catch(e){}},createMenu:function(elm,settings){var jscontextID=elm.id+"jscontext";var afterClose=function(){var jscontextElement=document.createElement('div');jscontextElement.id=jscontextID;jscontextElement.style.position='absolute';jscontextElement.style.display='none';if(mouse.y==undefined)
- mouse.y=0;if(mouse.x==undefined)
- mouse.x=0;jscontextElement.style.top=(mouse.y-(settings.sticky==true?0:15))+'px';jscontextElement.style.left=(mouse.x-(settings.sticky==true?0:15))+'px';jscontextElement.style.zIndex='9999';document.body.appendChild(jscontextElement);var jscontext=$("#"+jscontextID);jscontext.addClass("jscontextContainer");if(settings.fade){jscontext.fadeIn(settings.fadeSpeed);element.fade=true;}
- else{jscontext.show();element.fade=false;}}
- methods.closeMenu(null,afterClose);},closeMenu:function(elmID,afterClose){var remove=function(){if(elmID){if($("#"+elmID).length>0)
- document.body.removeChild(document.getElementById(elmID));}
- else{$(".jscontextContainer").remove();}}
- if(element.fade){if(elmID){if($("#"+elmID).length>0)
- $("#"+elmID).fadeOut(settings.fadeSpeed,remove);}
- else{$(".jscontextContainer").fadeOut(settings.fadeSpeed,remove);}}
- else{remove.call();}
- if(settings.close!=null)
- settings.close.call();if(afterClose!=null)
- afterClose.call();}};return this.each(function(){if(options&&typeof options==='object'){$.extend(settings,options);methods.initMenu(this,settings);}
- else if(typeof options==='string'){switch(options){case"":break;}}});};})(jQuery);jscontext=function(option){switch(option){case"close":$(".jscontextContainer").remove();break;}}
- jscontextElm=function(elm){jscontextObj=$(elm);}
- var element={current:null,moveit:false,fade:false,close:function(){if(element.current==null)
- return true;if((mouse.x<element.current.position().left+5)||(mouse.x>(element.current.position().left+element.current.width()-5))||(mouse.y<element.current.position().top+5)||(mouse.y>(element.current.position().top+element.current.height()-5)))
- return true;else
- return false;}};var mouse={x:null,y:null};var jscontextObj=$();(function(jQuery){jQuery.hotkeys={version:"0.8.1",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"command",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return;}
- var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");var isCommandPressed=false;handleObj.handler=function(event){var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+";}
- if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+";}
- if(jQuery.hotkeys.specialKeys[event.which]==="command"){isCommandPressed=true;}
- if(event.metaKey&&!event.ctrlKey&&special!=="meta"&&special!=="command"){if(isCommandPressed){modif+="command+";}else{modif+="meta+";}}
- if(event.shiftKey&&special!=="shift"){modif+="shift+";}
- if(special){possible[modif+special]=true;}else{possible[modif+character]=true;possible[modif+jQuery.hotkeys.shiftNums[character]]=true;if(modif==="shift+"){possible[jQuery.hotkeys.shiftNums[character]]=true;}}
- for(var i=0,l=keys.length;i<l;i++){if(possible[keys[i]]){isCommandPressed=false;return origHandler.apply(this,arguments);}}};}
- jQuery.each(["keydown","keyup","keypress"],function(){jQuery.event.special[this]={add:keyHandler};});})(jQuery);(function($){$.fn.defchat=function(options){var settings={'domain':'localhost','username':null,'password':null,'my_username':'','textinput':this.find('input.text'),'form':this.find('form.chat-form'),'chatlist':this.find('.chat-list'),'userslist':this.find('.users-list'),'buttons':this.find('ul.buttons'),'submitbutton':this.find('.send_message_button'),'usercount':this.find('.usercount'),'subject':'','room':'mymucroom@conference.localhost','private_room':'mymucroom@conference.localhost','throttlechat':false,'throttle_message':null,'translate_message_url':null,'add_moderator_url':null,'media_url':'','ban_url':null,'silence_url':null,'is_broadcasting':false,'allow_tipping':true,'domroot':this,'font_color':'#494949','chat_font':'default','current_subject':'','login_required_callback':null,'submenu_profile_url':null,'emoticon_overlay_url':null,'tipping_current_tokens_url':null,'welcome_message':null,'welcome_warning':null,'first_post_warning':null,'parse_subject':null,'color_choices':['default','Arial, Helvetica','Bookman Old Style','"Comic Sans MS", cursive','"Courier New"','Lucida','Palantino',"Tahoma, Geneva",'"Times New Roman"'],'font_color_cookie_name':'settings_font_color','chat_font_cookie_name':'settings_chat_font','interested_in':[],'group_show_tokens_per_minute_url':null,'group_show_request_url':null,'group_show_decline_url':null,'group_show_cancel_url':null,'return_from_away_url':null,'private_show_tokens_per_minute_url':null,'private_show_request_url':null,'private_show_approve_url':null,'private_show_decline_url':null,'private_show_cancel_url':null,'scroll_on_load':true,'room_goal':{}};if(options){$.extend(settings,options);}
- if(settings.is_broadcasting){settings.font_color_cookie_name='broadcast_settings_font_color';settings.chat_font_cookie_name='broadcast_settings_chat_font';}
- if($.cookie(settings.font_color_cookie_name)){settings.font_color=$.cookie(settings.font_color_cookie_name);}
- if($.cookie(settings.chat_font_cookie_name)){settings.chat_font=$.cookie(settings.chat_font_cookie_name);}
- var default_subject=$.cookie('my_room_subject');if(!default_subject){default_subject=Strophe.getNodeFromJid(settings.room)+"'s room";}
- $.extend(settings,{'user':settings.username+'@'+settings.domain,'muc_nickname':settings.username,'default_subject':default_subject,'bosh_host':'http://'+settings.domain+':5280/http-bind','roomownernick':Strophe.getNodeFromJid(settings.room),'roomowner':Strophe.getNodeFromJid(settings.room)+"@"+settings.domain});if(options){$.extend(settings,options);}
- var conn=new Strophe.Connection(settings.bosh_host);function consolelog(msg){}
- function get_contextual_menu_html(domele){var h=$("<div class='jscontextMenu'></div>");var nick=$(domele).data('nick');var jid=presence_monitor.participants[nick].jid;var account_name=Strophe.getNodeFromJid(jid);function add_link(cls,text,callback){var line=$("<p class='jscontextBtn "+cls+"' data-nick='"+nick+"'>"+text+"</p>");line.click(function(){jscontext('close')});line.click(callback);h.append(line);}
- h.append("<p class=\"jscontextLabel\"><img src=\""+settings.media_url+"images/red-arrow-down.gif\" width=\"9\" height=\"5\" alt=\"\" />"+nick+"</p><hr>");h.append("<div class=\"submenu_profile\"></div><hr>");add_link("pm",gettext("Send private message"),function(){if(!features_unlocked()){unlock_features_required();return;}
- tabs.open_pm(nick);});if(message_receiver.ignored_users.indexOf(jid)!==-1){add_link("ignore",gettext("Un-Ignore This User"),function(event){var ignorenick=$(event.target).data('nick');var ignorejid=presence_monitor.participants[ignorenick].jid;message_receiver.ignored_users=$.grep(message_receiver.ignored_users,function(a){return(a!=ignorejid);});var msg=interpolate(gettext("no longer ignoring %(username)s"),{username:ignorenick},true);add_system_message(msg,tabs.get_current_tab_domele());$('#ignored-list').find("[data-nick='"+ignorenick+"']").parent().remove();tabs._sort_ignored_users_list();ignored_user_methods.store_ignored_users();});}else{add_link("ignore",gettext("Ignore This User"),function(event){var ignorenick=$(event.target).data('nick');message_receiver.ignored_users.push(presence_monitor.participants[ignorenick].jid);var msg=interpolate(gettext("ignoring %(username)s"),{username:ignorenick},true);add_system_message(msg,tabs.get_current_tab_domele());var html="<li>"+ignorenick;html+=" (<a href='#' data-nick='"+presence_monitor.participants[ignorenick].jid;html+="' class='un-ignore'>"+gettext('Un-ignore')+"</a>)</li>";$('#ignored-list').append(html);tabs._sort_ignored_users_list();ignored_user_methods.store_ignored_users();});}
- h.append("<hr>");if(presence_monitor.participants[settings.muc_nickname].role=='moderator'){add_link("",gettext("Silence for 24 hours"),function(event){var bannick=$(event.target).data('nick');var jid=presence_monitor.participants[bannick].jid;var msg=interpolate(gettext("Silence %(username)s?"),{username:bannick},true);if(confirm(msg)){msg=interpolate(gettext("Silencing %(username)s"),{username:bannick},true);add_system_message(msg,tabs.get_current_tab_domele());var account_name=Strophe.getNodeFromJid(jid);var url=settings.silence_url.replace('USERNAMESLUG',account_name);$.post(url,{'foo':'bar'});}});if(presence_monitor.participants[settings.muc_nickname].jid===settings.roomowner){add_link("",gettext("Kick/Ban"),function(event){var bannick=$(event.target).data('nick');var jid=presence_monitor.participants[bannick].jid;var msg=interpolate(gettext("Ban %(username)s?"),{username:bannick},true);if(confirm(msg)){msg=interpolate(gettext("Kicking and banning %(username)s"),{username:bannick},true);add_system_message(msg,tabs.get_current_tab_domele());var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'affiliation':'outcast','jid':jid});consolelog(iq);conn.sendIQ(iq);var account_name=Strophe.getNodeFromJid(jid);var url=settings.ban_url.replace('USERNAMESLUG',account_name);$.post(url,{'foo':'bar'});}});if(presence_monitor.participants[nick].role!='moderator'){add_link("",gettext("Promote to Moderator"),function(event){var nick=$(event.target).data('nick');var msg=interpolate("granting moderator privileges to %(username)s",{username:nick},true);message_sender._send(msg);var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'role':'moderator','nick':nick});consolelog(iq);conn.sendIQ(iq);var url=settings.add_moderator_url.replace('USERNAMESLUG',account_name);$.post(url,{'foo':'bar'});moderators[presence_monitor.participants[nick].jid]=true;});}else{add_link("",gettext("Remove Moderator Status"),function(event){var nick=$(event.target).data('nick');var msg=interpolate(gettext("revoking moderator privileges from %(username)s"),{username:nick},true);add_system_message(msg,tabs.get_current_tab_domele());var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'role':'participant','nick':nick});consolelog(iq);conn.sendIQ(iq);delete moderators[presence_monitor.participants[nick].jid];});}}}
- var url=settings.submenu_profile_url.replace('USERNAMESLUG',account_name);consolelog("Loading menu from "+url);h.find(".submenu_profile").load(url);return h;}
- function add_system_message(message,domele){message_receiver.add_message('<div class="text"><p>'+message+'</p></div>',domele);}
- function insert_user(newhtml,nick,token_balance){var sort_key=$("select[name='sort']").val();if(sort_key==undefined){if($.cookie('room_sort_by')==undefined)
- sort_key='a';else{sort_key=$.cookie('room_sort_by');}}
- if(!settings.is_broadcasting){sort_key='a';}
- var inserted=false;settings.userslist.find("div.text").each(function(index,domEle){var $domEle=$(domEle);var domnick=String($domEle.data('nick'));if(sort_key=='a'){new_val=nick.replace('__anonymous__','zzzz');current_val=domnick.replace('__anonymous__','zzzz');}
- else{new_val=parseInt(token_balance);current_val=parseInt($domEle.data('tokenbalance'));}
- if((sort_key=='a')&&(new_val<current_val)){$domEle.before(newhtml);inserted=true;return false;}
- if((sort_key=='t')&&(new_val>current_val)){$domEle.before(newhtml);inserted=true;return false;}});if(!inserted){settings.userslist.append(newhtml);}}
- function userjoined(event,nick,token_balance){token_balance=parseInt(token_balance);if(isNaN(token_balance)){token_balance=0;}
- if(nick.indexOf('__anonymous__')!=-1){token_balance=-1;}
- var color='color-3';if(settings.is_broadcasting){if(token_balance<1){color='color-3';}else{color='color-4';}}
- var msg=interpolate(gettext("<span class='username "+color+"' data-nick='%(username)s'"+">%(username)s</span> joined"),{username:nick},true);if(initializer.joined&&(new Date()-initializer.joined_at>10*1000)){if(presence_monitor.num_participants<5){add_system_message(msg);}else{if(settings.is_broadcasting&token_balance>=1){add_system_message(msg);}}}
- if(tabs.pm_tab_map[nick]){add_system_message(msg,tabs.pm_tab_map[nick]);}
- var newhtml=$("<div class='text' data-nick='"+nick+"' data-tokenbalance='"+token_balance+"'><strong class='"+
- color+"'>"+nick+"</strong></div>");if(nick!=settings.muc_nickname){newhtml.jscontext({html:get_contextual_menu_html,bind:'anyclick'});}
- return insert_user(newhtml,nick,token_balance);}
- $(document).bind("userjoined.defchat",userjoined);function update_participants_count(){settings.usercount.text(presence_monitor.num_participants);}
- setInterval(update_participants_count,2000);function yield_ownership(event,nick,token_balance){if(nick!=settings.roomownernick){return;}
- if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){return;}}
- var iq=$iq({'to':settings.room,'type':'set'}).c('query',{xmlns:'http://jabber.org/protocol/muc#admin'}).c('item',{affiliation:'owner',jid:settings.roomowner});consolelog(iq.toString());conn.sendIQ(iq);}
- $(document).bind("userjoined.defchat",yield_ownership);var public_methods={_set_font_size:function(){if($.cookie('room_font_size')){var size=$.cookie('room_font_size');}
- else{var size='9pt';}
- $("div.chat-list").css("font-size",size);},join_group_show:function(){groups_and_privates.start_group_show_clicked();},change_title:function(title){if(title==settings.current_subject){return;}
- $.cookie('my_room_subject',title,{expires:365});conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(title));},select_emoticon:function(emoticon){settings.textinput.val(settings.textinput.val()+" "+emoticon);settings.textinput.focus();},is_goal_set:function(){return settings.room_goal.hasOwnProperty('amount');}};var ignored_user_methods={store_ignored_users:function(){var ignored_str="";for(var i=0;i<message_receiver.ignored_users.length;i++){ignored_str+="#"+message_receiver.ignored_users[i];}
- $.cookie('ignored_users',ignored_str,{expires:30,path:'/'});},load_ignored_users:function(){var ignored_str=$.cookie('ignored_users');if(ignored_str==null)
- return;var ignored_array=ignored_str.split('#');for(var i=0;i<ignored_array.length;i++){if(ignored_array[i]!=''){message_receiver.ignored_users.push(ignored_array[i]);}}}};function reassign_moderator(event,nick,token_balance){if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){return;}}
- if(!moderators[presence_monitor.participants[nick].jid]){return;}
- var iq=$iq({to:settings.room,type:'set'}).c('query',{'xmlns':'http://jabber.org/protocol/muc#admin'}).c('item',{'role':'moderator','nick':nick});consolelog(iq.toString());conn.sendIQ(iq);}
- $(document).bind("userjoined.defchat",reassign_moderator);function remove_user_from_list(nick){settings.userslist.find("[data-nick='"+nick+"']").remove();}
- function userleft(event,nick){var msg=interpolate(gettext("%(username)s has disconnected"),{username:nick},true);if(presence_monitor.num_participants<5){add_system_message(msg);}
- if(tabs.pm_tab_map[nick]){add_system_message(msg,tabs.pm_tab_map[nick]);}
- remove_user_from_list(nick);}
- $(document).bind("userleft.defchat",userleft);$(document).bind("disconnected.defchat",function(){add_system_message(gettext("chat disconnected"));});$(document).bind("connectionfailed.defchat",function(){add_system_message(gettext("unable to connect"));});$(document).bind("connecting.defchat",function(){add_system_message(gettext("connecting"));});function connected(){add_system_message(gettext("connection established"));conn.send($pres().c('priority').t('-1'));initializer.join_room();if(settings.welcome_message){add_system_message(settings.welcome_message);}
- if(settings.welcome_warning){add_system_message(settings.welcome_warning);}
- $(window).unload(function(){conn.sync=true;var msg=$pres({to:settings.room,type:'unavailable'});conn.send(msg);conn.disconnect();conn.flush();});}
- $(document).bind("connected.defchat",connected);var tabs={pm_tab_visible:false,current_tab:'chat',pm_tab:null,pm_tab_map:{},settings_body:null,unread_pm_map:{},total_unread_pms:0,current_pm_nick:null,opened_pms:new Array(),is_blinking:false,open_pm:function(nick){tabs._show_pm_tab();tabs._remove_unread_pms_for_nick(nick);settings.domroot.find('> div').hide();tabs.get_or_create_pm_tab_for_nick(nick,false).show();tabs.current_tab='pm';tabs.current_pm_nick=nick;tabs._enable_form();settings.textinput.focus();tabs._scroll_to_bottom();},close_pm:function(nick){tabs._show_pm_tab();tabs._remove_unread_pms_for_nick(nick);settings.domroot.find('> div').hide();tabs.pm_tab_map[nick].remove();tabs.pm_tab_map[nick]=null;tabs._show_chat_tab();var newopens=new Array();for(var i=0;i<tabs.opened_pms.length;i++){if(tabs.opened_pms[i]!=nick){newopens.push(tabs.opened_pms[i]);}}
- tabs.opened_pms=newopens;},on_tab_click:function(){var tab=$(this).data("tab");settings.domroot.find('> div').hide();if(tab=='users'){tabs._deactivate_tabs();$(this).closest('li').addClass('active');settings.domroot.find('> div.users-list').show();tabs.current_tab='users';tabs._disable_form();}else if(tab=='chat'){tabs._show_chat_tab();}else if(tab=='settings'){tabs._show_settings_tab();tabs._disable_form();}else{consolelog("Unknown tab "+tab);}
- return false;},get_or_create_pm_tab_for_nick:function(nick,show_alert){if(tabs.pm_tab_map[nick]){return tabs.pm_tab_map[nick];}
- if(show_alert){var msg=interpolate(gettext("New private conversation from <span class='username' data-nick='%(username)s'>%(username)s</span> <span class='pmalert'>(click the PM tab)</span>"),{username:nick},true);add_system_message(msg);}
- tabs.opened_pms.push(nick);tabs.opened_pms.sort();tabs._create_pm_tab();if(tabs.opened_pms.length>1){tabs._set_pm_tab_jscontext();}else{tabs._set_pm_tab_direct(nick);}
- tabs.pm_tab_map[nick]=$("<div class='chat-list' style='display: none;'></div>");settings.domroot.find('> div').last().after(tabs.pm_tab_map[nick]);msg=interpolate(gettext("Private conversation with %(username)s"),{username:nick},true);add_system_message(msg,tabs.pm_tab_map[nick]);return tabs.pm_tab_map[nick];},private_message_received:function(nick){if(tabs.current_tab==='pm'&&tabs.current_pm_nick==nick){return;}
- if(tabs.unread_pm_map[nick]){tabs.unread_pm_map[nick]+=1;}else{tabs.unread_pm_map[nick]=1;}
- tabs.total_unread_pms+=1;tabs._refresh_pm_tab_count();if(!tabs.pm_tab.hasClass('active')){if(!tabs.is_blinking){tabs._blink_pm(6,250);}}},_blink_pm:function(numblinks,timeout){if(tabs.current_tab==='pm'){tabs.is_blinking=false;return;}
- if(numblinks==0){tabs.pm_tab.removeClass('active');tabs.is_blinking=false;return;}
- if(!tabs.pm_tab.hasClass('active')){tabs.pm_tab.addClass('active');}else{tabs.pm_tab.removeClass('active');}
- tabs.is_blinking=true;setTimeout(function(){tabs._blink_pm(numblinks-1,timeout);},timeout);},get_current_tab_domele:function(){var r=settings.domroot.find('> div.chat-list:visible');if(r.length===0){return settings.chatlist;}else{return r;}},_show_chat_tab:function(){tabs._deactivate_tabs();settings.buttons.find('li:first').addClass('active');settings.domroot.find('> div').hide();settings.domroot.find('> div.chat-list:first').show();tabs.current_tab='chat';tabs._enable_form();settings.textinput.focus();tabs._scroll_to_bottom();},_scroll_to_bottom:function(){var chat=tabs.get_current_tab_domele().get(0);chat.scrollTop=chat.scrollHeight;},_disable_form:function(){settings.textinput.blur();settings.textinput.focus(function(event){settings.textinput.unbind(event);tabs._show_chat_tab();});},_enable_form:function(){settings.textinput.unbind('focus');},_remove_unread_pms_for_nick:function(nick){if(tabs.unread_pm_map[nick]&&tabs.unread_pm_map[nick]>0){tabs.total_unread_pms=tabs.total_unread_pms-tabs.unread_pm_map[nick];tabs.unread_pm_map[nick]=0;tabs._refresh_pm_tab_count();}},_refresh_pm_tab_count:function(){var str;if(tabs.total_unread_pms==0){str="";}else{str="("+tabs.total_unread_pms+")";}
- tabs.pm_tab.find('.pm_count').text(str);},_create_pm_tab:function(){if(!tabs.pm_tab_visible){tabs.pm_tab_visible=true;tabs.pm_tab=$("<li><a href='#' data-tab='pm'>"+"PM <span class='pm_count'></span></a></li>");settings.buttons.find('li:last').before(tabs.pm_tab);}},_set_pm_tab_direct:function(nick){tabs.pm_tab.unbind('click');tabs.pm_tab.bind('click',function(){tabs.open_pm(nick);return false;});},_set_pm_tab_jscontext:function(){tabs.pm_tab.unbind('click');tabs.pm_tab.jscontext({html:function(){var h=$("<div class='jscontextMenu'></div>");function add_link(nick,text,callback){var line=$("<div class=\"pmline\"><div class=\"user\" data-nick='"+nick+"'>"+text+"</div><div class=\"close\" data-nick='"+nick+"'></div></div>");line.find("div.user").click(callback);line.find("div.user").click(function(){jscontext('close');});line.find("div.close").click(function(event){tabs.close_pm($(event.target).data('nick'));jscontext('close');});h.append(line);}
- h.append("<p class=\"jscontextLabel\"><img src=\""+settings.media_url+"images/orange-arrow-down.gif\" width=\"9\" height=\"5\" alt=\"\" />Private Message with:</p><hr>");for(var i=0;i<tabs.opened_pms.length;i++){var nick=tabs.opened_pms[i];var unread=tabs.unread_pm_map[nick];if(unread&&unread>0){unread=" ("+unread+")";}else{unread="";}
- add_link(nick,nick+unread,function(event){var nick=$(event.target).data('nick');tabs.open_pm(nick);});}
- return h;},bind:"click"});},_deactivate_tabs:function(){settings.buttons.find('li').removeClass('active');},_show_pm_tab:function(){tabs._deactivate_tabs();tabs._create_pm_tab();tabs.pm_tab.addClass('active');},_sort_ignored_users_list:function(){if($("ul#ignored-list li").size()==0){$("ul#ignored-list").hide();$("h3#ignored-title").hide();return;}
- $("ul#ignored-list").show();$("#ignored-title").show();var list=$("ul#ignored-list");var listitems=list.children("li").get();listitems.sort(function(a,b){var compA=$(a).text().toUpperCase();var compB=$(b).text().toUpperCase();return(compA<compB)?-1:(compA>compB)?1:0;});$.each(listitems,function(idx,itm){list.append(itm);});},_sort_users_list:function(){var sort_key=$("select[name='sort']").val();if(sort_key==undefined){if($.cookie('room_sort_by')==undefined)
- sort_key='a';else{sort_key=$.cookie('room_sort_by');}}
- if(!settings.is_broadcasting){sort_key='a';}
- if(sort_key=='a'){var mylist=$('div.users-list');var listitems=mylist.children('div.text').get();listitems.sort(function(a,b){var compA=String($(a).data("nick"));compA=compA.replace('__anonymous__','zzzz');var compB=String($(b).data("nick"));compB=compB.replace('__anonymous__','zzzz');return(compA<compB)?-1:(compA>compB)?1:0;})
- $.each(listitems,function(idx,itm){mylist.append(itm);})}
- else{var mylist=$('div.users-list');var listitems=mylist.children('div.text').get();listitems.sort(function(a,b){var compA=parseInt($(a).data("tokenbalance"));var compB=parseInt($(b).data("tokenbalance"));return(compA<compB)?1:(compA>compB)?-1:0;})
- $.each(listitems,function(idx,itm){mylist.append(itm);})}},_get_font_change:function(){var html="<br/><form>";html+="<label>"+gettext('Change Font Size')+": </label>";html+=" <select id='font-change' name='font-change'>";for(var i=9;i<=20;i++){html+="<option value='"+i+"pt'>"+i+"pt</option>"}
- html+="</select></form>";$("#font-change").live("change",function(){$("div.chat-list").css("font-size",$(this).val());$.cookie('room_font_size',$(this).val(),{expires:365,path:'/'});});return html;},_get_show_emoticons_stored_value:function(){if($.cookie('show_emoticon_icons')=='yes'){return true;}
- if($.cookie('show_emoticon_icons')=='no'){return false;}
- return true;},_store_emoticons_value:function(val){$.cookie('show_emoticon_icons',val,{expires:365,path:'/'});},_get_emoticons_display:function(){var html="<form><label>"+gettext("Show Emoticons")+": </label>";html+="<select id='show-emoticons' name='show-emoticons'>";html+="<option value='yes'";if(tabs._get_show_emoticons_stored_value()){html+=" selected='selected' ";}
- html+=">"+gettext("Yes")+"</option><option value='no'";if(!tabs._get_show_emoticons_stored_value()){html+=" selected='selected' ";}
- html+=">"+gettext("No")+"</option></select></form>"
- $("#show-emoticons").live("change",function(){tabs._store_emoticons_value($(this).val());});return html;},_should_show_emoticon:function(){if($("#show-emoticons").length){return $("#show-emoticons").val()=="yes";}
- return tabs._get_show_emoticons_stored_value();},_set_default_font_change_value:function(){var size='9pt';if($.cookie('room_font_size')){size=$.cookie('room_font_size');}
- $("#font-change option[value='"+size+"']").attr("selected","selected");},_show_settings_tab:function(){tabs.current_tab='settings';settings.domroot.find('> div').hide();if(!tabs.settings_body){var html="<div class='settings-list'><form>"+"<div class='exampletext'>"+gettext("Your chat messages will look like this.")+"</div>"+"<div><br/><label>"+gettext("Chat font")+":</label> <select name='chatfont'></select></div>"+"<div><br/><label>"+gettext("Chat color")+":</label> <input type='color' id='settingscolor' name='color' value='"+settings.font_color+"' data-hex='true' data-text='hidden' style='height:20px;width:20px;'></div>"+"</form><h3 id='ignored-title'>"+gettext('Ignored users')+"</h3><ul id='ignored-list'>";for(var i=0;i<message_receiver.ignored_users.length;i++){var nick=message_receiver.ignored_users[i].split('@')[0];html+="<li>"+nick;html+=" (<a href='#' data-nick='"+message_receiver.ignored_users[i];html+="' class='un-ignore'>"+gettext('Un-ignore')+"</a>)</li>";}
- html+="</ul>";html+=tabs._get_font_change();html+=tabs._get_emoticons_display();if(settings.is_broadcasting){html+='<form><br/><label>'+gettext("Sort users")+":</label> "+'<select name="sort"><option value="a"';if(($.cookie('room_sort_by')=='a')||($.cookie('room_sort_by')==undefined)){html+=' selected="selected" '}
- html+='>'+
- gettext('Alphabetically')+'</option>'+'<option value="t"';if($.cookie('room_sort_by')=='t'){html+=' selected="selected" '}
- html+='>'+gettext('By Tokens')+'</option>'+'</select></form>';$("select[name='sort']").live("change",function(){$.cookie('room_sort_by',$(this).val(),{expires:365,path:'/'});tabs._sort_users_list();});html+="<br/><br/><a href='#' class='clear_all_banned_ips'>"+
- gettext('Clear All Banned IPs')+"</a>"+"<span style='display:none' class='ban_result'>"+
- gettext('Banned IPs cleared...')+"</span>";}
- html+="</div>";tabs.settings_body=$(html);$("#ignored-list li a").live("click",function(){var uname=$(this).data("nick");$(this).parent().remove();message_receiver.ignored_users=$.grep(message_receiver.ignored_users,function(a){return(a!=uname);});uname=uname.split('@')[0];var msg=interpolate(gettext("no longer ignoring %(username)s"),{username:uname},true);add_system_message(msg,tabs.get_current_tab_domele());ignored_user_methods.store_ignored_users();tabs._sort_ignored_users_list();return false;});$.each(settings.color_choices,function(index,value){tabs.settings_body.find('select[name="chatfont"]').append("<option>"+value+"</option>");});tabs.settings_body.find('select[name="chatfont"]').val(settings.chat_font);settings.domroot.find('> div').last().after(tabs.settings_body);consolelog($("#settingscolor"));$('#settingscolor').mColorPicker();$('#settingscolor').bind('colorpicked',function(){if(!features_unlocked()){unlock_features_required();$('#settingscolor').val('#494949');$('#icp_settingscolor').css('background-color','#494949');}
- settings.font_color=$(this).val();tabs.settings_body.find('.exampletext').css('color',settings.font_color);$.cookie(settings.font_color_cookie_name,settings.font_color,{expires:365,path:'/'});});tabs.settings_body.find('select[name="chatfont"]').change(function(){if(!features_unlocked()){tabs.settings_body.find('select[name="chatfont"]').val('default');unlock_features_required();return;}
- settings.chat_font=$(this).val();if(settings.chat_font==='default'){tabs.settings_body.find('.exampletext').css('font-family','');}else{tabs.settings_body.find('.exampletext').css('font-family',settings.chat_font);}
- $.cookie(settings.chat_font_cookie_name,settings.chat_font,{expires:365,path:'/'});});}
- tabs.settings_body.show();tabs._sort_ignored_users_list();tabs._deactivate_tabs();settings.buttons.find('a[data-tab="settings"]').parent().addClass('active');tabs._set_default_font_change_value();}};settings.buttons.find('a').click(tabs.on_tab_click);var initializer={attempts:0,joined:false,joined_at:null,is_on_private_room:false,base_room_name:settings.room,retry_join_room:function(){if(this.attempts>0){settings.muc_nickname+='_';}
- if(this.attempts>=5){consolelog("Too many failed attempts, disconnecting");conn.disconnect();}
- return this.join_room();},join_room:function(){this.attempts+=1;consolelog("Joining "+settings.room+" with "+settings.muc_nickname);var pres=$pres({to:settings.room+"/"+settings.muc_nickname,token_balance:settings.token_balance}).c('x',{xmlns:"http://jabber.org/protocol/muc"});if(initializer.is_on_private_room){pres=pres.c('history',{'maxchars':'0'});}
- conn.send(pres);},change_to_private_room:function(){if(initializer.is_on_private_room){return;}
- message_receiver.ignore_delayed=true;initializer.leave_room();initializer.attempts=4;initializer.is_on_private_room=true;settings.room=settings.private_room;presence_monitor.reset();initializer.join_room();},leave_private_room:function(){if(!initializer.is_on_private_room){return;}
- initializer.leave_room();initializer.attempts=4;initializer.is_on_private_room=false;settings.room=initializer.base_room_name;presence_monitor.reset();initializer.join_room();},leave_room:function(){conn.send($pres({to:settings.room+"/"+settings.muc_nickname,type:'unavailable'}).c('x',{xmlns:"http://jabber.org/protocol/muc"}));},on_disconnect:function(){initializer.joined=false;},on_received_my_presence:function(){initializer.joined=true;initializer.joined_at=new Date();if(!presence_monitor.participants[settings.muc_nickname]){return true;}
- if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){return true;}
- if(settings.current_subject===""&!public_methods.is_goal_set()){conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(settings.default_subject))}
- conn.sendIQ($iq({to:settings.room,type:'get'}).c('query',{xmlns:'http://jabber.org/protocol/muc#owner'}),function(response){consolelog("Server configuration form . . .");consolelog(response);var x=$iq({to:settings.room,type:'set'}).c('query',{xmlns:'http://jabber.org/protocol/muc#owner'}).c('x',{xmlns:'jabber:x:data',type:'submit'}).c('field',{'var':'FORM_TYPE'}).c('value').t('http://jabber.org/protocol/muc#roomconfig').up().up().c('field',{'var':'muc#roomconfig_whois'}).c('value').t('anyone').up().up().c('field',{'var':'muc#roomconfig_maxusers'}).c('value').t('50000');consolelog("Configuring room "+x.toString());conn.sendIQ(x,function(response){consolelog("Configuration response . . .");consolelog(response);});});}};$(document).bind("disconnected.defchat",initializer.on_disconnect);var presence_monitor={participants:new Array(),num_participants:0,reset:function(){presence_monitor.participants=new Array();presence_monitor.num_participants=0;settings.userslist.html("");},user_is_present:function(nick){var present=presence_monitor.participants[nick];present=(present!==undefined&&present!==false);return present;},remove_participant:function(nick){presence_monitor.num_participants-=1;delete presence_monitor.participants[nick];},on_presence:function(presence){var from=$(presence).attr('from');var room=Strophe.getBareJidFromJid(from);if(room==settings.room){consolelog(presence);var nick=Strophe.getResourceFromJid(from);if(nick.substring(0,6)=='admin-'){return true;}
- consolelog("Nick for "+from+" is "+nick);if($(presence).attr('type')==='error'&&!initializer.joined){if($(presence).find("status[code='409']")){initializer.retry_join_room();return true;}else{consolelog("Disconnecting because of error while connecting");conn.disconnect();return false;}}
- if($(presence).attr('type')!=='unavailable'){var present=presence_monitor.user_is_present(nick);var extradata=$(presence).find('item');if(extradata.attr('jid')){presence_monitor.participants[nick]={'jid':Strophe.getBareJidFromJid(extradata.attr('jid')),'role':extradata.attr('role')};if(!present){presence_monitor.num_participants+=1;$(document).trigger('userjoined.defchat',[nick,$(presence).attr('token_balance')]);}}}else if(presence_monitor.user_is_present(nick)&&$(presence).attr('type')==='unavailable'){presence_monitor.remove_participant(nick);$(document).trigger('userleft.defchat',nick);}
- if($(presence).attr('type')!=='error'&&!initializer.joined&&nick===settings.muc_nickname){initializer.on_received_my_presence();}}
- return true;}};conn.addHandler(presence_monitor.on_presence,null,"presence");var message_receiver={ignored_users:new Array(),ignore_delayed:false,on_goalset:function($message){settings.room_goal.amount=$message.attr('amount');settings.room_goal.current=$message.attr('current');settings.room_goal.hightipper=$message.attr('hightipper');settings.room_goal.hightipper_amount=$message.attr('hightipper_amount');settings.room_goal.lasttipper=$message.attr('lasttipper');settings.room_goal.lasttipper_amount=$message.attr('lasttipper_amount');if(settings.room_goal.lasttipper==""){settings.room_goal.lasttipper="--";settings.room_goal.hightipper="--";}
- tipping_goal.enable_goal();},on_message:function(message){consolelog(message);var $message=$(message);var subtype=$message.attr('subtype');var delayed=false;if($message.children('delay').length!=0){delayed=true;}
- if(message_receiver.ignore_delayed&delayed){return true;}
- if(subtype=='roomalert'){if(!delayed){message_receiver.on_roomalert($message);}
- return true;}else if(subtype=='goalset'){if(!delayed){message_receiver.on_goalset($message);}
- return true;}else if(subtype=='goalcancel'){if(!delayed){tipping_goal.disable_goal();}
- return true;}else if(subtype=='goalreached'){if(!delayed){message_receiver.on_goalreached();}}else if(subtype=='tipalert'){message_receiver.on_tipalert($message);return true;}else if(subtype=='messagechangerequest'){if(!delayed){message_receiver.on_messagechangerequest($message);}
- return true;}else if(subtype=='settingsupdate'){if(!delayed){message_receiver.on_settingsupdate($message);}
- return true;}else if(subtype=='groupshowrequest'){if(!delayed){groups_and_privates.on_groupshowrequest_message($message);}
- return true;}else if(subtype=='privateshowrequest'){if(!delayed){groups_and_privates.on_privateshowrequest_message($message);}
- return true;}else if(subtype=='groupshowapprove'){if(!delayed){groups_and_privates.on_groupshowrequest_approvemessage($message);}
- return true;}else if(subtype=='leaveprivateroom'){if(!delayed){groups_and_privates.on_leaveprivateroom_message($message);}
- return true;}else if(subtype=='privateshowapprove'){if(!delayed){groups_and_privates.on_privateshowrequest_approvemessage($message);}
- return true;}else if(subtype=='token_balance_update'){if(!delayed){tipping.current_balance=parseInt($(message).attr("tokenbalance_"+settings.my_username));$('.tokencount').html(tipping.current_balance);}
- return true;}else if(subtype=='groupshowcancel'){if(!delayed){groups_and_privates.on_groupshowrequest_cancelmessage();}
- return true;}else if(subtype=='privateshowcancel'){if(!delayed){groups_and_privates.on_privateshowrequest_cancelmessage();}
- return true;}else if(subtype=='awaycancel'){if(!delayed){groups_and_privates.on_awaystatus_cancelmessage();}
- return true;}
- var subject=$message.children('subject').text();if(subject){var msg=interpolate(gettext("room subject changed to \"%(subject)s\""),{subject:subject},true);add_system_message("<span class='roommessagelabel'>"+msg+"</span>");$(document).trigger("subjectchanged.defchat",subject);display_subject=settings.parse_subject(subject);settings.subject.text(display_subject);settings.current_subject=subject;return true;}
- var from=$message.attr('from');var nick=Strophe.getResourceFromJid(from);if(nick==null){return true;}
- if(presence_monitor.participants[nick]){if(message_receiver.ignored_users.indexOf(presence_monitor.participants[nick].jid)!==-1){return true;}}
- if($('.broadcaster_panel_away').is(':visible')){return true;}
- message_receiver.add_message(message_receiver._format_message(message));return true;},on_goalreached:function(){if(!settings.is_broadcasting){return;}
- var html="<span class='roommessagelabel'>";html+=gettext("Your goal is completed, to set a new one click Cancel goal and start over")+"</span>";add_system_message(html);},on_settingsupdate:function($message){if($message.attr('allow_privates')==='True'){$('.private_settings .value').html(gettext("Allowed"));groups_and_privates.show_private_show_controls(true);}else{$('.private_settings .value').html(gettext("Disabled"));groups_and_privates.hide_private_show_controls(true);}
- if($message.attr('allow_group')==='True'){$('.group_show_disabled').hide();$('.group_show_active').show();groups_and_privates.show_group_show_controls(true);}else{$('.group_show_active').hide();$('.group_show_disabled').show();groups_and_privates.hide_group_show_controls(true);}
- $('.num_users_required_for_group').html($message.attr('minimum_users_for_group_show'));return true;},on_messagechangerequest:function($message){var subject=$message.children('subject').text();if(settings.is_broadcasting){conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(subject));}
- return true;},on_roomalert:function($message){var slug=$message.attr('slug');var url=$message.attr('url');var gendericon=$message.attr('gendericon');var gender=$message.attr('gender');if($.inArray(gender,settings.interested_in)<0){return;}
- if(!(initializer.joined&&(new Date()-initializer.joined_at>2*1000))){return true;}
- var msg=interpolate(gettext("%(roomname)s turned on their cam -- click here to visit."),{roomname:slug},true);msg=message_receiver._add_emoticons(msg);add_system_message("<span class='roomalert'><a href='"+
- url+"'><<< <img src='"+settings.media_url+"images/"+gendericon+"' height=15 width=14 border=0> "+msg+" >>></a></span>",tabs.get_current_tab_domele());},on_tipalert:function($message){var from_username=$message.attr('from_username');var to_username=$message.attr('to_username');var amount=$message.attr("amount");var body=$message.find('body').text();var msg=interpolate(gettext("%(from_username)s tipped %(amount)s tokens"),{from_username:from_username,amount:amount},true);if(settings.is_broadcasting){if(!$message.find('delay').length!=0){PlayBeep();if($.trim(body)!=""){msg=msg+" -- "+body;}}}
- add_system_message("<span class='tipalert'>"+msg+"</span>",tabs.get_current_tab_domele());},on_private_message:function(message,nick){if(!nick){var from=$(message).attr('from');nick=Strophe.getResourceFromJid(from);}
- if(presence_monitor.participants[nick]&&presence_monitor.participants[nick].jid){if(message_receiver.ignored_users.indexOf(presence_monitor.participants[nick].jid)!==-1){return true;}}
- message_receiver.add_message(message_receiver._format_message(message),tabs.get_or_create_pm_tab_for_nick(nick,true));tabs.private_message_received(nick);return true;},add_message:function(message,domele){if(!domele){domele=settings.chatlist}
- var chat=domele.get(0);var at_bottom=chat.scrollTop>=chat.scrollHeight-
- chat.clientHeight;domele.append(message);domele.find('div:last').find('a[rel*=facebox]').facebox();domele.find('div:last span.username').not('span[data-nick="'+settings.muc_nickname+'"]').jscontext({html:get_contextual_menu_html,bind:'anyclick'});if(at_bottom){chat.scrollTop=chat.scrollHeight;}
- while(domele.find('div.text').length>200){domele.find('div.text:first').empty().remove();}},_format_message:function(message){var $message=$(message);var from=$message.attr('from');var chat_font=$message.attr('chat_font');var font_color=$message.attr('font_color');var is_mod=$message.attr('is_mod');var has_tokens=$message.attr('has_tokens');var room=Strophe.getBareJidFromJid(from);var nick=Strophe.getResourceFromJid(from);var body=$message.children('body').text();if(!body){body=$message.text();}
- if(room==settings.room){body=message_receiver._add_emoticons(body);var r=$('<div class="text"><span class="username messagelabel" '+'data-nick="'+nick+'">'+nick+':</span><p>'+body+'</p></div>');if(chat_font!=='default'){r.css('font-family',chat_font);}
- r.css('color',font_color);if(presence_monitor.participants[nick]){if(presence_monitor.participants[nick].jid===settings.roomowner){r.find('.messagelabel').addClass('hostmessagelabel');}else if(is_mod=='1'){r.find('.messagelabel').addClass('moderatormessagelabel');}else if(has_tokens=='1'){r.find('.messagelabel').addClass('hastokensmessagelabel');}}
- return r;}},_add_emoticons:function(in_body){var body=$("<div/>").text(in_body).html();while(true){var match=body.match(/%%%\[emoticon ([^\s]+)\]%%%/);if(!match){break;}
- var urlparts=match[1].split(/\|/);var str="";var show_icon=tabs._should_show_emoticon();if(!show_icon){str=":"+urlparts[0];}
- else{var str="<img src='"+urlparts[1]+"' title=':"+urlparts[0]+"' height='"+urlparts[3]+"' width='"+urlparts[2]+"'>";}
- if(urlparts.length==5){str="<a href='"+urlparts[4]+"' rel='facebox'>"+str+"</a>";}
- else if(!show_icon){str="<a href='"+urlparts[1]+"' rel='facebox'>"+str+"</a>";}
- body=body.replace(match[0],str);}
- return body;}};conn.addHandler(message_receiver.on_message,null,"message","groupchat");conn.addHandler(message_receiver.on_private_message,null,"message","chat");var moderators=new Array();var message_sender={message_to_send:'',confirmed_send:false,_recent_message_log:new Array(),on_form_submit:function(){if(settings.textinput.val()==""){message_sender._reset_form();return false;}
- if(settings.first_post_warning!==null){if(!message_sender.confirmed_send){if(!confirm(settings.first_post_warning)){return false;}
- message_sender.confirmed_send=true;}}
- if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role!='moderator'){if(message_sender.message_to_send==settings.textinput.val()){add_system_message(gettext("duplicate message not sent"),tabs.get_current_tab_domele());message_sender._reset_form();return false;}
- if(message_sender._get_recent_message_log_count()>=3&&tipping.current_balance===0){add_system_message(gettext("message not sent -- try slowing down"),tabs.get_current_tab_domele());return false;}}}
- if(!initializer.joined){add_system_message('not connected');return false;}
- if(settings.password==='anonymous'){if(settings.login_required_callback){settings.login_required_callback();}else{add_system_message(gettext("anonymous users cannot chat - create your free account"),tabs.get_current_tab_domele());}
- return false;}
- message_sender.message_to_send=settings.textinput.val();message_sender._reset_form();message_sender._translate_and_send();message_sender._recent_message_log.push(new Date());return false;},_get_recent_message_log_count:function(){message_sender._remove_old_messages_from_log();return message_sender._recent_message_log.length;},_remove_old_messages_from_log:function(){var now=new Date();message_sender._recent_message_log=$.grep(message_sender._recent_message_log,function(a){return((now-a)<(10*1000));});},_translate_and_send:function(){if(settings.translate_message_url!==null){message_sender._reset_form();$.ajax({url:settings.translate_message_url,aync:false,data:{message:message_sender.message_to_send,room:settings.roomownernick},success:function(data,textStatus,jqXHR){if(!jqXHR.getResponseHeader('X-Successful')){alert("An error occurred");return;}
- if(jqXHR.getResponseHeader('X-Spam')){var m=$msg({to:'',from:settings.room+'/'+settings.username,type:'chat',font_color:settings.font_color,chat_font:settings.chat_font}).c('body').t(data);m=String(m);message_receiver.add_message(message_receiver._format_message(m),tabs.get_current_tab_domele());}else if(jqXHR.getResponseHeader('X-Denied')){m=String(m);message_receiver.add_message("<div class='text'>"+jqXHR.getResponseHeader('X-Denied')+"</div>",tabs.get_current_tab_domele());}else{message_sender._send(data);}}});}else{message_sender._send(message_sender.message_to_send);}},_send:function(message){var ismod='0';if(presence_monitor.participants[settings.muc_nickname]){if(presence_monitor.participants[settings.muc_nickname].role=='moderator'){ismod='1';}}
- var to;var type;if(tabs.current_tab==='pm'){to=settings.room+"/"+tabs.current_pm_nick;type='chat';}else{to=settings.room;type='groupchat';}
- var has_tokens='0';if(tipping.current_balance>0){has_tokens='1';}
- var m=$msg({to:to,type:type,font_color:settings.font_color,chat_font:settings.chat_font,is_mod:ismod,has_tokens:has_tokens}).c('body').t(message);conn.send(m);if(tabs.current_tab==='pm'){var from=settings.room+'/'+settings.muc_nickname;m=$msg({to:to,type:type,from:from,font_color:settings.font_color,chat_font:settings.chat_font,is_mod:ismod}).c('body').t(message);message_receiver.on_private_message(m.toString(),tabs.current_pm_nick);}},_reset_form:function(){settings.textinput.val('');settings.textinput.focus();}};var tipping_goal={init:function(){$("#goalform").submit(tipping_goal.on_configuration_submit);$('.cancel_goal').click(tipping_goal.on_cancel_click);$('.set_goal').click(tipping_goal.on_set_goal_clicked);$('.broadcaster_panel_goal_configuration .cancel a').click(tipping_goal.on_configuration_cancel_click);},on_set_goal_clicked:function(){groups_and_privates.change_broadcaster_panel('goal_configuration');$('#token_goal_description_input').focus();},on_configuration_cancel_click:function(){groups_and_privates.change_broadcaster_panel('default');},disable_goal:function(){settings.room_goal={};if(!settings.is_broadcasting){$(".goal_display_table").hide();}},enable_goal:function(){if(!initializer.is_on_private_room){groups_and_privates.change_broadcaster_panel('goal_display');}
- $(".goal_display_table").show();$('.goal_status_disabled').hide();$('.goal_status_active').show();$('.room_goal_amount').text(settings.room_goal.amount);$('.room_goal_current').text(settings.room_goal.current);$('.room_goal_hightipper').text(settings.room_goal.hightipper);$('.room_goal_hightipper_amount').text(settings.room_goal.hightipper_amount);$('.room_goal_lasttipper').text(settings.room_goal.lasttipper);$('.room_goal_lasttipper_amount').text(settings.room_goal.lasttipper_amount);},on_configuration_submit:function(){var description=$("#goalform input[name='description']").val();var amount=parseInt($("#goalform input[name='amount']").val());if($.trim(description)==""){alert(gettext("Invalid token goal description"));return false;}
- if(isNaN(amount)|amount<=0){alert(gettext("Invalid token goal amount"));return false;}
- $.post($('#goalform').attr('action'),$('#goalform').serialize(),function(data){if(data!='ok'){alert(data);}});return false;},on_cancel_click:function(){if(confirm(gettext("Are you sure you want to remove this goal?"))){groups_and_privates.change_broadcaster_panel('default');$('.goal_status_active').hide();$('.goal_status_disabled').show();$.post($(this).attr('href'),{'foo':'bar'});conn.send($msg({to:settings.room,type:'groupchat'}).c('subject').t(settings.default_subject))}
- return false;}};tipping_goal.init();var emoticons={_emoticons_loaded:false,_popup_window:null,init:function(){settings.domroot.find(".emoticon_button").click(emoticons.on_emoticon_button_clicked);},on_emoticon_button_clicked:function(ev){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- emoticons.toggle_overlay();},on_body_clicked_while_overlay_up:function(ev){if(settings.domroot.find('.emote_popup').has(ev.target).length||settings.domroot.find('.emoticon_button').is(ev.target)){return;}
- emoticons.toggle_overlay();},on_popup_clicked:function(ev){if(!emoticons._popup_window||emoticons._popup_window.closed){emoticons._popup_window=window.open($(this).attr('href'),'_blank','status=0,toolbar=0,menubar=0,directories=0,resizable=1,'+'scrollbars=1,height=615,width=850');emoticons._popup_window.onload=function(){emoticons._popup_window.RunCallbackFunction=emoticons.on_popup_callback;};$(window).unload(emoticons.on_document_closing);}
- emoticons.toggle_overlay();emoticons._popup_window.focus();return false;},on_document_closing:function(){if(emoticons._popup_window){if(!emoticons._popup_window.closed){emoticons._popup_window.close();}}},on_popup_callback:function(){alert("popup callback");},on_emoticon_clicked:function(){emoticons.toggle_overlay();settings.textinput.val(settings.textinput.val()+" "+
- $(this).data('emoticon'));settings.textinput.focus();},toggle_overlay:function(){var ep=settings.domroot.find(".emote_popup");if(ep.is(":visible")){$("body").unbind('click',emoticons.on_body_clicked_while_overlay_up);ep.hide();}else{$("body").click(emoticons.on_body_clicked_while_overlay_up);if(emoticons._emoticons_loaded){ep.show();}else{emoticons._emoticons_loaded=true;ep.load(settings.emoticon_overlay_url,function(){ep.show();ep.find('.more a').click(emoticons.on_popup_clicked);ep.find('img.emoticon').click(emoticons.on_emoticon_clicked);});}}}};emoticons.init();var tipping={current_balance:0,init:function(){$(".tip_button").click(tipping.on_tipping_button_clicked);settings.domroot.find('.tip_popup form').submit(tipping.on_form_submit);tipping.current_balance=settings.token_balance;$(document).bind('keydown','ctrl+s',tipping.on_key_down);$(document).bind('keydown','command+s',tipping.on_key_down);},on_key_down:function(event){tipping.toggle_overlay();return false;},on_form_submit:function(){var amount=parseInt($("#id_tip_amount").val());if(isNaN(amount)|amount<1){alert(gettext("Invalid tip amount"));return false;}
- if(amount>tipping.current_balance){alert(gettext("You do not have enough tokens."));return false;}
- var msg=interpolate(gettext("Send %(tokens)s tokens to %(username)s?"),{username:settings.roomownernick,tokens:$("#id_tip_amount").val()},true);if(!confirm(msg)){return false;}
- var $form=$(this);$.ajax({url:$(this).attr('action'),dataType:'json',data:$(this).serialize(),type:'POST',success:function(response){if(response.error){alert(response.error);}else if(response.success){$form.find("textarea").val("");tipping.toggle_overlay();tipping.current_balance=parseInt(response.token_balance);$('.tokencount').html(response.token_balance);}}});return false;},on_tipping_button_clicked:function(ev){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- if(!(tabs.current_tab=='pm'|tabs.current_tab=='chat')){tabs._show_chat_tab();}
- tipping.toggle_overlay();},on_body_clicked_while_overlay_up:function(ev){if(settings.domroot.find('.tip_popup').has(ev.target).length||$('.tip_button').is(ev.target)){return;}
- tipping.toggle_overlay();},toggle_overlay:function(){if(!settings.allow_tipping){return;}
- if(!(typeof _gaq==='undefined')){_gaq.push(['_trackPageview','/tracking/toggle_tipping_overlay/']);}
- var ep=settings.domroot.find(".tip_popup");if(ep.is(":visible")){$("body").unbind('click',tipping.on_body_clicked_while_overlay_up);ep.hide();settings.textinput.focus();}else{$("body").click(tipping.on_body_clicked_while_overlay_up);$.ajax({url:settings.tipping_current_tokens_url,type:'GET',data:'foo=bar',dataType:'json',cache:false,success:function(response){tipping.current_balance=parseInt(response.token_balance);$('.tokencount').html(response.token_balance);ep.show();ep.find('#id_tip_amount').focus();ep.find('#id_tip_amount').select();}});}}};tipping.init();var keybinder={current_focus:null,init:function(){$(document).keydown(keybinder.handle_keydown);$(":input").live('focus',keybinder.on_focus);$(":input").live('blur',keybinder.on_blur);},handle_keydown:function(e){if(keybinder.current_focus!==null){return;}
- if((e.keyCode>=65&&e.keyCode<=90)|(e.keyCode>=48&&e.keyCode<=57)){settings.textinput.focus().val(settings.textinput.val());}},on_blur:function(){keybinder.current_focus=null;},on_focus:function(){keybinder.current_focus=this.id;}};keybinder.init();var groups_and_privates={init:function(){$('.start_group_show,.start_group_show_link').click(groups_and_privates.start_group_show_clicked);$('.start_group_show_cancel').click(groups_and_privates.cancel_group_chat_request);$('.start_private_show').click(groups_and_privates.start_private_show_clicked);$('.start_private_show_cancel').click(groups_and_privates.cancel_private_chat_request);$('.broadcaster_panel_show_requested .accept').click(groups_and_privates.approve_private_show_clicked);$('.broadcaster_panel_show_requested .decline').click(groups_and_privates.decline_private_show_clicked);$('.broadcaster_panel_private_show .decline').click(groups_and_privates.decline_private_show_clicked);$('.broadcaster_panel_group_show_requested .accept').click(groups_and_privates.approve_group_show_clicked);$('.broadcaster_panel_group_show_requested .decline').click(groups_and_privates.decline_group_show_clicked);$('.broadcaster_panel_group_show .decline').click(groups_and_privates.decline_group_show_clicked);$('.return_from_away_mode').live('click',groups_and_privates.return_from_away_mode_clicked);},approve_private_show_clicked:function(){$.post(settings.private_show_approve_url,{'foo':'bar'});},decline_private_show_clicked:function(){if(!confirm(gettext("Are you sure?"))){return}
- $.post(settings.private_show_decline_url,{'foo':'bar'});},approve_group_show_clicked:function(){$.post(settings.group_show_approve_url,{'foo':'bar'});},return_from_away_mode_clicked:function(){$.post(settings.return_from_away_url,{'foo':'bar'});},decline_group_show_clicked:function(){if(!confirm(gettext("Are you sure?"))){return}
- $.post(settings.group_show_decline_url,{'foo':'bar'});},start_group_show_clicked:function(){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- groups_and_privates.change_group_show_link('processing');$.post(settings.group_show_tokens_per_minute_url,{'foo':'bar'},function(data){var msg=interpolate(gettext("Enter group chat with %(modelname)s? (%(price)s tokens per minute)"),{modelname:settings.roomownernick,price:data},true);if(confirm(msg)){$.post(settings.group_show_request_url,{'chat_username':settings.muc_nickname},function(data){if(data.success){groups_and_privates.change_group_show_link('waiting');add_system_message("<span class='privatealert'>"+
- gettext("Group show request has been sent.")+"</span>");}else{if(data.message){alert(data.message);}
- groups_and_privates.change_group_show_link();}},'json').error(groups_and_privates.error_starting_group_show);}else{groups_and_privates.change_group_show_link();}}).error(groups_and_privates.error_starting_group_show);},on_groupshowrequest_message:function($message){var users_waiting=parseInt($message.attr('users_waiting'));var users_required=parseInt($message.attr('users_required'));if(!initializer.is_on_private_room){add_system_message("<span class='privatealert'>"+users_waiting+" of "+users_required+" users are ready to start a group show.</span>")}
- $('.num_users_waiting_for_group').html($message.attr('users_waiting'));if(settings.is_broadcasting&!initializer.is_on_private_room){if(users_waiting==users_required){$('.broadcaster_panel_group_show_requested .tokens_per_minute').html($message.attr('tokens_per_minute'));groups_and_privates.change_broadcaster_panel('group_show_requested');PlayBeep();}}},start_private_show_clicked:function(){if(settings.login_required_callback){if(settings.login_required_callback()){return false;}}
- groups_and_privates.change_private_show_link('processing');$.post(settings.private_show_tokens_per_minute_url,{'foo':'bar'},function(data){var msg=interpolate(gettext("Enter private chat with %(modelname)s? (%(price)s tokens per minute)"),{modelname:settings.roomownernick,price:data},true);if(confirm(msg)){$.post(settings.private_show_request_url,{'chat_username':settings.muc_nickname},function(data){if(data.success){groups_and_privates.change_private_show_link('waiting');add_system_message("<span class='privatealert'>"+
- gettext("Private show request has been sent. Waiting on broadcaster to approve.")+"</span>");}else{if(data.message){alert(data.message);}
- groups_and_privates.change_private_show_link();}},'json').error(groups_and_privates.error_starting_private_show);}else{groups_and_privates.change_private_show_link();}}).error(groups_and_privates.error_starting_private_show);},is_requesting_group_chat:function(){return $('.start_group_show_waiting').is(':visible')|$('.start_group_show_processing').is(':visible');},is_requesting_private_chat:function(){return $('.start_private_show_waiting').is(':visible');},on_groupshowrequest_approvemessage:function($message){add_system_message("<span class='privatealert'>"+
- gettext("Group show has started.")+"</span>");if(initializer.is_on_private_room){return;}
- $('.tokens_per_minute').html($message.attr('tokens_per_minute'));if(groups_and_privates.is_requesting_group_chat()|settings.is_broadcasting){groups_and_privates.change_group_show_link('active');groups_and_privates.change_broadcaster_panel('group_show');initializer.change_to_private_room();}},on_privateshowrequest_approvemessage:function($message){add_system_message("<span class='privatealert'>"+
- gettext("Private show has started.")+"</span>");if(initializer.is_on_private_room){return;}
- if(groups_and_privates.is_requesting_private_chat()|settings.is_broadcasting){groups_and_privates.change_private_show_link('active');groups_and_privates.change_broadcaster_panel('private_show');$('.tokens_per_minute').html($message.attr('tokens_per_minute'));initializer.change_to_private_room();}},change_broadcaster_panel:function(name){if(public_methods.is_goal_set()&&name=='default'){name='goal_display';}
- $('.broadcaster_panel_default').hide();$('.broadcaster_panel_private_show').hide();$('.broadcaster_panel_group_show').hide();$('.broadcaster_panel_show_requested').hide();$('.broadcaster_panel_group_show_requested').hide();$('.broadcaster_panel_goal_configuration').hide();$('.broadcaster_panel_goal_display').hide();$('.broadcaster_panel_away').hide();$(".broadcaster_panel_"+name).show();},on_groupshowrequest_cancelmessage:function(){$('.num_users_waiting_for_group').html('0');if(initializer.is_on_private_room){if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('away');}
- add_system_message("<span class='privatealert'>"+
- gettext("Group show has finished.")+"</span>");initializer.leave_private_room();groups_and_privates.change_group_show_link();}else{if(groups_and_privates.is_requesting_group_chat()){add_system_message("<span class='privatealert'>"+
- gettext("Group show has been declined.")+"</span>");groups_and_privates.change_group_show_link();}
- if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('default');}}},on_awaystatus_cancelmessage:function(){if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('default');}},on_privateshowrequest_cancelmessage:function(){if(initializer.is_on_private_room){add_system_message("<span class='privatealert'>"+
- gettext("Private show has finished.")+"</span>");initializer.leave_private_room();groups_and_privates.change_private_show_link();if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('away');}}else{if(groups_and_privates.is_requesting_private_chat()){add_system_message("<span class='privatealert'>"+
- gettext("Private show has been declined.")+"</span>");groups_and_privates.change_private_show_link();}
- if(settings.is_broadcasting){groups_and_privates.change_broadcaster_panel('default');}}},on_leaveprivateroom_message:function($message){if($message.attr('username')==settings.my_username){initializer.leave_private_room();groups_and_privates.change_group_show_link();}},on_privateshowrequest_message:function($message){if(settings.is_broadcasting){var username=$message.attr('requester_username');$('.broadcaster_panel_show_requested .requester_username').html(username);$('.broadcaster_panel_show_requested .tokens_per_minute').html($message.attr('tokens_per_minute'));groups_and_privates.change_broadcaster_panel('show_requested');PlayBeep();add_system_message("<span class='privatealert'>"+username+" wants to start a private show.</span>")}},error_starting_group_show:function(){alert(gettext("There was an error requesting your show. Please try again."));groups_and_privates.change_group_show_link();},error_starting_private_show:function(){alert(gettext("There was an error requesting your show. Please try again."));groups_and_privates.change_private_show_link();},cancel_group_chat_request:function(){if(confirm(gettext("Are you sure?"))){$.post(settings.group_show_cancel_url,{'foo':'bar'});groups_and_privates.change_group_show_link();}},cancel_private_chat_request:function(){if(confirm(gettext("Are you sure?"))){$.post(settings.private_show_cancel_url,{'foo':'bar'});}},change_group_show_link:function(link){$('.start_group_show').hide();$('.start_group_show_waiting').hide();$('.start_group_show_processing').hide();$('.start_group_show_active').hide();var key='.start_group_show';if(link){key=key+"_"+link;groups_and_privates.hide_private_show_controls();}else{groups_and_privates.show_private_show_controls();}
- $(key).show();},change_private_show_link:function(link){$('.start_private_show').hide();$('.start_private_show_processing').hide();$('.start_private_show_waiting').hide();$('.start_private_show_active').hide();var key='.start_private_show';if(link){key=key+"_"+link;groups_and_privates.hide_group_show_controls();}else{groups_and_privates.show_group_show_controls();}
- $(key).show();},hide_private_show_controls:function(force){$('.private_show_controls').hide();if(force){$('.private_show_controls').data('forcehidden','1');}
- groups_and_privates.show_group_show_controls();},show_private_show_controls:function(force){if(force|$('.private_show_controls').data('forcehidden')!='1'){$('.private_show_controls').show();}},hide_group_show_controls:function(force){$('.group_show_controls').hide();if(force){$('.group_show_controls').data('forcehidden','1');}},show_group_show_controls:function(force){if(force|$('.group_show_controls').data('forcehidden')!='1'){$('.group_show_controls').show();}}};groups_and_privates.init();public_methods._set_font_size();ignored_user_methods.load_ignored_users();settings.form.submit(message_sender.on_form_submit);settings.submitbutton.click(message_sender.on_form_submit);if(settings.throttlechat){if(settings.welcome_message){add_system_message(settings.welcome_message);}
- if(settings.welcome_warning){add_system_message(settings.welcome_warning);}
- add_system_message(settings.throttle_message);presence_monitor.num_participants=100;}else{consolelog("Trying to connect to "+settings.bosh_host+" with "+
- settings.user+":"+settings.password);conn.connect(settings.user,settings.password,function(status,data){if(status===Strophe.Status.CONNECTED){$(document).trigger("connected.defchat");}else if(status===Strophe.Status.CONNECTING){$(document).trigger("connecting.defchat");}else if(status===Strophe.Status.DISCONNECTED){$(document).trigger("disconnected.defchat");}else if(status===Strophe.Status.CONNFAIL){$(document).trigger("connectionfailed.defchat");}else{consolelog('Defchat Unhandled status: '+status+"-"+data);}});}
- if(settings.scroll_on_load){settings.textinput.focus();function isScrolledIntoView(elem)
- {var docViewTop=$(window).scrollTop();var docViewBottom=docViewTop+$(window).height();var elemTop=$(elem).offset().top;var elemBottom=elemTop+$(elem).height();return((elemBottom>=docViewTop)&&(elemTop<=docViewBottom));}
- if($('.top-section').length>0){if(!isScrolledIntoView($('.top-section'))){$(document).scrollTop($('.top-section').offset().top);}}}
- var returnhandle=function(method){if(public_methods[method]){return public_methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else if(typeof method==='object'||!method){return public_methods.init.apply(this,arguments);}else{$.error('Method '+method+' does not exist in defchat');}};return returnhandle;};})(jQuery);function EmbedViewerSwf(swfname,modelname,fms_address,popout_url,language,mute,pr,sa,express,uid,jg)
- {var params={allowScriptAccess:"always",allowFullScreen:"true",quality:"high",wmode:"opaque",id:"movie",FlashVars:"pid="+modelname+"&address="+fms_address+"&popouturl="+popout_url+"&language="+language+"&mute="+mute+"&pr="+pr+"&sa="+sa+"&uid="+uid+"&jg="+jg};if(!document.getElementById('movie')){return;}
- document.getElementById('movie').innerHTML="<center><br><br><br><br><a border='0' href='http://www.adobe.com/go/getflashplayer' target='_blank'>"+"<img alt='Get Adobe Flash player' src='"+MEDIA_URL+"images/160x41_Get_Flash_Player.jpg'></a><br>"+"We've detected that you are missing the latest version of Flash Player.<br>"+"This version of the Chaturbate Viewer requires Flash Player 10.2.0 or later.<br>"+"<a href='http://www.adobe.com/go/getflashplayer'>"+"Click here to update your Flash Player for free.</a></center>";swfobject.embedSWF(swfname,'movie',"100%","100%","10.2.0",null,"",params);}
- function EmbedBroadcasterSwf(swfname,modelname,fms_address,language,express,pt,captureurl,pk,pe)
- {var params={allowScriptAccess:"always",allowFullScreen:"false",quality:"high",wmode:"opaque",id:"movie",FlashVars:"pid="+modelname+"&address="+fms_address+"&language="+language+"&pt="+pt+"&captureurl="+captureurl+"&pk="+pk+"&pe="+pe};if(!document.getElementById('movie')){return;}
- document.getElementById('movie').innerHTML="<center><br><br><br><br><a border='0' href='http://www.adobe.com/go/getflashplayer' target='_blank'>"+"<img alt='Get Adobe Flash player' src='"+MEDIA_URL+"images/160x41_Get_Flash_Player.jpg'></a><br>"+"We've detected that you are missing the latest version of Flash Player.<br>"+"This version of the Chaturbate Broadcaster requires Flash Player 10.2.0 or later.<br>"+"<a href='http://www.adobe.com/go/getflashplayer'>"+"Click here to update your Flash Player for free.</a></center>";swfobject.embedSWF(swfname,'movie',"100%","100%","10.2.0",null,"",params);}
- function EmbedBroadcasterSwf_11(swfname,modelname,fms_address,language,express,pt,captureurl,pk,pe)
- {var params={allowScriptAccess:"always",allowFullScreen:"false",quality:"high",wmode:"opaque",id:"movie",FlashVars:"pid="+modelname+"&address="+fms_address+"&language="+language+"&pt="+pt+"&captureurl="+captureurl+"&pk="+pk+"&pe="+pe};if(!document.getElementById('movie')){return;}
- document.getElementById('movie').innerHTML="<center><br><br><br><br><a border='0' href='http://www.adobe.com/go/getflashplayer' target='_blank'>"+"<img alt='Get Adobe Flash player' src='"+MEDIA_URL+"images/160x41_Get_Flash_Player.jpg'></a><br>"+"We've detected that you are missing the latest version of Flash Player.<br>"+"This version of the Chaturbate Broadcaster requires Flash Player 11.0.1 or later.<br>"+"<a href='http://www.adobe.com/go/getflashplayer'>"+"Click here to update your Flash Player for free.</a></center>";swfobject.embedSWF(swfname,'movie',"100%","100%","11.0.1",null,"",params);}
- function EmbedDualBroadcasterSwf(swfname,swfname_11,modelname,fms_address,language,express,pt,captureurl,pk,pe)
- {var version=swfobject.getFlashPlayerVersion();if(version.major>=11&&version.minor>=0&&version.release>=1)
- EmbedBroadcasterSwf_11(swfname_11,modelname,fms_address,language,express,pt,captureurl,pk,pe);else
- EmbedBroadcasterSwf(swfname,modelname,fms_address,language,express,pt,captureurl,pk,pe);}
- var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();function SwfScale(width)
- {var swfwidth=parseInt(width);var swfheight=swfwidth*0.75;document.getElementById("player").style.width=swfwidth+"px";document.getElementById("player").style.height=swfheight+"px";}
- var SwfPopup=null;var PopupUpdater=null;function Popout(broadcaster,url)
- {var windowName="CBVPopup";var windowOptions="width="+(498+16)+",height="+(407+16)+",status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0";document.getElementById('player').style.display='none';SwfPopup=window.open(url,windowName,windowOptions);if(PopupUpdater==null)
- PopupUpdater=setInterval("SwfPopupUpdate()",1000);return SwfPopup;}
- function SwfPopupUpdate()
- {if(SwfPopup&&SwfPopup.closed)
- {clearInterval(PopupUpdater);PopupUpdater=null;SwfPopup=null;document.getElementById('player').style.display='block';}}
- function OnResizePopout()
- {var winW=514,winH=423;if(document.body&&document.body.offsetWidth)
- {winW=document.body.offsetWidth;winH=document.body.offsetHeight;}
- if(document.compatMode=='CSS1Compat'&&document.documentElement&&document.documentElement.offsetWidth)
- {winW=document.documentElement.offsetWidth;winH=document.documentElement.offsetHeight;}
- if(window.innerWidth&&window.innerHeight)
- {winW=window.innerWidth;winH=window.innerHeight;}
- var swfW=winW-16;var swfH=swfW*0.75;if(swfH+16>winH)
- SwfScale((winH-16)*1.33);else
- SwfScale((winW-16));}
- function GetFlashObject(movieName)
- {var isIE=navigator.appName.indexOf("Microsoft")!=-1;return(isIE)?window[movieName]:document[movieName];}
- function PlayBeep()
- {GetFlashObject('movie').PlayBeep();}
- function test_js()
- {alert('test join group link');}
- $(document).ready(function(){function on_key_down(){window.location=nextroomurl;return false;}
- $(document).bind('keydown','ctrl+x',on_key_down);$(document).bind('keydown','command+x',on_key_down);});(function($){$(document).ready(function(){$("a.endless_more").live("click",function(){var container=$(this).closest(".endless_container");var loading=container.find(".endless_loading");$(this).hide();loading.show();var data="querystring_key="+$(this).attr("rel").split(" ")[0];$.get($(this).attr("href"),data,function(data){container.before(data);container.remove();});return false;});$("a.endless_page_link").live("click",function(){var data="querystring_key="+$(this).attr("rel").split(" ")[0];$(this).closest(".endless_page_template").load($(this).attr("href"),data);return false;});});})(jQuery);$(document).ready(function(){$.fn.mColorPicker.init.replace=false;$.fn.mColorPicker.defaults.imageFolder="http://ccstatic.chaturbate.com/static/mColorPicker/images/";$.fn.mColorPicker.init.showLogo=false;$.fn.mColorPicker.init.allowTransparency=false;});(function($){var $o;$.fn.mColorPicker=function(options){$o=$.extend($.fn.mColorPicker.defaults,options);if($o.swatches.length<10)$o.swatches=$.fn.mColorPicker.defaults.swatches
- if($("div#mColorPicker").length<1)$.fn.mColorPicker.drawPicker();if($('#css_disabled_color_picker').length<1)$('head').prepend('<style id="css_disabled_color_picker" type="text/css">.mColorPicker[disabled] + span, .mColorPicker[disabled="disabled"] + span, .mColorPicker[disabled="true"] + span {filter:alpha(opacity=50);-moz-opacity:0.5;-webkit-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}</style>');$('.mColorPicker').live('keyup',function(){try{$(this).css({'background-color':$(this).val()}).css({'color':$.fn.mColorPicker.textColor($(this).css('background-color'))}).trigger('change');}catch(r){}});$('.mColorPickerTrigger').live('click',function(){$.fn.mColorPicker.colorShow($(this).attr('id').replace('icp_',''));});this.each(function(){$.fn.mColorPicker.drawPickerTriggers($(this));});return this;};$.fn.mColorPicker.currentColor=false;$.fn.mColorPicker.currentValue=false;$.fn.mColorPicker.color=false;$.fn.mColorPicker.init={replace:'[type=color]',index:0,enhancedSwatches:true,allowTransparency:true,checkRedraw:'DOMUpdated',liveEvents:false,showLogo:true};$.fn.mColorPicker.defaults={imageFolder:'images/',swatches:["#ffffff","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000","#4c2b11","#3b3b3b","#000000"]};$.fn.mColorPicker.liveEvents=function(){$.fn.mColorPicker.init.liveEvents=true;if($.fn.mColorPicker.init.checkRedraw&&$.fn.mColorPicker.init.replace){$(document).bind($.fn.mColorPicker.init.checkRedraw+'.mColorPicker',function(){$('input[data-mcolorpicker!="true"]').filter(function(){return($.fn.mColorPicker.init.replace=='[type=color]')?this.getAttribute("type")=='color':$(this).is($.fn.mColorPicker.init.replace);}).mColorPicker();});}};$.fn.mColorPicker.drawPickerTriggers=function($t){if($t[0].nodeName.toLowerCase()!='input')return false;var id=$t.attr('id')||'color_'+$.fn.mColorPicker.init.index++,hidden=false;$t.attr('id',id);if($t.attr('text')=='hidden'||$t.attr('data-text')=='hidden')hidden=true;var color=$t.val(),width=($t.width()>0)?$t.width():parseInt($t.css('width'),10),height=($t.height())?$t.height():parseInt($t.css('height'),10),flt=$t.css('float'),image=(color=='transparent')?"url('"+$o.imageFolder+"/grid.gif')":'',colorPicker='';$('body').append('<span id="color_work_area"></span>');$('span#color_work_area').append($t.clone(true));colorPicker=$('span#color_work_area').html().replace(/type="color"/gi,'').replace(/input /gi,(hidden)?'input type="hidden"':'input type="text"');$('span#color_work_area').html('').remove();$t.after((hidden)?'<span style="cursor:pointer;border:1px solid black;float:'+flt+';width:'+width+'px;height:'+height+'px;" id="icp_'+id+'"> </span>':'').after(colorPicker).remove();if(hidden){if($('#'+id).prop('class')){$('#icp_'+id).prop('class',$('#'+id).prop('class'));}
- $('#icp_'+id).css({'background-color':color,'background-image':image,'display':'inline-block'}).addClass('mColorPickerTrigger');}else{$('#'+id).css({'background-color':color,'background-image':image}).css({'color':$.fn.mColorPicker.textColor($('#'+id).css('background-color'))}).after('<span style="cursor:pointer;" id="icp_'+id+'" class="mColorPickerTrigger"><img src="'+$o.imageFolder+'color.png" style="border:0;margin:0 0 0 3px" align="absmiddle"></span>').addClass('mColorPickerInput');}
- $('#icp_'+id).attr('data-mcolorpicker','true');$('#'+id).addClass('mColorPicker');return $('#'+id);};$.fn.mColorPicker.drawPicker=function(){$(document.createElement("div")).attr("id","mColorPicker").css('display','none').html('<div id="mColorPickerWrapper"><div id="mColorPickerImg" class="mColor"></div><div id="mColorPickerImgGray" class="mColor"></div><div id="mColorPickerSwatches"><div class="mClear"></div></div><div id="mColorPickerFooter"><input type="text" size="8" id="mColorPickerInput"/></div></div>').appendTo("body");$(document.createElement("div")).attr("id","mColorPickerBg").css({'display':'none'}).appendTo("body");for(n=9;n>-1;n--){$(document.createElement("div")).attr({'id':'cell'+n,'class':"mPastColor"+((n>0)?' mNoLeftBorder':'')}).html(' ').prependTo("#mColorPickerSwatches");}
- $('#mColorPicker').css({'border':'1px solid #ccc','color':'#fff','z-index':999998,'width':'194px','height':'184px','font-size':'12px','font-family':'times'});$('.mPastColor').css({'height':'18px','width':'18px','border':'1px solid #000','float':'left'});$('#colorPreview').css({'height':'50px'});$('.mNoLeftBorder').css({'border-left':0});$('.mClear').css({'clear':'both'});$('#mColorPickerWrapper').css({'position':'relative','border':'solid 1px gray','z-index':999999});$('#mColorPickerImg').css({'height':'128px','width':'192px','border':0,'cursor':'crosshair','background-image':"url('"+$o.imageFolder+"colorpicker.png')"});$('#mColorPickerImgGray').css({'height':'8px','width':'192px','border':0,'cursor':'crosshair','background-image':"url('"+$o.imageFolder+"graybar.jpg')"});$('#mColorPickerInput').css({'border':'solid 1px gray','font-size':'10pt','margin':'3px','width':'80px'});$('#mColorPickerImgGrid').css({'border':0,'height':'20px','width':'20px','vertical-align':'text-bottom'});$('#mColorPickerSwatches').css({'border-right':'1px solid #000'});$('#mColorPickerFooter').css({'background-image':"url('"+$o.imageFolder+"grid.gif')",'position':'relative','height':'26px'});if($.fn.mColorPicker.init.allowTransparency)$('#mColorPickerFooter').prepend('<span id="mColorPickerTransparent" class="mColor" style="font-size:16px;color:#000;padding-right:30px;padding-top:3px;cursor:pointer;overflow:hidden;float:right;">transparent</span>');if($.fn.mColorPicker.init.showLogo)$('#mColorPickerFooter').prepend('<a href="http://meta100.com/" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="float:right;" target="_blank"><img src="'+$o.imageFolder+'meta100.png" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="border:0;border-left:1px solid #aaa;right:0;position:absolute;"/></a>');$("#mColorPickerBg").click($.fn.mColorPicker.closePicker);var swatch=$.fn.mColorPicker.getCookie('swatches'),i=0;if(typeof swatch=='string')swatch=swatch.split('||');if(swatch==null||$.fn.mColorPicker.init.enhancedSwatches||swatch.length<10)swatch=$o.swatches;$(".mPastColor").each(function(){$(this).css('background-color',swatch[i++].toLowerCase());});};$.fn.mColorPicker.closePicker=function(){$(".mColor, .mPastColor, #mColorPickerInput, #mColorPickerWrapper").unbind();$("#mColorPickerBg").hide();$("#mColorPicker").fadeOut()};$.fn.mColorPicker.colorShow=function(id){var $e=$("#icp_"+id);pos=$e.offset(),$i=$("#"+id);hex=$i.attr('data-hex')||$i.attr('hex'),pickerTop=pos.top+$e.outerHeight(),pickerLeft=pos.left,$d=$(document),$m=$("#mColorPicker");if($i.attr('disabled'))return false;if(pickerTop+$m.height()>$d.height())pickerTop=pos.top-$m.height();if(pickerLeft+$m.width()>$d.width())pickerLeft=pos.left-$m.width()+$e.outerWidth();$m.css({'top':(pickerTop)+"px",'left':(pickerLeft)+"px",'position':'absolute'}).fadeIn("fast");$("#mColorPickerBg").css({'z-index':999990,'background':'black','opacity':.01,'position':'absolute','top':0,'left':0,'width':parseInt($d.width(),10)+'px','height':parseInt($d.height(),10)+'px'}).show();var def=$i.val();$('#colorPreview span').text(def);$('#colorPreview').css('background',def);$('#color').val(def);if($('#'+id).attr('data-text'))$.fn.mColorPicker.currentColor=$e.css('background-color');else $.fn.mColorPicker.currentColor=$i.css('background-color');if(hex=='true')$.fn.mColorPicker.currentColor=$.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.currentColor);$("#mColorPickerInput").val($.fn.mColorPicker.currentColor);$('.mColor, .mPastColor').bind('mousemove',function(e){var offset=$(this).offset();$.fn.mColorPicker.color=$(this).css("background-color");if($(this).hasClass('mPastColor')&&hex=='true')$.fn.mColorPicker.color=$.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color);else if($(this).hasClass('mPastColor')&&hex!='true')$.fn.mColorPicker.color=$.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color);else if($(this).attr('id')=='mColorPickerTransparent')$.fn.mColorPicker.color='transparent';else if(!$(this).hasClass('mPastColor'))$.fn.mColorPicker.color=$.fn.mColorPicker.whichColor(e.pageX-offset.left,e.pageY-offset.top+(($(this).attr('id')=='mColorPickerImgGray')?128:0),hex);$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.color);}).click(function(){$.fn.mColorPicker.colorPicked(id);});$('#mColorPickerInput').bind('keyup',function(e){try{$.fn.mColorPicker.color=$('#mColorPickerInput').val();$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.color);if(e.which==13)$.fn.mColorPicker.colorPicked(id);}catch(r){}}).bind('blur',function(){$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.currentColor);});$('#mColorPickerWrapper').bind('mouseleave',function(){$.fn.mColorPicker.setInputColor(id,$.fn.mColorPicker.currentColor);});};$.fn.mColorPicker.setInputColor=function(id,color){var image=(color=='transparent')?"url('"+$o.imageFolder+"grid.gif')":'',textColor=$.fn.mColorPicker.textColor(color);if($('#'+id).attr('data-text')||$('#'+id).prop('text'))$("#icp_"+id).css({'background-color':color,'background-image':image});$("#"+id).val(color).css({'background-color':color,'background-image':image,'color':textColor}).trigger('change');$("#mColorPickerInput").val(color);};$.fn.mColorPicker.textColor=function(val){if(typeof val=='undefined'||val=='transparent')return"black";val=$.fn.mColorPicker.RGBtoHex(val);return(parseInt(val.substr(1,2),16)+parseInt(val.substr(3,2),16)+parseInt(val.substr(5,2),16)<400)?'white':'black';};$.fn.mColorPicker.setCookie=function(name,value,days){var cookie_string=name+"="+escape(value),expires=new Date();expires.setDate(expires.getDate()+days);cookie_string+="; expires="+expires.toGMTString();document.cookie=cookie_string;};$.fn.mColorPicker.getCookie=function(name){var results=document.cookie.match('(^|;) ?'+name+'=([^;]*)(;|$)');if(results)return(unescape(results[2]));else return null;};$.fn.mColorPicker.colorPicked=function(id){$.fn.mColorPicker.closePicker();if($.fn.mColorPicker.init.enhancedSwatches)$.fn.mColorPicker.addToSwatch();$("#"+id).trigger('colorpicked',[id,$('#mColorPickerInput').val()]);};$.fn.mColorPicker.addToSwatch=function(color){var swatch=[]
- i=0;if(typeof color=='string')$.fn.mColorPicker.color=color.toLowerCase();$.fn.mColorPicker.currentValue=$.fn.mColorPicker.currentColor=$.fn.mColorPicker.color;if($.fn.mColorPicker.color!='transparent')swatch[0]=$.fn.mColorPicker.color.toLowerCase();$('.mPastColor').each(function(){$.fn.mColorPicker.color=$(this).css('background-color').toLowerCase();if($.fn.mColorPicker.color!=swatch[0]&&$.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color)!=swatch[0]&&$.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color)!=swatch[0]&&swatch.length<10)swatch[swatch.length]=$.fn.mColorPicker.color;$(this).css('background-color',swatch[i++])});if($.fn.mColorPicker.init.enhancedSwatches)$.fn.mColorPicker.setCookie('swatches',swatch.join('||'),365);};$.fn.mColorPicker.whichColor=function(x,y,hex){var colorR=colorG=colorB=255;if(x<32){colorG=x*8;colorB=0;}else if(x<64){colorR=256-(x-32)*8;colorB=0;}else if(x<96){colorR=0;colorB=(x-64)*8;}else if(x<128){colorR=0;colorG=256-(x-96)*8;}else if(x<160){colorR=(x-128)*8;colorG=0;}else{colorG=0;colorB=256-(x-160)*8;}
- if(y<64){colorR+=(256-colorR)*(64-y)/64;colorG+=(256-colorG)*(64-y)/64;colorB+=(256-colorB)*(64-y)/64;}else if(y<=128){colorR-=colorR*(y-64)/64;colorG-=colorG*(y-64)/64;colorB-=colorB*(y-64)/64;}else if(y>128){colorR=colorG=colorB=256-(x/192*256);}
- colorR=Math.round(Math.min(colorR,255));colorG=Math.round(Math.min(colorG,255));colorB=Math.round(Math.min(colorB,255));if(hex=='true'){colorR=colorR.toString(16);colorG=colorG.toString(16);colorB=colorB.toString(16);if(colorR.length<2)colorR=0+colorR;if(colorG.length<2)colorG=0+colorG;if(colorB.length<2)colorB=0+colorB;return"#"+colorR+colorG+colorB;}
- return"rgb("+colorR+', '+colorG+', '+colorB+')';};$.fn.mColorPicker.RGBtoHex=function(color){color=color.toLowerCase();if(typeof color=='undefined')return'';if(color.indexOf('#')>-1&&color.length>6)return color;if(color.indexOf('rgb')<0)return color;if(color.indexOf('#')>-1){return'#'+color.substr(1,1)+color.substr(1,1)+color.substr(2,1)+color.substr(2,1)+color.substr(3,1)+color.substr(3,1);}
- var hexArray=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],decToHex="#",code1=0;color=color.replace(/[^0-9,]/g,'').split(",");for(var n=0;n<color.length;n++){code1=Math.floor(color[n]/16);decToHex+=hexArray[code1]+hexArray[color[n]-code1*16];}
- return decToHex;};$.fn.mColorPicker.hexToRGB=function(color){color=color.toLowerCase();if(typeof color=='undefined')return'';if(color.indexOf('rgb')>-1)return color;if(color.indexOf('#')<0)return color;var c=color.replace('#','');if(c.length<6)c=c.substr(0,1)+c.substr(0,1)+c.substr(1,1)+c.substr(1,1)+c.substr(2,1)+c.substr(2,1);return'rgb('+parseInt(c.substr(0,2),16)+', '+parseInt(c.substr(2,2),16)+', '+parseInt(c.substr(4,2),16)+')';};$(document).ready(function(){if($.fn.mColorPicker.init.replace){$('input[data-mcolorpicker!="true"]').filter(function(){return($.fn.mColorPicker.init.replace=='[type=color]')?this.getAttribute("type")=='color':$(this).is($.fn.mColorPicker.init.replace);}).mColorPicker();$.fn.mColorPicker.liveEvents();}});})(jQuery);$(document).ready(function(){var tabs={photos_url:$('.info-user a[data-tab="photos"]').attr('href'),settings_url:$('.info-user a[data-tab="settings"]').attr('href'),settings_button:$('.info-user a[data-tab="settings"]'),contest_url:$('.info-user a[data-tab="contest"]').attr('href'),tab_handles:{photos:null,settings:null,contest:null,token_stats:$(".info-user div.token_stats"),share_and_earn:$(".info-user div.share_and_earn"),leaderboard:$(".info-user div.leaderboard"),bio:$(".info-user div.bio")},init:function(){$(".info-user .buttons li a").click(tabs.on_tab_button_click);$(".private_settings .value").click(tabs.on_private_settings_clicked);$(".group_show_disabled a").click(tabs.on_groupshow_settings_clicked);},on_groupshow_settings_clicked:function(){tabs._disable_tabs();tabs.settings_button.parent().addClass('active');tabs._show_settings_tab(function(){$('#id_allow_group_shows').focus();});return false;},on_private_settings_clicked:function(){tabs._disable_tabs();tabs.settings_button.parent().addClass('active');tabs._show_settings_tab(function(){$('#id_allow_private_shows').focus();});return false;},on_tab_button_click:function(event){tabs._disable_tabs();$(this).parent().addClass('active');if($(this).data('tab')=='bio'){tabs.tab_handles.bio.show();}else if($(this).data('tab')=='photos'){tabs.refresh_photos();}else if($(this).data('tab')=='settings'){tabs.refresh_settings();}else if($(this).data('tab')=='contest'){tabs.refresh_contest();}else if($(this).data('tab')=='token_stats'){tabs._show_token_stats();}else if($(this).data('tab')=='share_and_earn'){tabs._show_share_and_earn();}else if($(this).data('tab')=='leaderboard'){tabs._show_leaderboard();}
- return false;},refresh_photos:function(){if(tabs.tab_handles.photos){tabs.tab_handles.photos.remove();tabs.tab_handles.photos=null;}
- tabs._show_photos_tab();},refresh_contest:function(){if(tabs.tab_handles.contest){tabs.tab_handles.contest.remove();tabs.tab_handles.contest=null;}
- tabs._show_contest_tab();},refresh_settings:function(callback){if(tabs.tab_handles.settings){tabs.tab_handles.settings.remove();tabs.tab_handles.settings=null;}
- tabs._show_settings_tab(callback);},_show_leaderboard:function(){tabs._load_tab(tabs.tab_handles.leaderboard,$(".info-user .buttons a[data-tab='leaderboard']").attr('href'));},_show_token_stats:function(){tabs._load_tab(tabs.tab_handles.token_stats,$(".info-user .buttons a[data-tab='token_stats']").attr('href'),function(){tabs.tab_handles.token_stats.find('.refreshstats').click(tabs._show_token_stats);tabs.tab_handles.token_stats.find('form').submit(tabs._on_token_transfer);tabs.tab_handles.token_stats.find('.account_activity').scroll(tabs._on_token_stats_scroll);});},_on_token_stats_scroll:function(){var $this=$(this);if($this.scrollTop()+300>=this.scrollHeight-$this.height()){$this.find("a.endless_more").click();}},_on_token_transfer:function(){var num_tokens=parseInt($(this).find("#id_transfer_amount").val());var token_balance=parseInt(tabs.tab_handles.token_stats.find('.token_balance').text());var cash_amount=num_tokens*0.05;if(isNaN(num_tokens)|num_tokens<1){alert("Invalid token amount.");return false;}
- if(num_tokens>token_balance){alert("Insufficient tokens.");return false;}
- var msg=interpolate(gettext("Convert %(num_tokens)s to \$%(cash_amount)s"),{num_tokens:num_tokens,cash_amount:cash_amount},true);return confirm(msg);},_show_share_and_earn:function(){tabs._load_tab(tabs.tab_handles.share_and_earn,$(".info-user .buttons a[data-tab='share_and_earn']").attr('href'));},_load_tab:function(tab,target,func){tab.show();tab.html(gettext("loading . . ."));if(func){tab.load(target,func);}else{tab.load(target);}},_show_photos_tab:function(){if(tabs.tab_handles.photos===null){var html="<div class='bottompanel fixedheightbottompanel photopages'>"+gettext("loading . . .")+"</div>";tabs.tab_handles.photos=$(html);tabs.tab_handles.bio.after(tabs.tab_handles.photos);tabs.tab_handles.photos.load(tabs.photos_url,function(){tabs.tab_handles.photos.scroll(tabs._on_photos_scroll);tabs.tab_handles.photos.find('.refreshphotos').click(tabs.refresh_photos);});}else{tabs.tab_handles.photos.show();}},_show_settings_tab:function(callback){if(tabs.tab_handles.settings===null){var html="<div class='bottompanel accountsettings'>"+gettext("loading . . .")+"</div>";tabs.tab_handles.settings=$(html);tabs.tab_handles.bio.after(tabs.tab_handles.settings);tabs.tab_handles.settings.load(tabs.settings_url,function(){tabs._init_settings_form();if(callback){callback();}});}else{tabs.tab_handles.settings.show();if(callback){callback();}}},_init_settings_form:function(){tabs.tab_handles.settings.find('a').attr('target','_blank');tabs.tab_handles.settings.find('form').submit(tabs._on_settings_submit);tabs.tab_handles.settings.find('#id_block_from_countries').listselect({listTitle:gettext('Able to view'),selectedTitle:gettext('Blocked countries')});tabs.tab_handles.settings.find('#id_block_from_states').listselect({listTitle:gettext('Able to view'),selectedTitle:gettext('Blocked states')});},_on_settings_submit:function(){$.ajax({type:'POST',url:$(this).attr('action'),data:$(this).serialize(),dataType:'json',cache:false,success:function(data){tabs.tab_handles.settings.html(data.html);tabs._init_settings_form();if(data.result=='success'){alert(gettext("Settings saved"));}
- return false;}});return false;},_show_contest_tab:function(){if(tabs.tab_handles.contest===null){var html="<div class='bottompanel conteststats'>"+gettext("loading . . .")+"</div>";tabs.tab_handles.contest=$(html);tabs.tab_handles.bio.after(tabs.tab_handles.contest);tabs.tab_handles.contest.load(tabs.contest_url,function(){tabs.tab_handles.contest.find('.refreshstats').click(tabs.refresh_contest);});}else{tabs.tab_handles.contest.show();}},_on_photos_scroll:function(){var $this=$(this);if($this.scrollTop()+500>=this.scrollHeight-$this.height()){$this.find("a.endless_more").click();}},_disable_tabs:function(){$(".info-user .buttons li.active").removeClass('active');$(".info-user > div").hide();$(".info-user .headline").show();}};tabs.init();var bio={bio_div:$(document).find('div.bio'),init:function(){$('a.editbio').live('click',bio.on_edit_click);},on_edit_click:function(){bio.bio_div.load($(this).attr('href'),bio._init_form);return false;},on_form_submit:function(){var next=$(this).find('input[name="next"]').val();$.ajax({type:'POST',url:$(this).attr('action'),data:$(this).serialize(),dataType:'json',cache:false,success:function(data){if(data.result=='success'){bio.bio_div.load(next);}else{bio.bio_div.html(data.html);bio._init_form();}
- return false;}});return false;},_init_form:function(){bio.bio_div.find('textarea').attr('rows','1');bio.bio_div.find('textarea').elastic();bio.bio_div.find('form').submit(bio.on_form_submit);bio.bio_div.find('.canceleditbio').click(bio._on_cancel_edit_click);},_on_cancel_edit_click:function(){bio.bio_div.load($(this).attr('href'));return false;}};bio.init();var follow={on_follow_click:function(){var link=$(this);if(login_required()){return false;}
- $.ajax({url:link.data('followurl'),cache:false,success:function(){link.parent().removeClass('button_follow');link.parent().addClass('button_unfollow');link.html(link.data('unfollowtext'));}});return false;},on_unfollow_click:function(){var link=$(this);$.ajax({url:link.data('unfollowurl'),cache:false,success:function(){link.parent().removeClass('button_unfollow');link.parent().addClass('button_follow');link.html(link.data('followtext'));}});return false;}};$(".button_follow a").live('click',follow.on_follow_click);$(".button_unfollow a").live('click',follow.on_unfollow_click);var report={_div_overlay:$("#report_popup"),on_cancel:function(){report._clear_and_close();return false;},on_submit:function(){var $this=$(this);if($this.find('select[name="category"]').val()===""){alert(gettext("Please choose a category."));return false;}
- $.ajax({type:'POST',url:$this.attr('action'),data:$this.serialize(),dataType:'json',cache:false,success:function(data){if(data['result']==='success'){report._clear_and_close();alert(gettext("Your abuse report has been submitted."));}else{alert("An error occurred.");}}});return false;},overlay_toggle:function(){if(login_required()){return false;}
- report._div_overlay.toggle();if(report._div_overlay.is(":visible")){report._div_overlay.find('textarea').focus();report._div_overlay.find('textarea').select();}},init:function(){$("#report_popup_link").click(report.overlay_toggle);report._div_overlay.find(".button_abuse_cancel a").click(report.on_cancel);report._div_overlay.find(".button_abuse_report a").click(function(){report._div_overlay.find("form").submit();return false;});report._div_overlay.find("form").submit(report.on_submit);$(".disputerecording").live('click',function(){var msg=gettext("Are the reports that this is a recording false?\n\nPlease only vote if you have confirmed that this cam is live.\n\nAsk something like \"hold up 2 fingers to prove you are live\" first!");if(confirm(msg)){$.ajax({type:'POST',url:$("#report_popup form").attr('action'),data:{'category':'recordingdispute'},dataType:'json',cache:false,success:function(data){if(data['result']==='success'){report._clear_and_close();alert(gettext("Your report has been submitted."));}else{alert("An error occurred.");}}});}});},_clear_and_close:function(){report._div_overlay.hide();report._div_overlay.find('textarea').val("");}};report.init();var dismisscookiename='dsmn4';$('a.dismiss_notice').click(function(){var d=new Date;d.setTime(d.getTime()+1000*60*60*24*60);$.cookie(dismisscookiename,'1',{expires:d,path:'/'});$('.dismissable_notice').hide();return false;});if($.cookie(dismisscookiename)=='1'){$('.dismissable_notice').hide();}
- $("a.deletephotolink").live('click',function(){var deletelink=$(this);if(confirm(gettext("Are you sure you want to delete?"))){$.post(deletelink.attr('href'),function(){deletelink.closest('.image_container').remove()});}
- return false;});$("a.disablephotoslink, a.enablephotoslink").live('click',function(){if(confirm(gettext("Are you sure?"))){$.post($(this).attr('href'),{'foo':'bar'},function(){tabs.refresh_photos();});}
- return false;});$('a[rel*=facebox]').live('mousedown',function(){$(this).facebox();});});
Add Comment
Please, Sign In to add comment