Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Old zen
- // @namespace http://tampermonkey.net/
- // @version 0.3
- // @description Partially restore the old zen mode
- // @match https://*.lichess.org/*
- // @require https://code.jquery.com/jquery-3.2.1.min.js
- // ==/UserScript==
- $(document).ready(function zenify() {
- 'use strict';
- var zen = true;
- if ($('.control.icons').length) {
- if (zen) {
- $('.board_left')[0].style.visibility = 'hidden';
- $('.underboard > .center')[0].style.visibility = 'hidden';
- $('.username')[0].style.display = 'none';
- $('.username')[1].style.display = 'none';
- $('.replay')[0].style.display = 'none';
- $('#top').children().each(function() {this.style.visibility = 'hidden';});
- $('#friend_box').children().each(function() {this.style.visibility = 'hidden';});
- $('#friend_box')[0].style.opacity = 0;
- }
- $(document).bind("keypress", function (e) {
- console.log(e);
- if (e.key == "x") {
- zen = !zen;
- if (zen) {
- $('.board_left')[0].style.visibility = 'hidden';
- $('.underboard > .center')[0].style.visibility = 'hidden';
- $('.username')[0].style.display = 'none';
- $('.username')[1].style.display = 'none';
- $('.replay')[0].style.display = 'none';
- $('#top').children().each(function() {this.style.visibility = 'hidden';});
- $('#friend_box').children().each(function() {this.style.visibility = 'hidden';});
- $('#friend_box')[0].style.opacity = 0;
- } else {
- $('.board_left')[0].style.visibility = 'visible';
- $('.underboard > .center')[0].style.visibility = 'visible';
- $('.username')[0].style.display = 'flex';
- $('.username')[1].style.display = 'flex';
- $('.replay')[0].style.display = 'block';
- $('#top').children().each(function() {this.style.visibility = 'visible';});
- $('#friend_box').children().each(function() {this.style.visibility = 'visible';});
- $('#friend_box')[0].style.opacity = 1;
- }
- }
- });
- //Left side bar
- $('#site_header').bind('mouseenter', function(e) {
- $('.board_left')[0].style.visibility = 'visible';
- });
- $('#site_header').bind('mouseleave', function(e) {
- $('.board_left')[0].style.visibility = zen ? 'hidden' : 'visible';
- });
- //Player names and move history
- $('.lichess_ground').bind('mouseenter', function(e) {
- $('.username')[0].style.display = 'flex';
- $('.username')[1].style.display = 'flex';
- $('.replay')[0].style.display = 'block';
- });
- $('.lichess_ground').bind('mouseleave', function(e) {
- $('.username')[0].style.display = zen ? 'none' : 'flex';
- $('.username')[1].style.display = zen ? 'none' : 'flex';
- $('.replay')[0].style.display = zen ? 'none' : 'block';
- });
- //Crosstable
- $('.underboard').bind('mouseenter', function(e) {
- $('.underboard > .center')[0].style.visibility = 'visible';
- });
- $('.underboard').bind('mouseleave', function(e) {
- $('.underboard > .center')[0].style.visibility = zen ? 'hidden' : 'visible';
- });
- //Nav bar
- $('#top').bind('mouseenter', function(e) {
- $('#top').children().each(function() {this.style.visibility = 'visible';});
- });
- $('#top').bind('mouseleave', function(e) {
- $('#top').children().each(function() {this.style.visibility = zen ? 'hidden' : 'visible';});
- });
- //Loneliness Indicator
- $('#friend_box').bind('mouseenter', function(e) {
- $('#friend_box').children().each(function() {this.style.visibility = 'visible';});
- $('#friend_box')[0].style.opacity = 1;
- });
- $('#friend_box').bind('mouseleave', function(e) {
- $('#friend_box').children().each(function() {this.style.visibility = zen ? 'hidden' : 'visible';});
- $('#friend_box')[0].style.opacity = zen ? 0 : 1;
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement