| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 { | 353 { | 
| 354 if (activeNotification && activeNotification.id === notification.id) | 354 if (activeNotification && activeNotification.id === notification.id) | 
| 355 return; | 355 return; | 
| 356 | 356 | 
| 357 activeNotification = notification; | 357 activeNotification = notification; | 
| 358 if (activeNotification.type === "critical" || activeNotification.type === "que stion") | 358 if (activeNotification.type === "critical" || activeNotification.type === "que stion") | 
| 359 { | 359 { | 
| 360 var texts = NotificationStorage.getLocalizedTexts(notification); | 360 var texts = NotificationStorage.getLocalizedTexts(notification); | 
| 361 var title = texts.title || ""; | 361 var title = texts.title || ""; | 
| 362 var message = texts.message ? texts.message.replace(/<\/?(a|strong)>/g, "") : ""; | 362 var message = texts.message ? texts.message.replace(/<\/?(a|strong)>/g, "") : ""; | 
| 363 var iconUrl = ext.getURL("icons/abp-128.png"); | 363 var iconUrl = ext.getURL("icons/detailed/abp-128.png"); | 
| 364 var hasLinks = activeNotification.links && activeNotification.links.length > 0; | 364 var hasLinks = activeNotification.links && activeNotification.links.length > 0; | 
| 365 | 365 | 
| 366 if (canUseChromeNotifications) | 366 if (canUseChromeNotifications) | 
| 367 { | 367 { | 
| 368 var opts = { | 368 var opts = { | 
| 369 type: "basic", | 369 type: "basic", | 
| 370 title: title, | 370 title: title, | 
| 371 message: message, | 371 message: message, | 
| 372 buttons: [], | 372 buttons: [], | 
| 373 priority: 2 // We use the highest priority to prevent the notification f rom closing automatically | 373 priority: 2 // We use the highest priority to prevent the notification f rom closing automatically | 
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 }); | 546 }); | 
| 547 break; | 547 break; | 
| 548 case "add-sitekey": | 548 case "add-sitekey": | 
| 549 processKey(msg.token, sender.page, sender.frame); | 549 processKey(msg.token, sender.page, sender.frame); | 
| 550 break; | 550 break; | 
| 551 case "report-html-page": | 551 case "report-html-page": | 
| 552 htmlPages.set(sender.page, null); | 552 htmlPages.set(sender.page, null); | 
| 553 refreshIconAndContextMenu(sender.page); | 553 refreshIconAndContextMenu(sender.page); | 
| 554 break; | 554 break; | 
| 555 case "compose-filters": | 555 case "compose-filters": | 
| 556 sendResponse(composeFilters( | 556 sendResponse(composeFilters({ | 
| 557 msg.tagName, msg.id, msg.src, msg.style, | 557 tagName: msg.tagName, | 
| 558 msg.classes, msg.urls, msg.mediatype, | 558 id: msg.id, | 
| 559 msg.baseURL, sender.page, sender.frame | 559 src: msg.src, | 
| 
 
Wladimir Palant
2015/03/02 20:14:19
Ten positional parameters in a function is certain
 
Sebastian Noack
2015/03/03 14:29:00
How about reducing the number of arguments by grou
 
Wladimir Palant
2015/03/03 14:40:31
That's eight parameters now - still way too many t
 
Sebastian Noack
2015/03/03 14:59:28
Fair enough.
 
 | |
| 560 )); | 560 style: msg.style, | 
| 561 classes: msg.classes, | |
| 562 urls: msg.urls, | |
| 563 type: msg.mediatype, | |
| 564 baseURL: msg.baseURL, | |
| 565 page: sender.page, | |
| 566 frame: sender.frame | |
| 567 })); | |
| 561 break; | 568 break; | 
| 562 case "forward": | 569 case "forward": | 
| 563 if (sender.page) | 570 if (sender.page) | 
| 564 { | 571 { | 
| 565 if (msg.expectsResponse) | 572 if (msg.expectsResponse) | 
| 566 { | 573 { | 
| 567 sender.page.sendMessage(msg.payload, sendResponse); | 574 sender.page.sendMessage(msg.payload, sendResponse); | 
| 568 return true; | 575 return true; | 
| 569 } | 576 } | 
| 570 | 577 | 
| 571 sender.page.sendMessage(msg.payload); | 578 sender.page.sendMessage(msg.payload); | 
| 572 } | 579 } | 
| 573 break; | 580 break; | 
| 574 } | 581 } | 
| 575 }); | 582 }); | 
| 576 | 583 | 
| 577 // update icon when page changes location | 584 // update icon when page changes location | 
| 578 ext.pages.onLoading.addListener(function(page) | 585 ext.pages.onLoading.addListener(function(page) | 
| 579 { | 586 { | 
| 580 page.sendMessage({type: "clickhide-deactivate"}); | 587 page.sendMessage({type: "clickhide-deactivate"}); | 
| 581 refreshIconAndContextMenu(page); | 588 refreshIconAndContextMenu(page); | 
| 582 }); | 589 }); | 
| 583 | 590 | 
| 584 setTimeout(function() | 591 setTimeout(function() | 
| 585 { | 592 { | 
| 586 var notificationToShow = NotificationStorage.getNextToShow(); | 593 var notificationToShow = NotificationStorage.getNextToShow(); | 
| 587 if (notificationToShow) | 594 if (notificationToShow) | 
| 588 showNotification(notificationToShow); | 595 showNotification(notificationToShow); | 
| 589 }, 3 * 60 * 1000); | 596 }, 3 * 60 * 1000); | 
| LEFT | RIGHT |