BlueCat Address Manager Resizable Columns

Dynamic Column Resizing in BlueCat Address Manager

当前为 2018-06-05 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        BlueCat Address Manager Resizable Columns
// @namespace   *
// @description Dynamic Column Resizing in BlueCat Address Manager
// @include     */app*
// @version     6
// @grant       none
// @author      Marius Galm
// @copyright   2018, Marius Galm
// @license		MIT
// @icon        https://www.bluecatnetworks.com/wp-content/uploads/2018/03/cropped-bluecat-favicon-32x32.png
// @require     http://code.jquery.com/jquery-latest.js
// ==/UserScript==

//jQuery fix
this.$ = this.jQuery = jQuery.noConflict(true);

// declare used function
function reSize() {
    $(function() {
        var pressed = false;
        var start = undefined;
        var startX, startWidth;

        $("table th").mousedown(function(e) {
            start = $(this);
            pressed = true;
            startX = e.pageX;
            startWidth = $(this).width();
            $(start).addClass("resizing");
        });

        $(document).mousemove(function(e) {
            if(pressed) {
                if(startWidth+(e.pageX-startX) > 9 ) {
                    $(start).width(startWidth+(e.pageX-startX));
                }
            }
        });

        $(document).mouseup(function() {
            if(pressed) {
                $(start).removeClass("resizing");
                pressed = false;
            }
        });
    });
}

// do something on specific pages
if (document.readyState === "interactive" ) {
    var page = document.childNodes[2].nodeValue;
    if (/Page: AddEdit/.test(page)) {
        page = "AddEditDummy";
    } else if (/Page: Edit/.test(page)) {
        page = "AddEditDummy";
    }
    switch(page) {
        case " Page: SystemInformation ":
            break;
        case " Page: UpdateSystem ":
            break;
        case "AddEditDummy":
            break;
        case " Page: AllocateIP4Address ":
            break;
        default:
            reSize();
    }
}