Commit ac688d64 authored by joetsuihk's avatar joetsuihk

Merge branch 'development' into 'master'

Should be usable by macOS

See merge request !2
parents fce4e9b4 92f1725e
...@@ -10,17 +10,15 @@ chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { ...@@ -10,17 +10,15 @@ chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
}]); }]);
}); });
var initial = 0; var initial = 0;
var a; var skus;
chrome.extension.onMessage.addListener(function(request,sender,sendResponse){ chrome.extension.onMessage.addListener(function(request,sender,sendResponse){
chrome.storage.local.get('idArray',function(item) { skus = request.idArray.split(',');
a = item.idArray.split(','); console.log(skus);
});
console.log(a);
}); });
chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) { chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
var new_filename = a[initial] + ".zip"; var new_filename = skus[initial] + ".zip";
suggest({filename: new_filename}); suggest({filename: new_filename});
initial++; initial++;
}); });
...@@ -7,6 +7,12 @@ inputButton.onclick = function(element) { ...@@ -7,6 +7,12 @@ inputButton.onclick = function(element) {
console.log("hi"); console.log("hi");
var text = document.querySelector("textarea").value.trim().split('\n'); var text = document.querySelector("textarea").value.trim().split('\n');
idArray = text.join(','); idArray = text.join(',');
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.storage.local.set({idArray : idArray}, function () {
console.log("set storage");
});
chrome.runtime.sendMessage({idArray: idArray});
});
} }
toGoogle.onclick = function(element) { toGoogle.onclick = function(element) {
...@@ -16,13 +22,13 @@ toGoogle.onclick = function(element) { ...@@ -16,13 +22,13 @@ toGoogle.onclick = function(element) {
}); });
}; };
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { // chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if(changeInfo.url) { // if(changeInfo.url) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { // chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.storage.local.set({idArray : idArray}, function () { // chrome.storage.local.set({idArray : idArray}, function () {
console.log("set storage"); // console.log("set storage");
}); // });
chrome.runtime.sendMessage(null); // chrome.runtime.sendMessage(null);
}); // });
} // }
}); // });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment