Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported extension to the W3C Web Extensions API to support Firefox, Chrome, and more #43

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9b95fa7
Updated npm packages and fixed issue where Feedly changed class name …
churchs19 Jul 21, 2016
8d26c79
Merge remote-tracking branch 'Muffo/master'
Oct 24, 2016
242279b
Merge remote-tracking branch 'Muffo/master'
churchs19 Oct 24, 2016
ade0439
Updated Spin.js to use Bower
churchs19 Oct 24, 2016
1fb0759
Updated Spin.js to use Bower
Oct 24, 2016
32cce0f
Article image formatting fix
churchs19 Oct 24, 2016
db4af48
Article image formatting fix
Oct 24, 2016
ee6ebc2
Merge branch 'full-article-image-fix' into develop
churchs19 Oct 24, 2016
cdcaf6a
Fixed bug causing formatting with other Feedly elements
churchs19 Oct 24, 2016
e030be2
Fixed bug causing formatting with other Feedly elements
Oct 24, 2016
3c6bd51
Merge remote-tracking branch 'origin/develop' into full-article-image…
churchs19 Oct 24, 2016
e1c0224
Merge remote-tracking branch 'origin/full-article-image-fix' into ful…
churchs19 Oct 24, 2016
e197902
Merge remote-tracking branch 'origin/master'
churchs19 Oct 24, 2016
f7034dc
Merge branch 'spinjs-bower' into develop
churchs19 Oct 24, 2016
94de8b5
Merge remote-tracking branch 'Muffo/develop' into develop
churchs19 Oct 29, 2016
401b670
Merge remote-tracking branch 'Muffo/master'
churchs19 Oct 29, 2016
fba5f9b
Merge remote-tracking branch 'Muffo/master' into develop
churchs19 Nov 2, 2016
df8e798
Merge branch 'release/0.9.0' into develop
Muffo Nov 5, 2016
0b269e0
Merge muffo/fullyfeedly/develop
churchs19 Nov 7, 2016
dad108c
Merge commit 'a230c07991c8f71e58930d7aec2c2c90267dd535'
churchs19 Nov 7, 2016
3bffb71
Merge branch 'hotfix/0.9.1' into develop
Muffo Nov 14, 2016
9e55e6e
Merge remote-tracking branch 'refs/remotes/Muffo/master' into develop
churchs19 Nov 15, 2016
0c7bb31
Merge branch 'develop' of https://github.com/churchs19/fullyfeedly in…
churchs19 Nov 15, 2016
7314929
Merge branch 'hotfix/0.9.2' into develop
Muffo Nov 19, 2016
d320afb
Merge remote-tracking branch 'refs/remotes/Muffo/develop' into develop
churchs19 Nov 20, 2016
03bfcdc
Merge remote-tracking branch 'refs/remotes/Muffo/master'
churchs19 Nov 20, 2016
71fc5e1
Added bottom margin to Readability migration warning for aesthetics
churchs19 Nov 21, 2016
abb1f89
Merge remote-tracking branch 'Muffo/master'
churchs19 Dec 23, 2016
ea7d184
Merge branch 'master' into develop
churchs19 Dec 23, 2016
f5af8c1
Merge branch 'master' of https://github.com/Muffo/fullyfeedly
churchs19 Sep 26, 2017
fd78cf0
Merge branch 'master' into develop
churchs19 Sep 26, 2017
da0a1f7
In-progress porting to web-extensions API
churchs19 Nov 8, 2017
83f2989
Completed port to Web Extensions API
churchs19 Dec 4, 2017
7f721d6
Updated extension with polyfill to support Chrome as well as Firefox
churchs19 Dec 7, 2017
5df5b9c
Updated build number for addons.mozilla.org
churchs19 Dec 11, 2017
4c83f4d
Updated Mercury API URL
churchs19 Apr 8, 2019
11415a9
Updated documentation
churchs19 Apr 8, 2019
c9989c2
Updated Version
churchs19 Apr 8, 2019
77da5de
Updated to 1.1.2 for resubmission to Mozilla
churchs19 Oct 31, 2019
0f78856
Update package.json
churchs19 Oct 31, 2019
1fe0128
Version 1.1.3 for Mozilla submission
churchs19 Oct 31, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"trailing": true,
"smarttabs": true,
"globals" : {
"chrome": true
"chrome": true,
"browser": true
}
}
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 4,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool! I heard of this project but never had a chance to use it.

Does it actually re-format all the source files based on the style specified here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if you run it at the command line on the project. There's also a great Visual Studio Code extension for it at https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode. It's great for making sure all of the files are formatted consistently.

