OkC Hidden Quickmatch Info

Show hidden info on Quickmatch page

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

  1. // ==UserScript==
  2. // @name OkC Hidden Quickmatch Info
  3. // @namespace http://thlayli.detrave.net
  4. // @version 1.2
  5. // @description Show hidden info on Quickmatch page
  6. // @author Nathan Blume
  7. // @match http://www.okcupid.com/quickmatch*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. // show nonsensical attractiveness number
  12. var showAttractiveness = false;
  13.  
  14. var secret_orientation;
  15. var secret_status;
  16.  
  17. function updateMoreInfo(){
  18. if(!$("enemy")){
  19. $("match").firstElementChild.innerHTML += '&nbsp;<span style="color: #949aa6; display: inline;" id="enemy"></span>';
  20. }
  21. if(!$("more_info")){
  22. $("left").innerHTML = "<div id=\"more_info\"></div>" + $("left").innerHTML;
  23. }
  24. switch(Quickmatch.stack[0].orientation) {
  25. case 1:
  26. secret_orientation = "Straight";
  27. break;
  28. case 2:
  29. secret_orientation = "Gay";
  30. break;
  31. case 3:
  32. secret_orientation = "Bisexual";
  33. break;
  34. default:
  35. secret_orientation = Quickmatch.stack[0].orientation;
  36. }
  37.  
  38. switch(Quickmatch.stack[0].status) {
  39. case 1:
  40. secret_status = "Single";
  41. break;
  42. case 2:
  43. secret_status = "Seeing Someone";
  44. break;
  45. case 3:
  46. secret_status = "Married";
  47. break;
  48. case 4:
  49. secret_status = "Available";
  50. break;
  51. case 5:
  52. secret_status = "Open Relationship";
  53. break;
  54. case 8:
  55. secret_status = "Mostly Nonmonogamous";
  56. break;
  57. default:
  58. secret_status = Quickmatch.stack[0].status;
  59. }
  60.  
  61. $("enemy").innerHTML = '| <strong class="percent">' + Quickmatch.stack[0].epercentage + '</strong>% Enemy';
  62.  
  63. $("more_info").innerHTML = "<h2>More Info</h2>" +
  64. "Screen Name: <a href=\"http://www.okcupid.com/profile/" + Quickmatch.stack[0].sn + "?cf=quickmatch\">" + Quickmatch.stack[0].sn +
  65. "</a><br />Orientation: " + secret_orientation +
  66. "<br />Status: " + secret_status;
  67. if(Quickmatch.stack[0].attractiveness && showAttractiveness === true)
  68. $("more_info").innerHTML += "<br />Attractiveness: " + Quickmatch.stack[0].attractiveness;
  69. $("more_info").innerHTML += "<br /><br />";
  70. }
  71.  
  72. var startTracing = function (onnew) {
  73. window.ajaxRequestComplete = 'no';//Make as a global javascript variable
  74. window.ajaxRequestStarted = 'no';
  75.  
  76. XMLHttpRequest.prototype.uniqueID = function() {
  77. if (!this.uniqueIDMemo) {
  78. this.uniqueIDMemo = Math.floor(Math.random() * 1000);
  79. }
  80. return this.uniqueIDMemo;
  81. };
  82.  
  83. XMLHttpRequest.prototype.oldOpen = XMLHttpRequest.prototype.open;
  84.  
  85. var newOpen = function(method, url, async, user, password) {
  86.  
  87. ajaxRequestStarted = 'open';
  88. /*alert(ajaxRequestStarted);*/
  89. this.oldOpen(method, url, async, user, password);
  90. };
  91.  
  92. XMLHttpRequest.prototype.open = newOpen;
  93.  
  94. XMLHttpRequest.prototype.oldSend = XMLHttpRequest.prototype.send;
  95.  
  96. var newSend = function(a) {
  97. var xhr = this;
  98.  
  99. var onload = function() {
  100. ajaxRequestComplete = 'loaded';
  101. //print info to page
  102. updateMoreInfo();
  103. };
  104.  
  105. var onerror = function( ) {
  106. ajaxRequestComplete = 'Err';
  107. /*alert(ajaxRequestComplete);*/
  108. };
  109.  
  110. xhr.addEventListener("load", onload, false);
  111. xhr.addEventListener("error", onerror, false);
  112.  
  113. xhr.oldSend(a);
  114. };
  115.  
  116. XMLHttpRequest.prototype.send = newSend;
  117. };
  118. startTracing();
  119. updateMoreInfo();