เห็นกระทู้ของไอ้ด็อกแล้วรำคาญ เลยเขียนสคริปต์มาบล็อกมันโดยเฉพาะ สคริปต์นี้ใช้ไม่ได้กับคนอื่นนะครับ วิชายังไม่แก่กล้าพอก็เลยเอาแค่นี้ก่อน แล้วก็ไม่ได้บล็อกข้อความตอบกระทู้นะครับ ถ้าได้ไอเดียวันหลังอาจจะมาเพิ่มเติม ความจริงแล้วถ้าใครเป็นสมาชิกก็สามารถ ignore สมาชิกอื่นได้อยู่แล้ว โดยการ Log in แล้วคลิกที่ชื่อตัวเอง จะเห็นเมนู “People You Ignore” กดเข้าไปเลย แล้วอยากจะบล็อกใครก็ใส่ชื่อเข้าไป แต่สคริปต์นี้ใช้ได้ตอนที่ยังไม่ Log in
การติดตั้งใช้งาน สำหรับ firefox: ไปหน้านี้ https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/ ติดตั้ง greasemonkey แล้ว restart ไฟร์ฟอกซ์หนึ่งครั้ง ก๊อปปี้ข้อความข้างบนไปใส่ใน text editor ถ้าเป็น windows ก็ notepad อะไรงี้ แล้ว save หลังจากนั้น rename ให้เป็นชื่ออะไรก็ได้ ลงท้ายด้วย .user.js ตัวอย่างเช่น fordog.user.js (ต้องปิด notepad ก่อนรึเปล่าไม่แน่ใจ) ในไฟร์ฟอกซ์ กด Ctrl+O แล้วเลือกไฟล์ที่เราเพิ่งเซฟไปนั่นแหละ สำหรับ chrome: ติดตั้ง addon ที่ชื่อ tampermonkey แล้วก็จะมีเมนู add new script อะไรนี่แหละ ลองหาดู พอเจอแล้วก็ก๊อปปี้ข้อความข้างบนไปใส่ แล้วก็ save
มีข้อผิดพลาดนะครับในสคริปต์ข้างบน บรรทัดที่มี var thi = th; ความจริงต้องเป็นแบบนี้นะครับ var thi = th;
แก้ไม่หายจริง ๆ ด้วย คือผมจะบอกว่าระหว่างชื่อตัวแปร th กับเครื่องหมาย ; (semicolon) มันต้องมีอันนี้ด้วย เป็นวงเล็บที่เป็นสี่เหลื่ยมหนื่งคู่แล้วมีตัว i อยู่ข้างในอะครับ ทำไมมันโพสต์ไม่ได้น้อ แบบภาพข้างล่าง
โอเคครับ ได้ซะที โง่อยู่นานเลย Code: // ==UserScript== // @name kaffee remove specific posts // @namespace stormtrooper // @description remove specific posts // @include https://xn--12c4db3b2bb9h.net/forums/cafe/* // @include https://สภากาแฟ.net/forums/cafe/* // @grant none // ==/UserScript== (function () { var th = document.querySelectorAll(".discussionListItem"); var i; for (i = 0; i < th.length; i++) { var thi = th[i]; if (thi.getAttribute("data-author") == "ดร.โสภณ พรโชคชัย") thi.parentElement.removeChild(thi); } })();
เวอร์ชัน 2 ปรับแต่งส่วนบน เปลี่ยนสีนิดหน่อย Code: // ==UserScript== // @name kaffee remove specific posts // @namespace stormtrooper // @description remove specific posts // @include https://xn--12c4db3b2bb9h.net/* // @include https://สภากาแฟ.net/* // @grant none // ==/UserScript== (function() { var st = document.createElement('style'); st.innerHTML = '#loginBar {border-bottom-width:0px !important;} ' + '#logo {display:none !important;} ' + '#logoBlock {height:181px !important;} ' + '#header {' + 'background:url(\'https://s25.postimg.org/teed8fd27/shachou_miho.png\') !important; ' + 'background-position:center top !important;} ' + '.navTab.PopupClosed .navLink {color: #13647a !important;} ' + '#content .pageContent {background-color: #C7CAD4 !important;}'; document.head.appendChild(st); var th = document.querySelectorAll(".discussionListItem"); var i; for (i = 0; i < th.length; i++) { thi = th[i]; if (thi.getAttribute("data-author") == "ดร.โสภณ พรโชคชัย") thi.parentElement.removeChild(thi); } })();
เป็น javascript ที่แต่ละคนติดตั้งใน web browser ของตัวเองครับ หมายถึงพวกเราที่เข้าเว็บนี้น่ะครับ แต่ละคนติดดั้งของตัวเอง ไม่เกี่ยวกับ mod