"singleQuote": true,
"trailingComma": "none"
}
3 changes: 1 addition & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ module.exports = function (grunt) {
dest: '<%= config.dist %>'
},
html: [
'<%= config.app %>/popup.html',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! I didn't realize this file was still there

'<%= config.app %>/options.html'
]
},
Expand Down Expand Up @@ -240,7 +239,7 @@ module.exports = function (grunt) {
'{,*/}*.html',
'styles/{,*/}*.css',
'styles/fonts/{,*/}*.*',
'_locales/{,*/}*.json',
'_locales/{,*/}*.json'
]
}]
}
Expand Down
29 changes: 16 additions & 13 deletions app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
{
"name": "__MSG_appName__",
"version": "0.10.0",
"version": "1.0.2",
"manifest_version": 2,
"description": "__MSG_appDescription__",
"icons": {
"16": "images/icon-16.png",
"128": "images/icon-128.png"
},
"applications": {
"gecko": {
"id": "addon@fullyfeedly"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is it required to package the application for Firefox?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more necessary to debug the application in Firefox since the local storage API requires the application ID to function. It's also required for publishing the extension to addons.firefox.com.

}
},
"default_locale": "en",
"background": {
"scripts": [
"scripts/chromereload.js",
"scripts/background.js"
],
"persistent": false
"scripts": ["scripts/chromereload.js", "scripts/browser-polyfill.js", "scripts/background.js"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is polyfill used to provide backward compatibility to certain browsers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The polyfill is used to provide compatibility for browsers that implement the chrome.* APIs but not the replacement browser.* APIs (i.e. Chromium-based browsers). Browser.* support is coming in Chromium, but it's not available yet, so this enables the same code to work across browsers.

},
"page_action": {
"browser_style": true,
"default_icon": {
"19": "images/icon-19.png",
"38": "images/icon-38.png"
},
"default_title": "fullyfeedly"
"default_title": "Fully Feedly"
},
"content_scripts": [
{
"matches": [
"*://*.feedly.com/*"
],
"matches": ["*://*.feedly.com/*"],
"js": [
"bower_components/spin.js/spin.js",
"bower_components/iosoverlay/js/iosOverlay.js",
"bower_components/mousetrap/mousetrap.js",
"scripts/browser-polyfill.js",
"scripts/content.js"
],
"css": [
Expand All @@ -45,11 +46,13 @@
"options.html"
],
"permissions": [
"declarativeContent",
"activeTab",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is activeTab Chrome specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not, however Chrome and Firefox implement the permission differently. ActiveTab in Firefox doesn't give you access to the URL while it does in Chrome. Tabs gives access to the URL in both.

"tabs",
"storage",
"*://*.feedly.com/*",
"https://boilerpipe-web.appspot.com/*",
"https://mercury.postlight.com/*"
],
"options_page": "options.html"
"options_ui": {
"page": "options.html"
}
}
9 changes: 8 additions & 1 deletion app/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ <h1 data-message="appName">FullyFeedly</h1>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<hr/>
<p style="text-align: right"><span data-message="optionsDevelopedBy">Developed by</span>
<p style="text-align: right"><span data-message="optionsDevelopedBy">Originally developed by</span>
<a href="http://linkedin.com/in/andreagrandi87">
<img src="images/linkedin_btn_20x15.png"/>Andrea Grandi
</a>
</p>
<p style="text-align: right"><span data-message="optionsDevelopedBy">Ported to Web Extensions API by</span>
<a href="http://linkedin.com/in/shanechurch">
<img src="images/linkedin_btn_20x15.png"/>Shane Church
</a>
</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -103,6 +108,8 @@ <h4 data-message="optionsMercuryStepTwo">2. Get your API key </h4>
<!-- endbower -->
<!-- endbuild -->

<script src="scripts/browser-polyfill.js"></script>

<!-- build:js scripts/options.js -->
<script src="scripts/options.js"></script>
<!-- endbuild -->
Expand Down
28 changes: 0 additions & 28 deletions app/popup.html

This file was deleted.

73 changes: 48 additions & 25 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,67 @@
'use strict';

chrome.runtime.onInstalled.addListener(function (details) {
console.log('FullyFeedly installed: previousVersion', details.previousVersion);
browser.runtime.onInstalled.addListener(function(details) {
console.log(
'FullyFeedly installed: previousVersion',
details.previousVersion
);
});


function printResponse(response) {
console.log('Content response:\n' + response);
}

/* Regex-pattern to check URLs against.
/* Regex-pattern to check URLs against.
It matches URLs like: http[s]://[...]feedly.com[...] */
var urlRegex = /^https?:\/\/(?:[^\.]+\.)?feedly\.com/;
var urlRegex = /^https?:\/\/(?:[^.]+\.)?feedly\.com/;

browser.tabs.onUpdated.addListener(function(tabId, changeInfo) {
if (!changeInfo.url) {
return;
}
if (urlRegex.test(changeInfo.url)) {
browser.pageAction.show(tabId);
} else {
browser.pageAction.hide(tabId);
}
});

// When the browser-action button is clicked...
chrome.pageAction.onClicked.addListener(function(tab) {
browser.pageAction.onClicked.addListener(function(tab) {
// ...check the URL of the active tab against our pattern and...
if (urlRegex.test(tab.url)) {
// ...if it matches, send a message specifying a callback too
chrome.tabs.sendMessage(tab.id, { text: 'extract_article' }, printResponse);
// ...if it matches, send a message specifying a callback too
browser.tabs
.sendMessage(tab.id, { text: 'extract_article' })
.then(printResponse);
}
});

// When the extension is installed or upgraded ...
chrome.runtime.onInstalled.addListener(function() {
// Replace all rules ...
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
// With a new rule ...
chrome.declarativeContent.onPageChanged.addRules([
{
// That fires when a page's URL contains a 'feedly.com' ...
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { urlContains: 'feedly.com' },
})
],
// And shows the extension's page action.
actions: [ new chrome.declarativeContent.ShowPageAction() ]
}
]);
browser.runtime.onMessage.addListener(function(message, sender) {
return new Promise(function(resolve, reject) {
if (message.hasOwnProperty('optionsUpdated')) {
browser.tabs
.query({
url: '*://*.feedly.com/*'
})
.then(function(tabs) {
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[i];
browser.tabs
.sendMessage(tab.id, {
reloadOptions: true
})
.then(function() {});
}
})
.catch(function(error) {
console.log(
'[FullyFeedly] Error reloading options on tabs: ',
error
);
});
}
resolve('done');
});
});

Expand Down
Loading