Permalink
Browse files

Fixing the edit extension

  • Loading branch information...
1 parent 8dc9fd3 commit c98b4e438fde12eca7cfed30aa83e7305211af11 Paul Kinlan committed Aug 20, 2012
@@ -1,27 +0,0 @@
-<script>
- function clickHandler(info, tab) {
- if(info.mediaType == "image" ||
- info.mediaType == "video" ||
- info.mediaType == "audio") {
- var i = new WebKitIntent({"action": "http://webintents.org/edit", "type": info.mediaType + "/*", "data": info.linkUrl });
-
- chrome.tabs.sendRequest(tab.id, i);
- }
- else if(!!info.linkUrl) {
- var i = new WebKitIntent({"action": "http://webintents.org/edit", "type": "text/uri-list", "data": info.linkUrl });
- window.navigator.webkitStartActivity(i, function() {}, function() {});
- }
- };
-
- chrome.browserAction.onClicked.addListener(function(tab) {
- clickHandler({linkUrl: tab.url}, tab);
- });
-
- chrome.contextMenus.create({
- "title" : "Edit",
- "type" : "normal",
- "contexts" : ["image", "video", "audio"],
- "onclick" : clickHandler
- });
-
-</script>
@@ -0,0 +1,24 @@
+function clickHandler(info, tab) {
+ if(info.mediaType == "image" ||
+ info.mediaType == "video" ||
+ info.mediaType == "audio") {
+ var i = new WebKitIntent({"action": "http://webintents.org/edit", "type": info.mediaType + "/*", "data": info.linkUrl });
+
+ window.navigator.webkitStartActivity(i, function() {}, function() {});
+ }
+ else if(!!info.linkUrl) {
+ var i = new WebKitIntent({"action": "http://webintents.org/edit", "type": "text/uri-list", "data": info.linkUrl });
+ window.navigator.webkitStartActivity(i, function() {}, function() {});
+ }
+};
+
+chrome.browserAction.onClicked.addListener(function(tab) {
+ clickHandler({linkUrl: tab.url}, tab);
+});
+
+chrome.contextMenus.create({
+ "title" : "Edit",
+ "type" : "normal",
+ "contexts" : ["image", "video", "audio"],
+ "onclick" : clickHandler
+});
@@ -1,6 +1,7 @@
{
"name": "Edit",
"description" : "Edit images, and links",
+ "manifest_version": 2,
"permissions": [
"contextMenus"
],
@@ -10,14 +11,11 @@
"128": "edit128.png"
},
"permissions" : [
- "http://*/*", "https://*/*", "contextMenus"
- ],
- "content_scripts": [
- {
- "matches" : ["http://*/*", "https://*/*"],
- "js" : ["webintents.js", "startActivity.js"]
- }
+ "contextMenus"
],
"version": "0.0.0.2",
- "background_page": "background.html"
+ "minimum_chrome_version": "23.0.0.0",
+ "background": {
+ "scripts": ["background.js"]
+ }
}

0 comments on commit c98b4e4

Please sign in to comment.