| 1 | <html> |
| 2 | <head> |
| 3 | <link type="text/css" href="popup.css" rel="stylesheet"/> |
| 4 | <script src="jquery-1.3.2.min.js"></script> |
| 5 | <script> |
| 6 | $(function() { |
| 7 | var execute = function() { |
| 8 | var code = $("#code").val(); |
| 9 | localStorage.code = code; |
| 10 | chrome.extension.getBackgroundPage().execute(code); |
| 11 | }; |
| 12 | $("#code").keypress(function(evt) { |
| 13 | if (evt.ctrlKey && (evt.keyCode === 10)) execute(); |
| 14 | }); |
| 15 | $("#run").click(function(evt) {execute();}); |
| 16 | $("#reload").click(function(evt) { |
| 17 | chrome.extension.getBackgroundPage().reload(); |
| 18 | }); |
| 19 | $("#clear").click(function(evt) { |
| 20 | $("#code").val(""); |
| 21 | $("#code").focus(); |
| 22 | }); |
| 23 | $("#close").click(function(evt) {window.close();}); |
| 24 | $("#code").val(localStorage.code); |
| 25 | $("#code").focus(); |
| 26 | $("#main").slideDown(); |
| 27 | }); |
| 28 | </script> |
| 29 | </head> |
| 30 | <body> |
| 31 | <div id="main" style="display:none"> |
| 32 | <textarea id="code" rows="10" cols="80"></textarea> |
| 33 | <button id="run">Run</button> |
| 34 | <button id="reload">Reload</button> |
| 35 | <button id="clear">Clear</button> |
| 36 | <button id="close">Close</button> |
| 37 | </div> |
| 38 | </body> |
| 39 | </html> |