Skip to content

Commit a021c88

Browse files
committed
insta download btn
1 parent a92fd2d commit a021c88

File tree

12 files changed

+851
-272
lines changed

12 files changed

+851
-272
lines changed

md/flow.pu

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
' https://plantuml.com/guide
2+
3+
4+
@startuml Useful-scripts
5+
Alice -> Bob: Authentication Request
6+
Bob --> Alice: Authentication Response
7+
Alice -> Bob: Another authentication Request
8+
Alice <-- Bob: Another authentication Response
9+
@enduml
10+
11+
@startuml ABC
12+
Alice -> Bob: Authentication Request
13+
Bob --> Alice: Authentication Response
14+
Alice -> Bob: Another authentication Request
15+
Alice <-- Bob: Another authentication Response
16+
@enduml
17+
18+
@startuml DEF
19+
participant participant as Foo
20+
actor actor as Foo1
21+
boundary boundary as Foo2
22+
control control as Foo3
23+
entity entity as Foo4
24+
database database as Foo5
25+
collections collections as Foo6
26+
queue queue as Foo7
27+
Foo -> Foo1 : To actor
28+
Foo -> Foo2 : To boundary
29+
Foo -> Foo3 : To control
30+
Foo -> Foo4 : To entity
31+
Foo -> Foo5 : To database
32+
Foo -> Foo6 : To collections
33+
Foo -> Foo7: To queue
34+
@endum
35+
36+
@startuml
37+
actor Bob #red
38+
' The only difference between actor and participant is the drawing
39+
participant Alice
40+
participant "I have a really\nlong name" as L #99FF99
41+
/' You can also declare:
42+
participant L as "I have a really\nlong name" #99FF99
43+
'/
44+
Alice->Bob: Authentication Request
45+
Bob->Alice: Authentication Response
46+
Bob->L: Log transaction
47+
@enduml
48+
49+
@startuml
50+
scale 600 width
51+
[*] -> State1
52+
State1 --> State2 : Succeeded
53+
State1 --> [*] : Aborted
54+
State2 --> State3 : Succeeded
55+
State2 --> [*] : Aborted
56+
state State3 {
57+
state "Accumulate Enough Data\nLong State Name" as long1
58+
long1 : Just a test
59+
[*] --> long1
60+
long1 --> long1 : New Data
61+
long1 --> ProcessData : Enough Data
62+
}
63+
State3 --> State3 : Failed
64+
State3 --> [*] : Succeeded / Save Result
65+
State3 --> [*] : Aborted
66+
@enduml
67+
68+
@startuml
69+
!include <cloudogu/common.puml>
70+
!include <cloudogu/dogus/jenkins.puml>
71+
!include <cloudogu/dogus/cloudogu.puml>
72+
!include <cloudogu/dogus/scm.puml>
73+
!include <cloudogu/dogus/smeagol.puml>
74+
!include <cloudogu/dogus/nexus.puml>
75+
!include <cloudogu/tools/k8s.puml>
76+
node "Cloudogu Ecosystem" <<$cloudogu>> {
77+
DOGU_JENKINS(jenkins, Jenkins) #ffffff
78+
DOGU_SCM(scm, SCM-Manager) #ffffff
79+
DOGU_SMEAGOL(smeagol, Smeagol) #ffffff
80+
DOGU_NEXUS(nexus,Nexus) #ffffff
81+
}
82+
TOOL_K8S(k8s, Kubernetes) #ffffff
83+
actor developer
84+
developer --> smeagol : "Edit Slides"
85+
smeagol -> scm : Push
86+
scm -> jenkins : Trigger
87+
jenkins -> nexus : Deploy
88+
jenkins --> k8s : Deploy
89+
@enduml

