Last active
August 12, 2019 21:59
-
-
Save kon3ko/a1fa77c6dea303acaa163002c92c0f6d to your computer and use it in GitHub Desktop.
Tampermonkey - SiamBit Blacklists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name [SiamBit] Blacklists | |
// @namespace http://tampermonkey.net/ | |
// @version 0.10 | |
// @description The file list will not be displayed. | |
// @author น้องแมว | |
// @match https://www.siambit.me/viewno18.php* | |
// @match https://www.siambit.me/viewbr.php* | |
// @require https://code.jquery.com/jquery-1.12.4.min.js | |
// @require https://openuserjs.org/src/libs/sizzle/GM_config.js | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// @grant GM_addStyle | |
// @updateURL https://gist.githubusercontent.com/akoneko/a1fa77c6dea303acaa163002c92c0f6d/raw/Tampermonkey-SiamBitBlacklists.js | |
// @downloadURL https://gist.githubusercontent.com/akoneko/a1fa77c6dea303acaa163002c92c0f6d/raw/Tampermonkey-SiamBitBlacklists.js | |
// ==/UserScript== | |
//-------SETTING-------// | |
GM_addStyle('#BlicklistsConfig {width: 454px !important;height: 355px !important;} #checkBoxIgnoreBlacklists {color:#c70909}'); | |
GM_config.init( | |
{ | |
'id': 'BlicklistsConfig', // The id used for this instance of GM_config | |
'title': 'Blacklists Settings', // Panel Title | |
'fields': // Fields object | |
{ | |
'usernames': | |
{ | |
'label': 'รายชื่อที่ถูกบล็อก (หากต้องการหลายชื่อให้ขึ้นบรรทัดใหม่)', | |
'type': 'textarea', | |
'default': '' | |
}, | |
'warning': | |
{ | |
'label': 'หากคุณติดตั้ง [SiamBit] Zoom Screen Shots คุณต้องเลื่อน [SiamBit] Blacklists ให้อยู่อันดับแรกกว่าเสมอ ในหน้า Tampermonkey Dashboard', | |
'type': 'text', | |
'default': '' | |
} | |
}, | |
'css': '#BlicklistsConfig_field_usernames {width: 438px;margin-top: 10px;height: 150px;} #BlicklistsConfig_usernames_var {margin-top: 10px !important;} #BlicklistsConfig_warning_var {margin-top: 10px !important; color:red;} #BlicklistsConfig_field_warning {display:none;}', | |
'events': | |
{ | |
'save': function() { | |
alert('บันทึกเรียบร้อยแล้ว!') | |
} | |
} | |
}); | |
//-------SETTING-------// | |
(function() { | |
'use strict'; | |
let $ = window.jQuery; | |
let currentLocation = window.location; | |
let blacklists = GM_config.get('usernames').trim().split("\n") | |
blacklists = blacklists.filter(function(v){return v!==''}); | |
//function | |
function getUrlParameter(sParam) { | |
var sPageURL = window.location.search.substring(1), | |
sURLVariables = sPageURL.split('&'), | |
sParameterName, | |
i; | |
for (i = 0; i < sURLVariables.length; i++) { | |
sParameterName = sURLVariables[i].split('='); | |
if (sParameterName[0] === sParam) { | |
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); | |
} | |
} | |
} | |
//Blacklists | |
let ignore = getUrlParameter('ignore_blicklists'); | |
if((currentLocation.pathname === '/viewno18.php' | |
|| currentLocation.pathname === '/viewbr.php' )){ | |
$(".mainouter table[width='100%'] tr").each(function(index,item){ | |
let owner = $("td:last a:first",$(this)); | |
if(blacklists.indexOf(owner.text()) !== -1 && blacklists.length > 0){ | |
if(ignore === 'true'){ | |
$(this).attr('onmouseover',"this.style.backgroundColor='#aba8a8';").attr('onmouseout',"this.style.backgroundColor='#ccc';").css('background-color','#ccc') | |
}else{ | |
$(this).remove() | |
} | |
} | |
//add btn | |
owner.parent().append($("<br>")).append($("<a>",{'style':'color:#c70909','text':'[ บล็อกสมาชิกนี้ ]','href':'javascript:void(0)'}).click(function(){ | |
if (confirm("คุณต้องการบล็อก "+owner.text()+" ใช่หรืิอไม่? คุณจะไม่เห็นรายการของเขาอีกในอนาคต (สามารถแก้ไขได้ที่เมนู [แบล็กลิส])")) { | |
GM_config.set('usernames',owner.text() + "\n" + GM_config.get('usernames')) | |
GM_config.save() | |
} | |
})) | |
}); | |
} | |
//Control Panel | |
$("div.anylinkcss#games").after( | |
$("<a>",{'href':'javascript:void(0)'}).html('<font color="#e60000">[<b>แบล็กลิส</b>]</font>').click(function(){ | |
GM_config.open() | |
}) | |
) | |
//Search Ignore | |
let btnSearch = $("form>.btn[value='ค้นหา']").first(); | |
btnSearch.before('<span id="checkBoxIgnoreBlacklists">( <input type="checkbox" name="ignore_blicklists" value="true" '+(ignore === 'true' ? 'checked':'')+'> <b>แสดงรายการที่บล็อกไว้เพื่อเช็คไฟล์ซ้ำ</b> ) </span>') | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment