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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 { | 332 { |
333 event.preventDefault(); | 333 event.preventDefault(); |
334 return; | 334 return; |
335 } | 335 } |
336 | 336 |
337 function setMultilineContent(box, text) | 337 function setMultilineContent(box, text) |
338 { | 338 { |
339 while (box.firstChild) | 339 while (box.firstChild) |
340 box.removeChild(box.firstChild); | 340 box.removeChild(box.firstChild); |
341 | 341 |
342 for (var i = 0; i < text.length; i += 80) | 342 let lines = text.match(/.{1,80}/g); |
| 343 if (lines.length > 7) |
343 { | 344 { |
344 var description = document.createElement("description"); | 345 // Text is too long to display in full so we cut out the middle part |
345 description.setAttribute("value", text.substr(i, 80)); | 346 lines = lines.slice(0,3).concat("\u2026", lines.slice(-3)); |
| 347 } |
| 348 |
| 349 for (let line of lines) |
| 350 { |
| 351 let description = document.createElement("description"); |
| 352 description.setAttribute("value", line); |
346 box.appendChild(description); | 353 box.appendChild(description); |
347 } | 354 } |
348 } | 355 } |
349 | 356 |
350 setMultilineContent(E("tooltip-filter"), item.filter.text); | 357 setMultilineContent(E("tooltip-filter"), item.filter.text); |
351 | 358 |
352 E("tooltip-hitcount-row").hidden = !(item.filter instanceof ActiveFilter); | 359 E("tooltip-hitcount-row").hidden = !(item.filter instanceof ActiveFilter); |
353 E("tooltip-lasthit-row").hidden = !(item.filter instanceof ActiveFilter) ||
!item.filter.lastHit; | 360 E("tooltip-lasthit-row").hidden = !(item.filter instanceof ActiveFilter) ||
!item.filter.lastHit; |
354 if (item.filter instanceof ActiveFilter) | 361 if (item.filter instanceof ActiveFilter) |
355 { | 362 { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 return; | 555 return; |
549 | 556 |
550 this.deleteItems(this.dragItems); | 557 this.deleteItems(this.dragItems); |
551 } | 558 } |
552 }; | 559 }; |
553 | 560 |
554 window.addEventListener("load", function() | 561 window.addEventListener("load", function() |
555 { | 562 { |
556 FilterActions.init(); | 563 FilterActions.init(); |
557 }, false); | 564 }, false); |
OLD | NEW |