OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 ); | 94 ); |
95 } | 95 } |
96 | 96 |
97 var dragStartX; | 97 var dragStartX; |
98 var dragStartY; | 98 var dragStartY; |
99 var dragEndX = null; | 99 var dragEndX = null; |
100 var dragEndY = null; | 100 var dragEndY = null; |
101 | 101 |
102 function onDragStart(event) | 102 function onDragStart(event) |
103 { | 103 { |
104 dragStartX = event.screenX; | 104 var element = document.elementFromPoint(event.clientX, event.clientY); |
105 dragStartY = event.screenY; | 105 if (element && element.localName == "textarea") |
| 106 { |
| 107 // Don't drag the dialog when the user has clicked into the textarea. |
| 108 // Most likely the user just wants to focus it or select text there. |
| 109 event.preventDefault(); |
| 110 } |
| 111 else |
| 112 { |
| 113 dragStartX = event.screenX; |
| 114 dragStartY = event.screenY; |
| 115 } |
106 } | 116 } |
107 | 117 |
108 function onDragEnd(event) | 118 function onDragEnd(event) |
109 { | 119 { |
110 if (dragEndX == null) | 120 if (dragEndX == null) |
111 dragEndX = event.screenX; | 121 dragEndX = event.screenX; |
112 if (dragEndY == null) | 122 if (dragEndY == null) |
113 dragEndY = event.screenY; | 123 dragEndY = event.screenY; |
114 | 124 |
115 ext.backgroundPage.sendMessage({ | 125 ext.backgroundPage.sendMessage({ |
(...skipping 17 matching lines...) Expand all Loading... |
133 // However on Chrome, the coordinates in the drag event are unreliable. | 143 // However on Chrome, the coordinates in the drag event are unreliable. |
134 // So we need to get the coordinates from dragend event there. | 144 // So we need to get the coordinates from dragend event there. |
135 if (navigator.userAgent.indexOf(" Version/") != -1) | 145 if (navigator.userAgent.indexOf(" Version/") != -1) |
136 { | 146 { |
137 window.addEventListener("drag", function(event) | 147 window.addEventListener("drag", function(event) |
138 { | 148 { |
139 dragEndX = event.screenX; | 149 dragEndX = event.screenX; |
140 dragEndY = event.screenY; | 150 dragEndY = event.screenY; |
141 }, false); | 151 }, false); |
142 } | 152 } |
OLD | NEW |