Greasy Fork

icve-helper

icve-funs

目前为 2020-03-31 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.cloud/scripts/399050/786279/icve-helper.js

// ==UserScript==
// @name         	icve-helper
// @namespace    	[email protected]
// @version      	1.0.0
// @description  	icve-funs
// @author       	AI_童话
// ==/UserScript==


/** 向控制台输出 hello world!
 * @method hello
 */
function hello() {
    console.log("hello world");
}


/** 获取网站的jQuery, 并添加自己的函数
 * @method getjQuery
 * @param window unsafewindow
 * @returns $
 */
function getjQuery(window) {

    /** 等待元素出现
     *  @method wait
     *  @param func 找到元素后执行
     *  @param times 检测次数 -1 一直检测
     *  @param interval 检测间隔 默认20s
     *  @return Promise 可等待对象
     */
    window.jQuery.fn.wait = function (func, times, interval) {
        var _times = times || -1, // 100次
            _interval = interval || 20, // 20毫秒每次
            _self = this,
            _selector = this.selector, // 选择器
            _iIntervalID; // 定时器id
        if (this.length) { // 如果已经获取到了,就直接执行函数
            func && func.call(this);
        } else {
            return new Promise((reslove, reject)=>{
                _iIntervalID = setInterval(function (reslove) {
                    if (!_times) { // 是0就退出
                        clearInterval(_iIntervalID);
                    }
                    _times <= 0 || _times--; // 如果是正数就 --
    
                    _self = $(_selector); // 再次选择
                    if (_self.length) { // 判断是否取到
                        func && func.call(_self);
                        clearInterval(_iIntervalID);
                        reslove(_self);
                    }
                }, _interval);
            });
        }
    }


    return window.jQuery;
}


/* 
* 职教云作业解封文本限制 @tuChanged
*/
function uncageCopyLimit() {
    let arr = ["oncontextmenu", "ondragstart", "onselectstart", "onselect", "oncopy", "onbeforecopy"]
    for (let i of arr)
        $(".hasNoLeft").attr(i, "return true")
    console.log("已成功复制解除限制,📣如果您有软件定制(管理系统,APP,小程序等),毕设困扰,又或者课程设计困扰等欢迎联系,价格从优,源码调试成功再付款💰,实力保证,包远程,包讲解 QQ:2622321887")
}