Commits

Anonymous committed b40845c

regen

  • Participants
  • Parent commits 2a11480
  • Tags v2.6

Comments (0)

Files changed (2)

static/css/screen.css

 p.copyright {display:block;margin:0pt auto 0pt auto;width:855px;}
 p.copyright span.brand {float:left;width:400px;}
 p.copyright span.powered {float:right;width:auto;position:relative;}
-div.grippie {background:#E9E9E9 url(../images/resize2.gif) no-repeat scroll 50% 50%;min-height:3px;height:3px;cursor:row-resize;width:99%;}
+div.grippie {background:#E9E9E9 url(../images/resize2.gif) no-repeat scroll 50% 50%;min-height:3px;height:3px;cursor:s-resize;width:99%;}
 body {background-color:#e5f1f4;color:#000;}
 h1, h2, h3, h4, h5, h6 {color:#111;}
 a:link {color:#2e8696;}

static/js/friendpaste.js

-var Resizeable=base2.Base.extend({min_height:280,constructor:function(d){var b=this;var a=document.createElement("div");a.className="grippie";a.style.cursor="row-resize";base2.DOM.bind(a);document.querySelectorAll(d).forEach(function(e){e.parentNode.appendChild(a);a.addEventListener("mousedown",function(f){f.preventDefault();f.stopPropagation();b.handleResize(f,e);return false},false)})},handleResize:function(h,d){var a=this;var i=d;var j={x:h.screenX,y:h.screenY};var f={width:i.offsetWidth,height:i.offsetHeight};var g=function(l){l.preventDefault();var m=l.screenY-j.y;if(m){var k=f.height+m;if(k>a.min_height){i.style.height=k+"px";f.height=k;j.y=l.screenY}}return false};var b=function(k){document.removeEventListener("mousemove",g,false);this.removeEventListener("mouseup",arguments.callee,false);return false};document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",b,false)}});var Editor=base2.Base.extend({tab_spacing:true,constructor:function(b){this.el=document.querySelector(b);this.lastSelection={};this.lineHeight=16;this.tab_nb_char=4;if(base2.detect("webkit")){this.tab_nb_char+=1}if(this.tab_spacing){this.tabulation="";for(var a=0;a<this.tab_nb_char;a++){this.tabulation+=" "}}else{this.tabulation="\t"}this._tab_detected=false;if(base2.detect("MSIE")){this.el.selectionStart=this.el.selectionEnd=0}this.el.addEventListener("keydown",this.handleKey.bindAsEventListener(this),false)},handleKey:function(a){c=a.keyCode;if(c==9){a.preventDefault();this.tab_selection();a.returnValue=false;return false}else{if(c==13){if(this.do_enter()){a.preventDefault();a.returnValue=false}return false}}return true},tab_selection:function(){if(this._is_tabbing){return}this._is_tabbing=true;var d=this;if(base2.detect("MSIE")){this._getIESelection()}if(!this._tab_detected){this._detect_tab()}var i=this.el.selectionStart;var a=this.el.selectionEnd;var e=this.el.value.substring(i,a);var g=this.el.scrollTop;var h=this.el.scrollLeft;var b=i;var f=a;if(e.length==0){this.el.value=this.el.value.substr(0,i)+this.tabulation+this.el.value.substr(a);b=i+this.tabulation.length;f=b}else{i=Math.max(0,this.el.value.substr(0,i).lastIndexOf("\n")+1);endText=this.el.value.substr(a);startText=this.el.value.substr(0,i);tmp=e.split("\n");e=this.tabulation+tmp.join("\n"+this.tabulation);this.el.value=startText+e+endText;b=i;f=this.el.value.indexOf("\n",startText.length+e.length);if(f==-1){f=this.el.value.length}}this.el.selectionStart=b;this.el.selectionEnd=f;if(base2.detect("MSIE")){this._setIESelection();setTimeout(function(){d._is_tabbing=false},100);this._is_tabbing=false}else{this._is_tabbing=false}this.el.scrollTop=g;this.el.scrollLeft=h},do_enter:function(){if(base2.detect("MSIE")){this._getIESelection()}var f=this.el.scrollTop;var g=this.el.scrollLeft;var h=this.el.selectionStart;var a=this.el.selectionEnd;var e=Math.max(0,this.el.value.substring(0,h).lastIndexOf("\n")+1);var b=this.el.value.substring(e,h);if(b.match(/^[ \t]+$/mg,"")){return false}var d=b.replace(/^([ \t]*).*/gm,"$1");if(d=="\n"||d=="\r"||d.length==0){return false}if(base2.detect("MSIE")||base2.detect("opera")){d="\r\n"+d}else{d="\n"+d}this.el.value=this.el.value.substring(0,h)+d+this.el.value.substring(a);this.area_select(h+d.length,0);this.el.scrollTop=f;this.el.scrollLeft=g;return true},area_select:function(b,a){b=Math.max(0,Math.min(this.el.value.length,b));end=Math.max(b,Math.min(this.el.value.length,b+a));if(base2.detect("MSIE")){this.el.selectionStart=b;this.el.selectionEnd=end;this._setIESelection()}else{if(base2.detect("opera")){this.el.setSelectionRange(0,0)}this.el.setSelectionRange(b,end)}},_detect_tab:function(){if(this.el.value.indexOf("\t")>0){this.tabulation="\t"}else{this.tabulation="";for(var a=0;a<this.tab_nb_char;a++){this.tabulation+=" "}}this._tab_detected=true},_getIESelection:function(){this.el.focus();var a=this.el.createTextRange();var b=a.duplicate();a.moveToBookmark(document.selection.createRange().getBookmark());a.moveEnd("character",this.el.value.length);this.el.selectionStart=this.el.value.length-a.text.length;b.moveToBookmark(document.selection.createRange().getBookmark());b.moveStart("character",-this.el.value.length);this.el.selectionEnd=b.text.length;if(this.el.selectionEnd<this.el.selectionStart){this.el.selectionEnd=this.el.selectionStart}},_setIESelection:function(){var a=this.el.value.substr(0,this.el.selectionStart).split("\n").length-1;var b=this.el.value.substr(0,this.el.selectionEnd).split("\n").length-1;var d=document.selection.createRange();d.moveToElementText(this.el);d.setEndPoint("EndToStart",d);d.collapse(true);d.moveStart("character",this.el.selectionStart-a);d.moveEnd("character",this.el.selectionEnd-b-(this.el.selectionStart-a));d.select()}});var Friendpaste=base2.Base.extend({snippet:null,snippet_edit:null,constructor:function(){var a=this;var d=document.querySelector(".e");var b=document.querySelectorAll(".cancel");var e=document.querySelector(".show-history");if(d){d.addEventListener("click",this.do_edit.bindAsEventListener(this),false)}if(b){b.forEach(function(f){f.addEventListener("click",a.do_cancel.bindAsEventListener(a),false)})}if(e){e.addEventListener("click",this.do_history.bindAsEventListener(this),false)}this.snippet=document.querySelector("#snippet_view");this.snippet_edit=document.querySelector("#snippet_edit");this.revisions=document.querySelector("#revisions");this.bdelete=document.querySelector("#snippet_actions li.delete");if(this.bdelete!=null){this.block=document.querySelector("#snippet_actions li.lock");this.adelete=document.querySelector("#snippet_actions li.delete a");this.alock=document.querySelector("#snippet_actions li.lock a");this._deleteListener=function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);a.alock.removeEventListener("click",a._lockListener,false);a.block.classList.add("disabled");a.deletePaste()};this._lockListener=function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);a.adelete.removeEventListener("click",a._deleteListener,false);a.bdelete.classList.add("disabled");a.lockPaste()};this.listenPasteActions()}this.editing=false;this.show_history=false;if(!base2.detect("webkit")){new Resizeable("#paste_snippet")}new Editor("#paste_snippet");this.setSettings();document.querySelector("#change-theme").addEventListener("change",this.setTheme.bindAsEventListener(this),false);document.querySelector("#show-linenos").addEventListener("click",this.toggleLineNumber.bindAsEventListener(this),false)},listenPasteActions:function(){this.adelete.addEventListener("click",this._deleteListener,false);this.alock.addEventListener("click",this._lockListener,false)},deletePaste:function(){var b=this;var d=this.formPassword("delete","Delete paste");var a=base2.DOM.bind(this.adelete.parentNode);this.adelete.style.display="none";a.appendChild(d);a.querySelector("input.ano").addEventListener("click",function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);b.adelete.style.display="inline";b.block.classList.remove("disabled");remove(d);b.listenPasteActions()},false);return false},lockPaste:function(){var b=this;if(!this.snippet_edit){var d=this.formPassword("unlock","Unlock paste")}else{var d=this.formPassword("lock","Lock paste")}var a=base2.DOM.bind(this.alock.parentNode);a.appendChild(d);this.alock.style.display="none";a.querySelector("input.ano").addEventListener("click",function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);b.alock.style.display="inline";b.bdelete.classList.remove("disabled");remove(d);b.listenPasteActions()},false);return false},formPassword:function(a,b){url="/"+snippet_id+"/"+a;form=document.createElement("form");form.className="fsnippet_action";form.action=url;form.method="POST";h4=document.createElement("h4");h4.appendChild(document.createTextNode(b));form.appendChild(h4);p=document.createElement("p");p.appendChild(document.createTextNode("Enter code entered when you create the paste to confirm:"));form.appendChild(p);label=document.createElement("label");label.setAttribute("for","edit_code");label.appendChild(document.createTextNode("Code: "));form.appendChild(label);input=document.createElement("input");input.type="password";input.name="edit_code";input.className="password";form.appendChild(input);submit=document.createElement("input");submit.name="f"+a;submit.type="submit";submit.value=a.substring(0,1).toUpperCase()+a.substring(1,a.length);submit.className="ayes";form.appendChild(submit);cancel=document.createElement("input");cancel.type="submit";cancel.value="Cancel";cancel.className="ano";form.appendChild(cancel);return form},handleSnippetAction:function(a){},do_edit:function(a){a.preventDefault();this._edit();return false},_edit:function(){this.snippet.classList.add("hidden");this.snippet_edit.classList.remove("hidden");this.editing=true;resizeBottom()},do_cancel:function(a){a.preventDefault();this._cancel();return false},_cancel:function(){this.editing=false;if(this.snippet_edit&&!this.snippet_edit.classList.has("hidden")){this.snippet_edit.classList.add("hidden")}if(!this.revisions.classList.has("hidden")){this.revisions.classList.add("hidden")}this.snippet.classList.remove("hidden");resizeBottom()},toggleLineNumber:function(a){document.querySelector("#paste").classList.toggle("hidenos");this.saveSettings()},setSettings:function(){Ajax.request({url:"/settings",dataType:"json",contentType:"application/json",method:"GET",success:function(a){showlineos=a.settings["showlinenos"];if(typeof(showlineos)!="undefined"){document.querySelector("#show-linenos").checked=a.settings["showlinenos"];if(!a.settings["showlinenos"]){document.querySelector("#paste").classList.add("hidenos")}}if(typeof(a.settings["theme"])!="undefined"&&a.settings["theme"]){theme=a.settings["theme"]}else{theme="default"}document.querySelector("#change-theme").value=theme;document.querySelectorAll('link[rel="stylesheet"][title]').forEach(function(b){if(b.getAttribute("title")=="syntax_theme"){b.href="/static/css/"+theme+".css"}})}})},saveSettings:function(){var d=document.querySelector("#factions");var b=true;var a=document.querySelector("#show-linenos:checked");if(!a){b=false}Ajax.request({url:d.action,dataType:"json",contentType:"application/json",method:"POST",data:this.toJSON({theme:document.querySelector("#change-theme").value,showlinenos:b}),success:function(e){}})},setTheme:function(b){var a=b.target.value;document.querySelectorAll('link[rel="stylesheet"][title]').forEach(function(d){if(d.getAttribute("title")=="syntax_theme"){d.href="/static/css/"+a+".css"}});this.saveSettings()},do_history:function(b){b.preventDefault();this.show_history=true;url="/"+snippet_id+"/revisions";if(typeof(revid)!="undefined"){url=url+"?rev="+revid}var a=this;Ajax.get(url,null,function(f,d){document.querySelector(".pasteHistory").innerHTML="";var e="";f.forEach(function(h,g){e+='<tr><td><time title="GMT" datetime="'+h.updated+'">'+h.updated+'</time></td><td class="rev">rev. <a href=\'/'+h.pasteid+"?rev="+h.nb_revision+"'>"+h.nb_revision+'</a></td><td class="changeset"><a href=\'/'+h.pasteid+"/changeset?rev="+h.nb_revision+"'>Diff</a></td><td class=\"view-rev\"><a href='/"+h.pasteid+"?rev="+h.nb_revision+"'>View</a></td></tr>"});e='<table class="revisionstable">'+e+"</table>";document.querySelector(".pasteHistory").innerHTML=e;a.snippet.classList.add("hidden");a.revisions.classList.remove("hidden");localizeDates();resizeBottom()},"json");return false},toJSON:function(a){return a!==null?JSON.stringify(a):null}});var Diff=base2.Base.extend({constructor:function(){this.sourcetable=document.querySelector(".sourceTable");this.difftabular=document.querySelector(".difftabular");this.switcher=document.querySelector("#switch");this.sourcetable.classList.add("hidden");this.switcher.innerHTML='<span class="stab active">Tabular</span><span class="suni">Unified</span>';this.stab=this.switcher.querySelector(".stab");this.suni=this.switcher.querySelector(".suni");var a=this;this.stab.addEventListener("click",this.setTabular.bindAsEventListener(this),false);this.suni.addEventListener("click",this.setUnified.bindAsEventListener(this),false);this.setSettings();document.querySelector("#show-linenos").addEventListener("click",this.toggleLineNumber.bindAsEventListener(this),false)},setTabular:function(a){a.preventDefault();if(!this.sourcetable.classList.has("hidden")){this.sourcetable.classList.add("hidden")}this.difftabular.classList.remove("hidden");this.suni.classList.remove("active");this.stab.classList.add("active");resizeBottom()},setUnified:function(a){a.preventDefault();if(!this.difftabular.classList.has("hidden")){this.difftabular.classList.add("hidden")}this.sourcetable.classList.remove("hidden");this.stab.classList.remove("active");this.suni.classList.add("active");resizeBottom()},toggleLineNumber:function(a){document.querySelector("#paste").classList.toggle("hidenos");this.saveSettings()},setSettings:function(){Ajax.request({url:"/settings",dataType:"json",contentType:"application/json",method:"GET",success:function(a){document.querySelector("#show-linenos").checked=a.settings["showlinenos"];if(!a.settings["showlinenos"]){document.querySelector("#paste").classList.add("hidenos")}}})},saveSettings:function(){var d=document.querySelector("#factions");var b=true;var a=document.querySelector("#show-linenos:checked");if(!a){b=false}Ajax.request({url:d.action,dataType:"json",contentType:"application/json",method:"POST",data:this.toJSON({showlinenos:b}),success:function(e){}})}});
+var Resizeable=base2.Base.extend({min_height:280,constructor:function(d){var b=this;var a=document.createElement("div");a.className="grippie";a.style.cursor="s-resize";base2.DOM.bind(a);document.querySelectorAll(d).forEach(function(e){e.parentNode.appendChild(a);a.addEventListener("mousedown",function(f){f.preventDefault();f.stopPropagation();b.handleResize(f,e);return false},false)})},handleResize:function(h,d){var a=this;var i=d;var j={x:h.screenX,y:h.screenY};var f={width:i.offsetWidth,height:i.offsetHeight};var g=function(l){l.preventDefault();var m=l.screenY-j.y;if(m){var k=f.height+m;if(k>a.min_height){i.style.height=k+"px";f.height=k;j.y=l.screenY}}return false};var b=function(k){document.removeEventListener("mousemove",g,false);this.removeEventListener("mouseup",arguments.callee,false);return false};document.addEventListener("mousemove",g,false);document.addEventListener("mouseup",b,false)}});var Editor=base2.Base.extend({tab_spacing:true,constructor:function(b){this.el=document.querySelector(b);this.lastSelection={};this.lineHeight=16;this.tab_nb_char=4;if(base2.detect("webkit")){this.tab_nb_char+=1}if(this.tab_spacing){this.tabulation="";for(var a=0;a<this.tab_nb_char;a++){this.tabulation+=" "}}else{this.tabulation="\t"}this._tab_detected=false;if(base2.detect("MSIE")){this.el.selectionStart=this.el.selectionEnd=0}this.el.addEventListener("keydown",this.handleKey.bindAsEventListener(this),false)},handleKey:function(a){c=a.keyCode;if(c==9){a.preventDefault();this.tab_selection();a.returnValue=false;return false}else{if(c==13){if(this.do_enter()){a.preventDefault();a.returnValue=false}return false}}return true},tab_selection:function(){if(this._is_tabbing){return}this._is_tabbing=true;var d=this;if(base2.detect("MSIE")){this._getIESelection()}if(!this._tab_detected){this._detect_tab()}var i=this.el.selectionStart;var a=this.el.selectionEnd;var e=this.el.value.substring(i,a);var g=this.el.scrollTop;var h=this.el.scrollLeft;var b=i;var f=a;if(e.length==0){this.el.value=this.el.value.substr(0,i)+this.tabulation+this.el.value.substr(a);b=i+this.tabulation.length;f=b}else{i=Math.max(0,this.el.value.substr(0,i).lastIndexOf("\n")+1);endText=this.el.value.substr(a);startText=this.el.value.substr(0,i);tmp=e.split("\n");e=this.tabulation+tmp.join("\n"+this.tabulation);this.el.value=startText+e+endText;b=i;f=this.el.value.indexOf("\n",startText.length+e.length);if(f==-1){f=this.el.value.length}}this.el.selectionStart=b;this.el.selectionEnd=f;if(base2.detect("MSIE")){this._setIESelection();setTimeout(function(){d._is_tabbing=false},100);this._is_tabbing=false}else{this._is_tabbing=false}this.el.scrollTop=g;this.el.scrollLeft=h},do_enter:function(){if(base2.detect("MSIE")){this._getIESelection()}var f=this.el.scrollTop;var g=this.el.scrollLeft;var h=this.el.selectionStart;var a=this.el.selectionEnd;var e=Math.max(0,this.el.value.substring(0,h).lastIndexOf("\n")+1);var b=this.el.value.substring(e,h);if(b.match(/^[ \t]+$/mg,"")){return false}var d=b.replace(/^([ \t]*).*/gm,"$1");if(d=="\n"||d=="\r"||d.length==0){return false}if(base2.detect("MSIE")||base2.detect("opera")){d="\r\n"+d}else{d="\n"+d}this.el.value=this.el.value.substring(0,h)+d+this.el.value.substring(a);this.area_select(h+d.length,0);this.el.scrollTop=f;this.el.scrollLeft=g;return true},area_select:function(b,a){b=Math.max(0,Math.min(this.el.value.length,b));end=Math.max(b,Math.min(this.el.value.length,b+a));if(base2.detect("MSIE")){this.el.selectionStart=b;this.el.selectionEnd=end;this._setIESelection()}else{if(base2.detect("opera")){this.el.setSelectionRange(0,0)}this.el.setSelectionRange(b,end)}},_detect_tab:function(){if(this.el.value.indexOf("\t")>0){this.tabulation="\t"}else{this.tabulation="";for(var a=0;a<this.tab_nb_char;a++){this.tabulation+=" "}}this._tab_detected=true},_getIESelection:function(){this.el.focus();var a=this.el.createTextRange();var b=a.duplicate();a.moveToBookmark(document.selection.createRange().getBookmark());a.moveEnd("character",this.el.value.length);this.el.selectionStart=this.el.value.length-a.text.length;b.moveToBookmark(document.selection.createRange().getBookmark());b.moveStart("character",-this.el.value.length);this.el.selectionEnd=b.text.length;if(this.el.selectionEnd<this.el.selectionStart){this.el.selectionEnd=this.el.selectionStart}},_setIESelection:function(){var a=this.el.value.substr(0,this.el.selectionStart).split("\n").length-1;var b=this.el.value.substr(0,this.el.selectionEnd).split("\n").length-1;var d=document.selection.createRange();d.moveToElementText(this.el);d.setEndPoint("EndToStart",d);d.collapse(true);d.moveStart("character",this.el.selectionStart-a);d.moveEnd("character",this.el.selectionEnd-b-(this.el.selectionStart-a));d.select()}});var Friendpaste=base2.Base.extend({snippet:null,snippet_edit:null,constructor:function(){var a=this;var d=document.querySelector(".e");var b=document.querySelectorAll(".cancel");var e=document.querySelector(".show-history");if(d){d.addEventListener("click",this.do_edit.bindAsEventListener(this),false)}if(b){b.forEach(function(f){f.addEventListener("click",a.do_cancel.bindAsEventListener(a),false)})}if(e){e.addEventListener("click",this.do_history.bindAsEventListener(this),false)}this.snippet=document.querySelector("#snippet_view");this.snippet_edit=document.querySelector("#snippet_edit");this.revisions=document.querySelector("#revisions");this.bdelete=document.querySelector("#snippet_actions li.delete");if(this.bdelete!=null){this.block=document.querySelector("#snippet_actions li.lock");this.adelete=document.querySelector("#snippet_actions li.delete a");this.alock=document.querySelector("#snippet_actions li.lock a");this._deleteListener=function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);a.alock.removeEventListener("click",a._lockListener,false);a.block.classList.add("disabled");a.deletePaste()};this._lockListener=function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);a.adelete.removeEventListener("click",a._deleteListener,false);a.bdelete.classList.add("disabled");a.lockPaste()};this.listenPasteActions()}this.editing=false;this.show_history=false;if(!base2.detect("webkit")){new Resizeable("#paste_snippet")}new Editor("#paste_snippet");this.setSettings();document.querySelector("#change-theme").addEventListener("change",this.setTheme.bindAsEventListener(this),false);document.querySelector("#show-linenos").addEventListener("click",this.toggleLineNumber.bindAsEventListener(this),false)},listenPasteActions:function(){this.adelete.addEventListener("click",this._deleteListener,false);this.alock.addEventListener("click",this._lockListener,false)},deletePaste:function(){var b=this;var d=this.formPassword("delete","Delete paste");var a=base2.DOM.bind(this.adelete.parentNode);this.adelete.style.display="none";a.appendChild(d);a.querySelector("input.ano").addEventListener("click",function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);b.adelete.style.display="inline";b.block.classList.remove("disabled");remove(d);b.listenPasteActions()},false);return false},lockPaste:function(){var b=this;if(!this.snippet_edit){var d=this.formPassword("unlock","Unlock paste")}else{var d=this.formPassword("lock","Lock paste")}var a=base2.DOM.bind(this.alock.parentNode);a.appendChild(d);this.alock.style.display="none";a.querySelector("input.ano").addEventListener("click",function(f){f.preventDefault();this.removeEventListener("click",arguments.callee,false);b.alock.style.display="inline";b.bdelete.classList.remove("disabled");remove(d);b.listenPasteActions()},false);return false},formPassword:function(a,b){url="/"+snippet_id+"/"+a;form=document.createElement("form");form.className="fsnippet_action";form.action=url;form.method="POST";h4=document.createElement("h4");h4.appendChild(document.createTextNode(b));form.appendChild(h4);p=document.createElement("p");p.appendChild(document.createTextNode("Enter code entered when you create the paste to confirm:"));form.appendChild(p);label=document.createElement("label");label.setAttribute("for","edit_code");label.appendChild(document.createTextNode("Code: "));form.appendChild(label);input=document.createElement("input");input.type="password";input.name="edit_code";input.className="password";form.appendChild(input);submit=document.createElement("input");submit.name="f"+a;submit.type="submit";submit.value=a.substring(0,1).toUpperCase()+a.substring(1,a.length);submit.className="ayes";form.appendChild(submit);cancel=document.createElement("input");cancel.type="submit";cancel.value="Cancel";cancel.className="ano";form.appendChild(cancel);return form},handleSnippetAction:function(a){},do_edit:function(a){a.preventDefault();this._edit();return false},_edit:function(){this.snippet.classList.add("hidden");this.snippet_edit.classList.remove("hidden");this.editing=true;resizeBottom()},do_cancel:function(a){a.preventDefault();this._cancel();return false},_cancel:function(){this.editing=false;if(this.snippet_edit&&!this.snippet_edit.classList.has("hidden")){this.snippet_edit.classList.add("hidden")}if(!this.revisions.classList.has("hidden")){this.revisions.classList.add("hidden")}this.snippet.classList.remove("hidden");resizeBottom()},toggleLineNumber:function(a){document.querySelector("#paste").classList.toggle("hidenos");this.saveSettings()},setSettings:function(){Ajax.request({url:"/settings",dataType:"json",contentType:"application/json",method:"GET",success:function(a){showlineos=a.settings["showlinenos"];if(typeof(showlineos)!="undefined"){document.querySelector("#show-linenos").checked=a.settings["showlinenos"];if(!a.settings["showlinenos"]){document.querySelector("#paste").classList.add("hidenos")}}if(typeof(a.settings["theme"])!="undefined"&&a.settings["theme"]){theme=a.settings["theme"]}else{theme="default"}document.querySelector("#change-theme").value=theme;document.querySelectorAll('link[rel="stylesheet"][title]').forEach(function(b){if(b.getAttribute("title")=="syntax_theme"){b.href="/static/css/"+theme+".css"}})}})},saveSettings:function(){var d=document.querySelector("#factions");var b=true;var a=document.querySelector("#show-linenos:checked");if(!a){b=false}Ajax.request({url:d.action,dataType:"json",contentType:"application/json",method:"POST",data:this.toJSON({theme:document.querySelector("#change-theme").value,showlinenos:b}),success:function(e){}})},setTheme:function(b){var a=b.target.value;document.querySelectorAll('link[rel="stylesheet"][title]').forEach(function(d){if(d.getAttribute("title")=="syntax_theme"){d.href="/static/css/"+a+".css"}});this.saveSettings()},do_history:function(b){b.preventDefault();this.show_history=true;url="/"+snippet_id+"/revisions";if(typeof(revid)!="undefined"){url=url+"?rev="+revid}var a=this;Ajax.get(url,null,function(f,d){document.querySelector(".pasteHistory").innerHTML="";var e="";f.forEach(function(h,g){e+='<tr><td><time title="GMT" datetime="'+h.updated+'">'+h.updated+'</time></td><td class="rev">rev. <a href=\'/'+h.pasteid+"?rev="+h.nb_revision+"'>"+h.nb_revision+'</a></td><td class="changeset"><a href=\'/'+h.pasteid+"/changeset?rev="+h.nb_revision+"'>Diff</a></td><td class=\"view-rev\"><a href='/"+h.pasteid+"?rev="+h.nb_revision+"'>View</a></td></tr>"});e='<table class="revisionstable">'+e+"</table>";document.querySelector(".pasteHistory").innerHTML=e;a.snippet.classList.add("hidden");a.revisions.classList.remove("hidden");localizeDates();resizeBottom()},"json");return false},toJSON:function(a){return a!==null?JSON.stringify(a):null}});var Diff=base2.Base.extend({constructor:function(){this.sourcetable=document.querySelector(".sourceTable");this.difftabular=document.querySelector(".difftabular");this.switcher=document.querySelector("#switch");this.sourcetable.classList.add("hidden");this.switcher.innerHTML='<span class="stab active">Tabular</span><span class="suni">Unified</span>';this.stab=this.switcher.querySelector(".stab");this.suni=this.switcher.querySelector(".suni");var a=this;this.stab.addEventListener("click",this.setTabular.bindAsEventListener(this),false);this.suni.addEventListener("click",this.setUnified.bindAsEventListener(this),false);this.setSettings();document.querySelector("#show-linenos").addEventListener("click",this.toggleLineNumber.bindAsEventListener(this),false)},setTabular:function(a){a.preventDefault();if(!this.sourcetable.classList.has("hidden")){this.sourcetable.classList.add("hidden")}this.difftabular.classList.remove("hidden");this.suni.classList.remove("active");this.stab.classList.add("active");resizeBottom()},setUnified:function(a){a.preventDefault();if(!this.difftabular.classList.has("hidden")){this.difftabular.classList.add("hidden")}this.sourcetable.classList.remove("hidden");this.stab.classList.remove("active");this.suni.classList.add("active");resizeBottom()},toggleLineNumber:function(a){document.querySelector("#paste").classList.toggle("hidenos");this.saveSettings()},setSettings:function(){Ajax.request({url:"/settings",dataType:"json",contentType:"application/json",method:"GET",success:function(a){document.querySelector("#show-linenos").checked=a.settings["showlinenos"];if(!a.settings["showlinenos"]){document.querySelector("#paste").classList.add("hidenos")}}})},saveSettings:function(){var d=document.querySelector("#factions");var b=true;var a=document.querySelector("#show-linenos:checked");if(!a){b=false}Ajax.request({url:d.action,dataType:"json",contentType:"application/json",method:"POST",data:this.toJSON({showlinenos:b}),success:function(e){}})}});