Last active
December 4, 2022 13:44
-
-
Save Nebula-Mechanica/03f704e6761cb6521a2b6ffc72f71514 to your computer and use it in GitHub Desktop.
Возможность просматривать удалённые комментарии игнорируемых пользователей
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 LOR IgnoredDeleted | |
// @description Возможность просматривать удалённые комментарии игнорируемых пользователей | |
// @author Nebula-Mechanica | |
// @version 1 | |
// @grant none | |
// @license The Unlicense | |
// @include http://www.linux.org.ru/* | |
// @include https://www.linux.org.ru/* | |
// ==/UserScript== | |
// Маркер, чтобы не добавлять вторую галочку при возврате назад | |
markerName = "LIDShowIgnored" | |
// Дальнейшие действия только, если маркера нет | |
if(document.getElementById(markerName) == null) { | |
// Пытаемся выбрать правильную форму | |
var showDeletedForm = null | |
for (var form of document.forms) { | |
if (form.querySelector("input[name='deleted']") != null) { | |
showDeletedForm = form | |
break | |
} | |
} | |
// var showDeletedForm = document.querySelector("#bd hr + form[method='POST']") | |
// Дальнейшие действия только, если форма есть | |
doNothing = false | |
if(showDeletedForm != null) { | |
console.log("Добавляем кнопку LOR IgnoredDeleted...") | |
var showIgnoredInput = document.createElement("input") | |
showIgnoredInput.type = "checkbox" | |
// Если присутствует messages - страничка с темой | |
if(document.getElementsByClassName("messages").length != 0) { | |
showIgnoredInput.name = "filter" | |
showIgnoredInput.value = "show" | |
} | |
// Если forum - раздел форума | |
else if(document.getElementsByClassName("forum").length != 0){ | |
showIgnoredInput.name = "showignored" | |
showIgnoredInput.value = "t" | |
} | |
// Иначе нам тут делать нечего | |
else { | |
doNothing = true | |
} | |
if (doNothing != true) { | |
// Состояние по умолчанию | |
//showIgnoredInput.checked = "true" | |
var checkLabel = document.createElement("label") | |
checkLabel.style.display = "inline" | |
var marker = document.createElement("div") | |
marker.style.display = "none" | |
marker.id = markerName | |
checkLabel.appendChild(showIgnoredInput) | |
checkLabel.appendChild(document.createTextNode("Показать игнорируемые")) | |
checkLabel.appendChild(marker) | |
showDeletedForm.appendChild(checkLabel) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment