diff --git a/zerobin/static/js/behavior.js b/zerobin/static/js/behavior.js index c01a163..8c09563 100644 --- a/zerobin/static/js/behavior.js +++ b/zerobin/static/js/behavior.js @@ -212,7 +212,6 @@ processData: false, dataType: 'json' }).done(function(data){ - console.log(data); success(data.id); }); }, @@ -887,7 +886,7 @@ /* Send the paste by email */ $('#email-link').click(function() { zerobin.getTinyURL(window.location.toString(), function(tinyurl) { - window.open('mailto:friend@example.com?body=' + tinyurl); + document.location.href= 'mailto:friend@example.com?body=' + tinyurl; }); return false; }); diff --git a/zerobin/static/js/main.min.js b/zerobin/static/js/main.min.js index 8d779da..f0879fb 100644 --- a/zerobin/static/js/main.min.js +++ b/zerobin/static/js/main.min.js @@ -48,4 +48,4 @@ b[d[2]]=d[3]?parseInt(d[3],10):d[2].match(/^(ct|salt|iv)$/)?sjcl.codec.base64.to undefined)c[b[d]]=a[b[d]];return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.S={};sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.S,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=b.salt===undefined?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}}; /* custom */ -(function(){sjcl.random.startCollectors();$.ajaxSetup({cache:true});function a(c){var b=arguments;return function(){return c.apply(c,Array.prototype.slice.call(b,1))}}window.zerobin={version:"0.1.1",encrypt:function(f,g,d,b,e,c){setTimeout(function(){g=sjcl.codec.utf8String.toBits(g);if(d){d()}setTimeout(function(){g=sjcl.codec.base64.fromBits(g);if(b){b()}setTimeout(function(){if(e){e()}setTimeout(function(){try{g=sjcl.encrypt(f,g)}catch(h){$("input, textarea, select, button").prop("disabled",false);zerobin.progressBar("form.well .progress").container.hide();zerobin.message("error","Paste could not be encrypted. Aborting.","Error")}if(c){c(g)}},250)},250)},250)},250)},decrypt:function(f,g,d,b,e,h,c){setTimeout(function(){try{g=sjcl.decrypt(f,g);if(b){b()}setTimeout(function(){try{g=lzw.decompress(g);if(e){e()}setTimeout(function(){try{g=sjcl.codec.base64.toBits(g);if(h){h()}setTimeout(function(){try{g=sjcl.codec.utf8String.fromBits(g);if(c){c(g)}}catch(l){d(l)}},250)}catch(k){d(k)}},250)}catch(j){d(j)}},250)}catch(i){d(i)}},250)},makeKey:function(){return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8,0),0)},getFormatedDate:function(b){b=b||new Date();return((b.getMonth()+1)+"-"+b.getDate()+"-"+b.getFullYear())},getFormatedTime:function(c){c=c||new Date();var e=c.getHours(),b=c.getMinutes(),d=c.getSeconds();if(e<10){e="0"+e}if(b<10){b="0"+b}if(d<10){d="0"+d}return e+":"+b+":"+d},numOrdA:function(d,c){return(d-c)},getLocalStorageKeys:function(){var b="zerobinV0.1";var d=[];for(var c in localStorage){if(c.indexOf(b)!==-1){d.push(c)}}d.sort();d.reverse();return d},getTinyURL:function(c,b){$.ajax({url:"https://www.googleapis.com/urlshortener/v1/url",type:"POST",contentType:"application/json",data:JSON.stringify({longUrl:c}),processData:false,dataType:"json"}).done(function(d){console.log(d);b(d.id)})},support:{localStorage:(function(){var b=!!(localStorage);$("html").addClass((b?"":"no-")+"local-storage");return b})(),history:(function(){var b=!!(window.history&&history.pushState);$("html").addClass((b?"":"no-")+"history");return b})(),fileUpload:(function(){var b=window;var c=!!(b.File&&b.FileReader&&b.FileList&&b.Blob);$("html").addClass((c?"":"no-")+"file-upload");return c})()},storePaste:function(c,b){b=b||new Date();b=(b.getFullYear()+"-"+(b.getMonth()+1)+"-"+b.getDate()+" "+zerobin.getFormatedTime(b));var d=zerobin.getLocalStorageKeys();if(localStorage.length>19){void localStorage.removeItem(d[19])}localStorage.setItem("zerobinV"+zerobin.version+"#"+b,c)},getPreviousPastes:function(){var c=[],d=zerobin.getLocalStorageKeys(),b=zerobin.getFormatedDate();$.each(d,function(g,f){var j=f.replace(/^[^#]+#/,"");var e=j.match(/^(\d+)-(\d+)-(\d+)\s/);e=e[2]+"-"+e[3]+"-"+e[1];var h="the ";if(e===b){e=j.split(" ")[1];h="at "}c.push({displayDate:e,prefix:h,link:localStorage.getItem(f)})});return c},parseUrl:(function(){var b=document.createElement("div");b.innerHTML="";return function(c){b.firstChild.href=c;b.innerHTML=b.innerHTML;return b.firstChild}})(),getPasteId:function(b){var c=b?zerobin.parseUrl(b):window.location;return c.pathname.replace(/\/|paste/g,"")},getPasteKey:function(b){var c=b?zerobin.parseUrl(b):window.location;return c.hash.replace("#","").replace(/(\?|&).*$/,"")},getPasteContent:function(){var b="";$("#paste-content li").each(function(c){b=b+$(this).text().replace(/[\u00a0]+/g," ")+"\n"});return b},count:function(h,d){var g=/(\r?\n|\r)/g;var c=/(\r?\n|\r|\s+)/g;d=d||{};d.lineBreaks=d.lineBreaks||1;var f=h.length,e=f-h.replace(/[\u0100-\uFFFF]/g,"").length,b=f-h.replace(g,"").length;return f+e+Math.max(0,d.lineBreaks*(b-1))},message:function(d,e,f,b,g){$(window).scrollTop(0);if(b){$(".alert-"+d).remove()}var c=$("#alert-template").clone().attr("id",null).addClass("alert alert-"+d);$(".message",c).html(e);if(f){$(".title",c).html(f)}else{$(".title",c).remove()}c.prependTo($("#main")).show("fadeUp",g)},progressBar:function(b){var d=$(b);var c={container:d,elem:d.find(".bar")};c.set=function(f,e){c.elem.text(f).css("width",e)};return c},isCode:function(j){var c=/[A-Z]{3}[A-Z]+|\.[a-z]|[=:<>{}\[\]$_'"&]| {2}|\t/g;var f=/(:?\/\*|)|(\/\/|#)(.*?)\n/g;var h=/[-*=_+]{4,}/;var g=0;var l=0;var b=j.match(f);if(b){g+=j.match(f).length}j=j.replace(f,"");j.replace(h,"");j=j.split("\n");for(var d=0;dg){if(i>l){g*=l/i;i=l}}else{if(g>k){i*=k/g;g=k}}var j=document.createElement("canvas");j.width=i;j.height=g;f.width=i;f.height=g;var h=j.getContext("2d");h.drawImage(this,0,0,i,g);var m=j.toDataURL(c.type);$("#content").val(m).trigger("change");$("#content").hide();$(f).css("max-width","742px");$("#content").after(f)}};b.readAsDataURL(c)}else{b.onload=function(e){$("#content").val(e.target.result).trigger("change")};b.readAsText(c)}}};$(function(){$(".btn-primary").live("click",function(u){u.preventDefault();var t=$("textarea").val();if(t.trim()){var p=$("input, textarea, select, button").prop("disabled",true);var s=zerobin.progressBar("form.well .progress");s.container.show();s.set("Converting paste to bits...","25%");try{var o=$("#expiration").val();var q=zerobin.makeKey();zerobin.encrypt(q,t,a(s.set,"Encoding to base64...","45%"),a(s.set,"Compressing...","65%"),a(s.set,"Encrypting...","85%"),function(v){s.set("Sending...","95%");var x={content:v,expiration:o};var z=zerobin.count(JSON.stringify(x));var y=z>zerobin.max_size;var e=Math.round(z/1024);var w=Math.round(zerobin.max_size/1024);if(y){s.container.hide();p.prop("disabled",false);zerobin.message("error",('The encrypted file was '+e+"KB. You have reached the maximum size limit of "+w+"KB."),"Warning!",true);return}$.post("/paste/create",x).error(function(A){p.prop("disabled",false);s.container.hide();zerobin.message("error","Paste could not be saved. Please try again later.","Error")}).success(function(B){s.set("Redirecting to new paste...","100%");if(B.status==="error"){zerobin.message("error",B.message,"Error");p.prop("disabled",false);s.container.hide()}else{var A="/paste/"+B.paste+"#"+q;if(zerobin.support.localStorage){zerobin.storePaste(A)}window.location=(A)}})})}catch(r){p.prop("disabled",false);s.container.hide();zerobin.message("error","Paste could not be encrypted. Aborting.","Error")}}});var g=$("#paste-content").text().trim();var j=zerobin.getPasteKey();var i=false;if(g&&j){$.getScript("/static/js/vizhash.min.js").done(function(o,p){if(vizhash.supportCanvas){var e=vizhash.canvasHash(zerobin.getPasteId(),24,24);$('').click(function(q){q.preventDefault();if(confirm("This picture is unique to your paste so you can identify it quickly. \n\n Do you want to know more about this?")){window.open("http://is.gd/IJaMRG","_blank")}}).prependTo(".lnk-option").append(e.canvas)}});var m=$("input, textarea, select, button").prop("disabled",true);var h=zerobin.progressBar(".well form .progress");h.container.show();h.set("Decrypting paste...","25%");zerobin.decrypt(j,g,function(){h.container.hide();zerobin.message("error","Could not decrypt data (Wrong key ?)","Error")},a(h.set,"Decompressing...","45%"),a(h.set,"Base64 decoding...","65%"),a(h.set,"From bits to string...","85%"),function(p){$("#paste-content").text(p);if(p.indexOf("data:image")==0){$("#paste-content").hide();var e=$("");$(e).attr("src",p);$(e).css("max-width","742px");$("#paste-content").after(e);$(".btn-clone").hide();var o=$("").attr("href",p);$(o).attr("download","0bin_"+document.location.pathname.split("/").pop());$(o).addClass("btn");$(o).html(' Download');$(".btn-clone").after(o)}h.set("Code coloration...","95%");setTimeout(function(){ZeroClipboard.setMoviePath("/static/js/ZeroClipboard.swf");var r=new ZeroClipboard.Client();var q=function(){r.reposition()};r.addEventListener("mouseup",function(){$("#clip-button").text("Copying paste...");r.setText(zerobin.getPasteContent())});r.addEventListener("complete",function(){$("#clip-button").text("Copy to clipboard");zerobin.message("info","The paste is now in your clipboard","",true,q)});r.glue("clip-button");window.onresize=q;$("#short-url").click(function(s){s.preventDefault();$("#short-url").text("Loading short url...");zerobin.getTinyURL(window.location.toString(),function(t){r.setText(t);$("#copy-success").hide();zerobin.message("success",''+t+"","Short url",true,q);$("#short-url").text("Get short url")})});$(".close").die().live("click",function(s){s.preventDefault();$(this).parent().fadeOut(q)});if(zerobin.isCode(p)>100){$("#paste-content").addClass("linenums");prettyPrint()}else{if(p.indexOf("data:image")!=0){zerobin.message("info","The paste did not seem to be code, so it was not colorized. Force coloration","",false,q)}}$("#paste-content").addClass("done");h.set("Done","100%");h.container.hide();m.prop("disabled",false);p=""},250)})}$(".paste-option select").live("change",function(){$(".paste-option select").val($(this).val())});$("#content").elastic();$("#content").live("keyup change",function(){if($("#content").height()<400){$(".paste-option.down").remove()}else{if($(".paste-option").length===1){$(".paste-option").clone().addClass("down").appendTo("form.well")}}});if(zerobin.support.localStorage){var l=$(".previous-pastes"),n=zerobin.getPreviousPastes();if(n.length){$.getScript("/static/js/vizhash.min.js").done(function(e,o){l.find(".item").remove();$.each(zerobin.getPreviousPastes(),function(r,t){var u=$('
  • ').appendTo(l);var q=$("").attr("href",t.link).text(t.prefix+t.displayDate).appendTo(u);if(vizhash.supportCanvas){var s=zerobin.getPasteId(t.link);var p=vizhash.canvasHash(s,24,24).canvas;q.prepend($(p).addClass("vhash"))}if(t.link.replace(/#[^#]+/,"")===window.location.pathname){u.addClass("active");q.click(function(){window.location=q.attr("href");window.location.reload()})}})})}}$(".btn-clone").click(function(o){o.preventDefault();$(".submit-form").show();$(".paste-form").hide();$("#content").val(zerobin.getPasteContent()).trigger("change")});$(".clone .btn-danger").click(function(o){o.preventDefault();$(".submit-form").hide();$(".paste-form").show()});if(zerobin.support.fileUpload){var d=$("#file-upload");var b=$(".btn-upload");try{b.val("Uploading...");b.prop("disabled",true);d.change(function(){zerobin.upload(this.files)})}catch(f){zerobin.message("error","Could no upload the file","Error");b.val("Upload File");b.prop("disabled",false)}b.prop("disabled",false);b.val("Upload File");d.mouseover(a($(this).css,"cursor","pointer"));$("#content").bind("drop",zerobin.handleDrop);$("#content").bind("dragover",zerobin.handleDragOver);$("#content").bind("dragleave",zerobin.handleDragLeave)}$(".close").live("click",function(o){o.preventDefault();$(this).parent().fadeOut()});$(".email-link").each(function(p,q){var s=$(this);var e=s.attr("title").replace("__AT__","@");var r=s.text().replace("__AT__","@");var o=$(''+r+"");s.replaceWith(o)});$("#wrap-content").each(function(e,o){$(o).show()});if(zerobin.support.history&&zerobin.paste_not_found){var c=zerobin.getPasteId();var k=zerobin.getLocalStorageKeys();$.each(k,function(o,e){if(localStorage[e].indexOf(c)!==-1){localStorage.removeItem(e);return false}})}$("#force-coloration").live("click",function(o){o.preventDefault();$("#paste-content").addClass("linenums");$(this).die(o).text("Applying coloration");prettyPrint();$(this).remove()});$("#email-link").click(function(){zerobin.getTinyURL(window.location.toString(),function(e){window.open("mailto:friend@example.com?body="+e)});return false})})})(); \ No newline at end of file +(function(){sjcl.random.startCollectors();$.ajaxSetup({cache:true});function a(c){var b=arguments;return function(){return c.apply(c,Array.prototype.slice.call(b,1))}}window.zerobin={version:"0.1.1",encrypt:function(f,g,d,b,e,c){setTimeout(function(){g=sjcl.codec.utf8String.toBits(g);if(d){d()}setTimeout(function(){g=sjcl.codec.base64.fromBits(g);if(b){b()}setTimeout(function(){if(e){e()}setTimeout(function(){try{g=sjcl.encrypt(f,g)}catch(h){$("input, textarea, select, button").prop("disabled",false);zerobin.progressBar("form.well .progress").container.hide();zerobin.message("error","Paste could not be encrypted. Aborting.","Error")}if(c){c(g)}},250)},250)},250)},250)},decrypt:function(f,g,d,b,e,h,c){setTimeout(function(){try{g=sjcl.decrypt(f,g);if(b){b()}setTimeout(function(){try{g=lzw.decompress(g);if(e){e()}setTimeout(function(){try{g=sjcl.codec.base64.toBits(g);if(h){h()}setTimeout(function(){try{g=sjcl.codec.utf8String.fromBits(g);if(c){c(g)}}catch(l){d(l)}},250)}catch(k){d(k)}},250)}catch(j){d(j)}},250)}catch(i){d(i)}},250)},makeKey:function(){return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8,0),0)},getFormatedDate:function(b){b=b||new Date();return((b.getMonth()+1)+"-"+b.getDate()+"-"+b.getFullYear())},getFormatedTime:function(c){c=c||new Date();var e=c.getHours(),b=c.getMinutes(),d=c.getSeconds();if(e<10){e="0"+e}if(b<10){b="0"+b}if(d<10){d="0"+d}return e+":"+b+":"+d},numOrdA:function(d,c){return(d-c)},getLocalStorageKeys:function(){var b="zerobinV0.1";var d=[];for(var c in localStorage){if(c.indexOf(b)!==-1){d.push(c)}}d.sort();d.reverse();return d},getTinyURL:function(c,b){$.ajax({url:"https://www.googleapis.com/urlshortener/v1/url",type:"POST",contentType:"application/json",data:JSON.stringify({longUrl:c}),processData:false,dataType:"json"}).done(function(d){b(d.id)})},support:{localStorage:(function(){var b=!!(localStorage);$("html").addClass((b?"":"no-")+"local-storage");return b})(),history:(function(){var b=!!(window.history&&history.pushState);$("html").addClass((b?"":"no-")+"history");return b})(),fileUpload:(function(){var b=window;var c=!!(b.File&&b.FileReader&&b.FileList&&b.Blob);$("html").addClass((c?"":"no-")+"file-upload");return c})()},storePaste:function(c,b){b=b||new Date();b=(b.getFullYear()+"-"+(b.getMonth()+1)+"-"+b.getDate()+" "+zerobin.getFormatedTime(b));var d=zerobin.getLocalStorageKeys();if(localStorage.length>19){void localStorage.removeItem(d[19])}localStorage.setItem("zerobinV"+zerobin.version+"#"+b,c)},getPreviousPastes:function(){var c=[],d=zerobin.getLocalStorageKeys(),b=zerobin.getFormatedDate();$.each(d,function(g,f){var j=f.replace(/^[^#]+#/,"");var e=j.match(/^(\d+)-(\d+)-(\d+)\s/);e=e[2]+"-"+e[3]+"-"+e[1];var h="the ";if(e===b){e=j.split(" ")[1];h="at "}c.push({displayDate:e,prefix:h,link:localStorage.getItem(f)})});return c},parseUrl:(function(){var b=document.createElement("div");b.innerHTML="";return function(c){b.firstChild.href=c;b.innerHTML=b.innerHTML;return b.firstChild}})(),getPasteId:function(b){var c=b?zerobin.parseUrl(b):window.location;return c.pathname.replace(/\/|paste/g,"")},getPasteKey:function(b){var c=b?zerobin.parseUrl(b):window.location;return c.hash.replace("#","").replace(/(\?|&).*$/,"")},getPasteContent:function(){var b="";$("#paste-content li").each(function(c){b=b+$(this).text().replace(/[\u00a0]+/g," ")+"\n"});return b},count:function(h,d){var g=/(\r?\n|\r)/g;var c=/(\r?\n|\r|\s+)/g;d=d||{};d.lineBreaks=d.lineBreaks||1;var f=h.length,e=f-h.replace(/[\u0100-\uFFFF]/g,"").length,b=f-h.replace(g,"").length;return f+e+Math.max(0,d.lineBreaks*(b-1))},message:function(d,e,f,b,g){$(window).scrollTop(0);if(b){$(".alert-"+d).remove()}var c=$("#alert-template").clone().attr("id",null).addClass("alert alert-"+d);$(".message",c).html(e);if(f){$(".title",c).html(f)}else{$(".title",c).remove()}c.prependTo($("#main")).show("fadeUp",g)},progressBar:function(b){var d=$(b);var c={container:d,elem:d.find(".bar")};c.set=function(f,e){c.elem.text(f).css("width",e)};return c},isCode:function(j){var c=/[A-Z]{3}[A-Z]+|\.[a-z]|[=:<>{}\[\]$_'"&]| {2}|\t/g;var f=/(:?\/\*|)|(\/\/|#)(.*?)\n/g;var h=/[-*=_+]{4,}/;var g=0;var l=0;var b=j.match(f);if(b){g+=j.match(f).length}j=j.replace(f,"");j.replace(h,"");j=j.split("\n");for(var d=0;dg){if(i>l){g*=l/i;i=l}}else{if(g>k){i*=k/g;g=k}}var j=document.createElement("canvas");j.width=i;j.height=g;f.width=i;f.height=g;var h=j.getContext("2d");h.drawImage(this,0,0,i,g);var m=j.toDataURL(c.type);$("#content").val(m).trigger("change");$("#content").hide();$(f).css("max-width","742px");$("#content").after(f)}};b.readAsDataURL(c)}else{b.onload=function(e){$("#content").val(e.target.result).trigger("change")};b.readAsText(c)}}};$(function(){$(".btn-primary").live("click",function(u){u.preventDefault();var t=$("textarea").val();if(t.trim()){var p=$("input, textarea, select, button").prop("disabled",true);var s=zerobin.progressBar("form.well .progress");s.container.show();s.set("Converting paste to bits...","25%");try{var o=$("#expiration").val();var q=zerobin.makeKey();zerobin.encrypt(q,t,a(s.set,"Encoding to base64...","45%"),a(s.set,"Compressing...","65%"),a(s.set,"Encrypting...","85%"),function(v){s.set("Sending...","95%");var x={content:v,expiration:o};var z=zerobin.count(JSON.stringify(x));var y=z>zerobin.max_size;var e=Math.round(z/1024);var w=Math.round(zerobin.max_size/1024);if(y){s.container.hide();p.prop("disabled",false);zerobin.message("error",('The encrypted file was '+e+"KB. You have reached the maximum size limit of "+w+"KB."),"Warning!",true);return}$.post("/paste/create",x).error(function(A){p.prop("disabled",false);s.container.hide();zerobin.message("error","Paste could not be saved. Please try again later.","Error")}).success(function(B){s.set("Redirecting to new paste...","100%");if(B.status==="error"){zerobin.message("error",B.message,"Error");p.prop("disabled",false);s.container.hide()}else{var A="/paste/"+B.paste+"#"+q;if(zerobin.support.localStorage){zerobin.storePaste(A)}window.location=(A)}})})}catch(r){p.prop("disabled",false);s.container.hide();zerobin.message("error","Paste could not be encrypted. Aborting.","Error")}}});var g=$("#paste-content").text().trim();var j=zerobin.getPasteKey();var i=false;if(g&&j){$.getScript("/static/js/vizhash.min.js").done(function(o,p){if(vizhash.supportCanvas){var e=vizhash.canvasHash(zerobin.getPasteId(),24,24);$('').click(function(q){q.preventDefault();if(confirm("This picture is unique to your paste so you can identify it quickly. \n\n Do you want to know more about this?")){window.open("http://is.gd/IJaMRG","_blank")}}).prependTo(".lnk-option").append(e.canvas)}});var m=$("input, textarea, select, button").prop("disabled",true);var h=zerobin.progressBar(".well form .progress");h.container.show();h.set("Decrypting paste...","25%");zerobin.decrypt(j,g,function(){h.container.hide();zerobin.message("error","Could not decrypt data (Wrong key ?)","Error")},a(h.set,"Decompressing...","45%"),a(h.set,"Base64 decoding...","65%"),a(h.set,"From bits to string...","85%"),function(p){$("#paste-content").text(p);if(p.indexOf("data:image")==0){$("#paste-content").hide();var e=$("");$(e).attr("src",p);$(e).css("max-width","742px");$("#paste-content").after(e);$(".btn-clone").hide();var o=$("").attr("href",p);$(o).attr("download","0bin_"+document.location.pathname.split("/").pop());$(o).addClass("btn");$(o).html(' Download');$(".btn-clone").after(o)}h.set("Code coloration...","95%");setTimeout(function(){ZeroClipboard.setMoviePath("/static/js/ZeroClipboard.swf");var r=new ZeroClipboard.Client();var q=function(){r.reposition()};r.addEventListener("mouseup",function(){$("#clip-button").text("Copying paste...");r.setText(zerobin.getPasteContent())});r.addEventListener("complete",function(){$("#clip-button").text("Copy to clipboard");zerobin.message("info","The paste is now in your clipboard","",true,q)});r.glue("clip-button");window.onresize=q;$("#short-url").click(function(s){s.preventDefault();$("#short-url").text("Loading short url...");zerobin.getTinyURL(window.location.toString(),function(t){r.setText(t);$("#copy-success").hide();zerobin.message("success",''+t+"","Short url",true,q);$("#short-url").text("Get short url")})});$(".close").die().live("click",function(s){s.preventDefault();$(this).parent().fadeOut(q)});if(zerobin.isCode(p)>100){$("#paste-content").addClass("linenums");prettyPrint()}else{if(p.indexOf("data:image")!=0){zerobin.message("info","The paste did not seem to be code, so it was not colorized. Force coloration","",false,q)}}$("#paste-content").addClass("done");h.set("Done","100%");h.container.hide();m.prop("disabled",false);p=""},250)})}$(".paste-option select").live("change",function(){$(".paste-option select").val($(this).val())});$("#content").elastic();$("#content").live("keyup change",function(){if($("#content").height()<400){$(".paste-option.down").remove()}else{if($(".paste-option").length===1){$(".paste-option").clone().addClass("down").appendTo("form.well")}}});if(zerobin.support.localStorage){var l=$(".previous-pastes"),n=zerobin.getPreviousPastes();if(n.length){$.getScript("/static/js/vizhash.min.js").done(function(e,o){l.find(".item").remove();$.each(zerobin.getPreviousPastes(),function(r,t){var u=$('
  • ').appendTo(l);var q=$("").attr("href",t.link).text(t.prefix+t.displayDate).appendTo(u);if(vizhash.supportCanvas){var s=zerobin.getPasteId(t.link);var p=vizhash.canvasHash(s,24,24).canvas;q.prepend($(p).addClass("vhash"))}if(t.link.replace(/#[^#]+/,"")===window.location.pathname){u.addClass("active");q.click(function(){window.location=q.attr("href");window.location.reload()})}})})}}$(".btn-clone").click(function(o){o.preventDefault();$(".submit-form").show();$(".paste-form").hide();$("#content").val(zerobin.getPasteContent()).trigger("change")});$(".clone .btn-danger").click(function(o){o.preventDefault();$(".submit-form").hide();$(".paste-form").show()});if(zerobin.support.fileUpload){var d=$("#file-upload");var b=$(".btn-upload");try{b.val("Uploading...");b.prop("disabled",true);d.change(function(){zerobin.upload(this.files)})}catch(f){zerobin.message("error","Could no upload the file","Error");b.val("Upload File");b.prop("disabled",false)}b.prop("disabled",false);b.val("Upload File");d.mouseover(a($(this).css,"cursor","pointer"));$("#content").bind("drop",zerobin.handleDrop);$("#content").bind("dragover",zerobin.handleDragOver);$("#content").bind("dragleave",zerobin.handleDragLeave)}$(".close").live("click",function(o){o.preventDefault();$(this).parent().fadeOut()});$(".email-link").each(function(p,q){var s=$(this);var e=s.attr("title").replace("__AT__","@");var r=s.text().replace("__AT__","@");var o=$(''+r+"");s.replaceWith(o)});$("#wrap-content").each(function(e,o){$(o).show()});if(zerobin.support.history&&zerobin.paste_not_found){var c=zerobin.getPasteId();var k=zerobin.getLocalStorageKeys();$.each(k,function(o,e){if(localStorage[e].indexOf(c)!==-1){localStorage.removeItem(e);return false}})}$("#force-coloration").live("click",function(o){o.preventDefault();$("#paste-content").addClass("linenums");$(this).die(o).text("Applying coloration");prettyPrint();$(this).remove()});$("#email-link").click(function(){zerobin.getTinyURL(window.location.toString(),function(e){document.location.href="mailto:friend@example.com?body="+e});return false})})})(); \ No newline at end of file