代码对比/归并工具文本框宽度调整脚本(实用在线工具 - 开源中国(OSCHINA))

工具网址: https://tool.oschina.net/diff/ 其他工具网址: https://tool.oschina.net/

当前为 2021-05-19 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         代码对比/归并工具文本框宽度调整脚本(实用在线工具 - 开源中国(OSCHINA))
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  工具网址: https://tool.oschina.net/diff/ 其他工具网址: https://tool.oschina.net/
// @author       beibeibeibei
// @match        *tool.oschina.net/diff*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    document.querySelector("form.form-inline.well").innerHTML = "<div class=\"diff-editor-width\" style=\"font-size: 24px;margin-bottom: 5px;\"><c style=\"color: black;\">代码对比/归并 powered by OSCHINA</c><button type=\"button\" style=\"padding: 0 10px;border-radius: 4px;color: rgba(0,0,0,0.65);height: 36px;float: right;\" onclick=\"var W = document.querySelector(\'input[class=diff-editor-width]\').value; if(W<430){W=430}; document.querySelector(\'#diff-editor-lhs\').style.width = W + \'px\'; document.querySelector(\'#diff-editor-rhs\').style.width = W + \'px\'; document.querySelector(\'#diff-editor-lhs > div > div.CodeMirror-scroll.cm-s-default\').style.width = W + \'px\'; document.querySelector(\'#diff-editor-rhs > div > div.CodeMirror-scroll.cm-s-default\').style.width = W + \'px\'; document.querySelector(\'#diff\').style.width = (W - 476) * 2 + 1000 + \'px\';document.querySelector(\'#mainContent\').style.width = (W - 476)*2 + 1000 + \'px\';\">修改宽度</button><input type=\"text\" class=\"diff-editor-width\" value=\"476\" style=\"width: 50px;height: 36px;box-sizing: border-box;border: 1px solid #2d78f4;float: right;\"><input id=\"hiddenText\" type=\"text\" style=\"display:none\" /></div><br><div style=\"color:#C00;margin-bottom: 5px;\">由于IE全系列对HTML5的Canvas以及File API支持不好,推荐使用<a href=\"http://www.oschina.net/p/chrome\" target=\"blank\" one-link-mark=\"yes\">Chrome</a>、<a href=\"http://www.oschina.net/p/firefox\" target=\"blank\" one-link-mark=\"yes\">Firefox</a>浏览器,另外请选择正确的文件编码方式以免出现乱码或者显示错误。</div>" + document.querySelector("form.form-inline.well").innerHTML;
    document.querySelector("#headerNavMenu").remove();
    document.querySelector("#mainContent > div.toolName").remove();
    document.querySelector("#diff").style.marginTop = "5px";
    document.querySelector("form.form-inline.well").style.padding = "15px";
    document.querySelector("form.form-inline.well").style.height = "80px";
    document.querySelector("#mainContent > div > div[style^='color:#C00;']").remove();
    // Your code here...
})();