Greasy Fork daha iyi yapın
// ==UserScript==
// @name Greasy Fork
// @namespace http://tampermonkey.net/
// @version 3
// @description Greasy Fork daha iyi yapın
// @author Atilla
// @match https://greatest.deepsurf.us/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=greatest.deepsurf.us
// @grant GM_setClipboard
// @grant unsafeWindow
// @grant GM_openInTab
// @run-at document-idle
// @require https://cdnjs.cloudflare.com/ajax/libs/arrive/2.5.2/arrive.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/toastify-js/1.12.0/toastify.js
// @license MIT
// ==/UserScript==
(async () => {
"use strict";
if (window.document) {
unsafeWindow.reklamEngelleyiciAl = () => {
GM_openInTab(
"https://chromewebstore.google.com/detail/ddkjiahejlhfcafbddmgiahcphecmpfh",
{ active: true },
);
};
}
// Userscript ek bilgi
let additional_info = document.getElementById("additional-info");
if (additional_info) {
additional_info.style.height = `${window.innerHeight.toString()}px`;
additional_info.style.overflow = "scroll";
}
//==Userscript ek bilgi==
// Reklam Engelleyici Bilgilendirici
let reklamEngelleyiciBilgilendirici = document.querySelector(
"body > div > section > section > p",
);
if (reklamEngelleyiciBilgilendirici) {
reklamEngelleyiciBilgilendirici.textContent =
document.querySelector("body > div > section > section > p").textContent +
" (Reklam engelleyici kullanmanızı öneriyorum) window.reklamEngelleyiciAl()";
}
//==Reklam Engelleyici Bilgilendirici==
// Script Listesi
let browse_script_list = document.getElementById("browse-script-list");
if (browse_script_list) {
browse_script_list.style.height = `${window.innerHeight.toString()}px`;
browse_script_list.style.overflow = "scroll";
}
document.arrive("#browse-script-list", (newElem) => {
if (
newElem.getAttribute("style").includes("height") ||
newElem.getAttribute("style").includes("overflow")
) {
newElem.style.height = `${window.innerHeight.toString()}px`;
newElem.style.overflow = "scroll";
}
});
//==Script Listesi==
// Ana sayfadaki adımları kaldır
let home_step = document.querySelectorAll("section[id^='home-step-']");
home_step.forEach((value) => value.remove());
//==Ana sayfadaki adımları kaldır==
//Otomatik Tamamlama Kapatma Optimizasyonu
const disableAutocomplete = (root = document) => {
const inputs = root.querySelectorAll('input:not([autocomplete="off"])');
inputs.forEach((input) => input.setAttribute("autocomplete", "off"));
};
disableAutocomplete();
document.arrive("input:not([autocomplete='off'])", (newElem) => {
newElem.setAttribute("autocomplete", "off");
});
//==Otomatik Tamamlama Kapatma Optimizasyonu==
// Kodu Kopyala Butonu Ekleme
const jsInstallAnchor = document.querySelector("a[data-install-format='js']");
if (jsInstallAnchor) {
const copyButtonDiv = document.getElementById("install-area");
if (copyButtonDiv) {
const copyButton = document.createElement("a");
copyButton.classList.add("install-link");
copyButton.style.cursor = "pointer";
copyButton.textContent = "Kodu Kopyala";
const copyHelpButton = document.createElement("a");
copyHelpButton.classList.add("install-help-link");
copyHelpButton.textContent = "\u{1F4CB}";
copyHelpButton.style.cursor = "pointer";
copyButtonDiv.prepend(copyButton);
copyButton.after(copyHelpButton);
const handleCopyClick = async (event) => {
event.preventDefault();
const url = jsInstallAnchor.href;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP hatası! Durum: ${response.status}`);
}
const rawCode = await response.text();
GM_setClipboard(rawCode);
console.log("Ham JAVASCRIPT Kopyalandı!");
Toastify({
text: "Userscript Kopyalandı!",
duration: 1500,
style: { "text-align": "center" },
}).showToast();
} catch (error) {
console.log(`Veri çekilirken hata oluştu: ${error.message}`);
}
};
copyButton.addEventListener("click", handleCopyClick);
}
}
//==Kodu Kopyala Butonu Ekleme==
// Otomatik Kod Uyarılarının Kaldırılması (Message Event Delegation)
window.addEventListener("message", () => {
const alertModals = document.querySelectorAll(
"#installation-instructions-modal-css, #installation-instructions-modal-js",
);
alertModals.forEach((modal) => modal.remove());
});
//==Otomatik Kod Uyarılarının Kaldırılması (Message Event Delegation)==
// Ekran Genişliği Kontrolü ve Debounce Mekanizması
const checkWidthAndReload = async () => {
if (window.innerWidth < 1018) {
document.body.textContent =
"Bu sitede bu kod çalışmaz! Sayfa yenileniyor...2";
await new Promise((resolve) => setTimeout(resolve, 2000));
location.reload();
}
};
await checkWidthAndReload();
const debounce = (func, delay) => {
let timeoutId;
return (...args) => {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => func(...args), delay);
};
};
window.addEventListener("resize", debounce(checkWidthAndReload, 250));
//==Ekran Genişliği Kontrolü ve Debounce Mekanizması==
// Arama ikonunu kaldır
document
.querySelector("#home-script-nav > form > input.search-submit")
.remove();
document.arrive(
"#home-script-nav > form > input.search-submit",
(newElem) => {
newElem.remove();
},
);
//==Arama ikonunu kaldır==
})();