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

Delta Between Two Patch Sets: background.js

Issue 5767063142400000: notification fixes (Closed)
Left Patch Set: Created March 3, 2014, 3:50 p.m.
Right Patch Set: Nit fix for long lines Created March 6, 2014, 10:10 a.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 | chrome/ext/background.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 file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 notification.show(); 340 notification.show();
341 notification.addEventListener("close", prepareNotificationIconAndPopup, fa lse); 341 notification.addEventListener("close", prepareNotificationIconAndPopup, fa lse);
342 return; 342 return;
343 } 343 }
344 344
345 var texts = Notification.getLocalizedTexts(notification); 345 var texts = Notification.getLocalizedTexts(notification);
346 var title = texts.title || ""; 346 var title = texts.title || "";
347 var message = texts.message ? texts.message.replace(/<\/?(a|strong)>/g, "") : ""; 347 var message = texts.message ? texts.message.replace(/<\/?(a|strong)>/g, "") : "";
348 var iconUrl = ext.getURL("icons/abp-128.png"); 348 var iconUrl = ext.getURL("icons/abp-128.png");
349 var hasLinks = activeNotification.links && activeNotification.links.length > 0; 349 var hasLinks = activeNotification.links && activeNotification.links.length > 0;
350 // Chrome on Linux does not fully support chrome.notifications yet ( https:/ /code.google.com/p/chromium/issues/detail?id=291485 ) 350 // Chrome on Linux does not fully support chrome.notifications yet
351 if (typeof chrome != "undefined" && "notifications" in chrome && navigator.p latform.indexOf("Linux") == -1) 351 // https://code.google.com/p/chromium/issues/detail?id=291485
Thomas Greiner 2014/03/04 09:48:48 You can find the platform information in the info
saroyanm 2014/03/04 10:53:26 Thanks for pointing to the module.
352 if (require("info").platform == "chromium" &&
353 "notifications" in chrome &&
354 navigator.platform.indexOf("Linux") == -1)
352 { 355 {
353 var opts = { 356 var opts = {
354 type: "basic", 357 type: "basic",
355 title: title, 358 title: title,
356 message: message, 359 message: message,
357 iconUrl: iconUrl, 360 iconUrl: iconUrl,
358 buttons: [] 361 buttons: []
359 }; 362 };
360 var regex = /<a>(.*?)<\/a>/g; 363 var regex = /<a>(.*?)<\/a>/g;
361 var plainMessage = texts.message || ""; 364 var plainMessage = texts.message || "";
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 tab.sendMessage({type: "clickhide-deactivate"}); 496 tab.sendMessage({type: "clickhide-deactivate"});
494 refreshIconAndContextMenu(tab); 497 refreshIconAndContextMenu(tab);
495 }); 498 });
496 499
497 setTimeout(function() 500 setTimeout(function()
498 { 501 {
499 var notificationToShow = Notification.getNextToShow(); 502 var notificationToShow = Notification.getNextToShow();
500 if (notificationToShow) 503 if (notificationToShow)
501 showNotification(notificationToShow); 504 showNotification(notificationToShow);
502 }, 3 * 60 * 1000); 505 }, 3 * 60 * 1000);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld