Skip to content

Commit

Permalink
make program only read local data
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleHanWei committed May 18, 2021
1 parent dc72794 commit c8ec0f8
Show file tree
Hide file tree
Showing 3 changed files with 410 additions and 6 deletions.
2 changes: 1 addition & 1 deletion chrome-extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
// 執行以下程式
chrome.tabs.executeScript(null, { file: "/static/javascripts/jquery-2.1.1.min.js" }, () => chrome.runtime.lastError);
chrome.tabs.executeScript(null, { file: "/static/javascripts/jquery.ba-replacetext.min.js" }, () => chrome.runtime.lastError);
// chrome.tabs.executeScript(null, { file: "data.js" }, () => chrome.runtime.lastError);
chrome.tabs.executeScript(null, { file: "/static/javascripts/data.js" }, () => chrome.runtime.lastError);
chrome.tabs.executeScript(null, { file: "/static/javascripts/content.js" }, () => chrome.runtime.lastError);
}
}
Expand Down
7 changes: 2 additions & 5 deletions chrome-extension/static/javascripts/content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
function translate(data) {
console.log(data);

let allKeys = Object.keys(data);
let Search_Txt = document.body.innerText;
allKeys.forEach(element => {
Expand All @@ -12,15 +10,14 @@ function translate(data) {
}

function handle() {
if(this.readyState == 4) {
console.log(this.response);

if (this.readyState == 4) {
let data = JSON.parse(this.response);
translate(data);
}
}

function init() {
translate(data);
// let xml = new XMLHttpRequest();
// xml.open('GET', 'https://lost.moli.rocks/getData');
// xml.send();
Expand Down
Loading

0 comments on commit c8ec0f8

Please sign in to comment.