ahk_codebox_quick_fix

Add 'EXPAND VIEW' to code box

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         ahk_codebox_quick_fix
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Add 'EXPAND VIEW' to code box
// @author       You
// @match        https://autohotkey.com/boards/viewtopic.php*
// @grant        none
// ==/UserScript==

expand_code_init();

window.expandCode = function expandCode(e) {
    var c = e.parentNode.parentNode.getElementsByTagName('code')[0];
	if (c.style.maxHeight == 'none') {
		c.style.maxHeight = '200px';
		e.innerHTML = 'EXPAND VIEW';
	}
	else {
		c.style.maxHeight = 'none';
		e.innerHTML = 'COLLAPSE VIEW';
	}
}

function expand_code_init() {
	var boxes = document.getElementsByTagName('code');
	for (var i = 0; i < boxes.length; i++) {
		if (boxes[i].scrollHeight > boxes[i].offsetHeight + 1) {
			boxes[i].parentNode.previousSibling.innerHTML += ' &middot; <a href="#" onclick="expandCode(this); return false;">EXPAND VIEW</a>';
        }
	}
}