Created
December 9, 2018 15:33
-
-
Save filip505/10c4dee0e2d144d919c42e119e186c55 to your computer and use it in GitHub Desktop.
popup.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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