Greasy Fork

Greasy Fork is available in English.

超星 - 在 iframe 中原地打开收件箱通知

不再需要跳转整个页面,或者打开新窗口。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        超星 - 在 iframe 中原地打开收件箱通知
// @description 不再需要跳转整个页面,或者打开新窗口。
// @namespace   UnKnown
// @author      UnKnown
// @icon        https://imgsrc.baidu.com/forum/pic/item/6a63f6246b600c33c3d714d61c4c510fd9f9a106.jpg
// @version     1.0
// @match       http://notice.chaoxing.com/pc/notice/*
// @match       https://notice.chaoxing.com/pc/notice/*
// @grant       unsafeWindow
// @inject-into page
// ==/UserScript==

if ( location.pathname === "/pc/notice/myNotice" ) {

	// Notice.openDetail(this, `/pc/notice/${ noticeID }/detail`);
	unsafeWindow.Notice.openDetail = function(obj, url) {
		url && location.assign(url);
	};

} else if ( location.pathname.endsWith("/detail") ) {

	const style = document.createElement("style");
	style.textContent =
`.subPageMain,
.editContainer.noticeDetail_editContainer {
	width: auto;
}
.subPageMain {
	padding: 0 16px;
}
button.back {
	position: fixed;
	z-index: 11;
	top: 4px;
	right: 4px;
	width: 90px;
	height: 32px;
	color: white;
	background-color: transparent;
	border: 1px solid white;
}
button.back:hover,
button.back:focus {
	cursor: pointer;
	background-color: rgba(255, 255, 255, .2);
}
button.back:active {
	background-color: rgba(255, 255, 255, .4);
}`;
	document.head.appendChild(style);

	const button = document.createElement("button");

	button.className = "back";
	button.textContent = "返回";
	button.addEventListener(
		"click", function () { history.back(); }
	);

	document.body.insertBefore( button, document.body.firstChild );
	
};