aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/demos/dragdropdetector.html
blob: 6787c0bc33999ecde9f0a2367226418b855eabee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<!--
Copyright 2010 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
  <title>goog.ui.DragDropDetector</title>
  <script src="../base.js"></script>
  <script>
    goog.require('goog.ui.DragDropDetector');
    goog.require('goog.ui.DragDropDetector.EventType');
  </script>
  <link rel="stylesheet" href="css/demo.css">
  <link rel="stylesheet" href="../css/dragdropdetector.css">
  <style type="text/css">
    html, body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
    }
  </style>
</head>
<body>
  <h1>goog.ui.DragDropDetector</h1>
  <p>Try dropping images from other web pages on this page.</p>
  <script type="text/javascript">
    var detector = new goog.ui.DragDropDetector();
    goog.events.listen(detector,
        [
          goog.ui.DragDropDetector.EventType.IMAGE_DROPPED,
          goog.ui.DragDropDetector.EventType.LINK_DROPPED
        ],
        function(e) {
          var str = 'Detected ' + e.getUrl();
          if (e.getPosition) {
            str += ' at ' + e.getPosition();
          }
          alert(str);
        });
  </script>
</body>
</html>