Browse files

Fixing the issue with sharing not working

  • Loading branch information...
1 parent d213df4 commit d03c93b504960e42094295299b5ed66f34958477 Paul Kinlan committed Aug 23, 2012
Showing with 12 additions and 10 deletions.
  1. +11 −9 tools/chrome/extensions/share/background.js
  2. +1 −1 tools/chrome/extensions/share/manifest.json
View
20 tools/chrome/extensions/share/background.js
@@ -1,49 +1,51 @@
function clickHandler(info, tab) {
var type = (info.mediaType) ? info.mediaType + "/*" : "text/uri-list" ;
+ var url = (info.mediaType) ? info.srcUrl : info.linkUrl;
var data = {
- "via": "Chrome Share extension",
- "url": info.linkUrl,
+ "via": tab.pageUrl,
+ "content-type": type,
+ "url": url
};
- var i = new WebKitIntent({"action": "http://webintents.org/share", "type": type, "data": data });
+ var i = new WebKitIntent({"action": "http://webintents.org/share", "type": "text/uri-list", "data": data });
window.navigator.webkitStartActivity(i, function() {}, function() {});
};
chrome.browserAction.onClicked.addListener(function(tab) {
- clickHandler({linkUrl: tab.url}, tab);
+ clickHandler({linkUrl: tab.url, pageUrl: tab.url}, tab);
});
chrome.contextMenus.create({
- "title" : "Share Link",
+ "title" : "Share link",
"type" : "normal",
"contexts" : ["link"],
"onclick" : clickHandler
});
chrome.contextMenus.create({
- "title" : "Share Image",
+ "title" : "Share link to image",
"type" : "normal",
"contexts" : ["image"],
"onclick" : clickHandler
});
chrome.contextMenus.create({
- "title" : "Share Page",
+ "title" : "Share link to page",
"type" : "normal",
"contexts" : ["page"],
"onclick" : clickHandler
});
chrome.contextMenus.create({
- "title" : "Share Video",
+ "title" : "Share link video",
"type" : "normal",
"contexts" : ["video"],
"onclick" : clickHandler
});
chrome.contextMenus.create({
- "title" : "Share Audio",
+ "title" : "Share link to audio",
"type" : "normal",
"contexts" : ["audio"],
"onclick" : clickHandler
View
2 tools/chrome/extensions/share/manifest.json
@@ -17,7 +17,7 @@
"permissions" : [
"contextMenus"
],
- "version": "0.0.0.4",
+ "version": "2012.108.123.10910",
"minimum_chrome_version": "23.0.0.0",
"background": {
"scripts": ["background.js"]

0 comments on commit d03c93b

Please sign in to comment.