Nitter Auto Theme Cookie

Automatically set theme cookie and URL param on Nitter

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name     Nitter Auto Theme Cookie
// @description Automatically set theme cookie and URL param on Nitter
// @version  1.1.0
// @include *nitter*
// @include *xcancel*
// @grant none
// @namespace https://github.com/rorycaputo
// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @homepageURL https://github.com/rorycaputo
// @icon https://nitter.poast.org/favicon-32x32.png
// ==/UserScript==

(
  function() {
    'use strict';
    var themeName = 'theme'
    var themeValue = 'Auto'
    var paramAbsent=false
    var cookieAbsent=false
    var themeChanged=false
    var url

    if ('URL' in window) {
      url = new URL(window.location);
      if(url.searchParams.get(themeName, themeValue) === null) {
        paramAbsent=true
      }
    }
    if (document.cookie.indexOf(themeName) == -1 ) {
      cookieAbsent=true
    }

    if (paramAbsent) {
      url.searchParams.set(themeName, themeValue);
      themeChanged=true
    }

    if(cookieAbsent) {
      document.cookie = `${themeName}=${themeValue}`;
      themeChanged=true
    }

    if(themeChanged) {
      window.location = url;
    }
  }
)();


  // {{{ changelog :

  // [2026-01-05 Mon] Set URL param and cookie

  // [2025-11-11 Tue] Hello

  // }}}

  // {{{ contact :

  // }}}