-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcsvify.js
More file actions
18 lines (18 loc) · 730 Bytes
/
Copy pathcsvify.js
File metadata and controls
18 lines (18 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(function(document) {
document.addEventListener('click', function(evt) {
if (evt.target.href && evt.target.href.match(/\.csv$/)) {
evt.preventDefault();
evt.stopPropagation();
// let's still update the browser url
// For file:/// urls window.history.pushState leads to a silent error which prevents further execution so we need to wrap in if statement
// try {
// window.history.pushState("", "", evt.target.href);
// window.addEventListener("popstate", function(e) {
// window.location.reload();
// });
// } catch(e) {}
chrome.extension.sendMessage({command: 'showCSV', url: evt.target.href}, function(response) {
});
}
});
}(document));