OkC Hidden Quickmatch Info

Show hidden info on Quickmatch page

当前为 2015-05-01 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         OkC Hidden Quickmatch Info
// @namespace    http://thlayli.detrave.net
// @version      1.2
// @description  Show hidden info on Quickmatch page
// @author       Nathan Blume
// @match        http://www.okcupid.com/quickmatch*
// @grant        none
// ==/UserScript==

// show nonsensical attractiveness number
var showAttractiveness = false;

var secret_orientation;
var secret_status;

function updateMoreInfo(){
    
            if(!$("enemy")){
                $("match").firstElementChild.innerHTML += '&nbsp;<span style="color: #949aa6; display: inline;" id="enemy"></span>';
            }
    
    		if(!$("more_info")){
				$("left").innerHTML =  "<div id=\"more_info\"></div>" + $("left").innerHTML;
			}
    
    		switch(Quickmatch.stack[0].orientation) {
                case 1:
                    secret_orientation = "Straight";
                    break;
                case 2:
                    secret_orientation = "Gay";
                    break;
                case 3:
                    secret_orientation = "Bisexual";
                    break;
                default:
                    secret_orientation = Quickmatch.stack[0].orientation;
    		}

			switch(Quickmatch.stack[0].status) {
                case 1:
                    secret_status = "Single";
                    break;
                case 2:
                    secret_status = "Seeing Someone";
                    break;
                case 3:
                    secret_status = "Married";
                    break;
                case 4:
                    secret_status = "Available";
                    break;
                case 5:
                    secret_status = "Open Relationship";
                    break;
                case 8:
                    secret_status = "Mostly Nonmonogamous";
                    break;
                default:
                    secret_status = Quickmatch.stack[0].status;
    		}

            $("enemy").innerHTML =  '| <strong class="percent">' + Quickmatch.stack[0].epercentage + '</strong>% Enemy';

    		$("more_info").innerHTML = "<h2>More Info</h2>" +
            "Screen Name: <a href=\"http://www.okcupid.com/profile/" + Quickmatch.stack[0].sn + "?cf=quickmatch\">" + Quickmatch.stack[0].sn +
            "</a><br />Orientation: " + secret_orientation +
            "<br />Status: " + secret_status;
            
    		if(Quickmatch.stack[0].attractiveness && showAttractiveness === true)
               $("more_info").innerHTML += "<br />Attractiveness: " + Quickmatch.stack[0].attractiveness;
    
    		$("more_info").innerHTML += "<br /><br />";
}

var startTracing = function (onnew) {
    window.ajaxRequestComplete = 'no';//Make as a global javascript variable
    window.ajaxRequestStarted = 'no';

    XMLHttpRequest.prototype.uniqueID = function() {
        if (!this.uniqueIDMemo) {
            this.uniqueIDMemo = Math.floor(Math.random() * 1000);
        }
        return this.uniqueIDMemo;
    };

    XMLHttpRequest.prototype.oldOpen = XMLHttpRequest.prototype.open;

    var newOpen = function(method, url, async, user, password) {

        ajaxRequestStarted = 'open';
        /*alert(ajaxRequestStarted);*/
        this.oldOpen(method, url, async, user, password);
    };

    XMLHttpRequest.prototype.open = newOpen;

    XMLHttpRequest.prototype.oldSend = XMLHttpRequest.prototype.send;

    var newSend = function(a) {
        var xhr = this;

        var onload = function() {
            ajaxRequestComplete = 'loaded';
            //print info to page
            updateMoreInfo();
        };

        var onerror = function( ) {
            ajaxRequestComplete = 'Err';
            /*alert(ajaxRequestComplete);*/
        };

        xhr.addEventListener("load", onload, false);
        xhr.addEventListener("error", onerror, false);

        xhr.oldSend(a);
    };

    XMLHttpRequest.prototype.send = newSend;
};
startTracing();
updateMoreInfo();