I obtain data through the following piece of code snippet
attend.js
var stuff = {}
for(i=1 ; i< 10; i++){
at1 =$('table')[3].children[0].children[i].children[1].innerHTML;
at =$('table')[3].children[0].children[i].children[8].innerHTML;
at = at.substr(0, at.length - 1);
console.log(parseInt(at));
stuff[i] = { };
stuff[i].course = at1;
stuff[i].attendance = at;
}
console.log(JSON.stringify(stuff, null, '\t'));
which is inside attend.js file but this file wont run on the main home page.
But my home page requires this object.
My file hierarchy:
|-scripts-|atten/attend.js
|home/main.js
Here both the scripts are in separate directories and also main.js file runs immediately when page loads, but the attend.js file runs only when we go to the specific url.
All I want is to run attend.js file immediately after main.js file is executed and store the stuff object in the main.js file to use.
Manifest.json
{
"matches": [
"*://domain.com/*/attn_report.asp*"
],
"all_frames": true,
"js": [
"scripts/jquery.min.js",
"scripts/atten/attendance.js",
"scripts/atten/attend.js"
]
},
{
"matches": [
"*://domain.com/student/stud_home.asp"
],
"all_frames": true,
"js": [
"scripts/home/main.js"
]
}