Add spellcheck toggle button etherpads, which is disabled by default (pad.piratenpartij.nl).

Add spellcheck toggle button etherpads, which is disabled by default

当前为 2014-07-05 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Add spellcheck toggle button etherpads, which is disabled by default (pad.piratenpartij.nl).
// @namespace   armeagle.nl
// @include     https://pad.piratenpartij.nl/p/*
// @version     1
// @grant       none
// @description Add spellcheck toggle button etherpads, which is disabled by default
// ==/UserScript==


var barul = document.querySelector("#editbar ul.menu_left");
var li = document.createElement("li");
var a = document.createElement("a");
a.textContent = "Spellcheck";
a.setAttribute("style", "color: black");
li.appendChild(a);

barul.appendChild(li);

a.addEventListener("click", function(event) {

	event.stopPropagation();

	var body = document.querySelector('iframe').contentDocument.querySelector('iframe').contentDocument.querySelector('body');
	if ( body.hasAttribute('spellcheck') ) {
		body.removeAttribute('spellcheck');
		a.setAttribute("style", "color: black; background: linear-gradient(#F4F4F4, #E4E4E4) !important;");
	} else {
		body.setAttribute('spellcheck', false);
		a.setAttribute("style", "color: black");
	}

});