OkC Hidden Quickmatch Info

Show hidden info on Quickmatch page

当前为 2015-11-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name OkC Hidden Quickmatch Info
  3. // @namespace http://thlayli.detrave.net
  4. // @version 1.3
  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. // automatically skip certain profiles - set to "true" to use autoSkip options below
  15. var autoSkipEnabled = false;
  16.  
  17. // auto skip settings
  18. var autoSkipMatch = 50; // skip if less than this match percentage
  19. var autoSkipEnemy = 50; // skip if more than this enemy percentage
  20.  
  21. // autoSkipCases skips profiles based on [orientation-gender-status] (see info below)
  22. var autoSkipCases = [];
  23.  
  24. // autoSkip instrctions: Enter sets of three numbers inside the brackets.
  25. // Numbers should be separated by hyphens and surrounded by quotes.
  26. // Multiple sets can be entered separated by commas.
  27. //
  28. // Number key:
  29. // orientation: 0 = ignore, 1 = straight, 2 = gay, 3 = bi
  30. // gender: 0 = ignore, 1 = male, 2 = female
  31. // status: 0 = ignore, 1 = single, 2 = seeing-someone, 3 = married, 4 = available, 5 = open-relationship, 8 = mostly-nonmonogamous
  32. //
  33. // e.g. ["1-3-0"] skips bi males
  34. // e.g. ["1-2-0","1-2-3"] skips gay males and married straight females
  35.  
  36. var secret_orientation;
  37. var secret_gender;
  38. var secret_status;
  39.  
  40. function updateMoreInfo(){
  41. if(!$("enemy")){
  42. $("match").firstElementChild.innerHTML += '&nbsp;<span style="color: #949aa6; display: inline;" id="enemy"></span>';
  43. }
  44. if(!$("more_info")){
  45. $("left").innerHTML = "<div id=\"more_info\"></div>" + $("left").innerHTML;
  46. }
  47. switch(Quickmatch.stack[0].orientation) {
  48. case 1:
  49. secret_orientation = "Straight";
  50. break;
  51. case 2:
  52. secret_orientation = "Gay";
  53. break;
  54. case 3:
  55. secret_orientation = "Bisexual";
  56. break;
  57. default:
  58. secret_orientation = Quickmatch.stack[0].orientation;
  59. }
  60. switch(Quickmatch.stack[0].tracking_gender) {
  61. case 1:
  62. secret_gender = "Male";
  63. break;
  64. case 2:
  65. secret_gender = "Female";
  66. break;
  67. default:
  68. secret_gender = Quickmatch.stack[0].tracking_gender;
  69. }
  70.  
  71. switch(Quickmatch.stack[0].status) {
  72. case 1:
  73. secret_status = "Single";
  74. break;
  75. case 2:
  76. secret_status = "Seeing Someone";
  77. break;
  78. case 3:
  79. secret_status = "Married";
  80. break;
  81. case 4:
  82. secret_status = "Available";
  83. break;
  84. case 5:
  85. secret_status = "Open Relationship";
  86. break;
  87. case 8:
  88. secret_status = "Mostly Nonmonogamous";
  89. break;
  90. default:
  91. secret_status = Quickmatch.stack[0].status;
  92. }
  93.  
  94. $("enemy").innerHTML = '| <strong class="percent">' + Quickmatch.stack[0].epercentage + '</strong>% Enemy';
  95.  
  96. $("more_info").innerHTML = "<h2>More Info</h2>" +
  97. "Screen Name: <a href=\"http://www.okcupid.com/profile/" + Quickmatch.stack[0].sn + "?cf=quickmatch\">" + Quickmatch.stack[0].sn +
  98. "</a><br />Gender: " + secret_gender +
  99. "<br />Orientation: " + secret_orientation +
  100. "<br />Status: " + secret_status;
  101. if(Quickmatch.stack[0].attractiveness && showAttractiveness === true)
  102. $("more_info").innerHTML += "<br />Attractiveness: " + Quickmatch.stack[0].attractiveness;
  103. $("more_info").innerHTML += "<br /><br />";
  104. }
  105.  
  106. function autoSkip(){
  107. if(autoSkipEnabled == true){
  108. if(Quickmatch.stack[0].epercentage >= autoSkipEnemy){
  109. document.getElementById("quickmatch-dislike").click();
  110. }
  111. if(Quickmatch.stack[0].fpercentage < autoSkipMatch){
  112. document.getElementById("quickmatch-dislike").click();
  113. }
  114. if(autoSkipCases.length > 0){
  115. for(i=0;i<autoSkipCases.length;i++){
  116. skipCase = autoSkipCases[i].split("-");
  117. console.debug(skipCase);
  118. orientationSkip = skipCase[0];
  119. genderSkip = skipCase[1];
  120. statusSkip = skipCase[2];
  121. orientationSkipMatch = false;
  122. genderSkipMatch = false;
  123. statusSkipMatch = false;
  124. if(orientationSkip == 0 || Quickmatch.stack[0].orientation == orientationSkip)
  125. orientationSkipMatch = true;
  126. if(genderSkip == 0 || Quickmatch.stack[0].tracking_gender == genderSkip)
  127. genderSkipMatch = true;
  128. if(statusSkip == 0 || Quickmatch.stack[0].status == statusSkip)
  129. statusSkipMatch = true;
  130. if(orientationSkipMatch == true && genderSkipMatch == true && statusSkipMatch == true){
  131. console.debug('skipping ' + Quickmatch.stack[0].sn);
  132. document.getElementById("quickmatch-dislike").click();
  133. }
  134. }
  135. }
  136. }
  137. }
  138.  
  139. var startTracing = function (onnew) {
  140. window.ajaxRequestComplete = 'no';//Make as a global javascript variable
  141. window.ajaxRequestStarted = 'no';
  142.  
  143. XMLHttpRequest.prototype.uniqueID = function() {
  144. if (!this.uniqueIDMemo) {
  145. this.uniqueIDMemo = Math.floor(Math.random() * 1000);
  146. }
  147. return this.uniqueIDMemo;
  148. };
  149.  
  150. XMLHttpRequest.prototype.oldOpen = XMLHttpRequest.prototype.open;
  151.  
  152. var newOpen = function(method, url, async, user, password) {
  153.  
  154. ajaxRequestStarted = 'open';
  155. /*alert(ajaxRequestStarted);*/
  156. this.oldOpen(method, url, async, user, password);
  157. };
  158.  
  159. XMLHttpRequest.prototype.open = newOpen;
  160.  
  161. XMLHttpRequest.prototype.oldSend = XMLHttpRequest.prototype.send;
  162.  
  163. var newSend = function(a) {
  164. var xhr = this;
  165.  
  166. var onload = function() {
  167. ajaxRequestComplete = 'loaded';
  168. //print info to page
  169. updateMoreInfo();
  170. autoSkip();
  171. };
  172.  
  173. var onerror = function( ) {
  174. ajaxRequestComplete = 'Err';
  175. /*alert(ajaxRequestComplete);*/
  176. };
  177.  
  178. xhr.addEventListener("load", onload, false);
  179. xhr.addEventListener("error", onerror, false);
  180.  
  181. xhr.oldSend(a);
  182. };
  183.  
  184. XMLHttpRequest.prototype.send = newSend;
  185. };
  186. startTracing();
  187. updateMoreInfo();
  188. autoSkip();