Skip to content

Commit 79cca56

Browse files
committed
update
1 parent b64a33f commit 79cca56

20 files changed

+494
-131
lines changed

content-scripts/useful-scripts-utils.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ window.UsefulScriptsUtils = {
4545
},
4646

4747
// https://mmazzarolo.com/blog/2022-07-30-checking-if-a-javascript-native-function-was-monkey-patched/
48+
// Kiểm tra xem function nào đó có bị override hay chưa
4849
isNativeFunction(f) {
4950
return f.toString().toString().includes("[native code]");
5051
},
5152

5253
// https://mmazzarolo.com/blog/2022-06-26-filling-local-storage-programmatically/
54+
// Làm đầy localStorage
5355
fillLocalStorage() {
5456
const key = "__filling_localstorage__";
5557
let max = 1;
@@ -80,6 +82,40 @@ window.UsefulScriptsUtils = {
8082
// https://stackoverflow.com/a/56933091/11898496
8183
const urlParams = new URLSearchParams(window.location.search);
8284
urlParams.set("globalsToInspect", varName);
83-
window.location.search = urlParams;
85+
window.location.search = urlParams.toString();
86+
},
87+
88+
// Tìm chuỗi xung quanh chuỗi bất kỳ
89+
// Ví dụ fullString = "abcd1234567890abcd" targetString = "6" bound = 3
90+
// => Kết quả around = 3456789
91+
getTextAround(fullString, targetString, bound = 10) {
92+
let curIndex = 0;
93+
let arounds = [];
94+
let limit = 100;
95+
96+
while (limit) {
97+
let index = fullString.indexOf(targetString, curIndex);
98+
if (index === -1) break;
99+
100+
let around = fullString.slice(
101+
Math.max(index - Math.floor(bound / 2) - 1, 0),
102+
Math.min(
103+
index + targetString.length + Math.floor(bound / 2),
104+
fullString.length
105+
)
106+
);
107+
arounds.push({ index, around });
108+
curIndex = index + (targetString.length || 1);
109+
limit--;
110+
}
111+
return arounds;
112+
},
113+
114+
// https://stackoverflow.com/a/40410744/11898496
115+
// Giải mã từ dạng 'http\\u00253A\\u00252F\\u00252Fexample.com' về 'http://example.com'
116+
decodeEscapedUnicodeString(str) {
117+
return decodeURIComponent(
118+
JSON.parse('"' + str.replace(/\"/g, '\\"') + '"')
119+
);
84120
},
85121
};

popup/tabs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const tabs = [
107107
// s.insta_reloaded,
108108
s.insta_enableDownloadImage,
109109
s.insta_getToken,
110-
s.insta_getUid,
110+
s.insta_getUserInfo,
111111
s.insta_getAllUserMedia,
112112
s.insta_getAllImagesInNewFeed,
113113
s.insta_getAllImagesInUserProfile,
@@ -198,7 +198,7 @@ const tabs = [
198198
},
199199
{
200200
...CATEGORY.more,
201-
scripts: [s.shortenURL, s.runStatJs],
201+
scripts: [s.shortenURL, s.runStatJs, s.test_script],
202202
},
203203
];
204204

scripts/archiveToday.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
2-
icon: `<i class="fa-solid fa-box-archive"></i>`,
2+
icon: `https://archive.ph/favicon.ico`,
33
name: {
44
en: "Archive the current Page online",
55
vi: "Lưu trữ online trang hiện tại",
@@ -8,13 +8,19 @@ export default {
88
en: "Creates an archive of the current page on archive.today.",
99
vi: "Lưu trang web hiện tại lên archive.today",
1010
},
11-
blackList: [],
12-
whiteList: [],
11+
runInExtensionContext: true,
1312

1413
func: function () {
15-
window.open(
16-
"https://archive.today/?run=1&url=" +
17-
encodeURIComponent(document.location)
18-
);
14+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
15+
var currentTab = tabs[0];
16+
if (currentTab?.url) {
17+
var a = currentTab.url.replace(/^http\:\/\/(.*)$/, "$1");
18+
window.open(
19+
"https://archive.today/?run=1&url=" + encodeURIComponent(a)
20+
);
21+
} else {
22+
alert("Không tìm thấy url web hiện tại");
23+
}
24+
});
1925
},
2026
};

scripts/checkWebDie.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
2-
icon: `<i class="fa-solid fa-skull-crossbones"></i>`,
2+
icon: `https://downforeveryoneorjustme.com/favicon.ico`,
33
name: {
44
en: "Dowfor - Check web die",
55
vi: "Dowfor - Kiểm tra web die",
@@ -8,12 +8,19 @@ export default {
88
en: "Check web die using downforeveryoneorjustme",
99
vi: "Dùng bên thứ 3 để kiểm tra xem website có bị die thật không",
1010
},
11+
runInExtensionContext: true,
1112

1213
func: function () {
13-
let url = prompt("Enter web url to check", location.hostname);
14-
15-
if (url) {
16-
window.open("https://downforeveryoneorjustme.com/" + url);
17-
}
14+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
15+
var currentTab = tabs[0];
16+
if (currentTab?.url) {
17+
let url = prompt("Enter web url to check", currentTab.url);
18+
if (url) {
19+
window.open("https://downforeveryoneorjustme.com/" + url);
20+
}
21+
} else {
22+
alert("Không tìm thấy url web hiện tại");
23+
}
24+
});
1825
},
1926
};

scripts/downDetector.js

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

scripts/download_image.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ export default {
8686

8787
let win = window.open(
8888
"",
89-
"All images from " + url,
89+
"",
9090
"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=500,top=50,left=50"
9191
);
92+
win.document.title = "All images from " + url;
9293

9394
let rows = link
9495
?.map((_, i) => {

0 commit comments

Comments
 (0)