From 4daa3d5d81e1b48920df15aaaf96da12fef635a2 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 9 Sep 2016 01:13:40 +0200 Subject: [PATCH] v1.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • change font to systems default font • add warning when no services activated • add credits in Options page • improve extension description • add other omnibox command keywords --- README.md | 12 ++++++++++++ _locales/en/messages.json | 5 ++++- _locales/fr/messages.json | 5 ++++- manifest.json | 4 ++-- options.html | 8 ++++++++ scripts/bg.js | 27 +++++++++++++-------------- scripts/share.js | 21 +++++++++++++++++++-- share.html | 2 ++ styles/global.css | 6 +++++- styles/options.css | 6 ++++++ 10 files changed, 75 insertions(+), 21 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..65d7656 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# ![SimpleShare](https://raw.githubusercontent.com/Devenet/SimpleShare/master/images/icon-19.png) Simple Share + +Chrome extension to Simple Share your current tab by email, to your social networks or your Shaarli! + +> Add a “Simple Share” button to share your current tab to your social networks (Facebook, Twitter), to a friend by email or to your Shaarli. +You can customize the extension to enable only services you want :) + +> Use the Omnibox for directly share the page with the keyword “share”. + +*** + +Your help is welcome to translate the extension in other languages :) \ No newline at end of file diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 4b6e874..b809551 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1,6 +1,6 @@ { "extension_description": { - "message": "Simple share the URL of your current tab by email, to social networks or to your Shaarli!", + "message": "Simple share your current tab by email, to your social networks or your Shaarli!", "description": "Extension description." }, "browser_action_title": { @@ -30,6 +30,9 @@ "share_unknow_command": { "message": "Unknow command!" }, + "share_services_disabled": { + "message": "No services activated :(" + }, "settings_name": { "message": "Options", diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 94b5bb3..c8b7740 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -1,6 +1,6 @@ { "extension_description": { - "message": "Partager simplement l’URL de votre page actuelle par email, sur vos réseaux sociaux ou sur votre Shaarli !", + "message": "Partager simplement votre onglet courant par email, sur vos réseaux sociaux ou sur votre Shaarli !", "description": "Extension description" }, "browser_action_title": { @@ -16,6 +16,9 @@ "share_unknow_command": { "message": "Commande inconnue !" }, + "share_services_disabled": { + "message": "Aucun service activé :(" + }, "settings_services": { "message": "Services" diff --git a/manifest.json b/manifest.json index d7dd443..d8a74d8 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "Simple Share", "short_name": "Share", - "version": "0.0.4", + "version": "1.0.0", "icons": { "16": "images/icon-16.png", @@ -29,7 +29,7 @@ }, "author": "Nicolas Devenet", - "homepage_url": "http://simpleshare.chrome.devenet.info", + "homepage_url": "https://github.com/Devenet/SimpleShare", "options_page": "options.html", "omnibox": { "keyword" : "share" }, diff --git a/options.html b/options.html index 0f26593..a7b3012 100644 --- a/options.html +++ b/options.html @@ -63,6 +63,14 @@

+ +
+

Credits

+

This extension was made with ♥ by Nicolas Devenet. Enjoy :) +
Feel free to improve it on Github.

