Greasy Fork is available in English.

巴哈姆特檢舉提示

有檢舉時跳出提醒,點確定進入後台。

От 2018-12-13 17:18:48 UTC. Виж последната версия.

// ==UserScript==
// @name         巴哈姆特檢舉提示
// @namespace    Bee10301
// @version      2.0
// @description  有檢舉時跳出提醒,點確定進入後台。
// @author       Bee10301
// @match        https://forum.gamer.com.tw/B.php?*
// @homepage    https://home.gamer.com.tw/home.php?owner=bee10301
// ==/UserScript==

(function() {
    'use strict';
    window.onload=function(){
        //refresh mouse
        var BmouseX, BmouseY;
        document.onmousemove = handleMouseMove;
        function handleMouseMove(event) {
            var dot, eventDoc, doc, body,pageX, pageY;

            event = event || window.event; // IE-ism

            if (event.pageX == null && event.clientX != null) {
                eventDoc = (event.target && event.target.ownerDocument) || document;
                doc = eventDoc.documentElement;
                body = eventDoc.body;

                event.pageX = event.clientX +
                    (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
                    (doc && doc.clientLeft || body && body.clientLeft || 0);
                event.pageY = event.clientY +
                    (doc && doc.scrollTop  || body && body.scrollTop  || 0) -
                    (doc && doc.clientTop  || body && body.clientTop  || 0 );
            }
            BmouseX=event.pageX;
            BmouseY=event.pageY;

        }

        //pop up abuse
        if(document.body.outerHTML.match(/文章檢舉待處理/g).length>1){
            Dialogify.confirm('有檢舉,進入後台?',{
                ok: function(){
                    window.open('gemadmin/accuse_B_2k14.php?bsn='+window.location.href.match(/bsn=(\d*)/)[1],'','');
                }
            });
        }



        ////right click
        //get manager
        var get_manage_bar = document.getElementsByClassName("b-manager managertools");
        get_manage_bar[0].innerHTML = "<div class='checkbox'></div><label for='check'></label><div class='bee' style='padding: 5px;'>  <button class='btn--sm btn--ghost' onclick='del()'>刪除</button>  <button class='btn--sm btn--ghost' onclick='lock()'>鎖定</button>  <button class='btn--sm btn--ghost' onclick='move_sub()'>修改子板</button></div><div class='bee' style='padding: 5px;'>  <button class='btn--sm btn--ghost' onclick='settop()'>置頂</button>  <button class='btn--sm btn--ghost' onclick='gather()'>收精華</button></div><div class='bee' style='padding: 5px;'>  <button class='btn--sm btn--ghost' onclick='recover()'>回復刪除</button>  <button class='btn--sm btn--ghost' onclick='rm()'>移除精M圖</button></div><div class='bee' style='padding: 5px;'>  <button class='btn--sm btn--ghost' onclick='location.href='listtype.php?stype=5&amp;bsn=04220&amp;subbsn=0''>刪文模式</button>  <button class='btn--sm btn--ghost' onclick='location.href='listtype.php?stype=10&amp;bsn=04220''>正常模式</button></div></div>";
        //do css
        $(get_manage_bar).css({
            "background-color": "rgb(14, 67, 85)",
            "color": "rgb(147, 156, 165)",
            "font-size": "15px",
            //"left": "5rem",
            "line-height": "15px",
            "margin-bottom": "10px",
            "position": "fixed",
            //"top": "305px",
            "transition-delay": "0s",
            "transition-duration": "0.15s",
            "transition-property": "top",
            "transition-timing-function": "ease",
            "z-index": "100"
        });

        //get elements (checkbox)
        var temp_elements_checkbox = document.getElementsByName("jsn[]");
        var $all_title = document.getElementsByClassName("b-list__main");
        var temp_matcher;
        //
        for( var $i = 0; $i < $all_title.length; $i++ ) {
            $all_title[$i].onclick = function () {
                //disable manager
                $(get_manage_bar).hide();
                //get inner
                temp_matcher = this.innerHTML;
                //get snA
                temp_matcher = temp_matcher.match(/snA=(\d*)/)[1];
                for(var i2= 0 ; i2< temp_elements_checkbox.length ; i2 ++){
                    if(temp_elements_checkbox[i2].value == temp_matcher){
                        console.log();
                        if(temp_elements_checkbox[i2].checked){
                            temp_elements_checkbox[i2].checked = false;
                            //$(this).css({"border-style":"none"});
                            $(this).css({"background-image":"linear-gradient(45deg,transparent 100%,hsla(48,20%,90%,1) 45%,hsla(48,20%,90%,1) 100%,transparent 0)"});
                        }
                        else{
                            temp_elements_checkbox[i2].checked = true;
                            //$(this).css({"border-style":"solid"});
                            $(this).css({"background-image":"linear-gradient(45deg,transparent 45%,hsla(48,20%,90%,1) 45%,hsla(48,20%,90%,1) 55%,transparent 0)",
                            "background-size": "1em 1em",
                            "-webkit-background-clip": "text",
                            "-webkit-text-fill-color": "transparent",
                            "-webkit-text-stroke": "2px #111"
                                        });
                        };
                    }
                }
            }
            //right click (*only on element)
            $all_title[$i].oncontextmenu = function () {
                var temp_scroll = window.scrollY || window.scrollTop || document.getElementsByTagName("html")[0].scrollTop;
                $(get_manage_bar).css({
                    "left":BmouseX+"px",
                    "top":BmouseY-temp_scroll+"px"
                });
                $(get_manage_bar).show();
                ////debug
                //console.log(temp_scroll);
                //right click return
                return false;
            }

        //end for
        }


    }
})();