Created
September 14, 2020 06:34
-
-
Save lolobosse/2d0f825af0e60e905f2fcfb5c92c4d1e to your computer and use it in GitHub Desktop.
This file contains 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
// var app = chrome.runtime.getBackgroundPage(); | |
document.addEventListener('DOMContentLoaded', function () { | |
debugger; | |
console.log("the doc loaded") | |
var form = document.getElementById("form") | |
console.log(form) | |
form.addEventListener('submit', function (e) { | |
e.preventDefault() | |
console.log("added to the form") | |
var rnr = parseInt(document.getElementById('rnr').value) | |
console.log(rnr); | |
chrome.storage.sync.set({rnr}, function () { | |
console.log('Has been set') | |
concatenateInjections(["jquery-3.5.1.min.js", | |
"jspdf.min.js", | |
"jspdf.plugin.autotable.js", | |
"moment-with-locales.min.js"], | |
'alert.js') | |
}) | |
}) | |
}); | |
function concatenateInjections(ar, scrpt) { | |
var i = ar.length; | |
var idx = 0; | |
function inject(idx) { | |
idx++; | |
if (idx <= i) { | |
var f = ar[idx - 1]; | |
chrome.tabs.executeScript({file: f}, function () { | |
inject(idx); | |
}); | |
} else { | |
if (typeof scrpt === 'undefined') return; | |
chrome.tabs.executeScript({file: scrpt}); | |
} | |
} | |
inject(idx); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment