summaryrefslogtreecommitdiffstats
path: root/toolkit/content
diff options
context:
space:
mode:
authorNew Tobin Paradigm <email@mattatobin.com>2018-04-13 00:46:41 -0400
committerGitHub <noreply@github.com>2018-04-13 00:46:41 -0400
commitcf22ff559bc8460d2dfd3c716524925979bb80a7 (patch)
treea33d5a88d1c8fa87ea50b32dca40f2a1b913b6fd /toolkit/content
parenta22bf0142f842fd7efe27acf7a0d906dab501517 (diff)
parent99e150cb434ff90a6a06f900065b88593a59e260 (diff)
downloadUXP-cf22ff559bc8460d2dfd3c716524925979bb80a7.tar
UXP-cf22ff559bc8460d2dfd3c716524925979bb80a7.tar.gz
UXP-cf22ff559bc8460d2dfd3c716524925979bb80a7.tar.lz
UXP-cf22ff559bc8460d2dfd3c716524925979bb80a7.tar.xz
UXP-cf22ff559bc8460d2dfd3c716524925979bb80a7.zip
Merge pull request #135 from janekptacijarabaci/aboutSupport_improvements_1
moebius#57: about:support - "Copy text to clipboard": "Places Database" - "Verify" (results)
Diffstat (limited to 'toolkit/content')
-rw-r--r--toolkit/content/aboutSupport.js39
-rw-r--r--toolkit/content/aboutSupport.xhtml6
2 files changed, 32 insertions, 13 deletions
diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js
index e66095e20..e9087dfcb 100644
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -715,7 +715,8 @@ Serializer.prototype = {
let hasText = false;
for (let child of elem.childNodes) {
if (child.nodeType == Node.TEXT_NODE) {
- let text = this._nodeText(child);
+ let text = this._nodeText(
+ child, (child.classList && child.classList.contains("endline")));
this._appendText(text);
hasText = hasText || !!text.trim();
}
@@ -742,7 +743,7 @@ Serializer.prototype = {
}
},
- _startNewLine: function (lines) {
+ _startNewLine: function () {
let currLine = this._currentLine;
if (currLine) {
// The current line is not empty. Trim it.
@@ -754,7 +755,7 @@ Serializer.prototype = {
this._lines.push("");
},
- _appendText: function (text, lines) {
+ _appendText: function (text) {
this._currentLine += text;
},
@@ -777,7 +778,8 @@ Serializer.prototype = {
let col = tableHeadingCols[i];
if (col.localName != "th" || col.classList.contains("title-column"))
break;
- colHeadings[i] = this._nodeText(col).trim();
+ colHeadings[i] = this._nodeText(
+ col, (col.classList && col.classList.contains("endline"))).trim();
}
}
let hasColHeadings = Object.keys(colHeadings).length > 0;
@@ -804,7 +806,10 @@ Serializer.prototype = {
let text = "";
if (colHeadings[j])
text += colHeadings[j] + ": ";
- text += this._nodeText(children[j]).trim();
+ text += this._nodeText(
+ children[j],
+ (children[j].classList &&
+ children[j].classList.contains("endline"))).trim();
this._appendText(text);
this._startNewLine();
}
@@ -820,7 +825,10 @@ Serializer.prototype = {
if (this._ignoreElement(trs[i]))
continue;
let children = trs[i].querySelectorAll("th,td");
- let rowHeading = this._nodeText(children[0]).trim();
+ let rowHeading = this._nodeText(
+ children[0],
+ (children[0].classList &&
+ children[0].classList.contains("endline"))).trim();
if (children[0].classList.contains("title-column")) {
if (!this._isHiddenSubHeading(children[0]))
this._appendText(rowHeading);
@@ -834,7 +842,10 @@ Serializer.prototype = {
// queued up from querySelectorAll earlier.
this._appendText(rowHeading + ": ");
} else {
- this._appendText(rowHeading + ": " + this._nodeText(children[1]).trim());
+ this._appendText(rowHeading + ": " + this._nodeText(
+ children[1],
+ (children[1].classList &&
+ children[1].classList.contains("endline"))).trim());
}
}
this._startNewLine();
@@ -846,8 +857,16 @@ Serializer.prototype = {
return elem.classList.contains("no-copy");
},
- _nodeText: function (node) {
- return node.textContent.replace(/\s+/g, " ");
+ _nodeText: function (node, endline) {
+ let whiteChars = /\s+/g
+ let whiteCharsButNoEndline = /(?!\n)[\s]+/g;
+ let _node = node.cloneNode(true);
+ if (_node.firstElementChild &&
+ (_node.firstElementChild.nodeName.toLowerCase() == "button")) {
+ _node.removeChild(_node.firstElementChild);
+ }
+ return _node.textContent.replace(
+ endline ? whiteCharsButNoEndline : whiteChars, " ");
},
};
@@ -919,7 +938,7 @@ function setupEventListeners() {
PlacesDBUtils.checkAndFixDatabase(function(aLog) {
let msg = aLog.join("\n");
$("verify-place-result").style.display = "block";
- $("verify-place-result").classList.remove("no-copy");
+ $("verify-place-result-parent").classList.remove("no-copy");
$("verify-place-result").textContent = msg;
});
});
diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml
index 8464e014b..9574365a3 100644
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -407,16 +407,16 @@
</h2>
<table>
- <tr class="no-copy">
+ <tr id="verify-place-result-parent" class="no-copy">
<th class="column">
&aboutSupport.placeDatabaseIntegrity;
</th>
- <td>
+ <td class="endline">
<button id="verify-place-integrity-button">
&aboutSupport.placeDatabaseVerifyIntegrity;
</button>
- <pre id="verify-place-result" class="hidden no-copy"></pre>
+ <pre id="verify-place-result" class="hidden"></pre>
</td>
</tr>
</table>