Skip to content

Commit ec6f4ac

Browse files
author
hoang.tran12
committed
.
1 parent 2e4dc90 commit ec6f4ac

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

scripts/shortenURL.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default {
1515
// https://www.shorturl.at/shortener.php
1616
// https://tinyurl.com/app
1717
// https://cutt.ly/
18+
// https://bom.so/
1819

1920
// Source code extracted from https://chrome.google.com/webstore/detail/url-shortener/godoifjoiadanijplaghmhgfeffnblib/related?hl=vi
2021
const urlShorten = [
@@ -72,6 +73,21 @@ export default {
7273
return shorturl;
7374
},
7475
},
76+
{
77+
name: "bom.so",
78+
func: async function (url) {
79+
let formData = new FormData();
80+
formData.append("url", url);
81+
82+
let resp = await fetch("https://bom.so/shorten", {
83+
method: "POST",
84+
body: formData,
85+
});
86+
let json = await resp.json();
87+
if (json.error) throw json.msg;
88+
return json.short;
89+
},
90+
},
7591
{
7692
name: "a.priv.sh",
7793
func: async function (url) {
@@ -202,3 +218,38 @@ export default {
202218
})();
203219
},
204220
};
221+
222+
function backup() {
223+
let div = `<div class="container">
224+
<div class="inner-container">
225+
<button id="close-btn">Close</button>
226+
227+
</div>
228+
</div>
229+
<style>
230+
.container {
231+
position: fixed;
232+
top:0;left:0;right:0;bottom:0;
233+
background: #333e;
234+
display: flex;
235+
justify-content: center;
236+
}
237+
.inner-container {
238+
position: relative;
239+
background: #aaa;
240+
}
241+
#close-btn {
242+
position: absolute;
243+
top: 0; right: 0;
244+
padding: 5px 10px;
245+
}
246+
</style>`;
247+
248+
let child = document.createElement("div");
249+
child.innerHTML = div;
250+
document.body.appendChild(child);
251+
252+
document.querySelector("#close-btn")?.addEventListener("click", function () {
253+
this?.parentElement?.parentElement?.parentElement?.remove?.();
254+
});
255+
}

0 commit comments

Comments
 (0)