mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-26 17:20:52 +00:00
style: 代码格式化
This commit is contained in:
parent
328bd55587
commit
f043ddff42
@ -22,25 +22,19 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
|
|
||||||
-webkit-user-select: none; /* Chrome, Safari, Opera */
|
-webkit-user-select: none; /* Chrome, Safari, Opera */
|
||||||
|
|
||||||
|
|
||||||
-moz-user-select: none; /* Firefox */
|
-moz-user-select: none; /* Firefox */
|
||||||
|
|
||||||
|
|
||||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
||||||
|
|
||||||
|
|
||||||
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||||
|
|
||||||
|
|
||||||
|
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.line-limit-length {
|
.line-limit-length {
|
||||||
@ -84,16 +78,16 @@
|
|||||||
height: 180px;
|
height: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tipLayer {
|
#tipLayer {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: rgba(255, 0, 0, 0.8);
|
background-color: rgba(255, 0, 0, 0.8);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@ -173,7 +167,7 @@
|
|||||||
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /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" +
|
" <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" +
|
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
|
||||||
" src=\"" + book.picUrl + "\"/>\n" +
|
" src=\"" + book.picUrl + "\"/>\n" +
|
||||||
@ -197,40 +191,38 @@
|
|||||||
$("#bookList").html(bookListHtml);
|
$("#bookList").html(bookListHtml);
|
||||||
|
|
||||||
|
|
||||||
$(".item").on('touchstart', function(e) {
|
$(".item").on('touchstart', function (e) {
|
||||||
var element = $(this);
|
var element = $(this);
|
||||||
// 清除可能存在的定时器
|
// 清除可能存在的定时器
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
isLongPress = false;
|
isLongPress = false;
|
||||||
|
|
||||||
// 获取触摸点位置
|
// 获取触摸点位置
|
||||||
var touch = e.originalEvent.touches[0];
|
var touch = e.originalEvent.touches[0];
|
||||||
|
|
||||||
// 设置一个定时器,在500ms后触发(可以根据需要调整时间)
|
|
||||||
timeout = setTimeout(function() {
|
|
||||||
e.preventDefault();
|
|
||||||
showTip(touch, element);
|
|
||||||
}, 1000);
|
|
||||||
}).on('touchend', function(e) {
|
|
||||||
if (!isLongPress) {
|
|
||||||
// 如果没有发生长按,则执行点击事件的逻辑
|
|
||||||
clearTimeout(timeout);
|
|
||||||
}
|
|
||||||
}).on('touchmove', function() {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
hideTip();
|
|
||||||
}).on('contextmenu', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tipLayer').click(function() {
|
|
||||||
// 点击tips层时删除对应的.item元素
|
|
||||||
removeFromBookShelf($(this).data('target').attr("id"));
|
|
||||||
$(this).data('target').remove();
|
|
||||||
hideTip();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// 设置一个定时器,在500ms后触发(可以根据需要调整时间)
|
||||||
|
timeout = setTimeout(function () {
|
||||||
|
e.preventDefault();
|
||||||
|
showTip(touch, element);
|
||||||
|
}, 1000);
|
||||||
|
}).on('touchend', function (e) {
|
||||||
|
if (!isLongPress) {
|
||||||
|
// 如果没有发生长按,则执行点击事件的逻辑
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
}).on('touchmove', function () {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
hideTip();
|
||||||
|
}).on('contextmenu', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tipLayer').click(function () {
|
||||||
|
// 点击tips层时删除对应的.item元素
|
||||||
|
removeFromBookShelf($(this).data('target').attr("id"));
|
||||||
|
$(this).data('target').remove();
|
||||||
|
hideTip();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
layui.use('laypage', function () {
|
layui.use('laypage', function () {
|
||||||
@ -272,7 +264,7 @@ $(".item").on('touchstart', function(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showTip(touchEvent, element) {
|
function showTip(touchEvent, element) {
|
||||||
isLongPress = true;
|
isLongPress = true;
|
||||||
// 根据触摸点位置设置弹出层的位置
|
// 根据触摸点位置设置弹出层的位置
|
||||||
$('#tipLayer')
|
$('#tipLayer')
|
||||||
.css({
|
.css({
|
||||||
@ -284,7 +276,7 @@ $(".item").on('touchstart', function(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hideTip() {
|
function hideTip() {
|
||||||
isLongPress = false;
|
isLongPress = false;
|
||||||
$('#tipLayer').hide().removeData('target'); // 隐藏tips并清除数据
|
$('#tipLayer').hide().removeData('target'); // 隐藏tips并清除数据
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,11 +325,11 @@ $(".item").on('touchstart', function(e) {
|
|||||||
searchByAllCondition(1, 20, keywords);
|
searchByAllCondition(1, 20, keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
function read(bookId,contentId){
|
function read(bookId, contentId) {
|
||||||
if(isLongPress){
|
if (isLongPress) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
location.href = '/book/'+bookId+"/"+contentId+".html"
|
location.href = '/book/' + bookId + "/" + contentId + ".html"
|
||||||
hideTip();
|
hideTip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,19 +339,19 @@ $(".item").on('touchstart', function(e) {
|
|||||||
|
|
||||||
function removeFromBookShelf(bookId) {
|
function removeFromBookShelf(bookId) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "delete",
|
type: "delete",
|
||||||
url: "/user/removeFromBookShelf/" + bookId,
|
url: "/user/removeFromBookShelf/" + bookId,
|
||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
$("#shelf" + bookId).remove();
|
$("#shelf" + bookId).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -22,25 +22,19 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
|
|
||||||
-webkit-user-select: none; /* Chrome, Safari, Opera */
|
-webkit-user-select: none; /* Chrome, Safari, Opera */
|
||||||
|
|
||||||
|
|
||||||
-moz-user-select: none; /* Firefox */
|
-moz-user-select: none; /* Firefox */
|
||||||
|
|
||||||
|
|
||||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
||||||
|
|
||||||
|
|
||||||
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||||
|
|
||||||
|
|
||||||
|
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.line-limit-length {
|
.line-limit-length {
|
||||||
@ -84,16 +78,16 @@
|
|||||||
height: 180px;
|
height: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tipLayer {
|
#tipLayer {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: rgba(255, 0, 0, 0.8);
|
background-color: rgba(255, 0, 0, 0.8);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@ -173,7 +167,7 @@
|
|||||||
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /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" +
|
" <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" +
|
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
|
||||||
" src=\"" + book.picUrl + "\"/>\n" +
|
" src=\"" + book.picUrl + "\"/>\n" +
|
||||||
@ -197,40 +191,38 @@
|
|||||||
$("#bookList").html(bookListHtml);
|
$("#bookList").html(bookListHtml);
|
||||||
|
|
||||||
|
|
||||||
$(".item").on('touchstart', function(e) {
|
$(".item").on('touchstart', function (e) {
|
||||||
var element = $(this);
|
var element = $(this);
|
||||||
// 清除可能存在的定时器
|
// 清除可能存在的定时器
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
isLongPress = false;
|
isLongPress = false;
|
||||||
|
|
||||||
// 获取触摸点位置
|
// 获取触摸点位置
|
||||||
var touch = e.originalEvent.touches[0];
|
var touch = e.originalEvent.touches[0];
|
||||||
|
|
||||||
// 设置一个定时器,在500ms后触发(可以根据需要调整时间)
|
|
||||||
timeout = setTimeout(function() {
|
|
||||||
e.preventDefault();
|
|
||||||
showTip(touch, element);
|
|
||||||
}, 1000);
|
|
||||||
}).on('touchend', function(e) {
|
|
||||||
if (!isLongPress) {
|
|
||||||
// 如果没有发生长按,则执行点击事件的逻辑
|
|
||||||
clearTimeout(timeout);
|
|
||||||
}
|
|
||||||
}).on('touchmove', function() {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
hideTip();
|
|
||||||
}).on('contextmenu', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tipLayer').click(function() {
|
|
||||||
// 点击tips层时删除对应的.item元素
|
|
||||||
removeFromBookShelf($(this).data('target').attr("id"));
|
|
||||||
$(this).data('target').remove();
|
|
||||||
hideTip();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// 设置一个定时器,在500ms后触发(可以根据需要调整时间)
|
||||||
|
timeout = setTimeout(function () {
|
||||||
|
e.preventDefault();
|
||||||
|
showTip(touch, element);
|
||||||
|
}, 1000);
|
||||||
|
}).on('touchend', function (e) {
|
||||||
|
if (!isLongPress) {
|
||||||
|
// 如果没有发生长按,则执行点击事件的逻辑
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
}).on('touchmove', function () {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
hideTip();
|
||||||
|
}).on('contextmenu', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tipLayer').click(function () {
|
||||||
|
// 点击tips层时删除对应的.item元素
|
||||||
|
removeFromBookShelf($(this).data('target').attr("id"));
|
||||||
|
$(this).data('target').remove();
|
||||||
|
hideTip();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
layui.use('laypage', function () {
|
layui.use('laypage', function () {
|
||||||
@ -272,7 +264,7 @@ $(".item").on('touchstart', function(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showTip(touchEvent, element) {
|
function showTip(touchEvent, element) {
|
||||||
isLongPress = true;
|
isLongPress = true;
|
||||||
// 根据触摸点位置设置弹出层的位置
|
// 根据触摸点位置设置弹出层的位置
|
||||||
$('#tipLayer')
|
$('#tipLayer')
|
||||||
.css({
|
.css({
|
||||||
@ -284,7 +276,7 @@ $(".item").on('touchstart', function(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hideTip() {
|
function hideTip() {
|
||||||
isLongPress = false;
|
isLongPress = false;
|
||||||
$('#tipLayer').hide().removeData('target'); // 隐藏tips并清除数据
|
$('#tipLayer').hide().removeData('target'); // 隐藏tips并清除数据
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,11 +325,11 @@ $(".item").on('touchstart', function(e) {
|
|||||||
searchByAllCondition(1, 20, keywords);
|
searchByAllCondition(1, 20, keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
function read(bookId,contentId){
|
function read(bookId, contentId) {
|
||||||
if(isLongPress){
|
if (isLongPress) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
location.href = '/book/'+bookId+"/"+contentId+".html"
|
location.href = '/book/' + bookId + "/" + contentId + ".html"
|
||||||
hideTip();
|
hideTip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,19 +339,19 @@ $(".item").on('touchstart', function(e) {
|
|||||||
|
|
||||||
function removeFromBookShelf(bookId) {
|
function removeFromBookShelf(bookId) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "delete",
|
type: "delete",
|
||||||
url: "/user/removeFromBookShelf/" + bookId,
|
url: "/user/removeFromBookShelf/" + bookId,
|
||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
$("#shelf" + bookId).remove();
|
$("#shelf" + bookId).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user