var a = false, blog_url = "https://blog.dmyhm.net/";
function insertSmile2(id) {
$('textarea[name=comment],textarea[name=reply]').parseHtml2(id)
}
function bqover(a){
var img='
'+a.title+'
';
$("#yulan").html(img);
var x=$(a).position().left+$(a).width();
var y=$(a).position().top-$("#yulan").height()-20;
$("#yulan").css({"left":x,"top":y});
//$(a).fadeTo("fast",0.5);
$("#yulan").show();
//alert(x+":"+y);
}
function bqout(a){
$("#yulan").hide();
}
$(function(){
$("textarea[name=comment],textarea[name=reply]").focus(function() {
if (!a) {
var bq = document.createElement('div');
$(bq).attr('id', 'biaoqing');
smiles2='![[牛] [牛]](https://blog.dmyhm.net/content/plugins/diyface/smile/009.gif)
![[稀饭] [稀饭]](https://blog.dmyhm.net/content/plugins/diyface/smile/020.gif)
![[愤怒] [愤怒]](https://blog.dmyhm.net/content/plugins/diyface/smile/031.gif)
![[无语] [无语]](https://blog.dmyhm.net/content/plugins/diyface/smile/003.gif)
![[哭] [哭]](https://blog.dmyhm.net/content/plugins/diyface/smile/004.gif)
![[汗] [汗]](https://blog.dmyhm.net/content/plugins/diyface/smile/016.gif)
![[哈哈] [哈哈]](https://blog.dmyhm.net/content/plugins/diyface/smile/032.gif)
![[得意] [得意]](https://blog.dmyhm.net/content/plugins/diyface/smile/007.gif)
![[戳] [戳]](https://blog.dmyhm.net/content/plugins/diyface/smile/018.gif)
![[鸡冻] [鸡冻]](https://blog.dmyhm.net/content/plugins/diyface/smile/029.gif)
![[拥抱] [拥抱]](https://blog.dmyhm.net/content/plugins/diyface/smile/021.gif)
![[微笑] [微笑]](https://blog.dmyhm.net/content/plugins/diyface/smile/001.gif)
![[帅哥] [帅哥]](https://blog.dmyhm.net/content/plugins/diyface/smile/002.gif)
![[上吊] [上吊]](https://blog.dmyhm.net/content/plugins/diyface/smile/005.gif)
![[抽烟] [抽烟]](https://blog.dmyhm.net/content/plugins/diyface/smile/006.gif)
![[飞吻] [飞吻]](https://blog.dmyhm.net/content/plugins/diyface/smile/008.gif)
![[委屈] [委屈]](https://blog.dmyhm.net/content/plugins/diyface/smile/010.gif)
![[!] [!]](https://blog.dmyhm.net/content/plugins/diyface/smile/011.gif)
![[大骂] [大骂]](https://blog.dmyhm.net/content/plugins/diyface/smile/012.gif)
![[晕] [晕]](https://blog.dmyhm.net/content/plugins/diyface/smile/013.gif)
![[财迷] [财迷]](https://blog.dmyhm.net/content/plugins/diyface/smile/014.gif)
![[思考] [思考]](https://blog.dmyhm.net/content/plugins/diyface/smile/015.gif)
![[超人] [超人]](https://blog.dmyhm.net/content/plugins/diyface/smile/017.gif)
![[心碎] [心碎]](https://blog.dmyhm.net/content/plugins/diyface/smile/019.gif)
![[握手] [握手]](https://blog.dmyhm.net/content/plugins/diyface/smile/022.gif)
![[安慰] [安慰]](https://blog.dmyhm.net/content/plugins/diyface/smile/023.gif)
![[礼物] [礼物]](https://blog.dmyhm.net/content/plugins/diyface/smile/024.gif)
![[石头] [石头]](https://blog.dmyhm.net/content/plugins/diyface/smile/025.gif)
![[剪刀] [剪刀]](https://blog.dmyhm.net/content/plugins/diyface/smile/026.gif)
![[布] [布]](https://blog.dmyhm.net/content/plugins/diyface/smile/027.gif)
![[?] [?]](https://blog.dmyhm.net/content/plugins/diyface/smile/030.gif)
![[鄙视] [鄙视]](https://blog.dmyhm.net/content/plugins/diyface/smile/033.gif)
![[可爱] [可爱]](https://blog.dmyhm.net/content/plugins/diyface/smile/034.gif)
![[害羞] [害羞]](https://blog.dmyhm.net/content/plugins/diyface/smile/035.gif)
![[鼓掌] [鼓掌]](https://blog.dmyhm.net/content/plugins/diyface/smile/036.gif)
';
$(bq).html(smiles2);
$('textarea[name=comment],textarea[name=reply]').before($(bq)); //将带有表情的层添加到 conten 之上;
var bq2 = document.createElement('div');
$(bq2).attr('id', 'yulan');
$('textarea[name=comment],textarea[name=reply]').before($(bq2));
$(bq).css({"width":$('textarea[name=comment],textarea[name=reply]').width()});
$(bq).fadeIn("slow");
$.fn.extend({
parseHtml2: function(myValue) {
var $t = $(this)[0];
if (document.selection) {
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus()
} else if ($t.selectionStart || $t.selectionStart == '0') {
var startPos = $t.selectionStart;
var endPos = $t.selectionEnd;
var scrollTop = $t.scrollTop;
$t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
this.focus()
$t.selectionStart = startPos + myValue.length;
$t.selectionEnd = startPos + myValue.length;
$t.scrollTop = scrollTop
} else {
this.value += myValue;
this.focus()
}
}
});
a = true;
}
});
});