Javascript Chuyển Các Từ Ngữ Thô Tục Khi Bình Luận Thành Dạng Ẩn

Ảnh Minh Họa Xin chào các bạn !!! Hôm nay mình quyết định sẽ hướng dẫn các bạn một thủ thuật nhỏ có thể làm cho Blog của bạn đẹp hơn đó chín...

Javascript Chuyển Các Từ Ngữ Thô Tục Khi Bình Luận Thành Dạng Ẩn

18 Comment tháng 2 04, 2018


Ảnh Minh Họa
Xin chào các bạn !!! Hôm nay mình quyết định sẽ hướng dẫn các bạn một thủ thuật nhỏ có thể làm cho Blog của bạn đẹp hơn đó chính là ẩn các từ ngữ thô tục - tục tĩu khi bình luận thành dạng ***** và đương nhiên nếu trang của bạn có một độ load không ổn định thì các bình luận dạng tục tĩu đó vẫn sẽ hiển thị ở lúc load trang. Không nói dài dòng nữa vào vấn đề chính nè !!!

Để làm được như thế bạn chỉ cần thêm đoạn Javascript sau vào trước thẻ đóng </body> nhé :

<script type='text/javascript'>
//<![CDATA[
function replaceText(){if(!document.getElementById){return;}
bodyText = document.getElementById("comment-holder");
theText = bodyText.innerHTML;
theText = theText.replace(/\[img\].*?'.*?\[\/img\]/gi, "");
theText = theText.replace(/\[nct\].*?'.*?\[\/nct\]/gi, "");
theText = theText.replace(/\[youtube\].*?'.*?\[\/youtube\]/gi, "");
theText = theText.replace(/\[img\]/gi, "<a href='");
theText = theText.replace(/\[\/img\]/gi, "'>Xem ảnh</a>");
theText = theText.replace(/\[youtube\]https:\/\/youtu.be/gi, "<iframe width='480' height='390' src='https://www.youtube.com/embed");
theText = theText.replace(/\[youtube\]https:\/\/www.youtube.com\/watch\?v=/gi, "<iframe width='480' height='390' src='https://www.youtube.com/embed/");
theText = theText.replace(/&amp;feature=/gi, "?rel=0' '");
theText = theText.replace(/\[\/youtube\]/gi, "?rel=0' frameborder='0' allowfullscreen></iframe>");
theText = theText.replace(/\[nct\]http:\/\/www.nhaccuatui.com\/nghe\?L=/gi, "<div style='overflow:hidden'><embed style='margin-top:-250px;width:300px;height:400px' src='http://www.nhaccuatui.com/l/");
theText = theText.replace(/\[nct\]http:\/\/www.nhaccuatui.com\/nghe\?M=/gi, "<div style='overflow:hidden'><embed style='margin-top:-350px;width:300px;height:400px' src='http://www.nhaccuatui.com/m/");
theText = theText.replace(/\[\/nct\]/gi, "' quality='high' wmode='transparent' type='application/x-shockwave-flash'></embed></div>");
theText = theText.replace(/:\)/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/ChuzkwA.png'/>");
theText = theText.replace(/=\)/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/csnz5ec.png'/>");
theText = theText.replace(/:\(/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/sJKPKNL.png'/>");
theText = theText.replace(/:D/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/jByThCS.png'/>");
theText = theText.replace(/:v/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/yvUDfPP.png'/>");
theText = theText.replace(/&lt;3/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/yW9iN6j.png'/>");
theText = theText.replace(/;\)/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/pYDVCDW.png'/>");
theText = theText.replace(/\^_\^/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/kNnsdmT.png'/>");
                       theText = theText.replace(/:\(\(/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/bUJjry0.png'/>");
theText = theText.replace(/\(y\)/gi, "<img class='starnhanit_emoticon' src='https://i.imgur.com/79F88wK.png'/>");
theText = theText.replace(/đụ mạ/gi, "****");
theText = theText.replace(/địt mẹ/gi, "****");
theText = theText.replace(/lồn/gi, "****");
theText = theText.replace(/lồ n/gi, "****");
theText = theText.replace(/l ồn/gi, "****");
theText = theText.replace(/đụmạ/gi, "****");
theText = theText.replace(/đ ụ mạ/gi, "****");
theText = theText.replace(/đụ m ạ/gi, "****");
theText = theText.replace(/đ ụ m ạ/gi, "****");
theText = theText.replace(/đụ/gi, "****");
theText = theText.replace(/cặc/gi, "****");
theText = theText.replace(/cặ c/gi, "****");
theText = theText.replace(/c ặc/gi, "****");
theText = theText.replace(/c ặ c/gi, "****");
bodyText.innerHTML = theText;
}replaceText();
//]]>
</script>
Vậy là xong chúc các bạn thành công !!!
Javascript Chuyển Các Từ Ngữ Thô Tục Khi Bình Luận Thành Dạng Ẩn Javascript Chuyển Các Từ Ngữ Thô Tục Khi Bình Luận Thành Dạng ẨnUnknown8.8stars based on9reviewsẢnh Minh Họa Xin chào các bạn !!! Hôm nay mình quyết định sẽ hướng dẫn các bạn một thủ thuật nhỏ có thể làm cho Blog của bạn đẹp hơn đó chín...



Emoticon

  • Blog bạn bè:
  • Phú Cường Blog |
  • TKN Blog |
  • Baoshady Blog|
  • Dan47 blog |
  • Siin Blog |
  • PRINCE DESIGN |
  • Hưng Star |
  • Tuổi Trẻ IT |
  • Z0mbie.win |
  • Hồ Nguyên IT |
  • Phụ kiện cực rẻ |