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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 * Called when a subscription entry is dragged. | 288 * Called when a subscription entry is dragged. |
289 */ | 289 */ |
290 startDrag: function(/**Event*/ event, /**Node*/ node) | 290 startDrag: function(/**Event*/ event, /**Node*/ node) |
291 { | 291 { |
292 let data = Templater.getDataForNode(node); | 292 let data = Templater.getDataForNode(node); |
293 if (!data) | 293 if (!data) |
294 return; | 294 return; |
295 | 295 |
296 event.dataTransfer.addElement(node); | 296 event.dataTransfer.addElement(node); |
297 event.dataTransfer.setData("text/x-moz-url", data.subscription.url); | 297 event.dataTransfer.setData("text/x-moz-url", data.subscription.url); |
298 event.dataTransfer.setData("text/plain", data.subscription.title); | 298 event.dataTransfer.setData("text/plain", getSubscriptionTitle(data.subscript
ion)); |
299 this.dragSubscription = data.subscription; | 299 this.dragSubscription = data.subscription; |
300 event.stopPropagation(); | 300 event.stopPropagation(); |
301 }, | 301 }, |
302 | 302 |
303 /** | 303 /** |
304 * Called when something is dragged over a subscription entry or subscriptions
list. | 304 * Called when something is dragged over a subscription entry or subscriptions
list. |
305 */ | 305 */ |
306 dragOver: function(/**Event*/ event) | 306 dragOver: function(/**Event*/ event) |
307 { | 307 { |
308 // Don't allow dragging onto a scroll bar | 308 // Don't allow dragging onto a scroll bar |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 let subscriptionNode = Templater.getDataNode(node); | 415 let subscriptionNode = Templater.getDataNode(node); |
416 if (!subscriptionNode || (checkSelection && !subscriptionNode._wasSelected)) | 416 if (!subscriptionNode || (checkSelection && !subscriptionNode._wasSelected)) |
417 return; | 417 return; |
418 | 418 |
419 let subscription = Templater.getDataForNode(subscriptionNode).subscription; | 419 let subscription = Templater.getDataForNode(subscriptionNode).subscription; |
420 if (!subscription || subscription.fixedTitle) | 420 if (!subscription || subscription.fixedTitle) |
421 return; | 421 return; |
422 | 422 |
423 subscriptionNode.getElementsByClassName("titleBox")[0].selectedIndex = 1; | 423 subscriptionNode.getElementsByClassName("titleBox")[0].selectedIndex = 1; |
424 let editor = subscriptionNode.getElementsByClassName("titleEditor")[0]; | 424 let editor = subscriptionNode.getElementsByClassName("titleEditor")[0]; |
425 editor.value = subscription.title; | 425 editor.value = getSubscriptionTitle(subscription); |
426 editor.setSelectionRange(0, editor.value.length); | 426 editor.setSelectionRange(0, editor.value.length); |
427 this.subscriptionEdited = subscriptionNode; | 427 this.subscriptionEdited = subscriptionNode; |
428 editor.focus(); | 428 editor.focus(); |
429 }, | 429 }, |
430 | 430 |
431 /** | 431 /** |
432 * Stops editing of a subscription title. | 432 * Stops editing of a subscription title. |
433 * @param {Boolean} save if true the entered value will be saved, otherwise di
smissed | 433 * @param {Boolean} save if true the entered value will be saved, otherwise di
smissed |
434 */ | 434 */ |
435 end: function(save) | 435 end: function(save) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 return; | 597 return; |
598 | 598 |
599 if (event.keyCode == event.DOM_VK_RETURN || event.keyCode == event.DOM_VK_EN
TER) | 599 if (event.keyCode == event.DOM_VK_RETURN || event.keyCode == event.DOM_VK_EN
TER) |
600 { | 600 { |
601 // This shouldn't accept our dialog, only the panel | 601 // This shouldn't accept our dialog, only the panel |
602 event.preventDefault(); | 602 event.preventDefault(); |
603 E("selectSubscriptionAccept").doCommand(); | 603 E("selectSubscriptionAccept").doCommand(); |
604 } | 604 } |
605 } | 605 } |
606 }; | 606 }; |
OLD | NEW |