Skip to content

Commit

Permalink
Fix Firefox preprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
olsh committed Jun 3, 2017
1 parent f20b951 commit 792e81f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"buildPath": "build",
"libPath": "node_modules",
"dependencies": {
"dompurify": "^0.8.7",
"jquery": "^3.1.1",
"dompurify": "^0.9.0",
"jquery": "^3.2.1",
"mustache": "^2.3.0",
"timeago": "^1.5.4",
"webextension-polyfill": "^0.1.1"
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "Feedly Notifier",
"description": "__MSG_ExtensionDescription__",
"version": "2.14.2",
"version": "2.15.0",
"default_locale": "en",
"permissions": [
"storage",
Expand Down
2 changes: 1 addition & 1 deletion src/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ <h3 data-locale-value="Notifications"></h3>

<label for="showThumbnailInNotifications" class="label" data-locale-value="ShowThumbnailInNotifications"></label>
<input id="showThumbnailInNotifications" type="checkbox" data-enable-parent="showDesktopNotifications" data-option-name="showThumbnailInNotifications" /><br>
<!-- @endif -->

<label for="maxNotificationsCount" class="label" data-locale-value="MaxNotificationsCount"></label>
<input id="maxNotificationsCount" type="number" data-enable-parent="showDesktopNotifications" min="1" max="100" data-option-name="maxNotificationsCount" /><br>
<!-- @endif -->

<label for="playSound" class="label" data-locale-value="PlaySound"></label>
<input id="playSound" type="checkbox" data-option-name="playSound" />
Expand Down
15 changes: 12 additions & 3 deletions src/scripts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,14 @@ chrome.notifications.onButtonClicked.addListener(function(notificationId, button
function sendDesktopNotification(feeds) {

//if notifications too many, then to show only count
if (feeds.length > appGlobal.options.maxNotificationsCount) {
let maxNotifications = appGlobal.options.maxNotificationsCount;
// @if BROWSER='firefox'
// https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/notifications/create
// If you call notifications.create() more than once in rapid succession,
// Firefox may end up not displaying any notification at all.
maxNotifications = 1;
// @endif
if (feeds.length > maxNotifications) {
//We can detect only limit count of new feeds at time, but actually count of feeds may be more
let count = feeds.length === appGlobal.options.maxNumberOfFeeds ? chrome.i18n.getMessage("many") : feeds.length.toString();

Expand Down Expand Up @@ -292,13 +299,15 @@ function sendDesktopNotification(feeds) {
type: showThumbnails && feed.thumbnail ? 'image' : 'basic',
title: feed.blog,
message: feed.title,
iconUrl: showBlogIcons ? feed.blogIcon : appGlobal.icons.defaultBig,
imageUrl: showThumbnails ? feed.thumbnail : null,
iconUrl: showBlogIcons ? feed.blogIcon : appGlobal.icons.defaultBig
// @if BROWSER!='firefox'
,imageUrl: showThumbnails ? feed.thumbnail : null,
buttons: [
{
title: chrome.i18n.getMessage("MarkAsRead")
}
]
// @endif
});

appGlobal.notifications[feed.id] = feed.url;
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ function loadOptions() {
}
}

// @if BROWSER!='firefox'
chrome.permissions.contains(optionsGlobal.allSitesPermission, function (enabled){
$("#showBlogIconInNotifications").prop("checked", enabled && items.showBlogIconInNotifications);
$("#showThumbnailInNotifications").prop("checked", enabled && items.showThumbnailInNotifications);

optionsForm.find("input").trigger("change");
});
// @endif
});
$("#header").text(chrome.i18n.getMessage("FeedlyNotifierOptions"));
$("#options").find("[data-locale-value]").each(function () {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ [email protected]:
version "1.0.2-1.2.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-1.0.2-1.2.3.tgz#b0220c02de98617433b72851cf47de3df2cdbee9"

dompurify@^0.8.7:
version "0.8.7"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-0.8.7.tgz#3cb7626f137e8e2008fe8a026352d87117fdb06b"
dompurify@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-0.9.0.tgz#470f9dd95657a644a84be1ed950677946259d055"

"esprima@~ 1.0.2":
version "1.0.4"
Expand Down Expand Up @@ -201,7 +201,7 @@ inherits@2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"

jquery@>=1.2.3, jquery@^3.1.1:
jquery@>=1.2.3, jquery@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"

Expand Down

0 comments on commit 792e81f

Please sign in to comment.