dragdropdetector.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4. Copyright 2010 The Closure Library Authors. All Rights Reserved.
  5. Use of this source code is governed by the Apache License, Version 2.0.
  6. See the COPYING file for details.
  7. -->
  8. <head>
  9. <title>goog.ui.DragDropDetector</title>
  10. <script src="../base.js"></script>
  11. <script>
  12. goog.require('goog.ui.DragDropDetector');
  13. goog.require('goog.ui.DragDropDetector.EventType');
  14. </script>
  15. <link rel="stylesheet" href="css/demo.css">
  16. <link rel="stylesheet" href="../css/dragdropdetector.css">
  17. <style type="text/css">
  18. html, body {
  19. width: 100%;
  20. height: 100%;
  21. margin: 0;
  22. padding: 0;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <h1>goog.ui.DragDropDetector</h1>
  28. <p>Try dropping images from other web pages on this page.</p>
  29. <script type="text/javascript">
  30. var detector = new goog.ui.DragDropDetector();
  31. goog.events.listen(detector,
  32. [
  33. goog.ui.DragDropDetector.EventType.IMAGE_DROPPED,
  34. goog.ui.DragDropDetector.EventType.LINK_DROPPED
  35. ],
  36. function(e) {
  37. var str = 'Detected ' + e.getUrl();
  38. if (e.getPosition) {
  39. str += ' at ' + e.getPosition();
  40. }
  41. alert(str);
  42. });
  43. </script>
  44. </body>
  45. </html>