forked from reactor-coding/silver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall_Extensions.js
124 lines (110 loc) · 5.45 KB
/
Install_Extensions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* @name Silver-ExInstaller
* @author react#1507
* @description
* for Install Something Extensions Bypass blocks
*/
document.documentElement.innerHTML = "";
let boxicons = document.createElement("link");
boxicons.setAttribute("rel", "stylesheet");
boxicons.setAttribute("href", "https://unpkg.com/[email protected]/css/boxicons.min.css");
boxicons.setAttribute("integrity", "sha512-cn16Qw8mzTBKpu08X0fwhTSv02kK/FojjNLz0bwp2xJ4H+yalwzXKFw/5cLzuBZCxGWIA+95X4skzvo8STNtSg==");
boxicons.setAttribute("crossorigin", "anonymous");
document.head.appendChild(boxicons);
let style = document.createElement("style");
style.innerHTML = `
/* original */
.warning {
border: 1px solid #f2ca00;
padding: 10px;
}
/*
No original - Use https://qiita.com/KengoShimizu/items/22c14b282fa9f53f4bd8
*/
.password_box{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 50px;
border-radius: 5px;
border: 1px solid lightgray;
}
.password_inner{
width: 100%;
height: 100%;
background-color: transparent;
position: relative;
}
#id{
position: absolute;
z-index: 1;
height: 100%;
width: 100%;
top: 0; left: 0; bottom: 0; right: 0;
border: none;
outline: none;
padding: 0 10px;
font-size: 16px;
background-color: transparent;
box-sizing: border-box;
}
.password_string{
position: absolute;
height: 100%;
width: 140px;
top: 0; left: 0; bottom: 0; right: 0;
padding-left: 10px;
font-size: 16px;
line-height: 50px;
background-color: transparent;
color: #80868b;
box-sizing: border-box;
transition: all 0.2s;
-webkit-transition: all 0.2s;
}
#id:focus + .password_string{
font-size: 10px;
line-height: 10px;
width: 85px;
height: 10px;
padding: 0 2px;
background-color: white;
transform:translate3d(5px, -6px, 0);
}
/*
No original - Use https://jajaaan.co.jp/css/button/
*/
.btn--orange, a.btn--orange {
color: #fff;
background-color: #eb6100;
}
.btn--orange:hover, a.btn--orange:hover {
color: #fff;
background: #f56500;
}
`;
document.body.appendChild(style);
document.body.innerHTML += "<div class='warning'><i class='bx bx-edit-alt'></i>Extension IDを入力したらEnter<br>注意: 使えない人もいるらしい</div><div class='group'><div class='password_box'><div class='password_inner'><input id='id' type='text'><div class='password_string'>Extension ID</div></div></div></div>";
document.addEventListener("keydown", (event) => {
switch (event.key) {
case "Enter":
if (document.querySelector(".password_inner > #id").value == ("" || null)) return alert("Please input Extension ID");
try {
chrome.webstorePrivate.beginInstallWithManifest3({
esbAllowlist: true,
iconUrl: "https://blogbooks.net/wp-content/uploads/2021/09/cropped-logo-2.png",
id: document.querySelector(".password_inner > #id").value,
localizedName: `Extension: ${document.querySelector(".password_inner > #id").value}`,
manifest: '{\n"update_url": "https://clients2.google.com/service/update2/crx",\n\n "manifest_version": 2,\n "content_security_policy": "script-src \'self\'; object-src \'self\';",\n "minimum_chrome_version": "71.0.0.0",\n "offline_enabled": true,\n "content_scripts":\n [\n {\n "js": [\n "page.js",\n "content.js"\n ],\n "matches": [ "file:///*", "http://*/*", "https://*/*" ],\n "run_at": "document_start",\n "all_frames": true\n }\n ],\n "browser_action": {\n "default_icon": {\n "19": "images/icon_grey19.png",\n "38": "images/icon_grey38.png",\n "16": "images/icon_grey16.png",\n "24": "images/icon_grey24.png",\n "32": "images/icon_grey32.png"\n },\n "default_title": "Tampermonkey",\n "default_popup": "action.html"\n },\n "icons": {\n "32": "images/icon.png",\n "48": "images/icon48.png",\n "128": "images/icon128.png"\n },\n "incognito": "split",\n "name": "Tampermonkey",\n "short_name": "Tampermonkey",\n "version": "4.18.0",\n "description": "The world\'s most popular userscript manager",\n "default_locale": "en",\n "background": {\n "page": "background.html"\n },\n "options_page": "options.html",\n "options_ui": {\n "page": "options.html",\n "chrome_style": false,\n "open_in_tab": true\n },\n "commands": {\n "toggle-enable": {\n "description": "Toggle enable state"\n },\n "open-dashboard": {\n "description": "Open dashboard"\n },\n "open-dashboard-with-running-scripts": {\n "description": "Open dashboard with the current tab\'s URL used as filter"\n },\n "open-new-script": {\n "description": "Open new script tab"\n }\n },\n "permissions": [\n "notifications",\n "unlimitedStorage",\n "tabs",\n "idle",\n "webNavigation",\n "webRequest", "webRequestBlocking",\n "storage",\n "contextMenus",\n "chrome://favicon/",\n "clipboardWrite",\n "cookies",\n "declarativeContent",\n "<all_urls>"\n ],\n "optional_permissions" : [ "downloads" ]\n}\n',
});
} catch (e) {
console.error(e);
alert("IDが正しくありません");
}
document.querySelector(".password_inner > #id").value
break;
default:
break;
}
})