最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
给wordpress评论处添加表情及工具
时间:2015-07-08 编辑:简简单单 来源:一聚教程网
wordpress评论框仅仅只有昵称、邮箱、站点和评论内容的话,会不会显得太简单了?当然追求简洁的人来说,可能觉得站点都有点多余,然后,大叔要说的是给wordpress评论处添加实用工具,丰富起我们的评论框吧!
include(TEMPLATEPATH . '/smiley.php'); //你主?引用表情的文件
/* 如果你使用「Custom Smilies」外?欤???h除上面那行,?K且去除下面?行的注? */
//cs_print_smilies();
?>
style.css内加入样式表:
/** ??工具 **/
#smiley{
padding-bottom: 10px;
}
#editor_tools{
line-
border: 1px #e0e0e0 solid;
border-radius: 2px 2px 0 0;
overflow: hidden;
z-index: 99999;
}
#editor_tools a{
color: #777;
display: inline-block;
padding: 0 8px;
border-right: 1px solid #ddd;
}
#editor_tools a:hover{
color: #333;
text-decoration: none;
}
#fontcolor{
line-
border: 2px #e0e0e0 solid;
z-index: 99999;
padding: 2px 0px 2px 2px;
}
#fontcolor a{
display: inline-block;
}
增加一个js,例comments.js,期内代码如下:
jQuery(function(){
jQuery("#smiley").hide(500);
jQuery("#comment-smiley").click(function(){
jQuery("#smiley").toggle(500);
});
});
jQuery(function(){
jQuery("#fontcolor").hide(500);
jQuery("#font-color").click(function(){
jQuery("#fontcolor").toggle(500);
});
});
jQuery(function(){
jQuery("#smiley").hide();
jQuery("#comment").click(function(){
});
});
jQuery(function(){
jQuery("#fontcolor").hide();
jQuery("#comment").click(function(){
});
});
jQuery(function() {
function addEditor(a, b, c) {
if (document.selection) {
a.focus();
sel = document.selection.createRange();
c ? sel.text = b + sel.text + c: sel.text = b;
a.focus()
} else if (a.selectionStart || a.selectionStart == '0') {
var d = a.selectionStart;
var e = a.selectionEnd;
var f = e;
c ? a.value = a.value.substring(0, d) + b + a.value.substring(d, e) + c + a.value.substring(e, a.value.length) : a.value = a.value.substring(0, d) + b + a.value.substring(e, a.value.length);
c ? f += b.length + c.length: f += b.length - e + d;
if (d == e && c) f -= c.length;
a.focus();
a.selectionStart = f;
a.selectionEnd = f
} else {
a.value += b + c;
a.focus()
}
}
var myDate = new Date();
var mytime=myDate.toLocaleTimeString()
var g = document.getElementById('comment') || 0;
var h = {
strong: function() {
addEditor(g, '', '')
},
em: function() {
addEditor(g, '', '')
},
del: function() {
addEditor(g, '', '')
},
underline: function() {
addEditor(g, '', '')
},
quote: function() {
addEditor(g, '
', '')
},
ahref: function() {
var a = prompt('??入?接地址', 'http://');
var b = prompt('??入?接?热?', '');
if (a) {
addEditor(g, '' + b + '', '')
}
},
img: function() {
var a = prompt('??入?D片地址', 'http://');
if (a) {
addEditor(g, '', '')
}
},
sign: function() {
addEditor(g, '今天?到啦!?r?:' + mytime, '')
},
code: function() {
addEditor(g, '
', '')
},
red: function() {
addEditor(g, '', '')
},
fuchsia: function() {
addEditor(g, '', '')
},
purple: function() {
addEditor(g, '', '')
},
orange: function() {
addEditor(g, '', '')
},
yellow: function() {
addEditor(g, '', '')
},
olive: function() {
addEditor(g, '', '')
},
lime: function() {
addEditor(g, '', '')
},
maroon: function() {
addEditor(g, '', '')
},
aqua: function() {
addEditor(g, '', '')
},
teal: function() {
addEditor(g, '', '')
},
green: function() {
addEditor(g, '', '')
},
blue: function() {
addEditor(g, '', '')
},
navy: function() {
addEditor(g, '', '')
},
gray: function() {
addEditor(g, '', '')
},
deepskyblue: function() {
addEditor(g, '', '')
},
gold: function() {
addEditor(g, '', '')
}, silver: function() {
addEditor(g, '', '')
},
black: function() {
addEditor(g, '', '')
}
};
window['SIMPALED'] = {};
window['SIMPALED']['Editor'] = h
});
调用这个JS
那么,在去看看你们的评论框吧,是不是碉堡了,恩,可能样式还需要修改修改,才能符合每个人不同的风格
相关文章
- wordpress 评论表情插件 04-08
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31