Last active
July 12, 2024 01:03
-
-
Save luoboQAQ/eaa42d5464f558d7214ef9350208b370 to your computer and use it in GitHub Desktop.
扬大门户校园网显示优化
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 扬大门户校园网显示优化 | |
// @namespace https://github.com/luoboQAQ | |
// @version 0.2.1 | |
// @description 将分钟转换为小时 | |
// @author luoboQAQ | |
// @match https://i.yzu.edu.cn/Student | |
// @icon https://i.yzu.edu.cn/favicon.ico | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
$(document).ajaxComplete(function(event, xhr, settings) { | |
if ( settings.url === "/Student/Home/GetEvents" ) { | |
const time = $('#freeRemain') | |
const title = $('#freeRemain').prev() | |
const father = $('#freeRemain').parent() | |
const minute = Number($('#freeRemain').text()) | |
const hours = minute/60.0 | |
father.mouseenter(function() { | |
title.text("免费时长(分钟)") | |
time.text(minute) | |
}); | |
father.mouseleave(function() { | |
title.text("免费时长(小时)") | |
time.text(hours.toFixed(1)) | |
}); | |
title.text("免费时长(小时)") | |
time.text(hours.toFixed(1)) | |
const preAccountFee = $('#preAccountFee') | |
preAccountFee.prev().text("剩余日均(小时)") | |
const remainDay = $('#remainDays').text() | |
let remainTime = hours/Number(remainDay) | |
if(remainTime <= 1) { | |
remainTime *= 60 | |
preAccountFee.prev().text("剩余日均(分钟)") | |
} | |
preAccountFee.text(remainTime.toFixed(1)) | |
$(document).off('ajaxComplete'); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment