Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7b14c32

Browse files
Merge pull request #17 from HoangTran0410/dev
Fix all click content script, optimize autorun scripts
2 parents ab1c790 + 9db6c7c commit 7b14c32

File tree

7 files changed

+66
-45
lines changed

7 files changed

+66
-45
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Donate? Muốn hỗ trợ mình 1 ly cafe <3 [Donate here](https://github.com/Ho
88

99
## Lịch sử cập nhật
1010

11-
Verion hiện tại: <del>v1.1</del> <del>v1.2</del> <del>v1.3</del> <del>v1.4</del> <del>v1.5</del> <del>v1.6</del> **v1.64-hotfix** (03/04/2024)
11+
Verion hiện tại: <del>v1.1</del> <del>v1.2</del> <del>v1.3</del> <del>v1.4</del> <del>v1.5</del> <del>v1.6</del> <del>v1.64-hotfix</del> **v1.65-hotfix** (08/04/2024)
1212

1313
[Lịch sử cập nhật](/md/CHANGELOGS.md)
1414

‎manifest.json‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 3,
33
"name": "Useful Scripts",
44
"description": "Scripts that can make your life faster and better",
5-
"version": "1.64",
5+
"version": "1.65",
66
"icons": {
77
"16": "./assets/icon16.png",
88
"32": "./assets/icon32.png",
@@ -33,7 +33,8 @@
3333
"run_at": "document_start",
3434
"world": "ISOLATED",
3535
"match_origin_as_fallback": true,
36-
"match_about_blank": true
36+
"match_about_blank": true,
37+
"all_frames": true
3738
},
3839
{
3940
"matches": ["<all_urls>"],
@@ -44,23 +45,26 @@
4445
"run_at": "document_start",
4546
"world": "MAIN",
4647
"match_origin_as_fallback": true,
47-
"match_about_blank": true
48+
"match_about_blank": true,
49+
"all_frames": true
4850
},
4951
{
5052
"matches": ["<all_urls>"],
5153
"js": ["scripts/content-scripts/document_idle.js"],
5254
"run_at": "document_idle",
5355
"world": "MAIN",
5456
"match_origin_as_fallback": true,
55-
"match_about_blank": true
57+
"match_about_blank": true,
58+
"all_frames": true
5659
},
5760
{
5861
"matches": ["<all_urls>"],
5962
"js": ["scripts/content-scripts/document_end.js"],
6063
"run_at": "document_end",
6164
"world": "MAIN",
6265
"match_origin_as_fallback": true,
63-
"match_about_blank": true
66+
"match_about_blank": true,
67+
"all_frames": true
6468
}
6569
],
6670
"web_accessible_resources": [

‎md/CHANGELOGS.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
## Change logs
22

3+
<details>
4+
<summary>v1564-hotfix - 08/04/2024</summary>
5+
6+
Fix các chức năng tự động chạy
7+
8+
Optimize scripts autorun
9+
10+
Bữa 03/04 fix chưa hết :(
11+
12+
[Tất cả Chức năng](./LIST_SCRIPTS_VI.md)
13+
14+
</details>
15+
316
<details>
417
<summary>v1.64-hotfix - 03/04/2024</summary>
518

‎scripts/content-scripts/run_scripts.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
runScripts(ids, detail.event, path);
1717
});
1818

19-
const data = await UsefulScriptGlobalPageContext.Extension.getActiveScripts();
19+
const data =
20+
await UsefulScriptGlobalPageContext?.Extension?.getActiveScripts?.();
2021
console.log(data);
2122
ids = data?.ids?.split(",") || [];
2223
path = data?.path || "";

‎scripts/search_userscript.js‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
2-
icon: "https://www.tampermonkey.net/favicon.ico",
2+
icon: "https://www.userscript.zone/favicon.ico",
33
name: {
44
en: "Search Userscripts",
55
vi: "Tìm Userscripts",
@@ -10,9 +10,6 @@ export default {
1010
},
1111

1212
onClickExtension: function () {
13-
let search = prompt("Search for Userscripts:", "");
14-
if (search != null) {
15-
window.open("https://www.userscript.zone/search?q=" + search);
16-
}
13+
window.open("https://www.userscript.zone/");
1714
},
1815
};

‎scripts/youtube_downloadVideo.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ export default {
1919
}
2020

