/* comment.js */ function ReplaceAnchor() { var anchor = new RegExp("(>>|>>|>>|※)([0-9]{1,4})","g"); /* var cmntDiv = document.getElementById("commentbody"); var aryDiv = cmntDiv.getElementsByTagName("div"); var sHTML; for(var i = 0; i < aryDiv.length ; i++) { if(aryDiv[i].getAttribute("class") == "commenttext" || aryDiv[i].getAttribute("className") == "commenttext") { var cmntNum = aryDiv[i].getAttribute("id"); cmntNum = cmntNum.replace(/ct/, ""); sHTML = aryDiv[i].innerHTML; if (sHTML.match(anchor)){ if (RegExp.$2 >= 1000){ sHTML = sHTML.replace(anchor, '$1$2
'); } else { sHTML = sHTML.replace(anchor, '$1$2
'); } aryDiv[i].innerHTML = sHTML; } } } */ if ($.isArray(ar_cmt)) for(var key in ar_cmt){ if (ar_cmt[key]['body'].match(anchor)){ if (RegExp.$2 >= 1000){ ar_cmt[key]['body'] = ar_cmt[key]['body'].replace(anchor, '$1$2
'); } else { ar_cmt[key]['body'] = ar_cmt[key]['body'].replace(anchor, '$1$2
'); } } } /* (function(cash) { $(".kobetsucom").each(function(){ $(this).html( $(this).html().replace(/((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g, '$1 ') ); }); })(jQuery); */ } function replace_anchor_html(input_html,comment_num) { var anchor = new RegExp("(>>|>>|>>|※)([0-9]{1,4})","g"); if (input_html.match(anchor)){ if (RegExp.$2 >= 1000){ input_html = input_html.replace(anchor, '$1$2
'); } else { input_html = input_html.replace(anchor, '$1$2
'); } } return input_html; } function CommentIn(CommentNumber, PopupNumber) { var cmntPOP = document.getElementById("cp" + PopupNumber); if (CommentNumber >= 1000){ var cmntTTL = document.getElementById("c" + CommentNumber); var cmntTXT = document.getElementById("com" + CommentNumber); cmntPOP.innerHTML = cmntTTL.innerHTML + "
" + cmntTXT.innerHTML; } else { var cmntTTL = $("#res_" + CommentNumber + " > .res_info").html(); var cmntTXT = $("#res_" + CommentNumber).children("[class^=res_body]").html(); if (!cmntTTL || !cmntTXT){ if ($("#res_" + CommentNumber + " > .news_quote")){ cmntPOP.innerHTML = $("#res_" + CommentNumber + " > .news_quote").html(); } else { return false; } } else { cmntPOP.innerHTML = cmntTTL + "
" + cmntTXT; } } cmntPOP.style.display = "inline"; } function CommentOut(CommentNumber) { var cmntPOP = document.getElementById("cp" + CommentNumber); cmntPOP.style.display = "none"; } function CommentAnchor(CommentNumber) { document.getElementById('text').value = ">>" + CommentNumber + "\n"; } function CommentWarota(CommentNumber) { $(function() { var CmTwitterText = "com" + CommentNumber; CmTwitterText = $('#' + CmTwitterText).text(); CmTwitterText = jQuery.trim(CmTwitterText); var CmTwitterURL = Turl + encodeURIComponent("#c" + CommentNumber); window.open('https://twitter.com/intent/tweet?text=コメ番' + CommentNumber + ':' + CmTwitterText + '&url=' + CmTwitterURL + '&original_referer=' + CmTwitterURL + '&related=alfalfafafa', null); }); //document.getElementById('text').value = ">>" + CommentNumber + "\nΣd(゚∀゚d)オウイエ!!\n"; //location.href='#write_comment02'; } /* <%DA%> ID:<%ID%>  */ function comment_tag(obj,aid){ var html = (function(){/**
<%NU%>  <%NA%>  <%DA%> *この発言に返信
<%BO%>
**/}).toString().split('**')[1].replace(/(\n|\t)/g,'').replace(/<%NU%>/g,obj["num"]).replace(/<%NA%>/g,obj["name"]).replace(/<%DA%>/g,'').replace(/<%DA%>/g,obj['date']).replace(/<%BO%>/g,obj['body']).replace(/<%ID%>/g,obj['id']).replace(/<%AID%>/g,aid); html = replace_anchor_html(html,obj["num"]); return html; } function vote(id,cid,sc){ document.getElementById('btn_a_'+cid).disabled = true; document.getElementById('btn_b_'+cid).disabled = true; newElm = document.createElement("script"); newElm.type = "text/javascript"; newElm.src = "http://cvote.a-ch.net/vote.php?id=" + id + "&cid=" + cid + "&sc=" + sc; document.getElementById('result' + cid).appendChild(newElm); } function rS(id,score){ if(!document.getElementById(id)) return false; var wid = 200; var bar = wid * (score / max); if(max <= 50) { bar = 4 * score; } if(id.indexOf("s_a") >= 0) { document.getElementById(id).innerHTML = "+" + score + " "; } if (id.indexOf("s_b") >= 0) { document.getElementById(id).innerHTML = "-" + score + " "; } } function cF(cid,total){ if (!$('#com'+cid).size()) return false; $('#com'+cid).css('color',(total<=-10)?"#F5F5DB":(total>=22)?"#DC143C":"#000000"); $('#com'+cid).css('fontSize',(total<=5)?"16px":(total<=12)?"20px":"20px"); } function disp_retweet(){ var template = (function(){/*
@<%SN%>
<%BODY%>
*/}).toString().replace(/(\n|\t)/g,'').split('*')[1]; var buffer = "",txt; for(var key in retweet_body){ if (typeof retweet_body[key]['body'] === "undefined") continue; txt = template; txt = txt.replace("<%IDX%>",key); txt = txt.replace("<%BODY%>",retweet_body[key]['body']); txt = txt.replace("<%ICON%>",retweet_body[key]['icon']); txt = txt.replace("<%TID%>",retweet_body[key]['tid']); txt = txt.replace(/<%SN%>/g,retweet_body[key]['sn']); buffer += txt; } /* if (contlink){ buffer += "
"; } */ document.write(buffer); } function disp_rescmt(aid){ /* pc */ var msie = 0; if(window.navigator.userAgent.toLowerCase().match(/trident/)) {msie=1;} if (isNaN(aid)) return false; var match,disp = document.cookie.match(/rescmt_nodisp=1/)?0:1 $("[id^=res_]").append('
'); $("[id^=com]").append('
'); if (disp) for(var key in ar_cmt){ if (isNaN(key)) continue; if (match = ar_cmt[key]['body'].match(/(>>|>>|>>|》|〉)([\d]+)/)){ if (parseInt(match[2]) < 1000){ if ($('#res_' + match[2]).length && (typeof minus_comment_48h == "undefined" || $.inArray(parseInt(ar_cmt[key]['num']),minus_comment_48h[aid]) == -1)){ $('#res_' + match[2] + ' > .rescmt_box').append('

' + ar_cmt[key]['body'].replace(/
/g,' ') + '

'); } } else { if ($('#com' + match[2]).length && (typeof minus_comment_48h == "undefined" || $.inArray(parseInt(ar_cmt[key]['num']),minus_comment_48h[aid]) == -1)){ $('#com' + match[2] + ' > .rescmt_box').append('

' + ar_cmt[key]['body'].replace(/
/g,' ') + '

'); } } } } $("[class=rescmt_box]").each(function(){ if ($(this).text().length==0) $(this).hide(); if ($(this).parent().attr('id').indexOf("res_") >= 0){ $(this).after('このレスにコメント'); } }); } function disp_cookie_btn(){ var expire = new Date(); expire.setTime(expire.getTime()+1000*3600*24*30); var disp = document.cookie.match(/rescmt_nodisp=1/)?0:1 $("[class=rescmt_switch]").each(function(){ $(this).html('レスコメントを' + (disp?"非表示に":"表示") + 'する'); }); if (disp){ document.cookie='rescmt_nodisp=0;expires=' + expire.toUTCString();; } else { document.cookie='rescmt_nodisp=1;expires=' + expire.toUTCString();; } if (document.cookie.match(/comment_desc=1/)){ $('#comment_sort_navi').html('新しい順 [古い順] ✎コメントする'); document.cookie='comment_desc=1;expires=' + expire.toUTCString();; } else { $('#comment_sort_navi').html('[新しい順] 古い順 ✎コメントする'); document.cookie='comment_desc=0;expires=' + expire.toUTCString();; } } function alfalfalfa_onload(){ disp_cookie_btn(); } window.onload = alfalfalfa_onload; $(function(){ /* kanren2.js move under ad */ /* $('.social-list').before($('#related-title').eq(0)); $('.social-list').before(""); $('.article_body > .automatic-related > li').each(function(){ $(this).appendTo($('.automatic-related-dynamic')); }); */ });