Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/aardvark.js

Issue 29366552: Issue 2879 - Make "view source" command work again (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper
Left Patch Set: Created Dec. 1, 2016, 10:49 a.m.
Right Patch Set: Addressed nits Created Dec. 8, 2016, 1:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | lib/child/commands.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); 7 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
8 8
9 let {Prefs} = require("prefs"); 9 let {Prefs} = require("prefs");
10 10
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 this.appendDescription(startTag, "<", null); 379 this.appendDescription(startTag, "<", null);
380 this.appendDescription(startTag, node.tagName, "tagName"); 380 this.appendDescription(startTag, node.tagName, "tagName");
381 381
382 for (let {name, value} of node.attributes) 382 for (let {name, value} of node.attributes)
383 { 383 {
384 this.appendDescription(startTag, name, "attrName"); 384 this.appendDescription(startTag, name, "attrName");
385 if (value != "") 385 if (value != "")
386 { 386 {
387 this.appendDescription(startTag, "=", null); 387 this.appendDescription(startTag, "=", null);
388 this.appendDescription(startTag, '"' + value.replace(/"/, "&quot;") + '"', "attrValue"); 388 this.appendDescription(startTag, `"${value.replace(/"/, "&quot;")}"`,
saroyanm 2016/12/05 17:51:47 Detail: exceeds 80 characters.
Wladimir Palant 2016/12/08 13:11:29 Done.
389 "attrValue");
389 } 390 }
390 } 391 }
391 392
392 this.appendDescription(startTag, node.children.length ? ">" : " />", null) ; 393 this.appendDescription(startTag, node.children.length ? ">" : " />", null) ;
393 box.appendChild(startTag); 394 box.appendChild(startTag);
394 395
395 if (node.children.length) 396 if (node.children.length)
396 { 397 {
397 for (let child of node.children) 398 for (let child of node.children)
398 this.getOuterHtmlFormatted(child, box); 399 this.getOuterHtmlFormatted(child, box);
(...skipping 13 matching lines...) Expand all
412 if (text == "") 413 if (text == "")
413 return; 414 return;
414 415
415 text = text.replace(/&/g, "&amp;") 416 text = text.replace(/&/g, "&amp;")
416 .replace(/</g, "&lt;") 417 .replace(/</g, "&lt;")
417 .replace(/>/g, "&gt;") 418 .replace(/>/g, "&gt;")
418 .replace(/\t/g, " "); 419 .replace(/\t/g, " ");
419 if (type == "comment") 420 if (type == "comment")
420 text = "<!--" + text + "-->"; 421 text = "<!--" + text + "-->";
421 422
422 let lines = text.split("\n"); 423 for (let line of text.split("\n"))
saroyanm 2016/12/05 17:51:47 detail: we can move this inside of for statement,
Wladimir Palant 2016/12/08 13:11:29 Done.
423 for (let line of lines)
424 this.appendDescription(container, line.trim(), type); 424 this.appendDescription(container, line.trim(), type);
425 }, 425 },
426 426
427 showMenu: function() 427 showMenu: function()
428 { 428 {
429 var helpBox = E("ehh-helpbox"); 429 var helpBox = E("ehh-helpbox");
430 if (helpBox.state == "open") 430 if (helpBox.state == "open")
431 { 431 {
432 helpBox.hidePopup(); 432 helpBox.hidePopup();
433 return true; 433 return true;
434 } 434 }
435 435
436 // Show help box 436 // Show help box
437 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft"); 437 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft");
438 return true; 438 return true;
439 } 439 }
440 } 440 }
441 441
442 // Makes sure event handlers like Aardvark.onKeyPress always have the correct 442 // Makes sure event handlers like Aardvark.onKeyPress always have the correct
443 // this pointer set. 443 // this pointer set.
444 for (let method of ["onKeyPress", "onMouseMove", "onTabSelect"]) 444 for (let method of ["onKeyPress", "onMouseMove", "onTabSelect"])
445 Aardvark[method] = Aardvark[method].bind(Aardvark); 445 Aardvark[method] = Aardvark[method].bind(Aardvark);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld