Subscene

Filter with english language!

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

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