Quantcast
Channel: 《回调函数个性化 WordPress 评论样式》的评论
Viewing all articles
Browse latest Browse all 11

作者:终于把留言本整好了!! |光速捏猫爪♪

$
0
0

[...] 终于把留言本整好了!! 这可真不容易,因为我为了简单起见,并没有使用自定义的评论模版,主题文件夹里连comments.php都没有,所以想要对留言页面做什么特殊定义就是做梦呀做梦。终于在这个周末我开工将评论部分全数自定义化(当然不是自己写的代码,来自这里),就将留言本做出来了!效果看这里。具体方法是照着这里做的,很简单,最重要的是评论得自定义化。其实一般的主题都自定义了,但是我自己写的就没有做……呀呀这下可以好好玩了。顺便也将日志下的评论板式做了下调整, 如果可以的话,我希望能做的更精简一些。不过看来用上大量jquery是免不了的了orz先到这里,继续折腾~  window.___gcfg = {lang: 'zh-CN'}; (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); 2012/02/04 | Category:更新记录 | Tags: | 本文固定链接 Pinched 0. No Comments发表评论 点击这里取消回复。 姓名 电子邮件 (不会被公开) 站点.yarr { position:relative;visibility:hidden; } .yarr span { cursor:pointer; position:absolute; bottom:5px; right:0; } .yarr img { vertical-align:-2px } li:hover .yarr { visibility:visible; } // function yus_replyTo(commentID, author) { var inReplyTo = '@' + author + ': '; var myField; if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') { myField = document.getElementById('comment'); } else { return false; } if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = inReplyTo; myField.focus(); } else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; var cursorPos = endPos; myField.value = myField.value.substring(0, startPos) + inReplyTo + myField.value.substring(endPos, myField.value.length); cursorPos += inReplyTo.length; myField.focus(); myField.selectionStart = cursorPos; myField.selectionEnd = cursorPos; } else { myField.value += inReplyTo; myField.focus(); } } // 有人回覆時郵件通知我 img.wp-smiley-select {cursor: pointer;} function grin(tag) { if (typeof tinyMCE != 'undefined') { grin_tinymcecomments(tag); } else { grin_plain(tag); } } function grin_tinymcecomments(tag) { tinyMCE.execCommand('mceInsertContent', false, ' ' + tag + ' '); } function grin_plain(tag) { var myField; var myCommentTextarea = "comment"; tag = ' ' + tag + ' '; if (document.getElementById(myCommentTextarea) && document.getElementById(myCommentTextarea).type == 'textarea') { myField = document.getElementById(myCommentTextarea); } else { return false; } if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = tag; myField.focus(); } else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; var cursorPos = endPos; myField.value = myField.value.substring(0, startPos) + tag + myField.value.substring(endPos, myField.value.length); cursorPos += tag.length; myField.focus(); myField.selectionStart = cursorPos; myField.selectionEnd = cursorPos; } else { myField.value += tag; myField.focus(); } } function moreSmilies() { document.getElementById('wp-smiley-more').style.display = 'inline'; document.getElementById('wp-smiley-toggle').innerHTML = '« less'; } function lessSmilies() { document.getElementById('wp-smiley-more').style.display = 'none'; document.getElementById('wp-smiley-toggle').innerHTML = 'more »'; } more »© JUGEM(PICTO). [...]


Viewing all articles
Browse latest Browse all 11

Trending Articles