Debian Codegraph @

closure-library/closure/goog/demos/pastehandler.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <!--
5 Copyright 2010 The Closure Library Authors. All Rights Reserved.
6
7 Use of this source code is governed by the Apache License, Version 2.0.
8 See the COPYING file for details.
9 -->
10 <head>
11 <title>PasteHandler Test</title>
12 <link rel="stylesheet" href="css/demo.css">
13 <script src="../base.js"></script>
14 <script>
15 goog.require('goog.debug.DivConsole');
16 goog.require('goog.debug.LogManager');
17 goog.require('goog.dom');
18 goog.require('goog.events.PasteHandler');
19 goog.require('goog.log');
20 goog.require('goog.ui.KeyboardShortcutEvent');
21 </script>
22 </head>
23 <body>
24 <h2>Demo of goog.events.PasteHandler</h2>
25
26 <fieldset>
27 <legend>Demo of the <strong>goog.events.PasteHandler</strong>:</legend>
28 <label>goog.events.PasteHandler detects paste events in textareas.
29 Try pasting text in the textarea below and watch the event log at the
30 bottom of the page.<br></label>
31 <textarea id="foo" rows="10" cols="100"></textarea>
32 </fieldset>
33
34 <fieldset class="goog-debug-panel">
35 <legend>Event Log</legend>
36 <div id="log" style="height: 200px;"></div>
37 </fieldset>
38
39 <script type="text/javascript">
40 var textarea = goog.dom.getElement('foo');
41 var pasteHandler = new goog.events.PasteHandler(textarea);
42 var logger = goog.log.getLogger('demo')
43
44 goog.events.listen(pasteHandler, goog.events.PasteHandler.EventType.PASTE,
45 function(e) {
46 goog.log.log(logger, goog.log.Level.SHOUT, 'pasted!');
47 });
48
49 goog.debug.LogManager.getRoot().setLevel(goog.log.Level.SEVERE);
50 var logconsole = new goog.debug.DivConsole(goog.dom.getElement('log'));
51 logconsole.setCapturing(true);
52 </script>
53 </body>
54 </html>