upload plugin
This commit is contained in:
11
Last_Volatility/conf.json
Normal file
11
Last_Volatility/conf.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Volatility",
|
||||
"brief": "与浏览器融为一体 - 更接近原生APP的主题, 目前仅作用于手机页面, (更新: 修复导航滚动)",
|
||||
"version": "1.2",
|
||||
"bbs_version": "4.0",
|
||||
"installed": 1,
|
||||
"enable": 1,
|
||||
"hooks_rank": [],
|
||||
"overwrites_rank": [],
|
||||
"dependencies": []
|
||||
}
|
21
Last_Volatility/hook/footer_js_after.htm
Normal file
21
Last_Volatility/hook/footer_js_after.htm
Normal file
@@ -0,0 +1,21 @@
|
||||
<script>
|
||||
// 监听滚动事件,判断滚动方向
|
||||
var Before_scollH = 0
|
||||
var header_phone = $("header.header_phone")
|
||||
var header_phonex = $("header.header_phone ul:first-child")
|
||||
$(window).on('scroll', function () {
|
||||
var After_scollH = $(window).scrollTop()
|
||||
var differH = After_scollH - Before_scollH
|
||||
if (differH == 0) { return false }
|
||||
if (differH > 0) {
|
||||
if ($(document).scrollTop() < 50) { return false }
|
||||
$('nav').removeClass('shrink');
|
||||
} else {
|
||||
//if (document.documentElement.scrollHeight-document.documentElement.scrollTop-document.documentElement.clientHeight < 50) { return false }
|
||||
if ($(document).height() - $(document).scrollTop() - $(window).height() < 50) { return false }
|
||||
$('nav').addClass('shrink');
|
||||
}
|
||||
Before_scollH = After_scollH
|
||||
})
|
||||
</script>
|
||||
<script src="plugin/Last_Volatility/view/js/user.js?v11" type="text/javascript"></script>
|
1
Last_Volatility/hook/forum_start.htm
Normal file
1
Last_Volatility/hook/forum_start.htm
Normal file
@@ -0,0 +1 @@
|
||||
<?php include _include(APP_PATH.'plugin/Last_Volatility/view/htm/nav.htm');?>
|
3
Last_Volatility/hook/header_link_after.htm
Normal file
3
Last_Volatility/hook/header_link_after.htm
Normal file
@@ -0,0 +1,3 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" href="plugin/Last_Volatility/view/css/style.css?v10s">
|
1
Last_Volatility/hook/index_start.htm
Normal file
1
Last_Volatility/hook/index_start.htm
Normal file
@@ -0,0 +1 @@
|
||||
<?php include _include(APP_PATH.'plugin/Last_Volatility/view/htm/nav.htm');?>
|
3
Last_Volatility/hook/post_list_inc_filelist_after.htm
Normal file
3
Last_Volatility/hook/post_list_inc_filelist_after.htm
Normal file
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<span class="date text-grey"><?php echo $_post['create_date_fmt'];?></span>
|
||||
</div>
|
11
Last_Volatility/hook/thread_username_before.htm
Normal file
11
Last_Volatility/hook/thread_username_before.htm
Normal file
@@ -0,0 +1,11 @@
|
||||
<a class="user_avatar" href='<?php echo url("user-$thread[uid]");?>' tabindex="-1">
|
||||
<img class="avatar-3 mr-3" src="<?php echo $thread['user_avatar_url'];?>">
|
||||
</a>
|
||||
<div>
|
||||
<div class="a">
|
||||
<span class="username">
|
||||
<a href="<?php echo url("user-$thread[uid]");?>"
|
||||
class="text-muted font-weight-bold"><?php echo $thread['username'];?></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="b">
|
2
Last_Volatility/hook/thread_views_after.htm
Normal file
2
Last_Volatility/hook/thread_views_after.htm
Normal file
@@ -0,0 +1,2 @@
|
||||
</div>
|
||||
</div>
|
BIN
Last_Volatility/icon.png
Normal file
BIN
Last_Volatility/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
405
Last_Volatility/view/css/style.css
Normal file
405
Last_Volatility/view/css/style.css
Normal file
@@ -0,0 +1,405 @@
|
||||
.message .date {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
/**
|
||||
.thread .media-body {
|
||||
min-width: 0;
|
||||
}
|
||||
.thread .media-body .subject {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
**/
|
||||
a {
|
||||
color: #555555;
|
||||
}
|
||||
a:link {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:active {
|
||||
text-decoration: none;
|
||||
}
|
||||
body {
|
||||
padding-top: 0;
|
||||
background: #ffffff;
|
||||
}
|
||||
.navbar {
|
||||
display: none;
|
||||
}
|
||||
#body>.container>.row>div {
|
||||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
.card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
word-wrap: break-word;
|
||||
background-color: #fff;
|
||||
background-clip: border-box;
|
||||
border: 0;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.card-body {
|
||||
flex: 1 1 auto;
|
||||
padding: 9px 18px;
|
||||
}
|
||||
.message {
|
||||
padding-top: 5px;
|
||||
}
|
||||
.message p {
|
||||
margin: 0;
|
||||
line-height: 2;
|
||||
color: #525252;
|
||||
font-family: Helvetica Neue, NotoSansHans-Regular, AvenirNext-Regular, arial, Hiragino Sans GB, Microsoft Yahei, WenQuanYi Micro Hei, serif;
|
||||
}
|
||||
.message img {
|
||||
max-width: 100%;
|
||||
height: auto !important;
|
||||
border: 0px;
|
||||
border-radius: 3px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
.message textarea {
|
||||
border: none;
|
||||
border-radius: 1rem;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
.message textarea:focus {
|
||||
border-radius: 1rem;
|
||||
background: #f8f9fa;
|
||||
outline: none;
|
||||
border: 0;
|
||||
outline: none;
|
||||
}
|
||||
/* 主题列表 */
|
||||
.card-threadlist {
|
||||
margin-top: 8rem;
|
||||
}
|
||||
.card-threadlist .card-header {
|
||||
display: none !important;
|
||||
}
|
||||
.card-threadlist a:visited {
|
||||
color: #666666;
|
||||
text-decoration: none;
|
||||
}
|
||||
.message .date {
|
||||
display: block;
|
||||
font-size: .8rem;
|
||||
margin-top: .5rem;
|
||||
}
|
||||
/* 移除全局页脚 */
|
||||
#footer {
|
||||
display: none;
|
||||
}
|
||||
/* 附件 */
|
||||
.message .fieldset>legend {
|
||||
display: none;
|
||||
}
|
||||
.message .fieldset::before {
|
||||
position: relative;
|
||||
top: -1.4rem;
|
||||
left: 0;
|
||||
content: "attach";
|
||||
padding: 0 10px;
|
||||
font-size: 1rem;
|
||||
border-radius: .5rem;
|
||||
color: #ffffff;
|
||||
background-color: #FFBA10;
|
||||
}
|
||||
/* DEBUG - info */
|
||||
.fieldset {
|
||||
padding: 8px;
|
||||
margin: 24px 0;
|
||||
border: none;
|
||||
border-radius: 2px;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
.fieldset>p {
|
||||
color: #525252;
|
||||
}
|
||||
.fieldset>ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #525252;
|
||||
}
|
||||
.debug::before {
|
||||
position: relative;
|
||||
top: -1.4rem;
|
||||
left: 0;
|
||||
content: "DEBUG";
|
||||
padding: 0 10px;
|
||||
font-size: 1rem;
|
||||
border-radius: .5rem;
|
||||
color: #ffffff;
|
||||
background-color: #FFBA10;
|
||||
}
|
||||
}
|
||||
|
||||
.card-thread .media .user_avatar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.card-thread .card-body .media .media-body .a {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
/* 主贴标题 */
|
||||
.card-thread .card-body>.media {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
.card-thread .card-body>.media>a {
|
||||
display: none;
|
||||
}
|
||||
.card-thread .card-body .media .media-body>h4 {
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
.card-thread .card-body .media .media-body>div>div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.card-thread .card-body .media .media-body>div>div:first-child>a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.card-thread .card-body .media .media-body>div>div>div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.card-thread .card-body .media .media-body .a {
|
||||
display: block;
|
||||
}
|
||||
.card-thread .card-body .media .media-body .a span.username {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.card-thread .card-body .media .media-body .b span.username {
|
||||
display: none;
|
||||
}
|
||||
.card-thread .card-body .media .media-body .b span.date {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
/* 主贴分割线 */
|
||||
.card-thread .card-body>hr {
|
||||
display: none;
|
||||
}
|
||||
.thread,
|
||||
.post {
|
||||
border-bottom: 0;
|
||||
padding: 0.8rem 0px;
|
||||
}
|
||||
/* 移除原有时间 */
|
||||
.post .media-body .justify-content-between>div>span.date {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 分页导航 */
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.page-item:first-child .page-link {
|
||||
margin-left: 0;
|
||||
padding-left: 1rem;
|
||||
border-top-left-radius: .5rem;
|
||||
border-bottom-left-radius: .5rem;
|
||||
}
|
||||
.page-item:last-child .page-link {
|
||||
padding-right: 1rem;
|
||||
border-top-right-radius: .5rem;
|
||||
border-bottom-right-radius: .5rem;
|
||||
}
|
||||
.page-link {
|
||||
font-size: 1.2rem;
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 0.5rem 1rem;
|
||||
margin-left: -1px;
|
||||
line-height: 1.25;
|
||||
color: #555555;
|
||||
background-color: #fff;
|
||||
border: 1px solid #dee2e6;
|
||||
}
|
||||
.page-item.active .page-link {
|
||||
z-index: 1;
|
||||
color: #fff;
|
||||
background-color: #999999;
|
||||
border-color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Rw Nav */
|
||||
|
||||
nav.navbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
nav.navbar {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 1030;
|
||||
border-width: 0 0 1px;
|
||||
min-height: 50px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid transparent;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #ffffff;
|
||||
-webkit-transition: all 0.8s ease;
|
||||
transition: all 0.8s ease;
|
||||
}
|
||||
nav.navbar.shrink {
|
||||
min-height: 120px;
|
||||
}
|
||||
nav.navbar ul {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
nav.navbar>.a {
|
||||
opacity: 0;
|
||||
height: 0;
|
||||
-webkit-transition: all 0.8s ease;
|
||||
transition: all 0.8s ease;
|
||||
}
|
||||
nav.navbar>.b {
|
||||
width: 100%;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
nav.navbar>.b::-webkit-scrollbar {display:none}
|
||||
nav.navbar.shrink>.a {
|
||||
opacity: 1;
|
||||
height: 3rem;
|
||||
}
|
||||
nav.navbar .user {}
|
||||
nav.navbar .user img {}
|
||||
nav.navbar .search {
|
||||
flex: 8;
|
||||
padding: 0 12px;
|
||||
}
|
||||
nav.navbar .search div {
|
||||
width: 100%;
|
||||
min-width: 150px;
|
||||
height: 2.2rem;
|
||||
padding: 0 1rem;
|
||||
border-radius: 1.1rem;
|
||||
background: #eeeeee;
|
||||
border: 0;
|
||||
outline: none;
|
||||
}
|
||||
/** 暂时放弃输入框
|
||||
nav.navbar .search input {
|
||||
width: 100%;
|
||||
min-width: 150px;
|
||||
height: 2.2rem;
|
||||
padding: 0 1rem;
|
||||
border-radius: 1.1rem;
|
||||
background: #eeeeee;
|
||||
border: 0;
|
||||
outline: none;
|
||||
}
|
||||
::-webkit-input-placeholder {
|
||||
color: #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
:-moz-placeholder {
|
||||
color: #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
::-moz-placeholder {
|
||||
color: #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
:-ms-input-placeholder {
|
||||
color: #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
*/
|
||||
nav.navbar .add {
|
||||
flex: 1;
|
||||
}
|
||||
nav.navbar .add a {
|
||||
display: block;
|
||||
height: 2.2rem;
|
||||
width: 2.2rem;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
border-radius: 1.1rem;
|
||||
line-height: 2.2rem;
|
||||
color: #ccc;
|
||||
background: #eeeeee;
|
||||
}
|
||||
nav.navbar .add .icon-edit:before {
|
||||
padding: 0;
|
||||
color: #555555;
|
||||
line-height: 2.2rem;
|
||||
}
|
||||
/* 返回按钮 */
|
||||
.xn-back {
|
||||
display: block;
|
||||
width: 60%;
|
||||
}
|
||||
}
|
||||
|
||||
/* USER */
|
||||
#signin {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1031;
|
||||
background: rgba(255, 255, 255, .8);
|
||||
}
|
||||
|
||||
/*设置移动效果*/
|
||||
.card-threadlist .card-body {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
.thread {
|
||||
padding-left: 18px;
|
||||
padding-right: 18px;
|
||||
transition:all 0.2s ;
|
||||
-webkit-transition:all 0.2s ;
|
||||
}
|
||||
.moveleft{
|
||||
transform: translateX(-20px);
|
||||
-webkit-transform: translateX(-20px);
|
||||
position: relative;
|
||||
transition:all 0.2s ;
|
||||
-webkit-transition:all 0.2s ;
|
||||
}
|
||||
.moveleft::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
display: block;
|
||||
background: #FFBA10;
|
||||
width: 20px;
|
||||
height: 100%;
|
||||
margin-top: -0.8rem;
|
||||
transition:all 0.2s ;
|
||||
-webkit-transition:all 0.2s ;
|
||||
}
|
43
Last_Volatility/view/htm/nav.htm
Normal file
43
Last_Volatility/view/htm/nav.htm
Normal file
@@ -0,0 +1,43 @@
|
||||
<nav class="navbar shrink" role="navigation">
|
||||
<ul class="a">
|
||||
<li class="user" id="user">
|
||||
<?php if(empty($uid)) { ?>
|
||||
<a href="<?php echo url('user-login');?>"><img src="<?php echo $conf['logo_mobile_url'];?>"
|
||||
class="logo-3"></a>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo url('my');?>"><img class="avatar-3" src="<?php echo $user['avatar_url'];?>"></a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<li class="search">
|
||||
<a href="?search.htm">
|
||||
<div></div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="add">
|
||||
<?php if(empty($uid)) { ?>
|
||||
<a class="navbar-brand hidden-lg" href="<?php echo url('user-login');?>" aria-label="<?php echo lang('login');?>"><i class="icon-user icon"></i></a>
|
||||
<?php } else { ?>
|
||||
<a class="navbar-brand hidden-lg" href='<?php echo url("thread-create-$fid");?>' aria-label="<?php echo lang('thread_create');?>"><i class="icon-plus icon"></i></a>
|
||||
<?php } ?>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="b">
|
||||
|
||||
<ul class="b">
|
||||
<!--{hook header_nav_forum_start.htm}-->
|
||||
<li class="nav-item home" fid="0" data-active="fid-0"><a class="nav-link" href="."><i
|
||||
class="icon-home d-md-none"></i> <?php echo lang('index_page');?></a></li>
|
||||
<!--{hook header_nav_home_link_after.htm}-->
|
||||
<?php foreach($forumlist_show as $_forum) { ?>
|
||||
<!--{hook header_nav_forumlist_loop_start.htm}-->
|
||||
<li class="nav-item" fid="<?php echo $_forum['fid'];?>" data-active="fid-<?php echo $_forum['fid'];?>">
|
||||
<a class="nav-link" href='<?php echo url("forum-$_forum[fid]");?>'><i class="icon-circle-o d-md-none"></i>
|
||||
<?php echo $_forum['name'];?></a>
|
||||
</li>
|
||||
<!--{hook header_nav_forumlist_loop_end.htm}-->
|
||||
<?php } ?>
|
||||
<!--{hook header_nav_forum_end.htm}-->
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</nav>
|
1
Last_Volatility/view/js/main.js
Normal file
1
Last_Volatility/view/js/main.js
Normal file
@@ -0,0 +1 @@
|
||||
|
167
Last_Volatility/view/js/user.js
Normal file
167
Last_Volatility/view/js/user.js
Normal file
@@ -0,0 +1,167 @@
|
||||
var storage = {
|
||||
// 检查可用的模式
|
||||
test: function () {
|
||||
// 本地存储是否可用
|
||||
var test = 'test';
|
||||
try {
|
||||
localStorage.setItem(test, test);
|
||||
localStorage.removeItem(test);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
setItem: function (k, v) {
|
||||
localStorage.setItem(k, v)
|
||||
}
|
||||
// cookies 是否可用
|
||||
// 都不可用, 直接提示无法登陆
|
||||
// 要存储的数据一般有 身份信息, 状态信息"x, 设置信息? 统计信息
|
||||
}
|
||||
var cookie = {
|
||||
get: function (cname) {
|
||||
var name = cname + "="
|
||||
var ca = document.cookie.split(';')
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i].trim()
|
||||
if (c.indexOf(name) == 0) return c.substring(name.length, c.length)
|
||||
}
|
||||
return ""
|
||||
},
|
||||
sid: function () {
|
||||
return this.get("bbs_sid")
|
||||
},
|
||||
token: function () {
|
||||
return this.get("bbs_token")
|
||||
}
|
||||
}
|
||||
var user = {
|
||||
signin: function () {
|
||||
var div = document.createElement("div")
|
||||
div.id = "signin"
|
||||
div.innerHTML = `<ul>
|
||||
<li>
|
||||
<i class="icon icon-user icon-fw"></i>
|
||||
<input type="text" placeholder="Email / 用户名" id="email" name="email">
|
||||
</li>
|
||||
<li>
|
||||
<i class="icon icon-lock icon-fw"></i>
|
||||
<input type="password" placeholder="密码" id="password" name="password">
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" >登录</button>
|
||||
<a href="?user-create.htm" class="text-muted"><small>用户注册</small></a>
|
||||
</li>
|
||||
</ul>`
|
||||
document.body.appendChild(div)
|
||||
|
||||
// 为登录按钮挂载一个事件监听, 如果已经登录则这个挂载是不必要的
|
||||
// 为窗口背景挂载一个关闭按钮区域
|
||||
// 当登录成功, 移除登录窗口时, 事件监听是否还存在?
|
||||
return div.onclick = function () {
|
||||
if (div.style.display == "none") {
|
||||
div.style.display = ""
|
||||
} else {
|
||||
div.style.display = "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
signout: function () {
|
||||
// 发送退出数据 转变模式到游客
|
||||
// 清空本地存储的所有数据, 通常退出的意义
|
||||
// 当退出登录时, 重新挂载登录窗口, 也可以始终都不移除它?
|
||||
// alert("aoaoaoaoaoao")
|
||||
},
|
||||
regedit: function () {
|
||||
// 游客可以注册, 但通常作为低频数据结构, 它不应放入js
|
||||
},
|
||||
id: "int",
|
||||
token: "string",
|
||||
name: "string",
|
||||
avact: "string",
|
||||
online: false,
|
||||
init: function () {
|
||||
// 基本数据初始化
|
||||
this.online = cookie.token == "" ? false : true
|
||||
|
||||
// 基本状态初始化
|
||||
this.online ? this.signout() : this.signin()
|
||||
}
|
||||
}
|
||||
|
||||
user.init()
|
||||
//alert("cacxscasca")
|
||||
// 所以只在判断未登录状态下才挂载这个面板
|
||||
// 为页面添加默认隐藏的登录窗口
|
||||
// signin()
|
||||
|
||||
var admin = {
|
||||
thread: {
|
||||
list: [],
|
||||
delete: function(){},
|
||||
},
|
||||
}
|
||||
|
||||
// 侧滑选中
|
||||
window.onload = function () {
|
||||
|
||||
//侧滑显示删除按钮
|
||||
|
||||
var open = null;//open初始化,判断是否是已展开元素
|
||||
var list = document.getElementsByClassName("thread");//list获取所有的待展开框
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var x, y, X, Y, moveX, moveY;
|
||||
list[i].addEventListener('touchstart', function (e) {
|
||||
/*获取最初的触摸位置*/
|
||||
x = e.changedTouches[0].pageX;
|
||||
y = e.changedTouches[0].pageY;
|
||||
moveX = true;
|
||||
moveY = true;
|
||||
});
|
||||
|
||||
list[i].addEventListener('touchmove', function (e) {
|
||||
X = e.changedTouches[0].pageX;
|
||||
Y = e.changedTouches[0].pageY;
|
||||
|
||||
//左右滑动
|
||||
if (moveX && Math.abs(X - x) - Math.abs(Y - y) > 0) {
|
||||
e.stopPropagation();//阻止冒泡事件
|
||||
//右滑收起删除按钮
|
||||
if (X - x > 10) {
|
||||
e.preventDefault();
|
||||
this.classList.remove("moveleft");
|
||||
}
|
||||
//左滑显示删除按钮
|
||||
if (x - X > 10) {
|
||||
e.preventDefault();
|
||||
this.classList.add("moveleft");
|
||||
open = this;//存入展开的li元素
|
||||
}
|
||||
//moveY = false;//左右滑动时不执行上下滑动时的事件
|
||||
}
|
||||
|
||||
//上下滑动
|
||||
if (moveY && Math.abs(X - x) - Math.abs(Y - y) < 0) {
|
||||
moveX = false;//上下滑动时不执行左右滑动时的事件
|
||||
}
|
||||
});
|
||||
|
||||
list[i].addEventListener('click', function (e) {
|
||||
//在已展开的元素中执行操作
|
||||
if (open) {
|
||||
var obj = e.target;
|
||||
var objli = e.target.closest(".list-li");
|
||||
|
||||
//点击li元素里不是删除按钮的部分,li元素收起
|
||||
if (obj.className != "btn") {
|
||||
open.classList.remove("moveleft");
|
||||
} else if (obj.className == "btn") {//点击删除按钮执行删除
|
||||
var objp = obj.parentNode;
|
||||
var objpp = obj.parentNode.parentNode;
|
||||
objpp.removeChild(objp);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user