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

Unified Diff: chrome/content/ui/filters-filteractions.js

Issue 29334565: Issue 1950 - Fixed: Filter tooltip not shown for long filters (Closed)
Patch Set: Created Jan. 29, 2016, 6:26 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/content/ui/sidebar.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/filters-filteractions.js
===================================================================
--- a/chrome/content/ui/filters-filteractions.js
+++ b/chrome/content/ui/filters-filteractions.js
@@ -339,10 +339,17 @@
while (box.firstChild)
box.removeChild(box.firstChild);
- for (var i = 0; i < text.length; i += 80)
+ let lines = text.match(/.{1,80}/g);
+ if (lines.length > 7)
{
- var description = document.createElement("description");
- description.setAttribute("value", text.substr(i, 80));
+ // Text is too long to display in full so we cut out the middle part
+ lines = lines.slice(0,3).concat("\u2026", lines.slice(-3));
+ }
+
+ for (let line of lines)
+ {
+ let description = document.createElement("description");
+ description.setAttribute("value", line);
box.appendChild(description);
}
}
« no previous file with comments | « no previous file | chrome/content/ui/sidebar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld