Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
guidiego committed Aug 22, 2015
2 parents ddbd701 + 0629ea3 commit cf2a387
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
3 changes: 2 additions & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"content_scripts" : [{
"matches" : ["http://*/*", "https://*/*"],
"js": ["vendors/Sketchpad.js"],
"css": ["assets/css/master.css"]
"css": ["assets/css/master.css"],
"run_at": "document_end"
}],

"permissions": ["tabs", "activeTab", "http://*/*", "https://*/*", "webNavigation"]
Expand Down
10 changes: 2 additions & 8 deletions app/scripts/_ChromeEvents.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
var initialized = false;

chrome.browserAction.onClicked.addListener(function(tab){
var canvas = new ChromeAnnotationCanvas(),
commands = [
'document.body.innerHTML += \'' + canvas.get() + '\'',
'var sketchpad = new Sketchpad({element: document.querySelectorAll("#chrome-annotation-write-pad-id canvas")[0],width: window.innerWidth,height: window.innerHeight})',
'if(!document.getElementById("chrome-annotation-write-pad-id")) {body.innerHTML += \'' + canvas.get() + '\'',
'var sketchpad = new Sketchpad({element: document.querySelectorAll("#chrome-annotation-write-pad-id canvas")[0],width: window.innerWidth,height: window.innerHeight})}',
'document.getElementById("chrome-annotation-write-pad-id").classList.toggle("opened")'
];

if (initialized) {
commands.splice(0, 2);
}

chrome.tabs.executeScript({
code : commands.join(";")
});
Expand Down

0 comments on commit cf2a387

Please sign in to comment.