-
-
Save mertcangokgoz/23cc8490e9c2b917e5aa156b93e8dbc3 to your computer and use it in GitHub Desktop.
R10 Yasaklı üyeleri gizlemek için bir kodtur.
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 R10.Net Yasaklı Listesi | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description R10 Yasaklı üyeleri gizlemek için bir kodtur. | |
// @author Hero | |
// @match https://www.r10.net/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=r10.net | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Fonksiyon: Cookie oluşturma | |
function createCookie(name, value, days) { | |
var expires = ""; | |
if (days) { | |
var date = new Date(); | |
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); | |
expires = "; expires=" + date.toUTCString(); | |
} | |
document.cookie = name + "=" + value + expires + "; path=/"; | |
} | |
// Fonksiyon: Cookie'dan veri okuma | |
function getCookie(name) { | |
const cookieValue = document.cookie | |
.split('; ') | |
.find(row => row.startsWith(name + '=')) | |
?.split('=')[1]; | |
return cookieValue ? decodeURIComponent(cookieValue) : null; | |
} | |
// Sayfanın URL'sini kontrol ederek, kodun çalışacağı sayfayı belirleme | |
if (window.location.href === "https://www.r10.net/profil/engellemeler/") { | |
// Tüm checkbox'ların HTMLCollection'ını al | |
var checkboxes = document.querySelectorAll("input[type='checkbox'][name^='listbits[ignore]']"); | |
// Boş bir dizi oluştur | |
var checkedUsers = []; | |
// Checkbox'ları dön ve seçili olanları diziye ekle | |
checkboxes.forEach(function (checkbox) { | |
if (checkbox.checked) { | |
// `for` özelliğini kullanarak label'ın içeriğini al ve diziye ekle | |
var label = document.querySelector("label[for='" + checkbox.id + "']"); | |
if (label) { | |
checkedUsers.push(label.textContent); | |
} | |
} | |
}); | |
// Diziyi çerezlere kaydet | |
createCookie("R10_YASAKLI_LIST", JSON.stringify(checkedUsers), 365); | |
// Popup mesajı oluştur | |
let popupContent = document.createElement('div'); | |
popupContent.id = 'popupMessage'; | |
popupContent.textContent = `Yasaklı üye listesi güncellendi. ${JSON.stringify(checkedUsers)}`; | |
// Popup stilini belirle | |
var style = document.createElement('style'); | |
style.textContent = ` | |
#popupMessage { | |
position: fixed; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
background-color: #33e773; | |
color: #00581e; | |
min-width: 300px; | |
font-weight: 600; | |
font-size: 2rem; | |
padding: 20px; | |
box-shadow: 0 7px 19px rgb(0 0 0 / 29%); | |
z-index: 9999; | |
border-radius: 10px; | |
letter-spacing: -1px; | |
} | |
`; | |
document.head.appendChild(style); | |
document.body.appendChild(popupContent); | |
} | |
// Elementi yavaşça silen fonksiyon | |
function fadeOutAndRemove(element) { | |
var opacity = 1; | |
var fadeOutInterval = setInterval(function() { | |
opacity -= 0.1; // Animasyon hızını kontrol etmek için decrement değerini ayarlayın | |
if (opacity <= 0) { | |
element.remove(); | |
clearInterval(fadeOutInterval); | |
} else { | |
element.style.opacity = opacity; | |
} | |
}, 10); // Daha yumuşak bir animasyon için interval süresini ayarlayın | |
} | |
// "alt" özniteliği "gusion" olan elementleri kaldıran fonksiyonu tanımlayın | |
function removeElementsWithGusionAlt() { | |
// R10_YASAKLI_LIST çerezi okuma | |
const r10YasakliListCookie = getCookie('R10_YASAKLI_LIST'); | |
if (r10YasakliListCookie) { | |
const R10_YASAKLI_LIST = JSON.parse(r10YasakliListCookie); | |
// Verileri döngü ile işleme | |
for (let i = 0; i < R10_YASAKLI_LIST.length; i++) { | |
// Konular içindekini de sil. | |
const threads = document.querySelectorAll('li.thread'); | |
threads.forEach((thread) => { | |
const usernameAnchor = thread.querySelector('.desktop a.usernames'); | |
if (usernameAnchor && usernameAnchor.innerText.trim() === R10_YASAKLI_LIST[i]) { | |
thread.remove(); | |
} | |
}); | |
var elementsWithGusionAlt = document.querySelectorAll('img[alt="'+ R10_YASAKLI_LIST[i] +'"]'); | |
// Eğer elementlerden herhangi biri "thread" sınıfına sahip bir li'nin içinde ise onu kaldır | |
elementsWithGusionAlt.forEach(function(element) { | |
var threadParent = element.closest('.thread'); | |
if (threadParent) { | |
fadeOutAndRemove(threadParent); | |
} | |
}); | |
} | |
} | |
} | |
// Belirli bir süre sonra "alt" özniteliği "gusion" olan elementleri kaldır | |
setTimeout(removeElementsWithGusionAlt, 400); | |
// XMLHttpRequest özelliğini değiştirerek "ajax.php" içeren istekler yapıldığında da elementleri kaldır | |
var originalOpen = XMLHttpRequest.prototype.open; | |
XMLHttpRequest.prototype.open = function() { | |
console.log(arguments[1]); | |
if (arguments[1].includes("ajax.php")) { | |
setTimeout(removeElementsWithGusionAlt, 400); | |
} | |
return originalOpen.apply(this, arguments); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment