| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * This Source Code is subject to the terms of the Mozilla Public License |    2  * This Source Code is subject to the terms of the Mozilla Public License | 
|    3  * version 2.0 (the "License"). You can obtain a copy of the License at |    3  * version 2.0 (the "License"). You can obtain a copy of the License at | 
|    4  * http://mozilla.org/MPL/2.0/. |    4  * http://mozilla.org/MPL/2.0/. | 
|    5  */ |    5  */ | 
|    6  |    6  | 
|    7 let {Prefs} = require("prefs"); |    7 let {Prefs} = require("prefs"); | 
|    8  |    8  | 
|    9 // Make sure to stop selection when we are uninstalled |    9 // Make sure to stop selection when we are uninstalled | 
|   10 onShutdown.add(function() Aardvark.quit()); |   10 onShutdown.add(() => Aardvark.quit()); | 
|   11  |   11  | 
|   12 // To be replaced when selection starts |   12 // To be replaced when selection starts | 
|   13 function E(id) {return null;} |   13 function E(id) {return null;} | 
|   14  |   14  | 
|   15 /********************************* |   15 /********************************* | 
|   16  * Minimal element creation code * |   16  * Minimal element creation code * | 
|   17  *********************************/ |   17  *********************************/ | 
|   18  |   18  | 
|   19 function createElement(doc, tagName, attrs, children) |   19 function createElement(doc, tagName, attrs, children) | 
|   20 { |   20 { | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   53   start: function(wrapper) |   53   start: function(wrapper) | 
|   54   { |   54   { | 
|   55     if (!this.canSelect(wrapper.browser)) |   55     if (!this.canSelect(wrapper.browser)) | 
|   56       return; |   56       return; | 
|   57  |   57  | 
|   58     if (this.browser) |   58     if (this.browser) | 
|   59       this.quit(); |   59       this.quit(); | 
|   60  |   60  | 
|   61     this.window = wrapper.window; |   61     this.window = wrapper.window; | 
|   62     this.browser = wrapper.browser; |   62     this.browser = wrapper.browser; | 
|   63     E = function(id) wrapper.E(id); |   63     E = id => wrapper.E(id); | 
|   64  |   64  | 
|   65     this.browser.addEventListener("click", this.onMouseClick, true); |   65     this.browser.addEventListener("click", this.onMouseClick, true); | 
|   66     this.browser.addEventListener("DOMMouseScroll", this.onMouseScroll, true); |   66     this.browser.addEventListener("DOMMouseScroll", this.onMouseScroll, true); | 
|   67     this.browser.addEventListener("keypress", this.onKeyPress, true); |   67     this.browser.addEventListener("keypress", this.onKeyPress, true); | 
|   68     this.browser.addEventListener("mousemove", this.onMouseMove, true); |   68     this.browser.addEventListener("mousemove", this.onMouseMove, true); | 
|   69     this.browser.addEventListener("select", this.quit, false); |   69     this.browser.addEventListener("select", this.quit, false); | 
|   70     this.browser.contentWindow.addEventListener("pagehide", this.onPageHide, tru
     e); |   70     this.browser.contentWindow.addEventListener("pagehide", this.onPageHide, tru
     e); | 
|   71  |   71  | 
|   72     this.browser.contentWindow.focus(); |   72     this.browser.contentWindow.focus(); | 
|   73  |   73  | 
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  556     this.browser.removeEventListener("select", this.quit, false); |  556     this.browser.removeEventListener("select", this.quit, false); | 
|  557     this.browser.contentWindow.removeEventListener("pagehide", this.onPageHide, 
     true); |  557     this.browser.contentWindow.removeEventListener("pagehide", this.onPageHide, 
     true); | 
|  558  |  558  | 
|  559     this.anchorElem = null; |  559     this.anchorElem = null; | 
|  560     this.selectedElem = null; |  560     this.selectedElem = null; | 
|  561     this.window = null; |  561     this.window = null; | 
|  562     this.browser = null; |  562     this.browser = null; | 
|  563     this.commentElem = null; |  563     this.commentElem = null; | 
|  564     this.lockedAnchor = null; |  564     this.lockedAnchor = null; | 
|  565     this.boxElem = null; |  565     this.boxElem = null; | 
|  566     E = function(id) null; |  566     E = id => null; | 
|  567     return false; |  567     return false; | 
|  568   }, |  568   }, | 
|  569  |  569  | 
|  570   select: function(elem) |  570   select: function(elem) | 
|  571   { |  571   { | 
|  572     if (!elem) |  572     if (!elem) | 
|  573       return false; |  573       return false; | 
|  574  |  574  | 
|  575     this.window.openDialog("chrome://elemhidehelper/content/composer.xul", "_bla
     nk", |  575     this.window.openDialog("chrome://elemhidehelper/content/composer.xul", "_bla
     nk", | 
|  576                            "chrome,centerscreen,resizable,dialog=no", elem); |  576                            "chrome,centerscreen,resizable,dialog=no", elem); | 
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  745     } |  745     } | 
|  746  |  746  | 
|  747     // Show help box |  747     // Show help box | 
|  748     helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft"); |  748     helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft"); | 
|  749     return true; |  749     return true; | 
|  750   } |  750   } | 
|  751 } |  751 } | 
|  752  |  752  | 
|  753 // Makes sure event handlers like Aardvark.onKeyPress always have the correct |  753 // Makes sure event handlers like Aardvark.onKeyPress always have the correct | 
|  754 // this pointer set. |  754 // this pointer set. | 
|  755 for each (let method in ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageH
     ide", "onMouseMove", "onAfterPaint", "quit"]) |  755 for (let method of ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageHide",
      "onMouseMove", "onAfterPaint", "quit"]) | 
|  756   Aardvark[method] = Aardvark[method].bind(Aardvark); |  756   Aardvark[method] = Aardvark[method].bind(Aardvark); | 
| OLD | NEW |