Subscene

Filter with english language!

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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();
}());