Screenshot
Source
Components- manifest.json
- popup.html
- popup.js
- icon.png
// manifest.json { "name": "Mosne Share", "version": "1.0", "description": "social networks sharing tool.", "permissions": [ "tabs", "http://*/*", "https://*/*" ], "browser_action": { "default_title": "Share this!", "default_icon": "icon.png", "default_popup": "popup.html" }, "icons": { "48": "icon48.png", "128": "icon128.png" }, "manifest_version": 2 }
<!-- popup.html --> <!doctype html> <html> <head> <title>Mosne Share</title> <style> body{overflow:hidden;margin:0px;padding:0px;background:white;} div:first-child{margin-top:0px;} div{cursor:pointer;text-align:center;padding:10px 20px;font-family:sans-serif;font-weight:bold;text-transform:uppercase;letter-spacing:1px;font-size:0.8em;width:100px;margin-top:1px;background:#cccccc;color:white;} #google{background:red;} #google{background:#FF6D77;} #banana{background:#43A4A5;} #eureka{background:#D3C9AA;} #facebook{background:#2E579A;} #twitter{background:#FEB679;} #pin{background:#C04475;} div:hover{background:#333!important;cursor:pointer;} </style> <script src="popup.js"></script> </head> <body> <div id="banana">Banana</div> <div id="eureka">Eureka</div> <div id="twitter">Twitter</div> <div id="google">Google+</div> <div id="pin">Pinterest</div> <div id="facebook">Facebook</div> <input type="hidden" id="url" name="url" value=""> <input type="hidden" id="title" name="title" value=""> </body> </html>
// popup.js chrome.tabs.getSelected(null, function(tab) { document.getElementById('url').value = tab.url; document.getElementById('title').value = tab.title; }); function click(e) { var what= e.target.id; switch (what){ case "banana": chrome.tabs.create({ 'url':'http://www.mosne.it/community/banana/index.php?url='+encodeURI(url.value), 'selected':true }); break; case "eureka": chrome.tabs.create({ 'url':'http://www.mosne.it/community/eureka/index.php?url='+encodeURI(url.value), 'selected':true }); break; case "twitter": chrome.tabs.create({ 'url':'https://twitter.com/intent/tweet?source=webclient&text='+encodeURI(title.value+' - '+url.value), 'selected':true }); break; case "google": chrome.tabs.create({ 'url':'https://plus.google.com/share?url='+encodeURI(url.value), 'selected':true }); break; case "facebook": chrome.tabs.create({ 'url':'http://www.facebook.com/sharer/sharer.php?u=='+encodeURI(url.value), 'selected':true }); break; case "pin": chrome.tabs.executeScript(null,{code:"void((function(){var e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)})());"}); break; } window.close(); } document.addEventListener('DOMContentLoaded', function () { var divs = document.querySelectorAll('div'); for (var i = 0; i < divs.length; i++) { divs[i].addEventListener('click', click); } });
Tools
Download
this project is under GNU General Public License