Advertisement
jNizM

Browser Notepad 02

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