+
+ + diff --git a/scripts/bg.js b/scripts/bg.js index 91b3c18..8599ba2 100644 --- a/scripts/bg.js +++ b/scripts/bg.js @@ -2,20 +2,18 @@ var items = { email:1, facebook:0, shaarli:0, twitter:1 }; items = !localStorage['settings.share.items'] ? items : JSON.parse(localStorage['settings.share.items']); var suggests = []; for (var item in items) { - if (items[item]) { + if (items[item] || item == 'facebook' || item == 'twitter' || item == 'email') { suggests.push({ content: item, description: item + ' ‣ ' + chrome.i18n.getMessage('share_' + item) }); } } chrome.omnibox.onInputChanged.addListener(function(text, suggest) { - if (items.email) { - var c = /email\s+.*/i.test(text) ? text : 'email ' + text; - var d = 'email ‣ ' + chrome.i18n.getMessage('share_email') - + ( text.length > 0 ? ' ' + chrome.i18n.getMessage('global_to') + ' ' + text : ''); - - suggests[0] = { content: c, description: d }; - } + var c = /email\s+.*/i.test(text) ? text : 'email ' + text; + var d = 'email ‣ ' + chrome.i18n.getMessage('share_email') + + ( text.length > 0 ? ' ' + chrome.i18n.getMessage('global_to') + ' ' + text : ''); + suggests[0] = { content: c, description: d }; + suggest(suggests); }); @@ -47,7 +45,7 @@ chrome.omnibox.onInputEntered.addListener(function(text) { } else { chrome.tabs.create({url: result}); } } - else { alert(chrome.i18n.getMessage('share_unknow_command')); } + else if (result === null) {alert(chrome.i18n.getMessage('share_unknow_command')); } }); }); @@ -57,26 +55,27 @@ function buildShareURL(method, url, title) { switch(method) { case 'shaarli': if (!localStorage['settings.shaarli.url']) { - var share_msg = document.getElementById('share-msg'); - share_msg.innerHTML = '

' + chrome.i18n.getMessage('share_shaarli_missing_url') + ' ‣ ' + chrome.i18n.getMessage('settings_name') + '

'; - break; + alert(chrome.i18n.getMessage('share_shaarli_missing_url')); + return false; } result = localStorage['settings.shaarli.url'] + '/?post=' + encodeURI(url) + '&title=' + encodeURI(title); break; case 'email': + case 'mail': + case 'courriel': result = 'mailto:?' + 'subject=' + encodeURI(title) + '&body=' + encodeURI(url); break; case 'twitter': + case 'twr': result = 'https://twitter.com/intent/tweet' + '?text=' + encodeURI(title) + '&url=' + encodeURI(url); break; case 'facebook': + case 'fb': result = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURI(url) + '&t=' + encodeURI(title); break; diff --git a/scripts/share.js b/scripts/share.js index d495cd4..28a7e28 100644 --- a/scripts/share.js +++ b/scripts/share.js @@ -30,7 +30,7 @@ for (var i=0, l=links.length; i' + + chrome.i18n.getMessage('settings_name') + ''; +} +else { + document.getElementById('services_disabled').style.display = 'none'; +} + function buildShareURL(method, url, title) { var result = null; switch(method) { case 'shaarli': if (!localStorage['settings.shaarli.url']) { var share_msg = document.getElementById('share-msg'); - share_msg.innerHTML = '

' + chrome.i18n.getMessage('share_shaarli_missing_url') + ' ‣ ' + chrome.i18n.getMessage('share_shaarli_missing_url') + ' ‣ ' + chrome.i18n.getMessage('settings_name') + '

'; break; @@ -70,4 +81,10 @@ function buildShareURL(method, url, title) { break; } return result; +} + +function count_services(items) { + total = 0; + for (var property in items) { total += items[property]; } + return total; } \ No newline at end of file diff --git a/share.html b/share.html index 1eaa081..c7fe2b2 100644 --- a/share.html +++ b/share.html @@ -13,6 +13,8 @@
  • + +

    diff --git a/styles/global.css b/styles/global.css index 381202c..7180214 100644 --- a/styles/global.css +++ b/styles/global.css @@ -1,4 +1,7 @@ -body { width: 200px; } +body { + width: 200px; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif; +} ul { padding: 0; margin: 0; @@ -36,6 +39,7 @@ input:focus, input:active { .espace-top { margin-top: 20px; } .espace-top-lg { margin-top: 40px; } +.espace-top-xs { margin-top: 5px; } .bg-fb { background-color: #3b5998; } .bg-fb:hover { background-color: #6d84b4; } diff --git a/styles/options.css b/styles/options.css index 4952fd7..3924f8c 100644 --- a/styles/options.css +++ b/styles/options.css @@ -34,4 +34,10 @@ h3 { margin: 20px 0 10px; border-bottom: 4px solid #efefef; padding-bottom: 5px; +} + +.credits { color: #888; } +.credits h3 { + border-bottom: 2px solid #efefef; + font-weight: normal; } \ No newline at end of file