Skip to content

Commit f27c6b7

Browse files
committed
V.0.1.7
1 parent 9f2bef1 commit f27c6b7

7 files changed

Lines changed: 241 additions & 142 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ try {
142142
* Automatic set multiple select field type
143143
* Radio Field Selector only name not id
144144

145+
### V.0.1.7
146+
147+
* Typewriter Effect and Set Typewriter Speed while filling data in the field
148+
* Start/Pause Application With `Alt+Q`
149+
* `FIXED:` Column Settings Model Not Open
150+
145151
### V.0.1.6
146152

147153
* `NEW:` After filling the data of field, filling the data of another field.

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fill-excel-data-to-form",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"description": "Fill Excel Sheet Data into HTML Online Forms",
55
"author": "Jeevan Lal <jeevan15498@gmail.com>",
66
"license": "MIT",
@@ -17,7 +17,7 @@
1717
"watch:dev": "cross-env HMR=true npm run build:dev -- --watch"
1818
},
1919
"dependencies": {
20-
"buefy": "^0.8.20",
20+
"buefy": "^0.9.4",
2121
"bulma-extensions": "^6.2.7",
2222
"chalk": "^4.1.0",
2323
"exceljs": "^4.1.1",

screenshot/after_fill_data-01.png

8.82 KB
Loading

src/background.js

Lines changed: 107 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,125 @@ global.browser = require('webextension-polyfill')
22
const Excel = require("exceljs"); // https://github.com/exceljs/exceljs
33
import { saveAs } from 'file-saver';
44

5-
chrome.browserAction.onClicked.addListener(function (a) {
6-
chrome.windows.getCurrent(function (a) {
7-
parentWindowId = a.id
8-
});
9-
10-
// Parse: Table ID and URL
11-
window.open(chrome.extension.getURL("popup/popup.html?tabid=" + encodeURIComponent(a.id) + "&url=" + encodeURIComponent(a.url)), "Excel Fill", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=660,height=1040,top=0,left=960")
12-
});
13-
14-
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
15-
if (changeInfo.status == "complete") {
16-
17-
// Action Page Settings
18-
var actionURLs = "objectVal__allActionSite";
19-
// Site Excel Columns
20-
var siteColumns = "objectVal__siteExcelColumns";
21-
// Excel JSON Data
22-
var excelJSONData = "objectVal__excelSheetJSONData";
23-
24-
// Get Data
25-
chrome.storage.local.get([actionURLs, excelJSONData, siteColumns], function (k) {
26-
if (k[actionURLs] !== undefined && k[actionURLs] !== null) {
27-
var url = k[actionURLs];
28-
if (url !== null && url.length > 0) {
29-
// console.log("Tab Option: ", tab)
30-
// console.log("Action URLs", url)
31-
32-
// Site Excel Column Data
33-
if (k[siteColumns] !== undefined && k[siteColumns] !== null && siteColumns.length > 0) {
34-
// Excel JSON Data
35-
if (k[excelJSONData] !== undefined && k[excelJSONData] !== null && Object.keys(k[excelJSONData]).length > 0) {
36-
var excelJSONObj = k[excelJSONData];
37-
if (excelJSONObj.obj !== undefined && excelJSONObj.obj.length > 0) {
38-
39-
// Execute Script
40-
chrome.tabs.executeScript(tabId, {
41-
file: '/script/run.js',
42-
}, function () {
43-
if (chrome.runtime.lastError) {
44-
console.error(chrome.runtime.lastError.message);
45-
}
46-
});
47-
48-
} else {
49-
console.error("Excel JSON Data Not Found!");
50-
}
5+
function checkTabURLMatch(tabId, tabURL) {
6+
7+
// Action Page Settings
8+
var actionURLs = "objectVal__allActionSite";
9+
// Site Excel Columns
10+
var siteColumns = "objectVal__siteExcelColumns";
11+
// Excel JSON Data
12+
var excelJSONData = "objectVal__excelSheetJSONData";
13+
14+
// Get Data
15+
chrome.storage.local.get([actionURLs, excelJSONData, siteColumns], function (k) {
16+
if (k[actionURLs] !== undefined && k[actionURLs] !== null) {
17+
var url = k[actionURLs];
18+
if (url !== null && url.length > 0) {
19+
20+
// console.log("Tab Option: ", tab)
21+
// console.log("Action URLs", url)
22+
23+
// Site Excel Column Data
24+
if (k[siteColumns] !== undefined && k[siteColumns] !== null && siteColumns.length > 0) {
25+
// Excel JSON Data
26+
if (k[excelJSONData] !== undefined && k[excelJSONData] !== null && Object.keys(k[excelJSONData]).length > 0) {
27+
var excelJSONObj = k[excelJSONData];
28+
if (excelJSONObj.obj !== undefined && excelJSONObj.obj.length > 0) {
29+
30+
// Execute Script
31+
chrome.tabs.executeScript(tabId, {
32+
file: '/script/run.js',
33+
}, function () {
34+
if (chrome.runtime.lastError) {
35+
console.error(chrome.runtime.lastError.message);
36+
}
37+
});
5138

5239
} else {
53-
console.error("Excel JSON Object Not Found!");
40+
console.error("Excel JSON Data Not Found!");
5441
}
5542

5643
} else {
57-
console.error("Action Site Excel Columns Data Not Found.");
44+
console.error("Excel JSON Object Not Found!");
5845
}
5946

6047
} else {
61-
console.error("Action URL Key Not Found");
48+
console.error("Action Site Excel Columns Data Not Found.");
6249
}
50+
51+
} else {
52+
console.error("Action URL Key Not Found");
53+
}
54+
} else {
55+
console.error("Action URLs Key Not Found");
56+
}
57+
});
58+
}
59+
60+
/**
61+
* If click extension icon
62+
*/
63+
chrome.browserAction.onClicked.addListener(function (a) {
64+
chrome.windows.getCurrent(function (a) {
65+
parentWindowId = a.id
66+
});
67+
68+
// Parse: Table ID and URL
69+
window.open(chrome.extension.getURL("popup/popup.html?tabid=" + encodeURIComponent(a.id) + "&url=" + encodeURIComponent(a.url)), "Excel Fill", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=660,height=1040,top=0,left=960")
70+
});
71+
72+
/**
73+
* App Status Check :: checkbox value get
74+
*/
75+
function appStatusCheck() {
76+
chrome.storage.local.get('valFillExcel_appStatus', function (budget) {
77+
if (budget.valFillExcel_appStatus === undefined) {
78+
chrome.browserAction.setIcon({ path: "icons/icon_48.png" });
79+
} else {
80+
if (budget.valFillExcel_appStatus === true) {
81+
chrome.browserAction.setIcon({ path: "icons/icon_48.png" });
6382
} else {
64-
console.error("Action URLs Key Not Found");
83+
chrome.browserAction.setIcon({ path: "icons/icon_disable.png" });
84+
}
85+
}
86+
});
87+
} appStatusCheck();
88+
89+
/**
90+
* keyboard shortcuts that trigger actions in your extension
91+
*/
92+
chrome.commands.onCommand.addListener(function (command, tab) {
93+
// console.log("TCL: command", command)
94+
// console.log("tab", tab)
95+
// console.log("tab", tab.url)
96+
97+
// Start/Pause Application
98+
if (command == "start-stop-app-excel-fill") {
99+
chrome.storage.local.get('valFillExcel_appStatus', function (budget) {
100+
if (budget.valFillExcel_appStatus === true) {
101+
chrome.storage.local.set({ 'valFillExcel_appStatus': false });
102+
}
103+
else {
104+
chrome.storage.local.set({ 'valFillExcel_appStatus': true });
105+
// Again RUN Script (Again Fill Form Data)
106+
checkTabURLMatch(tab.id, tab.url)
65107
}
108+
appStatusCheck();
66109
});
67110
}
68111
});
69112

113+
/**
114+
* Tabs
115+
*/
116+
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
117+
if (changeInfo.status == "complete") {
118+
119+
// Check URL Than RUN Script
120+
checkTabURLMatch(tab.id, tab.url)
121+
}
122+
});
123+
70124
/**
71125
* Copy Field Address
72126
*/
@@ -225,9 +279,9 @@ function onCopyElement(option, tab) {
225279
sheetDoc.getCell(cellAddress).font = { family: 4, size: 11, bold: true };
226280
// Set cell to wrap-text
227281
sheetDoc.getCell(cellAddress).alignment = { vertical: 'middle', horizontal: 'center', wrapText: true };
228-
}
282+
}
229283
}
230-
284+
231285
// Second Sheet: Second Row for field value
232286
if (field.value !== undefined) {
233287
if (typeof (field.value) === "object" && field.value.length > 0) {
@@ -250,7 +304,7 @@ function onCopyElement(option, tab) {
250304
startRow++
251305
});
252306
}
253-
307+
254308
} else {
255309
const row = sheetDoc.getRow(2);
256310
row.getCell(fieldKey).value = field.value

src/icons/icon_disable.png

1.73 KB
Loading

0 commit comments

Comments
 (0)