CubecraftHideLockedThreads

Adds an option to hide locked threads on the cubecraft forums.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        CubecraftHideLockedThreads
// @namespace   de.rasmusantons
// @description Adds an option to hide locked threads on the cubecraft forums.
// @include     https://www.cubecraft.net/forums/*/*
// @version     2
// @grant       none
// ==/UserScript==

function updateThreadList(hideLocked) {
  var lockedThreads = $('.discussionListItem.locked');
  lockedThreads.each(function(i, e) {
    var thread = $(e);
    thread.css('display', hideLocked ? 'none' : '');
  });
  cnt.text(hideLocked ? '(' + lockedThreads.length + ' locked threads hidden)' : '');
}

function onCbChange() {
  localStorage.setItem('hideLocked', this.checked);
  updateThreadList(this.checked);
}

var cb = $('<input type="checkbox" />');
var cnt = $('<span></span>');
cnt.css('margin-left', '5px');
cb.get(0).checked = (localStorage.getItem('hideLocked') == "true");
updateThreadList(cb.get(0).checked);
cb.change(onCbChange);
$($('.secondaryContent > .col2')[0]).append($('<li></li>').append($('<a></a>').append($('<label>hide locked threads</label>').prepend(cb))));
$($('.sectionFooter.SelectionCountContainer')[0]).append(cnt);