Subscene

Filter with english language!

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         Subscene
// @namespace    https://github.com/fabiencrassat
// @version      0.1.3
// @description  Filter with english language!
// @author       Fabien Crassat <[email protected]>
// @match        https://subscene.com/*
// @grant        none
// @require      https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js
// ==/UserScript==

/* global Cookies */
'use strict';

const SEPARATOR_VALUES = ',';

const languages = {
  arePresents() {
    const languageFilterCookie = Cookies.get(languages.key);
    if (!languageFilterCookie) {
      return false;
    }
    if (languageFilterCookie !== languages.getKeyValues()) {
      return false;
    }
    return true;
  },
  domain: '.subscene.com',
  getKeyValues() {
    return Object.keys(languages.values).join(SEPARATOR_VALUES);
  },
  key: 'LanguageFilter',
  path: '/',
  setCookie() {
    Cookies.set(languages.key, languages.getKeyValues(), {
      domain: languages.domain,
      path: languages.path,
      secure: true
    });
  },
  values: {
    13: 'english'
  }
};

(function subscene() {
  /* Main */
  if (languages.arePresents()) {
    return;
  }
  languages.setCookie();
  location.reload();
}());