Skip to content

Commit 5d0c421

Browse files
committed
2.0.3a
Signed-off-by: magicoflolis <magicoflolis@gmail.com>
1 parent 662f4be commit 5d0c421

15 files changed

Lines changed: 352 additions & 878 deletions

File tree

dist/extension/js/popup.js

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

dist/extension/js/popup.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/magic-userjs.gf.user.js

Lines changed: 68 additions & 199 deletions
Large diffs are not rendered by default.

dist/magic-userjs.user.js

Lines changed: 68 additions & 199 deletions
Large diffs are not rendered by default.

dist/ui.gf.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui.gf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/userjs-base.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ljs.addAliases({
2+
jQuery:'https://cdn.jsdelivr.net/gh/jquery/jquery/dist/jquery.slim.min.js'
3+
});

src/common/js/tools.js

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ export default {
1313
},
1414
installUserJs(uri) {
1515
let jsStr = `
16-
let evt = parent.document.createEvent('MouseEvents'),
16+
let evt = new MouseEvent("click"),
1717
link = parent.document.createElement('a');
18-
evt.initEvent('click', true, true);
1918
link.href = '${uri}'
2019
link.dispatchEvent(evt) `;
2120
brws.tabs.executeScript(null, { code: jsStr });
@@ -26,7 +25,7 @@ export default {
2625
let keys = key.split("."),
2726
v = data[keys.shift()];
2827
for (let i = 0, l = keys.length; i < l; i++) v = v[keys[i]];
29-
return typeof v !== "undefined" && v !== null ? v : "";
28+
return typeof v === "undefined" ? "" : v;
3029
});
3130
},
3231

@@ -78,17 +77,16 @@ export default {
7877
this.sessionStorage.then(bgSessionStorage => {
7978
this.host.then(host => {
8079
let data = bgSessionStorage.getItem(host),
81-
fetchJS = (api) => {
82-
fetch(api).then(r => {
83-
r.json().then(json => {
84-
json = json.map(item => {
85-
item.user = item.users[0];
86-
return item;
87-
});
88-
bgSessionStorage.setItem(host, JSON.stringify(json));
89-
callback(json);
80+
fetchJS = (url = '') => {
81+
let f = fetch(url).then(r => r.json())
82+
f.then(json => {
83+
json = json.map(item => {
84+
item.user = item.users[0];
85+
return item;
9086
});
91-
});
87+
bgSessionStorage.setItem(host, JSON.stringify(json));
88+
callback(json);
89+
})
9290
};
9391
(data) ? (data = JSON.parse(data),callback(data)) : (
9492
fetchJS(this.nano(config.api, {host: host})),
@@ -121,4 +119,16 @@ export default {
121119
nlang === "zh" ? (nlang = "zh-cn") : false;
122120
return nlang.search("zh-") === 0;
123121
}
124-
};
122+
};
123+
124+
// fetch(url).then(r => {
125+
// r.json().then(json => {
126+
// json = json.map(item => {
127+
// item.user = item.users[0];
128+
// return item;
129+
// });
130+
// console.log(JSON.stringify(json));
131+
// bgSessionStorage.setItem(host, JSON.stringify(json));
132+
// callback(json);
133+
// });
134+
// });

0 commit comments

Comments
 (0)