2121
let options = [
22+
{
23+
name: "y2mate.com",
24+
func: (url) => url.replace("youtube.com", "youtubepp.com"),
25+
},
2226
{
2327
name: "yt1s.com",
2428
func: (url) => "https://yt1s.com/vi/youtube-to-mp4?q=" + url,
2529
},
2630
{
2731
name: "yt5s.com",
28-
func: (url) => url.replace("youtube", "youtube5s"),
32+
func: (url) => url.replace("youtube.com", "youtube5s.com"),
2933
},
3034
{
3135
name: "tubemp3.to",

‎scripts/zingmp3_downloadMusic.js‎

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default {
6262
return sig;
6363
},
6464

65-
requestZing: async ({ path, qs, willHashParam }) => {
65+
requestZing: async ({ path, qs, willHashParam, host =URL_API }) => {
6666
let param = new URLSearchParams(qs).toString();
6767
let sig = await Utils.hashParam(path, param, willHashParam);
6868

@@ -73,7 +73,7 @@ export default {
7373
sig,
7474
};
7575

76-
return URL_API + path + "?" + new URLSearchParams(params).toString();
76+
return host + path + "?" + new URLSearchParams(params).toString();
7777
},
7878
};
7979

@@ -134,6 +134,19 @@ export default {
134134
willHashParam: false,
135135
});
136136
},
137+
async downloadSong(id) {
138+
return await Utils.requestZing({
139+
host: "https://download.zingmp3.vn",
140+
path: "/api/v2/download/post/song",
141+
qs: { id },
142+
});
143+
},
144+
async getLyric(id) {
145+
return await Utils.requestZing({
146+
path: "/api/v2/lyric/get/lyric",
147+
qs: { id },
148+
});
149+
},
137150
//#endregion
138151

139152
//#region other APIs
@@ -202,44 +215,33 @@ export default {
202215
qs: { page },
203216
});
204217
},
205-
// async getUserListSong({
206-
// type = "library",
207-
// page = 1,
208-
// count = 50,
209-
// sectionId = "mFavSong",
210-
// } = {}) {
211-
// return await Utils.requestZing({
212-
// path: "/api/v2/user/song/get/list",
213-
// qs: { type, page, count, sectionId },
214-
// // willHashParam: false,
215-
// });
216-
// },
217-
// async getSectionPlaylist(id) {
218-
// return await Utils.requestZing({
219-
// path: "/api/v2/playlist/getSectionBottom",
220-
// qs: { id },
221-
// });
222-
// },
223-
// async getLastPlaying() {
224-
// return await Utils.requestZing({
225-
// path: "/api/v2/user/lasplaying/get/lasplaying",
226-
// });
227-
// },
218+
async getLastPlaying() {
219+
return await Utils.requestZing({
220+
path: "/api/v2/user/lasplaying/get/lasplaying",
221+
});
222+
},
228223
//#endregion
229224
};
230225

231226
(async function () {
232-
// window.open(await ZingMp3.search("game thủ liên minh"));
233-
// window.open(await ZingMp3.getLastPlaying());
234227
// window.open(await ZingMp3.getHome());
235-
// window.open(await ZingMp3.getChartHome());
236-
// window.open(await ZingMp3.getInfoMusic("ZWFE8OUO"));
237-
// window.open(await ZingMp3.getStreaming("Z6WZD78I"));
228+
// window.open(await ZingMp3.getLyric("ZZDEZ8UC"));
229+
// window.open(await ZingMp3.getInfoMusic("ZZDEZ8UC"));
230+
// window.open(await ZingMp3.getStreaming("ZZDEZ8UC"));
231+
// window.open(await ZingMp3.search("game thủ liên minh"));
232+
// window.open(await ZingMp3.getUserMusicOverview());
233+
// window.open(await ZingMp3.getDetailPlaylist("Z6CZOIWU"));
234+
// window.open(await ZingMp3.getDetailArtist("ICM"));
235+
236+
// window.open(await ZingMp3.getChartHome()); // => die
237+
// window.open(await ZingMp3.getLastPlaying()); // => not working?
238+
// window.open(await ZingMp3.downloadSong("Z7ZCD9BD")); // => some songs be blocked on pc
239+
// return;
238240

239241
const tab = await getCurrentTab();
240-
let url = prompt("Nhap link bai hat: ", tab.url);
242+
let url = prompt("Nhập link hoặc id bài hát: ", tab.url);
241243
if (url) {
242-
let songid = ZingMp3.getSongIdFromURL(url);
244+
let songid = url.length>10 ? ZingMp3.getSongIdFromURL(url) : url;
243245
if (songid) {
244246
try {
245247
const streamUrl = await ZingMp3.getStreaming(songid);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /