Hide Arch Wiki Sidebar

Hides the sidebar on the Arch Linux wiki. The sidebar can be toggled with a button.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Hide Arch Wiki Sidebar
// @description Hides the sidebar on the Arch Linux wiki. The sidebar can be toggled with a button.
// @version     0.1.4
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @include     http://wiki.archlinux.org/*
// @include     https://wiki.archlinux.org/*
// @grant       none
// @namespace   https://greatest.deepsurf.us/users/13329
// ==/UserScript==

// make a "show sidebar" button mimicing the "watch" button
var watch_button = $('li#ca-nstab-main').parent().find('li:last')
var sidebar_button = watch_button.clone();

// change the duplicated "watch" button link to have the properties we want for
// the "show sidebar" button
var sidebar_toggle = sidebar_button.find('a')
	.text('show sidebar')
	.unbind('click')
	.removeAttr('href')
	.attr('id', 'ca-toggle-sidebar')
	.attr('accesskey', 'i')
	.attr('title', 'Toggle the sidebar [Alt+Shift+i]');

// put the new "show sidebar" button after the "watch" button
sidebar_button.insertAfter(watch_button);

var sidebar = $('div#column-one').find('div:gt(3)');
var content = $('div#content');
var original_margin = content.css('margin-left');

// toggle_sidebar shows or hides the sidebar, updating the "show sidebar"
// button link text to match
function toggle_sidebar() {
	if (sidebar.is(':visible')) {
		sidebar_toggle.text('show sidebar');
		sidebar.hide();
		content.css('margin-left', '0px');
	} else {
		sidebar_toggle.text('hide sidebar');
		sidebar.show();
		content.css('margin-left', original_margin);
	}
}

// bind the toggle_sidebar function to the "show sidebar" button link
sidebar_toggle.click(toggle_sidebar);

// sidebar is hidden by default
toggle_sidebar();