AC-论坛悬浮回复框

常用论坛的悬浮回复框,点击固定,再次点击缩回

目前為 2017-02-08 提交的版本,檢視 最新版本

// ==UserScript==
// @name        AC-论坛悬浮回复框
// @description 常用论坛的悬浮回复框,点击固定,再次点击缩回
// @namespace   K
// @include     *
// @version     1.3
// @note        反馈地址 http://bbs.kafan.cn/thread-2076136-1-1.html
// @icon        https://coding.net/u/zb227/p/zbImg/git/raw/master/img0/icon.jpg
// @run-at document-end
// @grant       none
// ==/UserScript==
function addStyle(css) {
    var style = document.createElement('style');
    style.type = 'text/css';
    var node = document.createTextNode(css);
    style.appendChild(node);
    document.head.appendChild(style);
    return style;
}
var frameNames = new Array(
    "div","DIV", "TD", "td", "h2", "form"
);
function isFrame(node){
    for(var index = 0; index < frameNames.length; index++){
        if(node.indexOf(frameNames[index]) == 0)
            return true;
    }
    return false;
}
function addBtn(nodeName){
    var node = document.querySelector(nodeName);
    if(node == null) return;
    node.setAttribute("expand", "0");
    var formNode = document.querySelector(nodeName+" form"); // "#f_pst form"
    if(formNode != null)
        formNode.setAttribute("onsubmit", formNode.getAttribute("onsubmit")+",this.click()");
    node.onclick = function expandView(sender){
        //console.log(node);
        //console.log(sender.target);
        //console.log(sender.target.localName);
        if(node.getAttribute("expand") == "0"){//未展开--->展开
            console.log("展开");
            node.setAttribute("expand", "1");
            node.style = "width:auto !important; height:auto !important;    background:#fcfcfc;    transition-delay:0.5s !important;";
            //addStyle("#anchor,#quickpost, #f_pst, #f_post, #fast_post_c, form[action=\"post.php?\"][method=\"post\"] > .t5{width:auto !important; height:auto !important;    background:#fcfcfc;    transition-delay:0.5s !important;    }");
        }else{
            if(isFrame(sender.target.localName) == false){
                console.log("点击了"+sender.target.localName + ",不是边框类型");
                return;
            }
            console.log("收回");
            node.setAttribute("expand", "0");
            node.style = "width:30px !important; height:240px !important;    background:#fcfcfc;    transition-delay:0.3s !important;";
            //addStyle("#anchor,#quickpost, #f_pst, #f_post, #fast_post_c, form[action=\"post.php?\"][method=\"post\"] > .t5{width:18px !important; height:280px !important;    background:#fcfcfc;    transition-delay:0.3s !important;    }");
        }
    };
}

addStyle("#anchor,#quickpost, #f_post, #f_pst, #fast_post_c, form[action=\"post.php?\"][method=\"post\"] > .t5 {border:1px solid #2B5782 !important;position:fixed;bottom:-11px !important;z-index:99 !important;right:20px !important;height:240px !important;width:30px !important;overflow:hidden;transition-duration: 0.2s !important;transition-delay:0.3s !important;}");
addStyle("#anchor:hover,#quickpost:hover, #f_pst:hover, #f_post:hover, #fast_post_c:hover, form[action=\"post.php?\"][method=\"post\"] > .t5:hover{width:auto !important;    height:auto !important;    background:#fcfcfc;    transition-delay:0.5s !important;    }");
addStyle("#f_pst .p_pop,#f_pst .p_opt{position: absolute !important;bottom: 34% !important;top: auto !important;}");
addBtn("#anchor");
addBtn("#quickpost");
addBtn("#f_pst");
addBtn("#f_post");
addBtn("#fast_post_c");
addBtn("form[action=\"post.php?\"][method=\"post\"] > .t5");

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址