摘要:还没时间做插件背景偶然的机会,在准备做小半谈否的时候,正在寻找用户人群时看到了利器网站他们使用了一款年貌似是由一个国外开发者做的句子标记插件,实现了文章中点击句子即可标记并评论的功能同样的也有句子标记功能,还是蛮有用的增加了互动,访客也能参
还没时间做 WordPress 插件…
背景偶然的机会,在准备做小半谈否 API 的时候,正在寻找用户人群时看到了利器 (liqi.io) 网站
他们使用了一款 2015年(貌似是)由一个国外开发者做的句子标记插件,实现了文章中点击句子即可标记并评论的功能
同样的 Medium 也有句子标记功能,还是蛮有用的
增加了互动,访客也能参与其中…
代码没有来得及整理,先贴代码
//内容数据都保存在当前文章自定义字段
$stream_ids = get_post_meta($post->ID,"stream_ids",true);
$stream_contents = get_post_meta($post->ID,"stream_contents",true);
$stream_users = get_post_meta($post->ID,"stream_users",true);
$stream_users = explode("######",$stream_users);
$stream_ids = explode("######",$stream_ids);
$stream_contents = explode("######",$stream_contents);
$count1 = count($stream_ids);
$count2 = count($stream_contents);
$count3 = count($stream_users);
↑ 文章页头部获取标记内容
ID;
if(empty($user_id)){
$login = 0;
}else{
$login = 1;
}
?>
↑ 文章页展示评论区块
↑ 文章页核心功能 jQuery 代码
↑ 文章页处理标记内容 jQuery 代码
function send_post_mark_comment() {
if(!empty($_POST["content"]) && !empty($_POST["post_id"]) && !empty($_POST["user_id"]) && !empty($_POST["stream_id"])) {
$content = addslashes($_POST["content"]);
$post_id = (int)$_POST["post_id"];
$user_id = (int)$_POST["user_id"];
$stream_id = (int)$_POST["stream_id"];
if(get_post_status($post_id) !== false){
$old_ids = get_post_meta($post_id,"stream_ids",true);
$old_contents = get_post_meta($post_id,"stream_contents",true);
$old_users = get_post_meta($post_id,"stream_users",true);
if(!empty($old_ids) && !empty($old_contents)){
$status = update_post_meta($post_id,"stream_ids",$old_ids."######".$stream_id);
$status = update_post_meta($post_id,"stream_users",$old_users."######".$user_id);
$status = update_post_meta($post_id,"stream_contents",$old_contents."######".$content);
}else{
$status = update_post_meta($post_id,"stream_ids",$stream_id);
$status = update_post_meta($post_id,"stream_users",$user_id);
$status = update_post_meta($post_id,"stream_contents",$content);
}
if($status !== false){
echo json_encode(array("stats"=>"1"));
}else{
echo json_encode(array("stats"=>"0"));
}
}else{
echo json_encode(array("stats"=>"0"));
}
die();
}
}
// 将接口加到 init 中
add_action("init", "send_post_mark_comment");
↑ 提交评论 action 函数
.new-single-comment-btn{
float: right !important;
border: 2px solid #959da5 !important;
background-color: #fff !important;
box-shadow: none !important;
border-radius: 5px !important;
padding: 12px 12px 11px 15px !important;
text-align: center !important;
text-shadow: none !important;
color: #959da5 !important;
margin: 0px !important;
margin-top: -5px !important;
}
.new-single-comment-avatar{
width: 40px;
height: 40px;
margin-left: -2px;
margin-right: 13px;
border-radius: 50%;
}
.new-single-div-author{
position: absolute;
right: 0px;
top: -54px;
padding: 6px 20px;
font-family: sans-serif;
font-size: 1.8rem;
border-radius: 50px;
box-shadow: 0 0.125rem 0.75rem 0 rgba(0,0,0,.08);
}
.new-p-under{
text-decoration: underline dashed rgb(253, 188, 1) !important;
}
.new-p-undered{
text-decoration: underline dashed rgb(253, 188, 1) !important;
}
.new-single-comment-fixed{
display: none;
position: fixed;
box-shadow: 0 1px 4px rgba(0,0,0,.2);
border: none;
transform: translateX(820px);
margin-top: 22.1vh;
width: 35vh;
top: 0px;
background: rgb(255, 255, 255);
}
.new-single-comment-fixed input{
border: none;font-size: 1.4rem;font-weight: 400;font-family: sans-serif;color: #666;height: 55px;padding-left: 20px; border-left: 5px solid rgb(253, 188, 1);
}
.new-single-comment-p{
font-size: 1.2rem !important;
margin: 5px 0 !important;
color: #888;
text-decoration: none !important;
}
.new-single-comment-img{
width: 28px !important;
min-width: 28px !important;
height: 28px !important;
margin: 0px !important;
display: inline-block !important;
border-radius: 50% !important;
margin-right: 7px !important;
margin-left: -5px !important;
margin-top: -4px !important;
}
.underline-ps{
background: rgb(252, 188, 1);
color: rgb(255, 255, 255);
font-style: normal;
font-size: 1rem;
padding: 1px 10px;
font-weight: 600;
border-radius: 5px;
margin-left: 5px;
}
.new-single-comment-div{
padding: 0px 20px 0px 20px;
border-left: 5px solid rgb(238, 238, 238);
transition: ease-in-out .2s;
}
.new-single-comment-div h4{
font-weight: 600;
font-size: 1.9rem;
color: #666;
margin-bottom: 3px;
}
.new-single-comment-div-list{
padding: 10px 0px;
padding-left: 0px;
border-top: 1px solid #eee;
max-height: 50vh;
overflow: hidden;
overflow-y: auto;
transition: ease-in-out .2s;
}
.new-cap-tags{
margin-top: -20px;
}
.new-cap-tags a{
position: relative;
display: inline-block;
height: 30px;
padding: 0 15px;
font-size: 1.7rem;
line-height: 30px;
color: rgb(0, 132, 255) !important;
vertical-align: top;
border-radius: 100px;
background: rgba(0, 132, 255, 0.1);
}
.new-single-comment-fixed-cap{
box-shadow: 0 1px 4px rgba(0,0,0,.2);
border: none;
background: rgb(255, 255, 255);
transform: none !important;
display: block !important;
margin-top: 30px !important;
margin-left: 44px !important;
width: 100%;
position: relative;
}
↑ CSS部分
截图 后记大概还不准备放在 Tony 主题 里 (感觉没啥必要)
之后可能会做成 WordPress 插件2333
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/114492.html
摘要:还没时间做插件背景偶然的机会,在准备做小半谈否的时候,正在寻找用户人群时看到了利器网站他们使用了一款年貌似是由一个国外开发者做的句子标记插件,实现了文章中点击句子即可标记并评论的功能同样的也有句子标记功能,还是蛮有用的增加了互动,访客也能参 还没时间做 WordPress 插件… 背景 偶然的机会,在准备做小半谈否 API 的时候,正在寻找用户人群时看到了利器 (liqi.io) 网站...
摘要:还没时间做插件背景偶然的机会,在准备做小半谈否的时候,正在寻找用户人群时看到了利器网站他们使用了一款年貌似是由一个国外开发者做的句子标记插件,实现了文章中点击句子即可标记并评论的功能同样的也有句子标记功能,还是蛮有用的增加了互动,访客也能参 还没时间做 WordPress 插件… 背景 偶然的机会,在准备做小半谈否 API 的时候,正在寻找用户人群时看到了利器 (liqi.io) 网站...
摘要:很快地恢复快速回复肯定是客户反馈的金凤凰,等会看是否考核得分健康的首付款获取注释所在的容器四总结以上写的时间比较急,代码很粗糙,有类似功能的大神们有好的建议或者想法多多留言与分享,谢谢先就这些吧,后续再继续改进和优化 初入前端,最近在使用word时发现有个批注功能,就想的如何用代码去实现一下 一、大概需求如下: 1.页面整体分为左中右两部分,中间为正文内容区域,右右两侧为注释浏览区域2...
摘要:上一篇前端常用插件工具类库汇总上内容摘要动画库滚动库轮播图滚屏弹出框消息通知下拉框级联选择器颜色选择器时间日期处理表单验证分页插件本篇延续上一篇的内容继续给大家带来一系列关于前端插件工具类的内容。 showImg(https://segmentfault.com/img/bVbjsMh?w=900&h=383); 前言 对本文感兴趣可以先加个收藏,也可以转发分享给身边的小伙伴,以后遇到...
摘要:只是抱怨事物的状态并没有什么卵用,我打算给你一个实实在在的一步一步征服生态圈的学习计划。好消息是,这刚好是本学习计划关注的问题。比如,一个不错的出发点是的课。是一个由创建和开源的库。我个人推荐的初学者课程。而个人项目是尝试新技术的完美时机。 本文转载自:众成翻译译者:网络埋伏纪事链接:http://www.zcfy.cc/article/1617原文:https://medium.fr...
阅读 2976·2023-04-25 18:10
阅读 1842·2019-08-30 15:53
阅读 3160·2019-08-30 13:10
阅读 3490·2019-08-29 18:40
阅读 1390·2019-08-23 18:31
阅读 1416·2019-08-23 16:49
阅读 3567·2019-08-23 16:07
阅读 1063·2019-08-23 15:27
120,"height"=>120,"rating"=>"X","class"=>array("new-single-comment-img"),"extra_attr"=>"title="user-avatar"","scheme"=>"https") ); ?>display_name; ?>