Skip to content

Instantly share code, notes, and snippets.

@kon3ko
Last active October 17, 2019 21:11
Show Gist options
  • Save kon3ko/e2b73738483c426ff422d34b7620a153 to your computer and use it in GitHub Desktop.
Save kon3ko/e2b73738483c426ff422d34b7620a153 to your computer and use it in GitHub Desktop.
Tampermonkey - SiamBit Clean
// ==UserScript==
// @name [SiamBit] Clean
// @namespace http://tampermonkey.net/
// @version 0.13
// @description Clean ADS
// @author น้องแมว
// @match https://www.siambit.me/*
// @require https://code.jquery.com/jquery-1.12.4.min.js
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @updateURL https://gist.githubusercontent.com/akoneko/e2b73738483c426ff422d34b7620a153/raw/Tampermonkey-SiamBitClean.js
// @downloadURL https://gist.githubusercontent.com/akoneko/e2b73738483c426ff422d34b7620a153/raw/Tampermonkey-SiamBitClean.js
// ==/UserScript==
(function() {
'use strict';
//setting
let logo = true;
let downloadLink = true;
let downloadZip = true
let adsInDetailPage = true;
let autoThank = true;
let bannerTextCenter = false;
let $ = window.jQuery;
let location = window.location
//logo
if(logo){
$("body>br:first").next("table").remove()
}
//download link
if(location.pathname === "/details.php"){
//download link
if(downloadLink){
let dl = $("a[title='Download this file']");
let loopCheck = 7;
let ele = $("a[title='Download this file']").parent();
for (let i = 0; i < loopCheck; i++) {
if(ele.attr('bgcolor') == 'white'){
break;
}
ele.parent();
}
ele.html(dl)
//$("a[title='Download this file']").parent().parent().parent().parent().html(dl)
$("td[bgcolor='white']").attr('bgcolor','')
}
if(downloadZip){
$("a[title='Download this file']>img").remove()
}
//ads in page detail
if(adsInDetailPage){
let adsColumns = [];
$("td.outer table[width='80%'] td.rowhead").each(function(i){
let text = $(this).html().trim();
if(text === "Advertising"
|| text === "Advertising<br>"){
adsColumns.unshift(i)
}
})
let td = $("td.rowhead");
$(adsColumns).each(function(item){
td.eq(this).parent().remove()
})
}
//auto thank
if(autoThank){
$("#saythank a").click();
$("#saythankup").addClass("rowhead").attr('style','color:#D91BEA;').html("Download")
}
}
//banner text center
if(bannerTextCenter){
$("table[width=550]").each(function(){
$(this).next()
if($("font",$(this)).length == 11){
let br = $(this).next();
if(br.length === 1 ){
if(br[0].tagName === 'BR'){
$(br).remove();
}
}
$(this).remove()
}
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment