使用四川大学教务系统导航栏

使用川大教务系统顶部导航栏

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         使用四川大学教务系统导航栏
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  使用川大教务系统顶部导航栏
// @author       Xiongqi
// @match        http://202.115.47.141/loginAction.do
// @match        http://zhjw.scu.edu.cn/loginAction.do
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  window.onload = function() {
    if (
      window.location.href === 'http://202.115.47.141/loginAction.do' ||
      window.location.href === 'http://zhjw.scu.edu.cn/loginAction.do'
    ) {
      window.frames['topFrame'].changeLeftMenu = function() {
        if (
          parent.frames['bottomFrame'] &&
          parent.frames['bottomFrame'].frames['menuFrame'] &&
          parent.frames['bottomFrame'].frames['menuFrame'].menus
        ) {
          parent.frames['bottomFrame'].frames['menuFrame'].menus.index = window.frames['topFrame'].moduleNum;
          parent.frames['bottomFrame'].frames['menuFrame'].menus.show();
          parent.frames['bottomFrame'].frames['menuFrame'].menus.click();
        }
      };
      // 插入链接
      const nameTr = window.frames['topFrame'].document
        .getElementsByClassName('leftuser01')[0]
        .getElementsByTagName('tr')[0];
      const urlTd = document.createElement('td');
      urlTd.innerHTML =
        '<a href="http://draven-system.xhuyq.me/draven" target="_blank" style="color: red" title="一个小系统">第三方教务系统</a>';
      nameTr.insertBefore(urlTd, nameTr.children[0]);
      console.log('成功');
    }
  };
})();