Skip to content

Instantly share code, notes, and snippets.

@filip505
Created December 9, 2018 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filip505/10c4dee0e2d144d919c42e119e186c55 to your computer and use it in GitHub Desktop.
Save filip505/10c4dee0e2d144d919c42e119e186c55 to your computer and use it in GitHub Desktop.
popup.js
function init() {
chrome.tabs.getSelected(null, (tab) => {
chrome.tabs.sendRequest(tab.id, { greeting: "scan", id: tab.id }, function (response) {
var node = document.createElement("div");
if (response instanceof Array) {
response.forEach(element => {
var div = document.createElement("div");
div.innerHTML = `<a href='${element}' download="video">${element}</a>`;
node.appendChild(div);
});
document.getElementById('container').appendChild(node)
}
});
})
}
window.onload = function () {
init();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment