Advertisement
jNizM

Browser Notepad 03

Jan 31st, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.12 KB | None | 0 0
  1. data:text/html,
  2. <style type="text/css">
  3. #e {
  4.   position:absolute;
  5.   top:0;
  6.   right:0;
  7.   bottom:0;
  8.   left:0;
  9.   font-size:16px;
  10. }
  11. </style>
  12. <div id="e"></div>
  13. <script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
  14. <script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
  15. <script>
  16. var myKey="SecretKeyz";
  17. $(document).ready(function(){
  18.     var e;
  19.     var url = "http://api.openkeyval.org/"+myKey;
  20.     $.ajax({
  21.       url: url,
  22.       dataType: "jsonp",
  23.       success: function(data){
  24.        e = ace.edit("e");
  25.        e.setTheme("ace/theme/tomorrow_night_eighties");
  26.        e.getSession().setMode("ace/mode/markdown");
  27.        e.setValue(data);
  28.       }
  29.     });
  30.  
  31.     $("#e").on("keydown", function (b) {
  32.       if (b.ctrlKey && 83 == b.which) {
  33.        b.preventDefault();
  34.         var data = myKey+"="+encodeURIComponent(e.getValue());
  35.         $.ajax({
  36.           data: data,
  37.           url: "http://api.openkeyval.org/store/",
  38.           dataType: "jsonp",
  39.           success: function(data){
  40.             alert("Saved.");
  41.           }
  42.         });
  43.       }
  44.     });
  45. });
  46. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement