This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9976cd5
commit 4fcd95c
Showing
7 changed files
with
284 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
console.log("page.js has been loaded.") | ||
|
||
const page = { | ||
appName: "", | ||
appNameShort: "", | ||
version: "v1.0.0", | ||
versionCode: 10020240420, | ||
buildVer: "(20240420)", | ||
buildType: "", | ||
license: "", | ||
author: "XiaozhiSans", | ||
url: "", | ||
changeBg: function() { | ||
var bgUrl = prompt("请输入图片url:", "https://eg.web/imgs/img0.jpg"); | ||
if((bgUrl != null)&&(bgUrl != "")) { | ||
document.getElementById("body").style.backgroundImage = bgUrl; | ||
document.getElementById("body").style.backgroundSize = auto; | ||
} | ||
else { | ||
console.error("page.js: on changeBg, error code: -1"); | ||
return -1; | ||
} | ||
alert("更改成功 ( ̄﹃ ̄)"); | ||
return 0; | ||
}, | ||
changeBoxAlpha: function() { | ||
var alpha = prompt("请输入透明度(0 ~ 1.0):", "1.0"); | ||
if((alpha > 1.0)||(alpha < 0.0)||(alpha == NaN)) { | ||
alert("更改失败 Σ(っ °Д °;)っ \n 无效的数值。"); | ||
console.error("page.js: on changeBoxAlpha, error code: -1"); | ||
return -1; | ||
} | ||
if((typeof alpha) != "string") { | ||
alert("更改失败 Σ(っ °Д °;)っ \n 输入的内容不合法。"); | ||
console.error("page.js: on changeBoxAlpha, error code: -2"); | ||
return -2; | ||
} | ||
document.getElementById("mainWindow").style.opacity = alpha; | ||
alert("更改成功 ( ̄﹃ ̄)"); | ||
return 0; | ||
},/* | ||
changeBoxBg: function() { | ||
const box = document.getElementById("bg"); | ||
var bgUrl = prompt("请输入图片url:", "https://eg.web/imgs/img0.jpg"); | ||
if((bgUrl != null)&&(bgUrl != "")) { | ||
box.setAttribute("style", "background-image: url(" + bgUrl + ");\nmargin: auto;"); | ||
} | ||
else return -1; | ||
alert("更改成功 ( ̄﹃ ̄)"); | ||
return 0; | ||
},*/ | ||
hideFooter: function() { | ||
const hideBtn = document.getElementById("hide"); | ||
document.getElementById("footerPnl").style.display = "none"; | ||
hideBtn.setAttribute("onclick", "page.displayFooter();"); | ||
hideBtn.setAttribute("tooltip", "显示") | ||
hideBtn.innerHTML = "➕"; | ||
return 0; | ||
}, | ||
displayFooter: function() { | ||
const hideBtn = document.getElementById("hide"); | ||
document.getElementById("footerPnl").style.display = ''; | ||
hideBtn.setAttribute("onclick", "page.hideFooter();"); | ||
hideBtn.setAttribute("tooltip", "隐藏"); | ||
hideBtn.innerHTML = "➖"; | ||
return 0; | ||
}/*, | ||
sentence: function() { | ||
}, | ||
randBg: function() { | ||
const url = "https://s21.ax1x.com/"; | ||
if (device.mobile()){ | ||
const bgList = [ | ||
"2024/04/18/pFzwE79.jpg" | ||
] | ||
} | ||
else { | ||
const bgList = [ | ||
"2024/04/18/pFzwQXD.jpg", | ||
"2024/04/18/pFzwmfx.jpg", | ||
"2024/04/18/pFzwE79.jpg", | ||
"2024/04/18/pFzwZkR.jpg", | ||
"2024/04/18/pFzwup6.jpg" | ||
] | ||
} | ||
document.getElementById("customBg").style.background = bgUrl + bgList[Math.floor(Math.random() * 6)]; | ||
}*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
document.addEventListener("keydown", function(event) { | ||
// 热键绑定 | ||
if (event.code == "Enter") { | ||
qtailHtml.main(); | ||
} | ||
if (event.code == "Escape") { | ||
qtailHtml.exit(); | ||
} | ||
if (event.key == "F8") { | ||
qtailHtml.copy(); | ||
} | ||
}); | ||
|
||
const qtailHtml = { | ||
appName: "qtail.js html module", | ||
appNameShort: "qtail-html-module", | ||
version: "v1.0.0", | ||
versionCode: 10020240420, | ||
buildVer: "(20240420)", | ||
buildType: "Stable", | ||
license: "MIT License", | ||
author: "XiaozhiSans", | ||
url: "", | ||
main: function() { | ||
console.log("开始生成新昵称 ( ̄﹃ ̄)"); | ||
console.log("获取表单内容 ( ̄﹃ ̄)"); | ||
const qtailForm = document.querySelector("#qtail"); | ||
const qtailData = new FormData(qtailForm); | ||
|
||
var name = qtailData.get("name"); | ||
var tail = qtailData.get("tail"); | ||
if (name == "" || tail == "") { | ||
alert("生成已取消 ( ̄﹃ ̄) \n 昵称或尾巴不能为空."); | ||
console.error("qtail.js: on main, error code: -1"); | ||
return -1; | ||
} | ||
console.log("获取到昵称:" + name + " 获取到尾巴:" + tail); | ||
|
||
var result = qtail.generation(name, tail); | ||
|
||
console.log("将结果返回页面 ( ̄﹃ ̄)"); | ||
document.getElementById("result").innerHTML = result; | ||
alert("生成完毕 ( ̄﹃ ̄)"); | ||
}, | ||
copy: function() { // 复制结果 ( ̄﹃ ̄) | ||
const result = document.querySelector("#result"); | ||
result.select(); | ||
document.execCommand("copy"); | ||
alert("复制成功 ( ̄﹃ ̄) \n 快去 qq 试试吧"); | ||
return 0; | ||
}, | ||
share: function() { | ||
if(!navigator.share) {alert("您的浏览器不支持分享功能! ( ̄﹃ ̄)"); return -1;} | ||
else {navigator.share({title: location.title, url: location.href, text: "hi,我发现了一个超有意思的昵称生成器 —— qtail"}); return 0;} | ||
}, | ||
donation: function() { | ||
if(confirm("感谢您的支持!! ✪ ω ✪")) {return 0;} | ||
else {return -1;} | ||
}, | ||
exit: function() { | ||
if(confirm("您确定要关闭 qtail 吗? >︿<")) { | ||
history.back(); | ||
} | ||
} | ||
} | ||
|
||
console.log( | ||
"\n" + | ||
" %c " + qtailHtml.appName + ' ' + qtailHtml.version + " by " + qtail.author + | ||
" %c License: " + qtailHtml.license + | ||
" %c " + qtailHtml.url + | ||
"\n" + | ||
"\n", | ||
"color: #fff; background: #fd79a8; padding: 5px 0;", | ||
"color: black; background-color: #999; padding: 5px 0;", | ||
"background: #FFF; padding: 5px 0;" | ||
); |
Oops, something went wrong.