/* * zclip :: jquery zeroclipboard v1.1.1 * http://steamdev.com/zclip * * copyright 2011, steamdev * released under the mit license. * http://www.opensource.org/licenses/mit-license.php * * date: wed jun 01, 2011 */ (function(a){a.fn.zclip=function(c){if(typeof c=="object"&&!c.length){var b=a.extend({path:"zeroclipboard.swf",copy:null,beforecopy:null,aftercopy:null,clickafter:true,sethandcursor:true,setcsseffects:true},c);return this.each(function(){var e=a(this);if(e.is(":visible")&&(typeof b.copy=="string"||a.isfunction(b.copy))){zeroclipboard.setmoviepath(b.path);var d=new zeroclipboard.client();if(a.isfunction(b.copy)){e.bind("zclip_copy",b.copy)}if(a.isfunction(b.beforecopy)){e.bind("zclip_beforecopy",b.beforecopy)}if(a.isfunction(b.aftercopy)){e.bind("zclip_aftercopy",b.aftercopy)}d.sethandcursor(b.sethandcursor);d.setcsseffects(b.setcsseffects);d.addeventlistener("mouseover",function(f){e.trigger("mouseenter")});d.addeventlistener("mouseout",function(f){e.trigger("mouseleave")});d.addeventlistener("mousedown",function(f){e.trigger("mousedown");if(!a.isfunction(b.copy)){d.settext(b.copy)}else{d.settext(e.triggerhandler("zclip_copy"))}if(a.isfunction(b.beforecopy)){e.trigger("zclip_beforecopy")}});d.addeventlistener("complete",function(f,g){if(a.isfunction(b.aftercopy)){e.trigger("zclip_aftercopy")}else{if(g.length>500){g=g.substr(0,500)+"...\n\n("+(g.length-500)+" characters not shown)"}e.removeclass("hover");}if(b.clickafter){e.trigger("click")}});d.glue(e[0],e.parent()[0]);a(window).bind("load resize",function(){d.reposition()})}})}else{if(typeof c=="string"){return this.each(function(){var f=a(this);c=c.tolowercase();var e=f.data("zclipid");var d=a("#"+e+".zclip");if(c=="remove"){d.remove();f.removeclass("active hover")}else{if(c=="hide"){d.hide();f.removeclass("active hover")}else{if(c=="show"){d.show()}}}})}}}})(jquery);var zeroclipboard={version:"1.0.7",clients:{},moviepath:"zeroclipboard.swf",nextid:1,$:function(a){if(typeof(a)=="string"){a=document.getelementbyid(a)}if(!a.addclass){a.hide=function(){this.style.display="none"};a.show=function(){this.style.display=""};a.addclass=function(b){this.removeclass(b);this.classname+=" "+b};a.removeclass=function(d){var e=this.classname.split(/\s+/);var b=-1;for(var c=0;c-1){e.splice(b,1);this.classname=e.join(" ")}return this};a.hasclass=function(b){return !!this.classname.match(new regexp("\\s*"+b+"\\s*"))}}return a},setmoviepath:function(a){this.moviepath=a},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveevent(b,c)}},register:function(b,a){this.clients[b]=a},getdomobjectposition:function(c,a){var b={left:0,top:0,width:c.width?c.width:c.offsetwidth,height:c.height?c.height:c.offsetheight};if(c&&(c!=a)){b.left+=c.offsetleft;b.top+=c.offsettop}return b},client:function(a){this.handlers={};this.id=zeroclipboard.nextid++;this.movieid="zeroclipboardmovie_"+this.id;zeroclipboard.register(this.id,this);if(a){this.glue(a)}}};zeroclipboard.client.prototype={id:0,ready:false,movie:null,cliptext:"",handcursorenabled:true,csseffects:true,handlers:null,glue:function(d,b,e){this.domelement=zeroclipboard.$(d);var f=99;if(this.domelement.style.zindex){f=parseint(this.domelement.style.zindex,10)+1}if(typeof(b)=="string"){b=zeroclipboard.$(b)}else{if(typeof(b)=="undefined"){b=document.getelementsbytagname("body")[0]}}var c=zeroclipboard.getdomobjectposition(this.domelement,b);this.div=document.createelement("div");this.div.classname="zclip";this.div.id="zclip-"+this.movieid;$(this.domelement).data("zclipid","zclip-"+this.movieid);var a=this.div.style;a.position="absolute";a.left=""+c.left+"px";a.top=""+c.top+"px";a.width=""+c.width+"px";a.height=""+c.height+"px";a.zindex=f;if(typeof(e)=="object"){for(addedstyle in e){a[addedstyle]=e[addedstyle]}}b.appendchild(this.div);this.div.innerhtml=this.gethtml(c.width,c.height)},gethtml:function(d,a){var c="";var b="id="+this.id+"&width="+d+"&height="+a;if(navigator.useragent.match(/msie/)){var e=location.href.match(/^https/i)?"https://":"http://";c+=''}else{c+=''}return c},hide:function(){if(this.div){this.div.style.left="-2000px"}},show:function(){this.reposition()},destroy:function(){if(this.domelement&&this.div){this.hide();this.div.innerhtml="";var a=document.getelementsbytagname("body")[0];try{a.removechild(this.div)}catch(b){}this.domelement=null;this.div=null}},reposition:function(c){if(c){this.domelement=zeroclipboard.$(c);if(!this.domelement){this.hide()}}if(this.domelement&&this.div){var b=zeroclipboard.getdomobjectposition(this.domelement);var a=this.div.style;a.left=""+b.left+"px";a.top=""+b.top+"px"}},settext:function(a){this.cliptext=a;if(this.ready){this.movie.settext(a)}},addeventlistener:function(a,b){a=a.tostring().tolowercase().replace(/^on/,"");if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)},sethandcursor:function(a){this.handcursorenabled=a;if(this.ready){this.movie.sethandcursor(a)}},setcsseffects:function(a){this.csseffects=!!a},receiveevent:function(d,f){d=d.tostring().tolowercase().replace(/^on/,"");switch(d){case"load":this.movie=document.getelementbyid(this.movieid);if(!this.movie){var c=this;settimeout(function(){c.receiveevent("load",null)},1);return}if(!this.ready&&navigator.useragent.match(/firefox/)&&navigator.useragent.match(/windows/)){var c=this;settimeout(function(){c.receiveevent("load",null)},100);this.ready=true;return}this.ready=true;try{this.movie.settext(this.cliptext)}catch(h){}try{this.movie.sethandcursor(this.handcursorenabled)}catch(h){}break;case"mouseover":if(this.domelement&&this.csseffects){this.domelement.addclass("hover");if(this.recoveractive){this.domelement.addclass("active")}}break;case"mouseout":if(this.domelement&&this.csseffects){this.recoveractive=false;if(this.domelement.hasclass("active")){this.domelement.removeclass("active");this.recoveractive=true}this.domelement.removeclass("hover")}break;case"mousedown":if(this.domelement&&this.csseffects){this.domelement.addclass("active")}break;case"mouseup":if(this.domelement&&this.csseffects){this.domelement.removeclass("active");this.recoveractive=false}break}if(this.handlers[d]){for(var b=0,a=this.handlers[d].length;b