UFindTitleFixer

Displays name of lecture/whatever in the title

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        UFindTitleFixer
// @namespace   uftf
// @description Displays name of lecture/whatever in the title
// @include     https://ufind.univie.ac.at/*/course.html*
// @include     https://ufind.univie.ac.at/*/person.html*
// @include     https://ufind.univie.ac.at/*/pvz_sub.html*  
// @include     https://ufind.univie.ac.at/*/vvz_sub.html*  
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require     https://greasyfork.org/scripts/6250-waitforkeyelements/code/waitForKeyElements.js?version=23756
// @author      oerpli
// @version     1.1
// @grant       none
// ==/UserScript==

waitForKeyElements(".when", setTitleSubject);
waitForKeyElements(".name.full", function(){setTitle(".name.full");});
waitForKeyElements(".usse-id-pvz h1.name span.label", function(){setTitle(".usse-id-pvz h1.name span.label");});
waitForKeyElements(".usse-id-vvz h1",function(){setTitle(".usse-id-vvz h1");});

function setTitleSubject() {
    var year = $(".when").eq(0).html();
    var name = $(".what").eq(0).html();
    var type = $(".type").eq(0).html();
    $(document).prop("title", type + " " + name + " (" + year + ")");
}

function setTitle(sel) {
    var name = $(sel).eq(0).html();
    $(document).prop("title",name);
}