主页图标增加文字

This commit is contained in:
sonichy 2024-03-21 00:08:47 +08:00
parent c0725c5b20
commit 10980bd750
2 changed files with 26 additions and 17 deletions

BIN
app.apk

Binary file not shown.

View File

@ -13,8 +13,8 @@ img { vertical-align:middle; }
.operation:hover { cursor:hand; color:black; }
.menu { position:absolute; background:white; border:1px solid gray; width:100px; display:none; }
.menu div:hover { background:#ddd; }
#list a { margin:20px; width:50px; height:50px; display: inline-block; }
#list button { margin:20px; width:50px; height:50px; font-size:40px; vertical-align:bottom; }
#list a { margin:10px; width:50px; height:75px; display:inline-block; text-align:center; white-space:nowrap; overflow:hidden; color:black; }
#list button { width:50px; height:50px; font-size:40px; }
</style>
<body>
<center><img src="logo.png"></center>
@ -33,7 +33,7 @@ img { vertical-align:middle; }
<dialog id="dialog">
<h2 align="center" id="type"></h2>
<input type="text" id="title" placeholder="标题" value=""><p>
<input type="text" id="website" placeholder="https://" value="https://"><p>
<input type="text" id="website" placeholder="https://" value=""><p>
<center><button id="button_confirm">确定</button> <button id="button_cancel">取消</button></center>
</dialog>
<script>
@ -74,8 +74,8 @@ function genList() {
//通过时间间隔区分点击和长按https://www.jianshu.com/p/b05d3d5d5e81
(function(i){
img.addEventListener('mousedown', function(e){
timer = setTimeout(function(){
e.target.style.background = '#eee';
timer = setTimeout(function(){
menu.style.display = 'block';
menu.style.left = e.pageX + 'px';
menu.style.top = e.pageY + 'px';
@ -90,20 +90,22 @@ function genList() {
e.preventDefault();
t = e.touches[0];
time = Date.now();
});
img.addEventListener('touchend', function(e){
e.target.style.background = 'none';
var dt = Date.now() - time;
if (dt < 300)
window.location.href = json[i].website;
else {
timer = setTimeout(function(){
e.target.style.background = '#eee';
menu.style.display = 'block';
menu.style.left = t.pageX + 'px';
menu.style.top = t.pageY + 'px';
id = i;
title1 = json[i].title;
website1 = json[i].website;
}
}, 500);
});
img.addEventListener('touchend', function(e){
e.target.style.background = 'none';
clearTimeout(timer);
var dt = Date.now() - time;
if (dt < 300)
window.location.href = json[i].website;
});
})(i);
img.addEventListener('mouseup', function(e){
@ -111,18 +113,25 @@ function genList() {
clearTimeout(timer);
});
a.appendChild(img);
var br = document.createElement('br');
a.appendChild(br);
var text = document.createTextNode(json[i].title);
a.appendChild(text);
list.appendChild(a);
}
var a = document.createElement('a');
var button = document.createElement('button');
button.textContent = '+';
button.onclick = function(){
type.textContent = '添加';
type1 = 0;
title.value = '';
website.value = 'https://';
website.value = '';
dialog.showModal();
};
list.appendChild(button);
a.appendChild(button);
list.appendChild(a);
}
text_search.addEventListener('keypress', function(e){