Skip to content
Browse files

Merge pull request #3 from 6wunderkinder/releases/1.1

(in progress) Release 1.1
  • Loading branch information...
2 parents cc5a86a + aa59188 commit 5897c3dcf2b5f9efb9dd01c7d4cdcb6ce3971796 @adamrenklint adamrenklint committed
View
3 .gitmodules
@@ -0,0 +1,3 @@
+[submodule "data/common"]
+ path = data/common
+ url = git@github.com:6wunderkinder/browser-extension-common.git
View
4 _locales/en/messages.json
@@ -1,8 +1,8 @@
{
"appDesc": {
- "message": "Wunderlist is the best way to remember websites you want to visit later, with just one click."
+ "message": "The Add to Wunderlist extension is the best way to remember websites you want to visit later, with just one click."
},
"appName": {
- "message": "Wunderlist"
+ "message": "Add to Wunderlist"
}
}
View
80 data/chrome/wunderlist-chrome.js
@@ -1,81 +1,13 @@
-(function() {
+(function (WL) {
- function buildUrl (data) {
+ // listener for menu button
+ chrome.extension.onConnect.addListener(function (rawPort) {
- var title = encodeURI(document.title);
- var note = window.location.href;
- var selection = window.getSelection().toString();
-
- if (selection) {
- note = note + "\n" + selection;
- }
-
- note = encodeURI(note);
-
- return data.config.host + '/#/extension/add/' + title + '/' + note;
- }
-
- function buildCss (options) {
-
- var transitionSpeed = options && options.transitionSpeed || 500;
- var opacity = options && options.opacity || 0;
-
- return 'border:none;height:100%;width:100%;position:fixed;z-index:99999999;top:0;left:0;opacity:' + opacity + ';display:block;-webkit-transition:opacity ' + transitionSpeed + 'ms linear;';
- }
-
- chrome.extension.onConnect.addListener(function(rawPort) {
-
- var overlayId = 'wunderlist_overlay';
var port = PortWrapper(rawPort);
+ port.on('wunderlist_clickQuickAdd', function (postData) {
- port.on('wunderlist_clickQuickAdd', function(postData) {
-
- var existing = document.getElementById(overlayId);
-
- if (!existing) {
-
- var frame = document.createElement('iframe');
-
- frame.allowtransparency = 'true';
- frame.scrolling = 'no';
- frame.id = overlayId;
- frame.name = overlayId;
-
- frame.style.cssText = buildCss();
- frame.src = buildUrl(postData);
-
- frame.onload = function () {
- frame.style.opacity = 1;
-
- setTimeout(function () {
- frame.style.cssText = buildCss({
- 'opacity': 1,
- 'transitionSpeed': 50
- });
- }, 1000);
- };
-
- document.body.appendChild(frame);
-
- var close = function close (ev) {
- if (ev.data === 'close_wunderlist') {
-
- frame.style.opacity = 0;
-
- setTimeout(function () {
- frame.src = 'about:blank';
- frame.onload = function() {
- window.removeEventListener('message', close, false);
- frame.parentNode.removeChild(frame);
- frame = null;
- };
- }, 500);
- }
- };
-
- window.addEventListener('message', close, false);
- }
+ WL.showOverlay(postData);
});
});
-}());
+})(window.WL);
1 data/common
@@ -0,0 +1 @@
+Subproject commit 6c353166a22e014f6069426a26d0e729695365c0
View
24 data/main.js
@@ -1,11 +1,6 @@
// Add manifest access to the extension
chrome.manifest = chrome.app.getDetails();
-// Plugin configuration
-var config = {
- 'host': 'https://www.wunderlist.com'
-};
-
// Trigger wunderlist_click in the content scripts,
// so that an overlay is created
var attachOverlay = function (data) {
@@ -18,11 +13,24 @@ var attachOverlay = function (data) {
};
// Fire the overlay when the browser action button is clicked
-chrome.browserAction.onClicked.addListener(function(tab) {
+chrome.browserAction.onClicked.addListener(function (tab) {
attachOverlay({
- 'tab': tab,
- 'config': config
+ 'tab': tab
});
});
+
+// context menu item
+chrome.contextMenus.create({
+
+ "title": "Add to Wunderlist",
+ "contexts": ["page", "selection", "image", "link"],
+ "onclick": function (info, tab) {
+
+ attachOverlay({
+
+ 'tab': tab
+ });
+ }
+});
View
BIN icon.png
Deleted file not rendered
View
BIN icon128.png
Deleted file not rendered
View
BIN icon16.png
Deleted file not rendered
View
BIN icon48.png
Deleted file not rendered
View
73 manifest.json
@@ -1,21 +1,64 @@
{
- "background": { "page": "app.html" },
- "browser_action": { "default_icon": "icon.png" },
- "content_scripts": [ {
- "js": [
- "data/chrome/wunderlist-chrome-port-wrapper.js",
- "data/chrome/wunderlist-chrome.js"
- ],
- "matches": [ "http://*/*", "https://*/*" ]
- }],
+ "background": {
+
+ "page": "app.html"
+ },
+
+ "browser_action": {
+
+ "default_icon": "data/common/icons/AddToWLIcon128.png"
+ },
+
+ "content_scripts": [ {
+
+ "js": [
+
+ "data/common/libs/jquery.min.js",
+
+ "data/common/WL.js",
+ "data/common/Overlay.js",
+ "data/common/Scrapers.js",
+ "data/common/Injectors.js",
+
+ "data/chrome/wunderlist-chrome-port-wrapper.js",
+ "data/chrome/wunderlist-chrome.js"
+ ],
+
+ "css": [
+
+ "data/common/css/styles.css"
+ ],
+
+ "matches": [
+
+ "http://*/*",
+ "https://*/*"
+ ]
+ }],
+
"default_locale": "en",
+
"description": "__MSG_appDesc__",
- "content_security_policy": "script-src 'self' https://www.wunderlist.com; object-src 'self'",
+
+ // "content_security_policy": "script-src 'self' https://www.wunderlist.com; object-src 'self'",
+ "content_security_policy": "script-src 'self' http://localhost:5000; object-src 'self'",
+
"manifest_version": 2,
+
"name": "__MSG_appName__",
- "permissions": [ "tabs", "http://*/*", "contextMenus" ],
- "version": "1.0",
- "icons": { "16": "icon16.png",
- "48": "icon48.png",
- "128": "icon128.png" }
+
+ "permissions": [
+ "tabs",
+ "http://*/*",
+ "contextMenus"
+ ],
+
+ "version": "1.1",
+
+ "icons": {
+
+ "16": "data/common/icons/AddToWLIcon16.png",
+ "48": "data/common/icons/AddToWLIcon48.png",
+ "128": "data/common/icons/AddToWLIcon128.png"
+ }
}

0 comments on commit 5897c3d

Please sign in to comment.
Something went wrong with that request. Please try again.