Mturk Title Fixer

Change the titles on Mturk pages to be more descriptive

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Mturk Title Fixer
// @namespace   DonovanM
// @author	DonovanM (dnast)
// @description Change the titles on Mturk pages to be more descriptive
// @include     https://www.mturk.com/mturk/*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
// @version     0.9.5
// @grant       none
// @copyright	2013+
// ==/UserScript==

/** This simple script makes the page titles more useful. Most pages on Mechanical Turk simply have
    "Amazon Mechanical Turk" for the title and if you have multiple tabs open, it can be hard
    to determine which is which at a glance. This script puts an appropriate title for nearly
    every page on AMT.
**/
var title = $("title").text().trim();
var existingTitle = title.replace(/Amazon Mechanical Turk( - )?/, "");
var newText = "";

if (existingTitle != "") {
	existingTitle += " - AMT";
} else {
	existingTitle = " - AMT";

	if ($(".capsulelink_bold > div:nth-child(1)").length > 0) {
		newText = $(".capsulelink_bold > div:nth-child(1)").text().trim();
	} else if ($(".title_orange_text_bold").length > 0) {
		newText = $(".title_orange_text_bold").text().trim();
	} else if ($(".error_title").length > 0) {
		newText = $(".error_title").text().trim();
	} else {
		existingTitle = "AMT";
	}
}

$("title").text(newText + existingTitle);