MY ZCST UNLOCK

解锁我的珠科APP独占功能

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         MY ZCST UNLOCK
// @version      0.1
// @description  解锁我的珠科APP独占功能
// @author       WeiYuanStudio
// @match        *://my.zcst.edu.cn/_web/sopplus/things.jsp*
// @grant        GM_xmlhttpRequest
// @namespace https://greasyfork.org/users/432318
// ==/UserScript==

(function() {
    'use strict';

    function createThingElement(name, url) {
        let thingElement = $(`<div class="col-md-3"><div class="box box-solid"><div class="box-body"><div class="app-info"><h3 class="app-name"><a title="${name}" href="${url}">${name}</a></h3></div></div></div></div></div>`)
        return thingElement
    }

    GM_xmlhttpRequest({
        method: "POST",
        url: "https://my.zcst.edu.cn/mobile/queryIndexApps.mo",
        onload: function(response) {
            console.log(response.response)
            let responseObject = JSON.parse(response.response)
            console.log(responseObject)
            let thingList = []
            if (responseObject.data.ranks) {
                responseObject.data.ranks.forEach(item => {
                    thingList.push({
                        title: item.title,
                        url: item.mainUrl
                    })
                })
                console.log(thingList)
                Array.from($("div.app-info a")).forEach(item => {
                    thingList = thingList.filter(checkItem => checkItem.title !== item.title)
                })
                console.log(thingList) //独占功能列表

                $("#serviceApps:last").append('<div class="box-header with-border things-list-header"><h3>手机独占功能</h3></div>')

                $("#serviceApps:last").append('<div class="things-list-main clearfix app-only"></div>')

                thingList.forEach(item => {
                    $(".app-only").append(createThingElement(item.title, item.url))
                })
            }
        }
    });

    // Your code here...
})();