RegExr: toggle sidebar

Allows you to toggle sidebar on RegExr.com

Stan na 28-01-2017. Zobacz najnowsza wersja.

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

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

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         RegExr: toggle sidebar
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Allows you to toggle sidebar on RegExr.com
// @author       Himalay
// @match        http://regexr.com/
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  document.head.appendChild(Object.assign(document.createElement('style'), {
    innerText: `#menuToggle {
                    font-weight: 900;
                    color: #101113;
                    margin-right: 10px;
                  }

                  .sidemenu {
                    position:absolute;
                    float: none;
                    left: -352px;
                  }

                  .mainarea {
                    float: none;
                    width: 100%;
                  }`
  }));

  toggleSidemenu();

  document.querySelector('#docview  .title').prepend(Object.assign(document.createElement('a'), {
    id: 'menuToggle',
    innerText: '☰'
  }));

  document.querySelector('#menuToggle').addEventListener('click', toggleSidemenu);

  function toggleSidemenu() {
    document.querySelector('#libview').classList.toggle('sidemenu');
    document.querySelector('#docview').classList.toggle('mainarea');
  }
})();