Advertisement
Guest User

Base64 De/Encod Bookmarklet

a guest
Jan 16th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. step one: put this bookmarklet on your browser
  2.  
  3. javascript:function%20appendAll(a){for(var%20b=0;b<a.length;b++){for(var%20c=0;c<a[b].c.length;c++){a[b].p.appendChild(a[b].c[c])}}}function%20getDocDims(){return[Math.max(Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),Math.max(document.body.clientWidth,document.documentElement.clientWidth)),Math.max(Math.max(document.body.scrollHeight,document.documentElement.scrollHeight),Math.max(document.body.offsetHeight,document.documentElement.offsetHeight),Math.max(document.body.clientHeight,document.documentElement.clientHeight))]}if(document.getElementById("base64container")!=null)document.body.removeChild(document.getElementById("base64container"));var%20dims=getDocDims();var%20div=document.createElement("div");div.id="base64container";div.setAttribute("style","width:"+dims[0]+"px;height:"+dims[1]+"px;top:0;left:0;position:absolute;");var%20basebg=document.createElement("div");basebg.id="base64blackout";basebg.setAttribute("style","width:"+dims[0]+"px;height:"+dims[1]+"px;position:absolute;z-index:100000000;top:0;left:0;background:#000;opacity:0.8;filter:alpha(opacity=80);-moz-opacity:0.8;-khtml-opacity:0.8;");var%20wrap=document.createElement("div");wrap.id="base64wrap";wrap.setAttribute("style","position:fixed;top:0;left:0;width:100%;height:100%;z-index:200000000;");wrap.onclick=function(a){if(a.target==this){document.getElementById("base64container").parentNode.removeChild(document.getElementById("base64container"))}};var%20inner=document.createElement("div");inner.id="base64inner";inner.setAttribute("style","position:relative;width:500px;height:200px;z-index:200000000;margin:10px%20auto;background:white;border-radius:5px;box-shadow:0px%200px%2020px%20-5px%20#000");var%20textbit=document.createElement("div");textbit.id="base64textbit";textbit.setAttribute("style","position:relative;width:500px;height:auto;z-index:200000000;margin:10px%20auto%2010px%20auto;border-radius:5px;text-align:center;font-family:monospace;color:#fff;font-size:25px;text-shadow:%200px%200px%2010px%20black;");textbit.innerHTML="encoder%20<%20&nbsp;%20>%20decoder";var%20leftArea=document.createElement("div");leftArea.id="base64leftarea";leftArea.setAttribute("style","float:left;width:235px;height:180px;border-radius:3px;margin:10px%200px%2010px%2010px;");var%20rightArea=document.createElement("div");rightArea.id="base64rightarea";rightArea.setAttribute("style","float:left;width:235px;height:180px;border-radius:3px;margin:10px;");var%20rightTextArea=document.createElement("textarea");rightTextArea.id="base64righttextarea";rightTextArea.setAttribute("style","width:233px;height:100%;border-radius:3px;border-color:#888;padding:0;box-shadow:inset%201px%201px%205px%20#aaa;");rightTextArea.onkeyup=function(){leftTextArea.value=atob(this.value)};var%20leftTextArea=document.createElement("textarea");leftTextArea.id="base64lefttextarea";leftTextArea.setAttribute("style","width:233px;height:100%;border-radius:3px;border-color:#888;padding:0;box-shadow:inset%201px%201px%205px%20#aaa;");leftTextArea.onkeyup=function(){rightTextArea.value=btoa(this.value)};appendAll([{p:leftArea,c:[leftTextArea]},{p:rightArea,c:[rightTextArea]},{p:inner,c:[leftArea,rightArea]},{p:wrap,c:[inner,textbit]},{p:div,c:[basebg,wrap]},{p:document.body,c:[div]}]);
  4.  
  5. step two: change its name to Base64 De/Encoder
  6. step three: copy the text from my post (do not copy ";)[base64]")
  7. step four: click bookmarklet
  8. step five: paste copied text on the box on the right
  9. step six: ‽‽‽
  10. step seven: profit(the decoded text on the left(and you can paste test on the left to have it encoded on the right))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement