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() {
}]);
});
var initial = 0;
var a;
var skus;
chrome.extension.onMessage.addListener(function(request,sender,sendResponse){
chrome.storage.local.get('idArray',function(item) {
a = item.idArray.split(',');
});
console.log(a);
skus = request.idArray.split(',');
console.log(skus);
});
chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
var new_filename = a[initial] + ".zip";
var new_filename = skus[initial] + ".zip";
suggest({filename: new_filename});
initial++;
});
......@@ -7,6 +7,12 @@ inputButton.onclick = function(element) {
console.log("hi");
var text = document.querySelector("textarea").value.trim().split('\n');
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) {
......@@ -16,13 +22,13 @@ toGoogle.onclick = function(element) {
});
};
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if(changeInfo.url) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.storage.local.set({idArray : idArray}, function () {
console.log("set storage");
});
chrome.runtime.sendMessage(null);
});
}
});
\ No newline at end of file
// chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
// if(changeInfo.url) {
// chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
// chrome.storage.local.set({idArray : idArray}, function () {
// console.log("set storage");
// });
// chrome.runtime.sendMessage(null);
// });
// }
// });
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