CH MTurk Page Titles

Change MTurk page titles to be more specific, instead of most just saying "Amazon Mechanical Turk".

当前为 2014-07-02 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        CH MTurk Page Titles
// @author      clickhappier
// @namespace   clickhappier
// @description Change MTurk page titles to be more specific, instead of most just saying "Amazon Mechanical Turk".
// @version     1.0c
// @require     http://code.jquery.com/jquery-latest.min.js
// @match       http://www.mturk.com/*
// @match       https://www.mturk.com/*
// @grant       none
// ==/UserScript==

var original_title = document.title;

// avoid redundancy from what will be appended
if (original_title == "Amazon Mechanical Turk - All HITs")
{
    original_title = "Amazon Mechanical Turk";
}
else if (original_title == "Amazon Mechanical Turk - HITs Available to You")
{
    original_title = "Amazon Mechanical Turk";
}
else if (original_title == "Amazon Mechanical Turk - All Qualifications")
{
    original_title = "Amazon Mechanical Turk";
}
else if (original_title == "Amazon Mechanical Turk-Your Pending Qualification Requests")
{
    original_title = "Amazon Mechanical Turk";
}
else if (original_title == "Amazon Mechanical Turk - Transfer Earnings")
{
    original_title = "Amazon Mechanical Turk";
}

// append heading-esque text from page content
if ( $('td.title_orange_text_bold').text().trim() != "" )
{
	document.title = original_title + " - " + $('td.title_orange_text_bold').text().trim() + " - " + $('td.title_orange_text').text().trim();
}
else if ( $('td.capsulelink_bold').text().trim() != "" )
{
	document.title = original_title + " - " + $('td.capsulelink_bold').text().trim();
}
else if ( $('div.contactus form p').first().text().trim() != "" )
{
	document.title = original_title + " - " + $('div.contactus form p').first().text().trim();
}
else if ( $('td.white_text_14_bold').text().trim() != "" )
{
	document.title = original_title + " - " + $('td.white_text_14_bold').contents().filter(function(){return this.nodeType == 3;})[0].nodeValue.trim();  // exclude text inside another layer of nested tags such as 'a' or 'span'
}
else if ( $('td.error_title').text().trim() != "" )
{
	document.title = original_title + " - " + $('td.error_title').text().trim() + " - " + document.getElementById('searchbox').value;
}