pages/viewScriptSource/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ window.onload = async () => {
66
if (source) {
77
document.querySelector("#copy-btn").onclick = () => copy(source);
88
document.querySelector("code").innerHTML = escapeHTML(source);
9+
document.title = scriptId + ".js";
910

1011
hljs.highlightAll();
1112
hljs.initLineNumbersOnLoad();

popup/tabs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ const tabs = [
131131
{
132132
...CATEGORY.instagram,
133133
scripts: [
134+
s.insta_injectDownloadBtn,
134135
s.insta_getToken,
135136
s.insta_getUserInfo,
136137
createTitle("--- Download ---", "--- Tải xuống ---"),

scripts/background-scripts/index.js

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,43 @@ import {
1212
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
1313
console.log("> Received message:", message, sender?.tab?.url);
1414

15-
try {
16-
switch (message.type) {
17-
case MsgType.runScript:
18-
let funcName = Events[message.event];
19-
if (!funcName) break;
20-
21-
let count = 0,
22-
tabId = sender.tab.id,
23-
url = sender.tab.url;
15+
switch (message.type) {
16+
case MsgType.runScript:
17+
runScript(message.event, sender.tab);
18+
break;
19+
}
20+
});
2421

25-
Object.values(allScripts).map(async (script) => {
26-
if (!checkBlackWhiteList(script, url)) return;
22+
async function runScript(event, tab) {
23+
let funcName = event,
24+
count = 0,
25+
tabId = tab.id,
26+
url = tab.url;
2727

28-
let func = script[funcName];
29-
if (isFunction(func) && !isEmptyFunction(func)) {
30-
let isActive = (await getActiveScript(script.id)) ?? true;
31-
if (isActive) {
32-
runScriptInTab({ func, tabId });
33-
console.log(
34-
`%c > Run ${script.id} ${funcName} in ${url}`,
35-
"background: #222; color: #bada55"
36-
);
37-
count++;
38-
}
39-
}
40-
});
28+
for (let script of Object.values(allScripts)) {
29+
try {
30+
if (!checkBlackWhiteList(script, url)) continue;
4131

42-
updateBadge(tabId, count);
43-
break;
32+
let func = script[funcName];
33+
if (isFunction(func) && !isEmptyFunction(func)) {
34+
let isActive = (await getActiveScript(script.id)) ?? true;
35+
if (isActive) {
36+
runScriptInTab({ func, tabId });
37+
console.log(
38+
`%c > Run ${script.id} ${funcName} in ${url}`,
39+
"background: #222; color: #bada55"
40+
);
41+
count++;
42+
}
43+
}
44+
} catch (e) {
45+
console.log("ERROR at script " + script?.id, e);
4446
}
45-
} catch (e) {
46-
console.log("ERROR: ", e);
4747
}
48-
});
48+
49+
updateBadge(tabId, count);
50+
console.log(count);
51+
}
4952

5053
function updateBadge(tabId, text = "", bgColor = "#666") {
5154
text = text.toString();

scripts/content-scripts/document_start.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(async () => {
22
try {
3-
const { MsgType, Events, ClickType: OnClickType } = await import(
3+
const { MsgType, Events, ClickType } = await import(
44
"../helpers/constants.js"
55
);
66
const { sendEventToBackground, isFunction } = await import(
@@ -12,23 +12,20 @@
1212
event: Events.onDocumentStart,
1313
});
1414

15-
const { allScripts } = await import("../index.js");
16-
chrome.runtime.onMessage.addListener(function (
15+
chrome.runtime.onMessage.addListener(async function (
1716
message,
1817
sender,
1918
sendResponse
2019
) {
2120
console.log("> Received message:", message);
2221

2322
switch (message.type) {
24-
// run script on receive event from popup
2523
case MsgType.runScript:
2624
let scriptId = message.scriptId;
27-
if (
28-
scriptId in allScripts &&
29-
isFunction(allScripts[scriptId][OnClickType.onClickContentScript])
30-
) {
31-
allScripts[scriptId][OnClickType.onClickContentScript]();
25+
const script = (await import("../" + scriptId + ".js"))?.default;
26+
27+
if (script && isFunction(script[ClickType.onClickContentScript])) {
28+
script[ClickType.onClickContentScript]();
3229
console.log("> Run script " + scriptId);
3330
}
3431
break;

scripts/content-scripts/scripts/fb_invisible_message.js

Lines changed: 0 additions & 170 deletions
This file was deleted.

0 commit comments

Comments
 (0)