Skip to content

Commit 5e9fbff

Browse files
committed
tweaking showme, adding buildme
1 parent 5490c13 commit 5e9fbff

4 files changed

Lines changed: 39 additions & 3 deletions

File tree

buildme.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Build a Show-Me URL</title>
5+
</head>
6+
<body>
7+
<h1>Build a Show-Me URL</h1>
8+
<p>
9+
<textarea id="source" cols="100" rows="30"></textarea><br>
10+
<input type="button" id="buildit" value="build"><br>
11+
<input id="showmeurl" size="100">
12+
</p>
13+
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
14+
<script src="buildme.js"></script>
15+
</body>
16+
</html>

buildme.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(function(){var t="undefined"!=typeof window?window:exports,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=function(){try{document.createElement("$")}catch(t){return t}}();t.btoa||(t.btoa=function(t){for(var o,e,a=0,c=r,f="";t.charAt(0|a)||(c="=",a%1);f+=c.charAt(63&o>>8-8*(a%1))){if(e=t.charCodeAt(a+=.75),e>255)throw n;o=o<<8|e}return f}),t.atob||(t.atob=function(t){if(t=t.replace(/=+$/,""),1==t.length%4)throw n;for(var o,e,a=0,c=0,f="";e=t.charAt(c++);~e&&(o=a%4?64*o+e:e,a++%4)?f+=String.fromCharCode(255&o>>(6&-2*a)):0)e=r.indexOf(e);return f})})();
2+
3+
(function(global,$){
4+
5+
function buildit() {
6+
var src = $source.val();
7+
src = btoa(src);
8+
$showmeurl.val("http://getify.github.io/showme.html#data:text/html;charset=utf-8;base64," + src);
9+
}
10+
11+
var $source, $showmeurl;
12+
13+
$(document).ready(function(){
14+
$source = $("#source");
15+
$showmeurl = $("#showmeurl");
16+
17+
$("#buildit").click("click",buildit);
18+
});
19+
20+
})(window,jQuery);

showme.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<html>
33
<head>
44
<title>Show Me</title>
5-
<script src="jquery.js"></script>
5+
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
66
<style>#showcode{background-color:#eee;border:1px solid #000;font-weight:bold;font-size:16px;}</style>
77
</head>
88
<body>
9-
<pre id="showcode"></pre>
9+
<pre id="showcode"><code></code></pre>
1010
<script src="showme.js"></script>
1111
</body>
1212
</html>

showme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
if (str.match(/^data:text\/html.*?base64,/)) {
88
str = str.replace(/^data:text\/html.*?base64,/,"");
99
str = atob(str);
10-
$("#showcode").text(str);
10+
$("#showcode code").text(str);
1111
document.write(str);
1212
}
1313
}

0 commit comments

Comments
 (0)