style: 代码格式化

This commit is contained in:
xiongxiaoyang 2025-03-23 11:49:23 +08:00
parent 328bd55587
commit f043ddff42
2 changed files with 128 additions and 144 deletions

View File

@ -34,13 +34,7 @@
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
}
}
.line-limit-length {
@ -93,7 +87,7 @@
border-radius: 3px;
cursor: pointer;
z-index: 1000;
}
}
</style>
</head>
@ -173,7 +167,7 @@
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/&nbsp;/g, "");
}
bookListHtml += ("<div id='"+book.bookId+"' onclick='read(\""+book.bookId+"\",\""+book.preContentId+"\")' class=\"item layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
bookListHtml += ("<div id='" + book.bookId + "' onclick='read(\"" + book.bookId + "\",\"" + book.preContentId + "\")' class=\"item layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
" <div class=\"layui-col-xs6 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
" src=\"" + book.picUrl + "\"/>\n" +
@ -197,7 +191,7 @@
$("#bookList").html(bookListHtml);
$(".item").on('touchstart', function(e) {
$(".item").on('touchstart', function (e) {
var element = $(this);
// 清除可能存在的定时器
clearTimeout(timeout);
@ -207,23 +201,23 @@ $(".item").on('touchstart', function(e) {
var touch = e.originalEvent.touches[0];
// 设置一个定时器在500ms后触发可以根据需要调整时间
timeout = setTimeout(function() {
timeout = setTimeout(function () {
e.preventDefault();
showTip(touch, element);
}, 1000);
}).on('touchend', function(e) {
}).on('touchend', function (e) {
if (!isLongPress) {
// 如果没有发生长按则执行点击事件的逻辑
clearTimeout(timeout);
}
}).on('touchmove', function() {
}).on('touchmove', function () {
clearTimeout(timeout);
hideTip();
}).on('contextmenu', function(e) {
}).on('contextmenu', function (e) {
e.preventDefault();
});
$('#tipLayer').click(function() {
$('#tipLayer').click(function () {
// 点击tips层时删除对应的.item元素
removeFromBookShelf($(this).data('target').attr("id"));
$(this).data('target').remove();
@ -231,8 +225,6 @@ $(".item").on('touchstart', function(e) {
});
layui.use('laypage', function () {
var laypage = layui.laypage;
@ -333,11 +325,11 @@ $(".item").on('touchstart', function(e) {
searchByAllCondition(1, 20, keywords);
}
function read(bookId,contentId){
if(isLongPress){
function read(bookId, contentId) {
if (isLongPress) {
return false;
}
location.href = '/book/'+bookId+"/"+contentId+".html"
location.href = '/book/' + bookId + "/" + contentId + ".html"
hideTip();
}

View File

@ -34,13 +34,7 @@
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
}
}
.line-limit-length {
@ -93,7 +87,7 @@
border-radius: 3px;
cursor: pointer;
z-index: 1000;
}
}
</style>
</head>
@ -173,7 +167,7 @@
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/&nbsp;/g, "");
}
bookListHtml += ("<div id='"+book.bookId+"' onclick='read(\""+book.bookId+"\",\""+book.preContentId+"\")' class=\"item layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
bookListHtml += ("<div id='" + book.bookId + "' onclick='read(\"" + book.bookId + "\",\"" + book.preContentId + "\")' class=\"item layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
" <div class=\"layui-col-xs6 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
" src=\"" + book.picUrl + "\"/>\n" +
@ -197,7 +191,7 @@
$("#bookList").html(bookListHtml);
$(".item").on('touchstart', function(e) {
$(".item").on('touchstart', function (e) {
var element = $(this);
// 清除可能存在的定时器
clearTimeout(timeout);
@ -207,23 +201,23 @@ $(".item").on('touchstart', function(e) {
var touch = e.originalEvent.touches[0];
// 设置一个定时器在500ms后触发可以根据需要调整时间
timeout = setTimeout(function() {
timeout = setTimeout(function () {
e.preventDefault();
showTip(touch, element);
}, 1000);
}).on('touchend', function(e) {
}).on('touchend', function (e) {
if (!isLongPress) {
// 如果没有发生长按则执行点击事件的逻辑
clearTimeout(timeout);
}
}).on('touchmove', function() {
}).on('touchmove', function () {
clearTimeout(timeout);
hideTip();
}).on('contextmenu', function(e) {
}).on('contextmenu', function (e) {
e.preventDefault();
});
$('#tipLayer').click(function() {
$('#tipLayer').click(function () {
// 点击tips层时删除对应的.item元素
removeFromBookShelf($(this).data('target').attr("id"));
$(this).data('target').remove();
@ -231,8 +225,6 @@ $(".item").on('touchstart', function(e) {
});
layui.use('laypage', function () {
var laypage = layui.laypage;
@ -333,11 +325,11 @@ $(".item").on('touchstart', function(e) {
searchByAllCondition(1, 20, keywords);
}
function read(bookId,contentId){
if(isLongPress){
function read(bookId, contentId) {
if (isLongPress) {
return false;
}
location.href = '/book/'+bookId+"/"+contentId+".html"
location.href = '/book/' + bookId + "/" + contentId + ".html"
hideTip();
}