[แจก] บล๊อคเกรียน แบนโทรลพันทิปด้วย HeroDoi Block script
ผมเชื่อว่ามีคนเรียกร้องไปยังพันทิปอยู่บ้างสำหรับฟังค์ชั่นในการบล๊อคผู้ใช้อื่นที่สร้างความรำคาญให้แก่ตนเองแต่ก็ไม่ได้รับการตอบรับใดๆ
ยิ่งในช่วงกระหน่ำซัมเมอร์เกรียนโทรลแบบนี้ด้วยแล้ว หลายท่านคงเอือมระอากันไม่น้อย
ผมเองก็มีบ้างเช่นกันจึงได้เขียนสคริปสำหรับบล๊อกความเห็นเอาไว้ใช้ส่วนตัว แต่เนื่องด้วยมีเพื่อนสมาชิกได้ขอมาผมเลยเขียน GUI เพิ่มให้ใช้งานสะดวกยิ่งขึ้นซึ่งมีวิธีการติดตั้งและใช้งานดังนี้ครับ
1. เริ่มจากโหลดเบราว์เซอร์ปลักอินสำหรับการลงสคริปเช่น Greasemonkey(Firefox) หรือ Tampermonkey(Chrome) กันก่อนครับ (ใครมีแล้วก็ไม่ต้องโหลดเพิ่ม) เรียบร้อยแล้วก็จัดการปิดแล้วเปิดเบราว์เซอร์ใหม่ซักรอบ (Restart browser)
2. กดไปยังไอคอนของปลักอินที่เพิ่มเข้ามา อย่างเช่นหน้าลิงของ Greasemonkey เป็นต้นครับ แล้วเลือก New user script
3. กรอกค่าตามภาพด้านล่างนี้ได้เลยครับ ชื่อนั้นแล้วแต่จะตั้งแต่ที่อยู่ต้อง
http://pantip.com/* เท่านั้นนะครับ
4. ก๊อปโค๊ดในแท็ก Spoil ด้านล่างนี้แล้วนำไปวางดังภาพครับ
//===================================================================================================
// Update 20150421[10:00 PM] :: Fixed variant scope bug <thanks SL7205(InvCrt) for report and fixed>
//===================================================================================================
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
/*Pantip block and ban word script by ฮีโร่ดอย@pantip.com (HeroDoi@pantip.com)
------------------------------------------------------------------------------
Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
http://creativecommons.org/licenses/by-nc-nd/4.0/
------------------------------------------------------------------------------
=====================
You are free to:
=====================
Share — copy and redistribute the material in any medium or format
The licensor cannot revoke these freedoms as long as you follow the license terms.
=====================
Under the following terms:
=====================
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes.
NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
*/
var BanWordList = [];
var BlockList = [];
//=========================
// API
//=========================
function LoadList() {
var BlockIn = localStorage.getItem("BlockData");
var BanIn = localStorage.getItem("BanData");
if (BlockIn) BlockList = BlockIn.split("\n");
if(BanIn) BanWordList = BanIn.split("\n");
return [BlockIn, BanIn];
}
function SaveList(BlockIn, BanIn) {
localStorage.setItem("BlockData", BlockIn);
localStorage.setItem("BanData", BanIn);
BlockList = BlockIn.split("\n");
BanWordList = BanIn.split("\n");
}
//=========================
// GUI Setup
//=========================
var HStyle = (function () {/*
.Body { position:fixed; width:50%; height:480px; z-index: 9999 !important;
top: 60px; left:25%; padding: 5px;
background-color: #3C3963; color: #FFCD05;
font-size: 1.71em;
font-weight: 400;
line-height: 120%; text-align:center;
border: 1px solid #8E8BA7;
}
.Body a {color: #FFCD05;}
.Body button, .Body hr { width:91%; }
.Body div>div, .Body textarea { width:45%; }
.Body div>div {display:inline-block; text-align:center;}
.Body textarea {height:240px; font-size:24px; background-color:#0E5C6A; border:1px solid #4793A1; color:#fff;}
.Body button {font-size:24px; background: #33315D;
border: 1px solid #6C6A8D;
border-top: 1px solid #8D89D8;
color: #E9E5F6;
font-style: normal;
font-weight: 700;
padding: 3px 8px 4px;
text-shadow: 0px 1px 1px #3E3C7F;
cursor:pointer;
}
.Body button:hover { background:#639230; }
*/}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1];
var HeroStyle = document.createElement("STYLE");
HeroStyle.innerHTML = HStyle;
document.body.appendChild(HeroStyle);
var HBody = (function () {/*
<div><div>Block List</div><div>Ban word List</div></div>
<textarea id="BlockInput"></textarea>
<textarea id="BanInput"></textarea>
<br/><br/>
<button id="SaveInput">Save</button>
<hr />
<div><a href="http://pantip.com/profile/182884">By ฮีโร่ดอย@Pantip.com</a></div>
<hr />
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">
<img alt="Creative Commons License" style="border-width:0"
src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" width="115;" /></a>
*/}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1];
var HeroFrame = document.createElement("DIV");
HeroFrame.id = "HeroDoi";
HeroFrame.className = "Body";
HeroFrame.style.cssText = "opacity:0; display:none;";
HeroFrame.innerHTML = HBody;
document.body.appendChild(HeroFrame);
SaveInput.addEventListener("click", function () {
SaveList(BlockInput.value, BanInput.value);
HeroDoi.style.cssText = "opacity:0; display:none;";
});
var DataIn = LoadList();
BlockInput.value = DataIn[0];
BanInput.value = DataIn[1];
//=========================
// GUI
//=========================
var Menu = document.querySelectorAll(".sub-menu-list");
if (Menu.length > 0) {
for (var i = 0; i < Menu.length; i++) {
var BanButton = document.createElement("LI");
BanButton.innerHTML = '<a><div class="notify-item-wrapper"><span class="icon-mini-status icon-mini-setting"></span>Block/Ban list</div></a>';
BanButton.addEventListener("click", function () {
HeroDoi.style.cssText = "opacity:1; display:block;";
});
Menu[i].appendChild(BanButton);
}
}
//=========================
// Core
//=========================
function CheckList(Name) {
for (var i = 0; i < BlockList.length; i++) if (BlockList[i] == Name) return true;
return false;
}
function CheckWord(Word){
for (var i = 0; i < BanWordList.length; i++) if (Word.indexOf(BanWordList[i]) >= 0) return true;
return false;
}
setInterval(
function () {
var GS = document.getElementById("comments-jsrender");
LoadList();
var GSI, GSN, GSW, i;
if (GS) {
//Comment clear
GS = document.querySelectorAll(".section-comment");
for (i = 0; i < GS.length; i++) {
GSI = GS[i];
GSN = GSI.querySelector(".display-post-name");
if (GSN) if (CheckList(GSN.innerHTML)) GSI.parentElement.removeChild(GSI);
GSW = GSI.querySelector("display-post-story");
if (GSW) if (CheckWord(GSW.innerHTML)) GSI.parentElement.removeChild(GSI);
}
} else {
//Topic clear
GS = document.querySelectorAll(".post-item");
for (i = 0; i < GS.length; i++) {
GSI = GS[i];
GSN = GSI.querySelector(".by-name");
if (GSN) if (CheckList(GSN.innerHTML)) GSI.parentElement.removeChild(GSI);
GSW = GSI.querySelector(".post-item-title>a");
if (GSW) if (CheckWord(GSW.innerHTML)) GSI.parentElement.removeChild(GSI);
}
}
}, 1000);
//--------------------------------------------------------------------------------------
// Update 20150423[6:00 PM] :: Fixed Firefox user can't upload picture <report by MrCatZaa>
//--------------------------------------------------------------------------------------
4.1 สำหรับผู้ใช้ Firefox ที่มีปัญหาอัพโหลดภาพไม่ได้
แก้ตรง
// @include http://pantip.com/*
ให้เป็น
// @include http://pantip.com/forum/*
// @include http://pantip.com/topic/*
แบบในภาพนี้นะครับ
5. ทำการรีเฟรชหน้าพันทิปซักรอบหากเปิดทิ้งเอาไว้ ไปยังเมนูบัญชีผู้ใช้เราก็จะพบกับคำสั่งใหม่ขึ้นมาดังภาพ
6. เลือกใส่ชื่อผู้ใช้ที่เราต้องการแบนในช่อง Block List และคำหรือประโยคที่เราต้องการแบนใน Ban Word List ครับ เรียบร้อยแล้วก็กด Save
หวังว่าทุกท่านจะมีความสุขในการใช้งานเว็บพันทิปกันต่อไปนะครับ
//==================
// Change log
//==================
@ 9:45 PM :: Fixed bug overlay problem
@ 20150421 :: Fixed for Blink engine
@ 20150421[10:00 PM] :: Fixed variant scope bug <thanks SL7205(InvCrt) for report and fixed>
@ 20150423[6:00 PM] :: Fixed Firefox user can't upload picture <report by MrCatZaa>
[แจก] บล๊อคเกรียน แบนโทรลพันทิปด้วย HeroDoi Block script
ผมเชื่อว่ามีคนเรียกร้องไปยังพันทิปอยู่บ้างสำหรับฟังค์ชั่นในการบล๊อคผู้ใช้อื่นที่สร้างความรำคาญให้แก่ตนเองแต่ก็ไม่ได้รับการตอบรับใดๆ
ยิ่งในช่วงกระหน่ำซัมเมอร์เกรียนโทรลแบบนี้ด้วยแล้ว หลายท่านคงเอือมระอากันไม่น้อย
ผมเองก็มีบ้างเช่นกันจึงได้เขียนสคริปสำหรับบล๊อกความเห็นเอาไว้ใช้ส่วนตัว แต่เนื่องด้วยมีเพื่อนสมาชิกได้ขอมาผมเลยเขียน GUI เพิ่มให้ใช้งานสะดวกยิ่งขึ้นซึ่งมีวิธีการติดตั้งและใช้งานดังนี้ครับ
1. เริ่มจากโหลดเบราว์เซอร์ปลักอินสำหรับการลงสคริปเช่น Greasemonkey(Firefox) หรือ Tampermonkey(Chrome) กันก่อนครับ (ใครมีแล้วก็ไม่ต้องโหลดเพิ่ม) เรียบร้อยแล้วก็จัดการปิดแล้วเปิดเบราว์เซอร์ใหม่ซักรอบ (Restart browser)
2. กดไปยังไอคอนของปลักอินที่เพิ่มเข้ามา อย่างเช่นหน้าลิงของ Greasemonkey เป็นต้นครับ แล้วเลือก New user script
3. กรอกค่าตามภาพด้านล่างนี้ได้เลยครับ ชื่อนั้นแล้วแต่จะตั้งแต่ที่อยู่ต้อง http://pantip.com/* เท่านั้นนะครับ
4. ก๊อปโค๊ดในแท็ก Spoil ด้านล่างนี้แล้วนำไปวางดังภาพครับ
//===================================================================================================
// Update 20150421[10:00 PM] :: Fixed variant scope bug <thanks SL7205(InvCrt) for report and fixed>
//===================================================================================================
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
//--------------------------------------------------------------------------------------
// Update 20150423[6:00 PM] :: Fixed Firefox user can't upload picture <report by MrCatZaa>
//--------------------------------------------------------------------------------------
4.1 สำหรับผู้ใช้ Firefox ที่มีปัญหาอัพโหลดภาพไม่ได้
แก้ตรง
// @include http://pantip.com/topic/*
แบบในภาพนี้นะครับ
5. ทำการรีเฟรชหน้าพันทิปซักรอบหากเปิดทิ้งเอาไว้ ไปยังเมนูบัญชีผู้ใช้เราก็จะพบกับคำสั่งใหม่ขึ้นมาดังภาพ
6. เลือกใส่ชื่อผู้ใช้ที่เราต้องการแบนในช่อง Block List และคำหรือประโยคที่เราต้องการแบนใน Ban Word List ครับ เรียบร้อยแล้วก็กด Save
หวังว่าทุกท่านจะมีความสุขในการใช้งานเว็บพันทิปกันต่อไปนะครับ
//==================
// Change log
//==================
@ 9:45 PM :: Fixed bug overlay problem
@ 20150421 :: Fixed for Blink engine
@ 20150421[10:00 PM] :: Fixed variant scope bug <thanks SL7205(InvCrt) for report and fixed>
@ 20150423[6:00 PM] :: Fixed Firefox user can't upload picture <report by MrCatZaa>