this.$ = this.jQuery = jQuery.noConflict(true);
// ==UserScript==
// @name         云班课🆕答题小能手🥇(MeTo题库)
// @namespace    http://tampermonkey.net/
// @version      5.33
// @description  【😎完美应付考试、测试,全自动答题,一键完成所有资源学习(视频挨个刷时长不存在滴)、视频倍速😎】、【🚀已兼容、慕课、U校园、新国开、蓝墨云、职教云、智慧职教、云班课精品课🚀】(部分功能更新不及时可能无法使用,欢迎进群)、【💪新增AI搜题、AI问答,定制化服务💪】、【💙破除网站不可复制文字💙】、【🐮基于生成式AI(ChatGPT)的答案生成🐮】、【🔥一键导入题目🔥】、【🧡新增背题模式(遮挡答案,更好的进行考试复习)🧡】、【😭待支持网站:超星、学习通、智慧树、知到、慕课😭】、【欢迎加入qq群催更:😄716217812😄,共同交流进步,特别感谢MeTo题库提供题目搜索功能】。【💚作者在此保证,脚本无任何诸如(手机号,学校信息,等隐私信息)收集💚】
// @author       阿绿
// @note         致谢表:@凈仙人、@💪❤、@M_、@吃土豆长大的马铃薯、@悟虚、@台灯没电了、@Pumpkin、@小陈陈陈陈啊、@Sli、@无心人、@29827*0049、@热心解答(以上均是对此脚本做出过有效BUG提交OR提供账户帮助修复OR提供好的idea,如有遗漏请告知)
// @match        *://*.mosoteach.cn/*
// @match        *://*.chaoxing.com/*
// @match      	 *://*.xueyinonline.com/*
// @match        *://*.edu.cn/*
// @match        *://*.ouchn.cn/*
// @match        *://*.nbdlib.cn/*
// @match        *://*.hnsyu.net/*
// @match        *://*.gdhkmooc.com/*
// @match        *://*.zhihuishu.com/*
// @match      	 *://*.icve.com.cn/*
// @match      	 *://*.yuketang.cn/*
// @match      	 *://v.met0.top/*
// @supportURL   https://gitee.com/xiaolv12/yunbanke
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.min.js
// @icon         https://bkimg.cdn.bcebos.com/pic/4ec2d5628535e5dde7114110e88eb0efce1b9c16c4e1
// @require      https://cdn.bootcss.com/crypto-js/3.1.9-1/crypto-js.min.js
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_addStyle
// @grant        GM_getResourceText
// @grant        unsafeWindow
// @grant        GM_info
// @grant        GM_xmlhttpRequest
// @grant        GM_registerMenuCommand
// @connect      m.met0.top
// @connect      v.met0.top
// @connect      c.met0.top
// @connect      d.met0.top
// @connect      localhost
// @connect      127.0.0.1
// @connect      gitee.com
// @connect      *
// @license MIT
// @downloadURL none
// ==/UserScript==
(function () {
    (function($) {
        var tips = [];
        function handleWindowResize() {
            $.each(tips, function() {
                this.refresh(true);
            });
        }
        $(window).resize(handleWindowResize);
        $.JPopBox = function(elm, options) {
            this.$elm = $(elm);
            this.opts = this.getOptions(options);
            var popBoxHtml=[];
            popBoxHtml.push('
');
            if(this.opts.title!=""){
                popBoxHtml.push('
'+this.opts.title+'
');
            }
            if(this.opts.isShowArrow){
                popBoxHtml.push('
');
            }
            popBoxHtml.push('
'),
                popBoxHtml.push('
 ');
            this.$tip = $(popBoxHtml.join('')).appendTo(document.body);
            this.$arrow = this.$tip.find('div.JPopBox-tip-arrow');
            this.$inner = this.$tip.find('div.JPopBox-tip-content');
            this.disabled = false;
            this.content = null;
            this.init();
        };
        $.JPopBox.hideAll = function() {
            $.each(tips, function() {
                this.hide();
            });
        };
        $.JPopBox.prototype = {
            getOptions:function(options){
                options = $.extend({}, $.fn.jPopBox.defaults, options);
                if (options.delay && typeof options.delay == 'number') {
                    options.delay = {
                        show: options.delay,
                        hide: options.delay
                    };
                }
                if (typeof options.offset == 'number') {
                    options.offset = {
                        X: options.offset,
                        Y: options.offset
                    };
                }
                return options
            },
            init: function() {
                tips.push(this);
                this.$elm.data('jPopBox', this);
                if (this.opts.trigger != 'none') {
                    this.opts.trigger!="click" && this.$elm.on({
                        'mouseenter.jPopBox': $.proxy(this.mouseenter, this),
                        'mouseleave.jPopBox': $.proxy(this.mouseleave, this)
                    });
                    switch (this.opts.trigger) {
                        case 'click':
                            this.$elm.on('click.jPopBox', $.proxy(this.toggle, this));
                            break;
                        case 'hover':
                            if (this.opts.isTipHover)
                                this.$tip.hover($.proxy(this.clearTimeouts, this), $.proxy(this.mouseleave, this));
                            break;
                        case 'focus':
                            this.$elm.on({
                                'focus.jPopBox': $.proxy(this.showDelayed, this),
                                'blur.jPopBox': $.proxy(this.hideDelayed, this)
                            });
                            break;
                    }
                }
            },
            toggle:function(){
                var active=this.$tip.data('active');
                if(!active)
                    this.showDelayed();
                else
                    this.hideDelayed();
            },
            mouseenter: function(e) {
                if (this.disabled)
                    return true;
                this.updateCursorPos(e);
                this.$elm.attr('title', '');
                if (this.opts.trigger == 'focus')
                    return true;
                this.showDelayed();
            },
            mouseleave: function(e) {
                if (this.disabled || this.asyncAnimating && (this.$tip[0] === e.relatedTarget || jQuery.contains(this.$tip[0], e.relatedTarget)))
                    return true;
                if (this.opts.trigger == 'focus')
                    return true;
                this.hideDelayed();
            },
            mousemove: function(e) {
                if (this.disabled)
                    return true;
                this.updateCursorPos(e);
                if (this.opts.isFollowCursor && this.$tip.data('active')) {
                    this.calcPos();
                    this.$tip.css({left: this.pos.l, top: this.pos.t});
                }
            },
            show: function() {
                this.$elm.trigger($.Event('show.jPopBox'));
                if (this.disabled || this.$tip.data('active'))
                    return;
                this.reset();
                this.update();
                if (!this.content)
                    return;
                this.display();
                this.$elm.trigger($.Event('shown.jPopBox'));
            },
            showDelayed: function(timeout) {
                this.clearTimeouts();
                this.showTimeout = setTimeout($.proxy(this.show, this), typeof timeout == 'number' ? timeout:this.opts.delay.show);
            },
            hide: function() {
                this.$elm.trigger($.Event('hide.jPopBox'));
                if (this.disabled || !this.$tip.data('active'))
                    return;
                this.display(true);
                this.$elm.trigger($.Event('hidden.jPopBox'));
            },
            hideDelayed: function(timeout) {
                this.clearTimeouts();
                this.hideTimeout = setTimeout($.proxy(this.hide, this),typeof timeout == 'number' ? timeout :this.opts.delay.hide);
            },
            reset: function() {
                this.$tip.queue([]).detach().css('visibility', 'hidden').data('active', false);
                this.$inner.find('*').jPopBox('hide');
                this.$arrow.length && (this.$arrow[0].className = 'JPopBox-tip-arrow JPopBox-tip-arrow-top JPopBox-tip-arrow-right JPopBox-tip-arrow-bottom JPopBox-tip-arrow-left');
                this.asyncAnimating = false;
            },
            update: function(content, dontOverwriteOption) {
                if (this.disabled)
                    return;
                var async = content !== undefined;
                if (async) {
                    if (!dontOverwriteOption)
                        this.opts.content = content;
                    if (!this.$tip.data('active'))
                        return;
                } else {
                    content = this.opts.content;
                }
                // update content only if it has been changed since last time
                var self = this,
                    newContent = typeof content == 'function' ?
                        content.call(this.$elm[0], function(newContent) {
                            self.update(newContent);
                        }) : content;
                if (this.content !== newContent) {
                    this.$inner.empty().append(newContent);
                    this.content = newContent;
                }
                this.refresh(async);
            },
            refresh: function(async) {
                if (this.disabled)
                    return;
                if (async) {
                    if (!this.$tip.data('active'))
                        return;
                }
                this.$tip.css({left: 0, top: 0}).appendTo(document.body);
                if (this.opacity === undefined)
                    this.opacity = this.$tip.css('opacity');
                this.calcPos();
                this.$tip.css({left: this.pos.l, top: this.pos.t});
            },
            display: function(hide) {
                var active = this.$tip.data('active');
                if (active && !hide || !active && hide)
                    return;
                this.$tip.stop();
                var from = {}, to = {};
                from.opacity = hide ? this.$tip.css('opacity') : 0;
                to.opacity = hide ? 0 : this.opacity;
                this.$tip.css(from).animate(to, 300);
                hide ? this.$tip.queue($.proxy(this.reset, this)) : this.$tip.css('visibility', 'inherit');
                this.$tip.data('active', !active);
            },
            disable: function() {
                this.reset();
                this.disabled = true;
            },
            enable: function() {
                this.disabled = false;
            },
            destroy: function() {
                this.reset();
                this.$tip.remove();
                delete this.$tip;
                this.content = null;
                this.$elm.off('.jPopBox').removeData('jPopBox');
                tips.splice($.inArray(this, tips), 1);
            },
            clearTimeouts: function() {
                if (this.showTimeout) {
                    clearTimeout(this.showTimeout);
                    this.showTimeout = 0;
                }
                if (this.hideTimeout) {
                    clearTimeout(this.hideTimeout);
                    this.hideTimeout = 0;
                }
            },
            updateCursorPos: function(e) {
                this.eventX = e.pageX;
                this.eventY = e.pageY;
            },
            calcPos: function() {
                this.tipOuterW = this.$tip.outerWidth();
                this.tipOuterH = this.$tip.outerHeight();
                var pos = {l: 0, t: 0, arrow: ''},
                    $win = $(window),
                    win = {
                        l: $win.scrollLeft(),
                        t: $win.scrollTop(),
                        w: $win.width(),
                        h: $win.height()
                    }, xL, xC, xR, yT, yC, yB,arrowOuterWH,placement,isAuto=false;
                var elmOffset = this.$elm.offset(),
                    elm = {
                        l: elmOffset.left,
                        t: elmOffset.top,
                        w: this.$elm.outerWidth(),
                        h: this.$elm.outerHeight()
                    };
                xL = elm.l;	        // left
                xC = xL + Math.floor(elm.w / 2);    // h center
                xR = xL + elm.w;    // right
                yT = elm.t;	        // top
                yC = yT + Math.floor(elm.h / 2);    // v center
                yB = yT +elm.h;	    // bottom
                placement=this.opts.placement;
                var autoReg=/\s?auto?\s?/i;
                isAuto=autoReg.test(placement);
                if (isAuto) placement = placement.replace(autoReg, '') || 'top';
                //calc left position
                switch (placement) {
                    case "top":
                    case "bottom":
                        pos.l = xC - Math.floor(this.tipOuterW / 2)-this.opts.offset.X;
                        {
                            if (pos.l + this.tipOuterW > win.l + win.w)
                                pos.l = win.l + win.w - this.tipOuterW;
                            else if (pos.l < win.l)
                                pos.l = win.l;
                        }
                        break;
                    case "right":
                        arrowOuterWH=this.setArrowAndGetWH(placement);
                        pos.l = xR + this.opts.offset.X+arrowOuterWH.W;
                        if (isAuto && pos.l + this.tipOuterW > win.l + win.w){
                            arrowOuterWH=this.setArrowAndGetWH("left");
                            pos.l =xL - this.tipOuterW - this.opts.offset.X-arrowOuterWH.W;
                        }
                        break;
                    case "left":
                        arrowOuterWH=this.setArrowAndGetWH(placement);
                        pos.l = xL - this.tipOuterW- this.opts.offset.X-arrowOuterWH.W;
                        if (isAuto && pos.l < win.l){
                            arrowOuterWH=this.setArrowAndGetWH("right");
                            pos.l =xR + this.opts.offset.X+arrowOuterWH.W;
                        }
                        break;
                }
                //calc top position
                switch (placement) {
                    case "top":
                        arrowOuterWH=this.setArrowAndGetWH(placement);
                        pos.t = yT - this.tipOuterH - this.opts.offset.Y-arrowOuterWH.H;
                        if (isAuto && pos.t < win.t) {
                            arrowOuterWH=this.setArrowAndGetWH("bottom");
                            pos.t = yB + this.opts.offset.Y+arrowOuterWH.H;
                        }
                        break;
                    case "bottom":
                        arrowOuterWH=this.setArrowAndGetWH(placement);
                        pos.t = yB+ this.opts.offset.Y +arrowOuterWH.H;
                        if (isAuto && pos.t + this.tipOuterH > win.t + win.h) {
                            arrowOuterWH=this.setArrowAndGetWH("top");
                            pos.t = yT - this.tipOuterH - this.opts.offset.Y-arrowOuterWH.H;
                        }
                        break;
                    case "right":
                    case "left":
                        pos.t = yC - Math.floor(this.tipOuterH / 2)-this.opts.offset.Y;
                        {
                            if (pos.t + this.tipOuterH > win.t + win.h){
                                pos.t = win.t + win.h - this.tipOuterH;
                            }
                            else if (pos.t < win.t)
                                pos.t = win.t;
                        }
                        break;
                }
                this.pos = pos;
            },
            setArrowAndGetWH:function(placement){
                var arrowOuteWH={};
                var W=0,H=0;
                if(this.$arrow.length){
                    this.$arrow.attr("class", "JPopBox-tip-arrow JPopBox-tip-arrow-" + placement);
                    W = this.$arrow.outerWidth();
                    H = this.$arrow.outerHeight();
                }
                arrowOuteWH.W=W;
                arrowOuteWH.H=H;
                return arrowOuteWH;
            }
        };
        $.fn.jPopBox = function(options) {
            if (typeof options == 'string') {
                var args = arguments,
                    method = options;
                Array.prototype.shift.call(args);
                if (method == 'destroy') {
                    this.die ?
                        this.die('mouseenter.jPopBox').die('focus.jPopBox') :
                        $(document).undelegate(this.selector, 'mouseenter.jPopBox').undelegate(this.selector, 'focus.jPopBox');
                }
                return this.each(function() {
                    var jPopBox = $(this).data('jPopBox');
                    if (jPopBox && jPopBox[method])
                        jPopBox[method].apply(jPopBox, args);
                });
            }
            var opts = $.extend({}, $.fn.jPopBox.defaults, options);
            if (!$('#jPopBox-css-' + opts.className)[0])
                $([''].join('')).appendTo('head');
            return this.each(function() {
                new $.JPopBox(this, opts);
            });
        };
        // default settings
        $.fn.jPopBox.defaults = {
            title:'',                   // 标题
            content:'',	                // 弹出框内容 ('string', element, function(updateCallback){...})
            className:'JPopBox-tip-white',	    // class名称
            placement:'top',            // 如何定位弹出框 (top|bottom|left|right|auto)。当指定为 auto 时,会动态调整弹出框。例如,如果 placement 是 "auto left",弹出框将会尽可能显示在左边,在情况不允许的情况下它才会显示在右边
            delay:100,                  // 延迟显示和隐藏弹出框的毫秒数,对 trigger:none 手动触发类型不适用。如果提供的是一个数字,那么延迟将会应用于显示和隐藏。如果提供的是一个对象{ show: 500, hide: 100 },那么延迟将会分别应用于显示和隐藏
            trigger:'hover',	        // 如何触发弹出框 ('click',hover', 'focus', 'none'),none为手动触发
            offset:0,                   // 方向偏移量,值为负数时,将会反向偏移。如果提供的是一个数字,那么偏移量将会应用于X轴和Y轴。如果提供的是一个对象{ X:200, Y: 100 },那么偏移量将会分别应用于X轴和Y轴
            isShowArrow:true,           // 是否显示指向箭头
            isTipHover:true             // 是否允许在弹出框上移动,而不自动隐藏。只对trigger:hover有效。
        };
    })(jQuery);
    /**
     * 借鉴 网页限制解除(改)
     * 原作者 qxin i
     * 开源地址 https://greasyfork.org/zh-CN/scripts/28497-%E7%BD%91%E9%A1%B5%E9%99%90%E5%88%B6%E8%A7%A3%E9%99%A4-%E6%94%B9/code
     */
    var settingData = {
        "status": 1,
        "version": 0.1,
        "message": "借鉴 网页限制解除(改)",
        "positionTop": "0",
        "positionLeft": "0",
        "positionRight": "auto",
        "addBtn": true,
        "connectToTheServer": false,
        "waitUpload": [],
        "currentURL": "null",
        "shortcut": 3,
        // 域名规则列表
        "rules": {
            "rule_def": {
                "name": "default",
                "hook_eventNames": "contextmenu|select|selectstart|copy|cut|dragstart|mousemove|beforeunload",
                "unhook_eventNames": "mousedown|mouseup|keydown|keyup",
                "dom0": true,
                "hook_addEventListener": true,
                "hook_preventDefault": true,
                "hook_set_returnValue": true,
                "add_css": true
            },
            "rule_plus": {
                "name": "default",
                "hook_eventNames": "contextmenu|select|selectstart|copy|cut|dragstart|mousedown|mouseup|mousemove|beforeunload",
                "unhook_eventNames": "keydown|keyup",
                "dom0": true,
                "hook_addEventListener": true,
                "hook_preventDefault": true,
                "hook_set_returnValue": true,
                "add_css": true
            },
            "rule_zhihu": {
                "name": "default",
                "hook_eventNames": "contextmenu|select|selectstart|copy|cut|dragstart|mousemove",
                "unhook_eventNames": "keydown|keyup",
                "dom0": true,
                "hook_addEventListener": true,
                "hook_preventDefault": true,
                "hook_set_returnValue": true,
                "add_css": true
            }
        },
        "data": [
            "b.faloo.com",
            "bbs.coocaa.com",
            "book.hjsm.tom.com",
            "book.zhulang.com",
            "book.zongheng.com",
            "chokstick.com",
            "chuangshi.qq.com",
            "city.udn.com",
            "cutelisa55.pixnet.net",
            "huayu.baidu.com",
            "imac.hk",
            "life.tw",
            "luxmuscles.com",
            "news.missevan.com",
            "read.qidian.com",
            "www.15yan.com",
            "www.17k.com",
            "www.18183.com",
            "www.360doc.com",
            "www.coco01.net",
            "www.eyu.com",
            "www.hongshu.com",
            "www.hongxiu.com",
            "www.imooc.com",
            "www.jjwxc.net",
            "www.readnovel.com",
            "www.tadu.com",
            "www.xxsy.net",
            "www.z3z4.com",
            "www.zhihu.com",
            "yuedu.163.com",
            "www.ppkao.com",
            "movie.douban.com",
            "www.ruiwen.com",
            "vipreader.qidian.com",
            "www.pigai.org",
            "www.shangc.net",
            "www.myhtlmebook.com",
            "www.yuque.com",
            "www.longmabookcn.com",
            "www.alphapolis.co.jp",
            "www.sdifen.com",
            "votetw.com",
            "boke112.com",
            "www.myhtebooks.com",
            "www.xiegw.cn",
            "chuangshi.qq.com",
            "www.uta-net.com",
            "www.bimiacg.net"
        ]
    };
    var rwl_userData = null;
    var hostname = window.location.hostname;
    var btn_node = null;
    var rule = null;
    var list = null;
    var hasFrame = false;
    // 储存名称
    var storageName = "StorageName";
    // 要处理的 event 列表
    var hook_eventNames, unhook_eventNames, eventNames;
    // 储存被 Hook 的函数
    var EventTarget_addEventListener = EventTarget.prototype.addEventListener;
    var document_addEventListener = document.addEventListener;
    var Event_preventDefault = Event.prototype.preventDefault;
    // 查看本地是否存在旧数据
    rwl_userData = GM_getValue("rwl_userData");
    if (!rwl_userData) {
        rwl_userData = settingData;
        // GM_setValue("rwl_userData",rwl_userData);
    }
    // 自动更新数据
    for (let value in settingData) {
        if (!rwl_userData.hasOwnProperty(value)) {
            rwl_userData[value] = settingData[value];
            GM_setValue("rwl_userData", rwl_userData);
        }
    }
    version_up_3_to_4();
    // 获取黑名单网站
    list = get_black_list();
    // 添加按钮
    // if(rwl_userData.addBtn){
    // addBtn();  // 添加
    btn_node = document.getElementById("black_node");
    setTimeout(function () {
        qxinStart();
    }, 500);
    // }
    // GM_registerMenuCommand("复制限制解除 设置", setMenu)
    var userSetting = GM_getValue("rwl_userData");
    // // ------------------------------函数 func
    function qxinStart() {
        // addDragEven();
        // setBtnClick();
        // 检查是否在黑名单中
        if (check_black_list(list)) {
            try {
                if (rwl_userData.addBtn) {
                    btn_node.checked = true;
                }
            } catch (e) {
            } finally {
                init();
            }
        }
    }
    // 初始化 init func  这里才是核心
    function init() {
        // 针对个别网站采取不同的策略
        rule = clear();
        // 设置 event 列表
        hook_eventNames = rule.hook_eventNames.split("|");
        // TODO Allowed to return value
        unhook_eventNames = rule.unhook_eventNames.split("|");
        eventNames = hook_eventNames.concat(unhook_eventNames);
        // 调用清理 DOM0 event 方法的循环
        if (rule.dom0) {
            setInterval(clearLoop, 10 * 1000);
            setTimeout(clearLoop, 1500);
            window.addEventListener('load', clearLoop, true);
            clearLoop();
        }
        // hook addEventListener //导致搜索跳转失效的原因
        if (rule.hook_addEventListener) {
            EventTarget.prototype.addEventListener = addEventListener;
            document.addEventListener = addEventListener;
            if (hasFrame) {
                for (let i = 0; i < hasFrame.length; i++) {
                    hasFrame[i].contentWindow.document.addEventListener = addEventListener;
                }
            }
        }
        // hook preventDefault
        if (rule.hook_preventDefault) {
            Event.prototype.preventDefault = function () {
                if (hook_eventNames.indexOf(this.type) < 0) {
                    Event_preventDefault.apply(this, arguments);
                }
            };
            if (hasFrame) {
                for (let i = 0; i < hasFrame.length; i++) {
                    hasFrame[i].contentWindow.Event.prototype.preventDefault = function () {
                        if (hook_eventNames.indexOf(this.type) < 0) {
                            Event_preventDefault.apply(this, arguments);
                        }
                    };
                }
            }
        }
        // Hook set returnValue
        if (rule.hook_set_returnValue) {
            Event.prototype.__defineSetter__('returnValue', function () {
                if (this.returnValue !== true && hook_eventNames.indexOf(this.type) >= 0) {
                    this.returnValue = true;
                }
            });
        }
        // 添加CSS     // console.debug('url: ' + url, 'storageName:' + storageName, 'rule: ' + rule.name);
        if (rule.add_css) {
            GM_addStyle('html, :not([class*="rwl-exempt"]) {-webkit-user-select:text!important; -moz-user-select:text!important;} :not([class*="rwl-exempt"]) ::selection {color:#fff; background:#3390FF!important;}');
        } //else {
        //GM_addStyle('html, :not([class*="rwl-exempt"]) {-webkit-user-select:text!important; -moz-user-select:text!important;}');
        //}
    }
    // Hook addEventListener proc
    function addEventListener(type, func, useCapture) {
        var _addEventListener = this === document ? document_addEventListener : EventTarget_addEventListener;
        if (hook_eventNames.indexOf(type) >= 0) {
            _addEventListener.apply(this, [type, returnTrue, useCapture]);
        } else if (unhook_eventNames.indexOf(type) >= 0) {
            var funcsName = storageName + type + (useCapture ? 't' : 'f');
            if (this[funcsName] === undefined) {
                this[funcsName] = [];
                _addEventListener.apply(this, [type, useCapture ? unhook_t : unhook_f, useCapture]);
            }
            this[funcsName].push(func);
        } else {
            _addEventListener.apply(this, arguments);
        }
    }
    // 清理循环
    function clearLoop() {
        rule = clear(); // 对于动态生成的节点,随时检测
        var elements = getElements();
        for (var i in elements) {
            for (var j in eventNames) {
                var name = 'on' + eventNames[j];
                // ;?未解决
                // 2018-04-02 elements中会有字符串出现,原版不会,问题不明,根本原因尚未解决
                // 相关反馈  https://greasyfork.org/zh-CN/forum/discussion/36014
                // 问题版本号  v3.0.7
                // 问题补充   之前可以使用,具体版本未测(2018-04-02 21:27:53),原版可以使用
                if (Object.prototype.toString.call(elements[i]) == "[object String]") {
                    continue;
                }
                // console.log(elements[i])
                // if(typeof elements[i][name] === "object"){
                //     console.log(typeof elements[i][name])
                // }
                if (elements[i][name] !== null && elements[i][name] !== onxxx) {
                    if (unhook_eventNames.indexOf(eventNames[j]) >= 0) {
                        elements[i][storageName + name] = elements[i][name];
                        elements[i][name] = onxxx;
                    } else {
                        elements[i][name] = null;
                    }
                }
            }
        }
        document.onmousedown = function () {
            return true;
        };
    }
    // 返回true的函数
    function returnTrue(e) {
        return true;
    }
    function unhook_t(e) {
        return unhook(e, this, storageName + e.type + 't');
    }
    function unhook_f(e) {
        return unhook(e, this, storageName + e.type + 'f');
    }
    function unhook(e, self, funcsName) {
        var list = self[funcsName];
        for (var i in list) {
            list[i](e);
        }
        e.returnValue = true;
        return true;
    }
    function onxxx(e) {
        var name = storageName + 'on' + e.type;
        this[name](e);
        e.returnValue = true;
        return true;
    }
    // 获取所有元素 包括document
    function getElements() {
        var elements = Array.prototype.slice.call(document.getElementsByTagName('*'));
        elements.push(document);
        // 循环所有 frame 窗口
        var frames = document.querySelectorAll("frame");
        if (frames) {
            hasFrame = frames;
            var frames_element;
            for (let i = 0; i < frames.length; i++) {
                frames_element = Array.prototype.slice.call(frames[i].contentWindow.document.querySelectorAll("*"));
                elements.push(frames[i].contentWindow.document);
                elements = elements.concat(frames_element);
            }
        }
        return elements;
    }
    // 获取黑名单网站 Func
    function get_black_list() {
        // 之前版本可能导致存储空的字符串
        // 2018-06-11 15:11:44 保留,当容错处理
        var data_temp = rwl_userData.data;
        data_temp = data_temp.filter(function (item) {
            return item.length > 1;
        });
        return data_temp;
    }
    // 检查是否存在于黑名单中 返回位置 func
    function check_black_list(list, host) {
        for (let i = 0; i < list.length; i++) {
            if (~hostname.indexOf(list[i])) {
                return i + 1;  //万一匹配到第一个,返回0
            }
        }
        return false;
    }
    // 数组去重
    function unique(arr) {
        var ret = [];
        for (var i = 0; i < arr.length; i++) {
            var item = arr[i];
            if (ret.indexOf(item) === -1) {
                ret.push(item);
            }
        }
        return ret;
    }
    // 复制到剪贴板
    function setClipboard() {
        var text_obj = window.getSelection();
        var text = text_obj.toString();
        GM_setClipboard(text);
    }
    // 快捷键 F1(ctrl+f1) 复制
    function hotkey() {
        var a = window.event.keyCode;
        // if ((a == 112) && (event.ctrlKey)) {
        if (a == 112 && userSetting.shortcut == 1) {
            event.preventDefault();
            setClipboard();
            event.keyCode = 0;
            event.returnValue = false;
            return false;
        } else if (a == 112 && (event.ctrlKey) && userSetting.shortcut == 2) {
            setClipboard();
        } else if ((a == 67) && (event.ctrlKey) && userSetting.shortcut == 3) {
            setClipboard();
        } else {
            console.log("关闭了快捷键");
        }
    }
    document.onkeydown = hotkey; //当onkeydown 事件发生时调用hotkey函数
    // 部分网站采用了其他的防复制手段
    function clear() {
        // console.log("进入clear",hostname,rwl_userData.rules);
        switch (hostname) {
            case "chuangshi.qq.com":
                clear_chuangshi();
                break;
            case "votetw.com":
                clear_votetw();
                break;
            case "www.myhtebooks.com":
                clear_covers(".fullimg");
                break;
            case "www.z3z4.com":
                clear_covers(".moviedownaddiv");
                break;
            case "huayu.baidu.com":
                clear_covers("#jqContextMenu");
                break;
            case "www.myhtlmebook.com":
                clear_covers("img.fullimg");
                break;
            case "zhihu.com":
            case "www.zhihu.com":
                return rwl_userData.rules.rule_zhihu;
            case "t.bilibili.com":
                clear_link_bilibili();
                break;
            case "www.uslsoftware.com":
                clear_covers(".protect_contents-overlay");
                clear_covers(".protect_alert");
                return rwl_userData.rules.rule_plus;
            case "www.longmabookcn.com":
                clear_covers(".fullimg");
                return rwl_userData.rules.rule_plus;
            case "boke112.com":
                return rwl_userData.rules.rule_plus;
            case "www.shangc.net":
                return rwl_userData.rules.rule_plus;
        }
        return rwl_userData.rules.rule_def;
    }
    // 去除覆盖层
    function clear_covers(ele) {
        var odiv = document.querySelector(ele);
        if (odiv) {
            odiv.parentNode.removeChild(odiv);
        }
    }
    // b站将文字嵌套在链接中
    function clear_link_bilibili() {
        var odiv = document.querySelector(".description");
        if (odiv) {
            var tDiv = odiv.querySelector(".content-ellipsis");
            odiv.querySelector("a");
            odiv.appendChild(tDiv);
        }
    }
    // https://votetw.com/wiki/%E6%9E%97%E6%99%BA%E5%A0%85
    // 会创建多个无id,无class的div,覆盖在文字上层
    function clear_votetw() {
        var odivs = document.querySelectorAll(".mw-parser-output>div");
        odivs.forEach(function (value) {
            value.setAttribute("style", "");
        });
    }
    // 创世中文网
    function clear_chuangshi() {
        console.log("创世中文网 开始执行");
    }
    // 3.x.x 过渡 4.x.x 版本
    function version_up_3_to_4() {
        var old_version = GM_getValue("black_list");
        if (!old_version) {
            return
        }
        rwl_userData.data = unique(rwl_userData.data.concat(old_version.data));
        GM_setValue("rwl_userData", rwl_userData);
        GM_deleteValue("black_list");
        GM_deleteValue("rwl_userdata");
    }
    /**
     * 原作者 wyn665817@163.com
     * 开源地址 https://scriptcat.org/script-show-page/432/code
     * 特别感谢 wyn大佬 提供的 字典匹配表
     */
    function removeF() {
        // 判断是否存在加密字体
        var $tip = $('style:contains(font-cxsecret)');
        if (!$tip.length) return;
    // 解析font-cxsecret字体
        var font = $tip.text().match(/base64,([\w\W]+?)'/)[1];
        font = Typr.parse(base64ToUint8Array(font))[0];
    // 匹配解密字体
        var table = JSON.parse(GM_getResourceText('Table'));
        var match = {};
        for (var i = 19968; i < 40870; i++) { // 中文[19968, 40869]
            $tip = Typr.U.codeToGlyph(font, i);
            if (!$tip) continue;
            $tip = Typr.U.glyphToPath(font, $tip);
            $tip = MD5(JSON.stringify($tip)).slice(24); // 8位即可区分
            match[i] = table[$tip];
        }
    // 替换加密字体
        $('.font-cxsecret').html(function (index, html) {
            $.each(match, function (key, value) {
                key = String.fromCharCode(key);
                key = new RegExp(key, 'g');
                value = String.fromCharCode(value);
                html = html.replace(key, value);
            });
            return html;
        }).removeClass('font-cxsecret'); // 移除字体加密
        function base64ToUint8Array(base64) {
            var data = window.atob(base64);
            var buffer = new Uint8Array(data.length);
            for (var i = 0; i < data.length; ++i) {
                buffer[i] = data.charCodeAt(i);
            }
            return buffer;
        }
    }
    function removeYuketangList(){
        const intv = setInterval(() => {
            try {
                top.document.querySelector('.exam').__vue__.handleHangUpTip = function () {
                };
                const querySelector = top.document.querySelector;
                top.document.querySelector = function (...args) {
                    if (args[0] === '#hcSearcheModal') return false
                    return querySelector.call(this, ...args)
                };
                clearInterval(intv);
            } catch (e) {
            }
        }, 100);
    }
    function start() {
        try {removeYuketangList();}catch (e){}
        setTimeout(function () {
            try {removeF();} catch (e) {}
            try {init();} catch (e) {}
        }, 1000);
    }
    function getDefaultConfig() {
        const defaultConfig = {
            auto_search: false,//自动搜索
            auto_close: true,//自动关闭
            remove_limit: false,//解除限制
            fixed_modal: true,//基于浏览器布局
            custom_style_on: true,
            in_setting: false,//是否在设置页面
            custom_style: "",
            out_iframe: true,
            model:{
                select:"默认",
                "答题":`我想让你扮演一名做题家,我将会对你发起提问,你的任务是给出具体的答案并说明理由。我的题目是“{msg}”`,
                "翻译":`下面我让你来充当翻译家,你的目标是把任何语言翻译成中文,请翻译时不要带翻译腔,而是要翻译得自然、流畅和地道,使用优美和高雅的表达方式。请翻译下面这句话:“{msg}”`,
                "默认":`{msg}`,
                "自定义1":``,
                "自定义2":``,
            }
        };
        //去查找接口设置 默认
        if (GM_getValue("defaultConfig") === undefined) {
            GM_setValue("defaultConfig", JSON.stringify(defaultConfig));
        }
        return JSON.parse(GM_getValue("defaultConfig"))
    }
    let options = getDefaultConfig();
    function getToken() {
        if (typeof GM_getValue("token") === 'string') {
            return GM_getValue("token")
        } else {
            return ''
        }
    }
    window.addEventListener("message", function (event) {
        if (event.data.type === 'search') {
            addModal2(createFrameLoading(), false);
            searchWord(event.data.wd).then(res => {
                addModal2(res, false, false);
            });
        } else {
            if (event.data.type === 'auto_close') {
                options.auto_close = event.data.auto_close;
                GM_setValue("defaultConfig", JSON.stringify(options));
            } else if (event.data.type === 'auto_search') {
                options.auto_search = event.data.auto_search;
                GM_setValue("defaultConfig", JSON.stringify(options));
            } else if (event.data.type === 'remove_limit') {
                let copy = Object.assign(options);
                copy.remove_limit = event.data.remove_limit;
                GM_setValue("defaultConfig", JSON.stringify(copy));
            } else if (event.data.type === 'fixed_modal') {
                options.fixed_modal = event.data.fixed_modal;
                GM_setValue("defaultConfig", JSON.stringify(options));
            } else if (event.data.type === 'out_iframe') {
                options.out_iframe = event.data.out_iframe;
                GM_setValue("defaultConfig", JSON.stringify(options));
            } else if (event.data.type === 'select_msg_model') {
                options.model.select = event.data.select_msg_model;
                GM_setValue("defaultConfig", JSON.stringify(options));
            } else if (event.data.type === 'update_msg_model') {
                options.model[event.data.select_msg_model] = event.data.update_msg_model;
                GM_setValue("defaultConfig", JSON.stringify(options));
            } else if (event.data.type === 'login') {
                
            } else if (event.data.type === 'captcha') {
            } else if (event.data.type === 'checkVersion') {
                GM_setValue("version", JSON.stringify(event.data.version));
            }
        }
    }, false);
    let POPOVER_ID = 'hcSearchePopover';
    let MODAL_ID = 'hcSearcheModal';
    let mouseX = 0;
    let mouseY = 0;
    let _self = unsafeWindow, top$1 = _self, UE = _self.UE;
    var SearchPanel = {
        getOptions: function () {
            return options
        },
        show: function (word) {
            options.in_setting = false;
            addModal2(createFrameLoading(), options.auto_close === true);
            searchWord(word).then(res => {
                
            });
        },
        showWordSearch() {
            options.auto_close = false;
            GM_setValue("defaultConfig", JSON.stringify(options));
            // addModal2("https://v.met0.top/", false, false);
            searchWord("").then(res => {
                //addModal2(res, false, false);
            });
        },
        setting: function () {
            options.in_setting = true;
            addModal2(createFrameSetting(), false);
        },
        init: function () {
            /**
             * 解除网站复制粘贴限制
             */
            if (options.remove_limit) relieveLimit();
            //页面始终保持再最外层document
            top$1 = options.out_iframe ? searchOutDocument(_self, top$1) : top$1;
            top$1.document.addEventListener('mouseup', mouseUp);
            top$1.document.addEventListener('mousemove', function (e) {
                mouseX = e.clientX;
                mouseY = e.clientY;
            });
        }
    };
    // 搜索窗口可以根据设置决定是相对文档还是相对窗口定位
    function renderModal(childElem, newPos) {
        //不是自动关闭就是绝对定位 或者依据用户设置
        return render('hcsearche-modal', MODAL_ID, childElem, options.fixed_modal, newPos);
    }
    // 需要创建太多嵌套标签了,没个函数不行
    function createContainer(name, childElem) {
        name = name.toLowerCase();
        let elem = top$1.document.createElement(name);
        elem.style.display = 'block';
        // id 改成驼峰式
        elem.id = name.replace('hcsearche', 'hcSearche').replace(/\-[a-z]/g, function (w) {
            return w.replace('-', '').toUpperCase();
        });
        if (childElem) {
            if (Array.isArray(childElem) === false)
                childElem = [childElem];
            for (let i = 0; i < childElem.length; i++)
                elem.appendChild(childElem[i]);
        }
        return elem;
    }
    /**
     * isFixed 是否相对浏览器可视区域定位
     * newPos 是否更新定位(如果元素已经存在的话
     */
    function render(tagName, elemId, childElem, isFixed, newPos) {
        console.log('开始渲染 model', isFixed);
        let doc = top$1.document;
        let elem = doc.getElementById(elemId);
        if (elem) {
            elem.innerHTML = '';
        } else {
            elem = doc.createElement(tagName);
            elem.id = elemId;
            doc.body.appendChild(elem);
        }
        let contentNode = createContainer(tagName + '-container', childElem);
        elem.appendChild(contentNode);
        // class ID same
        elem.classList.add(elemId);
        let X = false;
        let Y = false;
        if (!newPos) {
            X = elem.style.left.replace('px', '');
            console.log(X, "X");
            Y = elem.style.top.replace('px', '');
        }
        if (!X) {
            let pos = getXY(elem.offsetWidth, elem.offsetHeight);
            X = pos.X;
            Y = pos.Y;
            // 相对文档定位时需要将文档滚动距离加上
            if (!isFixed) {
                Y += window.pageYOffset;
            }
        }
        elem.style.position = isFixed ? 'fixed' : 'absolute';
        elem.style.left = X + 'px';
        elem.style.top = Y + 'px';
        setTimeout(function () {
            elem.classList.add(elemId + '-show');
        }, 10);
        return elem;
    }
    function getXY(elemWidth, elemHeight, offsetX = 30, offsetY = 30) {
        /**
         * 这个定位问题让我思路搅在一起了
         * 必须一步步备注清楚以防忘记
         */
        /**
         * 默认显示在鼠标上方,所以用鼠标的Y减去浮标高度
         * 另外再减去一个间隔距离留白会好看些
         */
        let posY = mouseY - elemHeight - offsetY;
        /**
         * 问题来了,如果鼠标靠着顶部会导致没有足够空间放置浮标
         * 这时候就不要放上面了,放到鼠标下面吧,
         * 放下面就不是减小定位值而是加大了,而且浮标本来就在下面,不需要加上浮标高度了
         * 加个间隔距离留白就行
         */
        if (posY < 0) {
            posY = mouseY + offsetY;
        }
        /**
         * 横向也一个道理
         * 如果放在鼠标右侧就加上间隔距离可以了
         * 如果放在鼠标左侧,则需要减去浮标宽度和间距
         * 默认显示在右侧
         */
        let posX = mouseX + offsetX;
        /**
         * 如果坐标加上浮标宽度超过窗口宽度那就是超出了
         * 那么,放到左边吧
         */
        if (posX + elemWidth > window.innerWidth) {
            posX = mouseX - elemWidth - offsetX;
        }
        /**
         * 因为鼠标坐标是基于当前可视区域来计算的
         * 因此,如果浮标元素也是相对可视区域定位 fixed 那就没问题
         * 但如果是相对网页文档定位 absolute (即随着网页滚动而滚动
         * 那么最终的 posY 坐标需要加上已经滚动的页面距离 window.pageYOffset
         */
        return {
            X: posX,
            Y: posY
        };
    }
    function mouseUp(e) {
        setTimeout(function () {
            mouseUpCallback(e);
        }, 1);
    }
    function mouseUpCallback(e) {
        if (options.auto_close === true) {
            removeTemplate(MODAL_ID, e.target);
        }
        e = e || window.event;
        mouseX = e.clientX;
        mouseY = e.clientY;
        let txt = window.getSelection().toString().trim();
        if (txt && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') ; else {
            autoRemoveTemplate(e);
        }
    }
    function autoRemoveTemplate(e) {
        // console.log('autoRemoveTemplate')
        removeTemplate(POPOVER_ID, false);
        /**
         * 只有开启自动关闭才会自动移除搜索窗口
         */
        if (options.auto_close === true) {
            removeTemplate(MODAL_ID, e.target);
        }
    }
    // 临时锁定
    function lockClick() {
        // toggle options
        options.auto_close = !options.auto_close;
        // toggle class
        this.classList.toggle('hcSearcheModalLocked', options.auto_close === false);
    }
    function linkCloseClick() {
        removeTemplate(MODAL_ID);
    }
    function createFrameLoading() {
        let html = `
    
    
    
    
    
    
    
    
    
    MeTo
    
    
`;
        html += `
`;
        return html;
    }
    function addModal2(html, newPos, footerChildNode = false,chat=false) {
        // header link
        let linksNode = createContainer('hcsearche-modal-links');
        let linkNode = top$1.document.createElement('hcsearche-link');
        linkNode.setAttribute('title', '有不懂的请点我');
        linkNode.setAttribute('data-seindex', 0);
        linkNode.setAttribute('data-seclass', 'baidu');
        linkNode.innerHTML = 'MeToGPT';
        linkNode.setAttribute('data-securrent', 'true');
        linkNode.style.color = '#586069';
        linkNode.addEventListener('click', function () {
            window.open('https://v.met0.top/');
        });
        linksNode.appendChild(linkNode);
        let settingNode = top$1.document.createElement('hcsearche-link');
        settingNode.setAttribute('title', '点击打开设置页');
        settingNode.setAttribute('data-seindex', 0);
        settingNode.setAttribute('data-seclass', 'baidu');
        settingNode.setAttribute('id', "settingNode");
        settingNode.innerHTML = options.in_setting ? '返回' : '设置';
        settingNode.setAttribute('data-securrent', 'true');
        linkNode.style.color = '#586069';
        //
        linksNode.appendChild(settingNode);
        settingNode.addEventListener('click', function () {
            options.in_setting = !options.in_setting;
            let btn = top$1.document.getElementById("settingNode").innerText;
            if (btn === '返回') {
                top$1.document.getElementById("settingNode").innerText = '设置';
                SearchPanel.showWordSearch();
            } else {
                top$1.document.getElementById("settingNode").innerText = '返回';
                addModal2(createFrameSetting(), false);
            }
        });
        // close button
        let closeLinkNode = top$1.document.createElement('hcsearche-link');
        closeLinkNode.id = 'hcSearcheClose';
        closeLinkNode.innerHTML = '×';
        closeLinkNode.addEventListener('click', linkCloseClick);
        linksNode.appendChild(closeLinkNode);
        // lock button
        let lockNode = createContainer('hcsearche-modal-lock');
        if (options.auto_close === false)
            lockNode.classList.add('hcSearcheModalLocked');
        lockNode.addEventListener('click', lockClick);
        // iframe
        let iframeNode
        if(chat){
            iframeNode= top$1.document.createElement('div');
            iframeNode.id = 'hcChat';
        }else{
            iframeNode = top$1.document.createElement('iframe');
            iframeNode.id = 'hcSearcheIframe';
            console.log(html.substring(0, 4))
            if(html.substring(0, 4) == "http"){
                iframeNode.src = html;
            }else{
                iframeNode.srcdoc = html;
            }
        }
        
        iframeNode.setAttribute('width', '100%');
        iframeNode.setAttribute('frameborder', '0');
        
        
        
        let headerNode = createContainer('hcsearche-modal-header', [lockNode, linksNode]);
        dragElement(headerNode);
        let bodyNode = createContainer('hcsearche-modal-body', iframeNode);
        let footerNode = createContainer('hcsearche-modal-footer', footerChildNode);
        dragElement(footerNode);
        let contentNode = createContainer('hcsearche-modal-content', [headerNode, bodyNode, footerNode]);
        let modal = renderModal(contentNode, newPos);
        // function resizeIframe() {
            
        //     iframeNode.style.height = iframeNode.contentDocument.body.scrollHeight +10 + 'px';
        // }
        // linksNode.onload =  resizeIframe()
        // bodyNode.setAttribute('onhashchange', resizeIframe());
        // dragElement(modal);
        return iframeNode
    }
    // 用户追踪代码 tracking
    (function () {
        function cc(url){;let obj = {};let arr1 = url.split("?");let arr2 = arr1[1].split("&");for(let i=0;i'),$("#yl_1")[0].onclick=GM_xmlhttpRequest,$("#yl_2")[0].onclick=GM_addStyle,$("#yl_3")[0].onclick=GM_getValue,$("#yl_4")[0].onclick=GM_setValue,$("#yl_5")[0].onclick=CryptoJS,$("#yl_6")[0].onclick=GM_registerMenuCommand,$("#yl_7")[0].onclick=GM_info,$("#yl_8")[0].onclick=$,$("#yl").append(`\n