FA Fixes Control Panel

Adds a control panel of fixes to the FurAffinity website, so you can enable/disable them at will.

当前为 2016-11-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name FA Fixes Control Panel
  3. // @namespace FurAffinity.net
  4. // @version 1.3.4
  5. // @description Adds a control panel of fixes to the FurAffinity website, so you can enable/disable them at will.
  6. // @author JaysonHusky
  7. // @match *://www.furaffinity.net/*
  8. // @exclude *://www.furaffinity.net/login/
  9. // @exclude *://www.furaffinity.net/logout/
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // @require http://code.jquery.com/jquery-latest.js
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. // Load Current Settings
  18. function FAFCP_LoadCP(i){
  19. var setting_returned = GM_getValue(i);
  20. if(setting_returned=="yes"){
  21. $('#'+i+'_yes').prop("checked", true);
  22. }
  23. else if(setting_returned=="no") {
  24. $('#'+i+'_no').prop("checked", true);
  25. }
  26. else {
  27. console.log('Setting: '+i+' Returned: '+setting_returned+' (Other Result)');
  28. }
  29. }
  30. function FAFCP_Load_Tweaks(i){
  31. var setting_returned = GM_getValue(i);
  32. if(setting_returned=="yes"){
  33. return "yes";
  34. }
  35. else if(setting_returned=="no") {
  36. return "no";
  37. }
  38. else {
  39. return "undefined";
  40. }
  41. }
  42. function FAFCP_SaveSettings(fafcp_nct,fafcp_sbg,fafcp_hs,fafcp_os,fafcp_sst,fafcp_fn,fafcp_tp,fafcp_nf){
  43. GM_setValue('fafcp_nct',fafcp_nct);GM_setValue('fafcp_sbg',fafcp_sbg);GM_setValue('fafcp_hs',fafcp_hs);GM_setValue('fafcp_os',fafcp_os);
  44. GM_setValue('fafcp_sst',fafcp_sst);GM_setValue('fafcp_fn',fafcp_fn);GM_setValue('fafcp_tp',fafcp_tp);GM_setValue('fafcp_nf',fafcp_nf);
  45. }
  46. function ExecuteTweak(tweak){
  47. switch(tweak) {
  48. case "NoCustomThumbnails":
  49. $("img[src*='t.facdn.net']").each(function(index){
  50. var thumburl=$(this).attr('src').replace("@150","@400");
  51. $(this).attr("src",thumburl);
  52. });
  53. break;
  54. case "SidebarBeGone":
  55. $("<style>#submission_page .submission-sidebar{position:fixed;top:50px;bottom:0px;right:-290px;z-index:1000000;background:rgba(1,0,0,0.6);transition: 0.5s all;height: 800px;}#submission_page .submission-sidebar:hover{position:absolute;top:50px;bottom:0px;right:0px;z-index:1000000;background:rgba(1,0,0,0.9);transition: 0.5s all;height:800px;}</style>").appendTo("head");
  56. break;
  57. case "HiddenStreams":
  58. $("<style>div#messagecenter-other ul.message-stream li.stream-notification{display:none;}</style>").appendTo("head");
  59. break;
  60. case "ObviousStreams":
  61. $("<style>div#messagecenter-other ul.message-stream li.stream-notification{background: rgba(255,255,255,0.5);color: black;border: 0.5px dashed black;}div#messagecenter-other ul.message-stream li.stream-notification a {color: black;}</style>").appendTo("head");
  62. break;
  63. case "SameSizeThumbnails":
  64. $("<style>.userpage-gallery-item img,.userpage-favorites-item img{height: 150px;width: 150px;}</style>").appendTo("head");
  65. break;
  66. case "FixedNavigation":
  67. $("<style>nav#ddmenu{position:fixed;background:black;}div#news{margin-top:50px;margin-bottom:-50px;}div.user-nav-info{margin-top:50px;}.bg1{margin-top:50px;}</style>").appendTo("head");
  68. break;
  69. case "TidyProfile":
  70. var ProfileSize = 480; // (Defines max amount of profile that should be shown, the rest is still DOM loaded but hidden by overflow)
  71. if ($('.userpage-profile-info').height() > ProfileSize) { // Check for height
  72. $('.userpage-profile-info').css('height',''+ProfileSize+'px'); // Set new height
  73. $('.userpage-profile-info').css('overflow-y','auto'); // Allow overflow of remaining content
  74. }
  75. break;
  76. case "NoteFix":
  77. $('<style>#JSMessage{background: #3c3c3c !important;}.textbox, .textarea{background: #3c3c3c !important;border-radius:5px;}</style>').appendTo("head");
  78. break;
  79. default:
  80. /* No Code */
  81. }
  82. }
  83. var pathx = window.location.pathname;
  84. if(~pathx.indexOf("/controls/user-settings/")){
  85. // Update
  86. $(document.body).on('click', '#fafcp_saveit', function() {
  87. var fafcp_set_nct = $("input[name='fafcp_nct']:checked").val();
  88. var fafcp_set_sbg = $("input[name='fafcp_sbg']:checked").val();
  89. var fafcp_set_hs = $("input[name='fafcp_hs']:checked").val();
  90. var fafcp_set_os = $("input[name='fafcp_os']:checked").val();
  91. var fafcp_set_sst = $("input[name='fafcp_sst']:checked").val();
  92. var fafcp_set_fn = $("input[name='fafcp_fn']:checked").val();
  93. var fafcp_set_tp = $("input[name='fafcp_tp']:checked").val();
  94. var fafcp_set_nf = $("input[name='fafcp_nf']:checked").val();
  95. FAFCP_SaveSettings(fafcp_set_nct,fafcp_set_sbg,fafcp_set_hs,fafcp_set_os,fafcp_set_sst,fafcp_set_fn,fafcp_set_tp,fafcp_set_nf);
  96. $('.faf-update-status').fadeIn('slow');
  97. setTimeout(function() {
  98. $('.faf-update-status').fadeOut('slow');
  99. }, 5000);
  100. });
  101. if(STATIC_PATH=="/themes/beta"){
  102. $('.content .section-divider').after(`
  103. <div id="customfacontrolpanel" style="border:1px dashed white; background: rgba(1,0,0,0.1); padding: 5px; border-radius: 5px; margin-top: 20px;">
  104. <h2>FA Fixes Control Panel <span class="faf-update-status" style="font-weight: bold; color: #02cc02; float:right; clear:right; display: none;">Update successful!</span></h2>
  105. <br/>
  106. <strong>No Custom Thumbnails</strong>
  107. <div class="control-panel-option">
  108. <div class="control-panel-item-1">
  109. <p>Disables Furaffinity from showing custom thumbnails on all submissions. Replacing the original thumbnails with a scaled down version of the actual submission.</p>
  110. </div>
  111. <div class="control-panel-item-2">
  112. <input type="radio" id="fafcp_nct_yes" name="fafcp_nct" value="yes" /><label for="fafcp_nct_yes">Enable</label><br/>
  113. <input type="radio" id="fafcp_nct_no" name="fafcp_nct" value="no"/><label for="fafcp_nct_no">Disable</label>
  114. </div>
  115. </div>
  116. <strong>Sidebar-Be-Gone</strong>
  117. <div class="control-panel-option">
  118. <div class="control-panel-item-1">
  119. <p>Relocates the sidebar off the screen, so it can be activated by hovering over it. <br/><i>Fixes the fullscreen submission bug</i></p>
  120. </div>
  121. <div class="control-panel-item-2">
  122. <input type="radio" id="fafcp_sbg_yes" name="fafcp_sbg" value="yes"/><label for="fafcp_sbg_yes">Enable</label><br/>
  123. <input type="radio" id="fafcp_sbg_no" name="fafcp_sbg" value="no"/><label for="fafcp_sbg_no">Disable</label>
  124. </div>
  125. </div>
  126. <strong>No Streams</strong>
  127. <div class="control-panel-option">
  128. <div class="control-panel-item-1">
  129. <p>Hides all stream notifications in the notifications centre.<br/><i><b>Important:</b> Does not change the notifications counter!</i></p>
  130. </div>
  131. <div class="control-panel-item-2">
  132. <input type="radio" id="fafcp_hs_yes" name="fafcp_hs" value="yes"/><label for="fafcp_hs_yes">Enable</label><br/>
  133. <input type="radio" id="fafcp_hs_no" name="fafcp_hs" value="no"/><label for="fafcp_hs_no">Disable</label>
  134. </div>
  135. </div>
  136. <strong>Obvious Streams</strong>
  137. <div class="control-panel-option">
  138. <div class="control-panel-item-1">
  139. <p>Re-styles stream notifications to make them more obvious in the notification's centre.</p>
  140. </div>
  141. <div class="control-panel-item-2">
  142. <input type="radio" id="fafcp_os_yes" name="fafcp_os" value="yes"/><label for="fafcp_os_yes">Enable</label><br/>
  143. <input type="radio" id="fafcp_os_no" name="fafcp_os" value="no"/><label for="fafcp_os_no">Disable</label>
  144. </div>
  145. </div>
  146. <strong>Same Size Thumbnails</strong>
  147. <div class="control-panel-option">
  148. <div class="control-panel-item-1">
  149. <p>Adjusts all thumbnails on profile pages to be of the same size (150px x 150px)</p>
  150. </div>
  151. <div class="control-panel-item-2">
  152. <input type="radio" id="fafcp_sst_yes" name="fafcp_sst" value="yes"/><label for="fafcp_sst_yes">Enable</label><br/>
  153. <input type="radio" id="fafcp_sst_no" name="fafcp_sst" value="no"/><label for="fafcp_sst_no">Disable</label>
  154. </div>
  155. </div>
  156. <strong>Fixed Navigation</strong>
  157. <div class="control-panel-option">
  158. <div class="control-panel-item-1">
  159. <p>Places the navigation bar in a fixed position, so it scrolls with the page</p>
  160. </div>
  161. <div class="control-panel-item-2">
  162. <input type="radio" id="fafcp_fn_yes" name="fafcp_fn" value="yes"/><label for="fafcp_fn_yes">Enable</label><br/>
  163. <input type="radio" id="fafcp_fn_no" name="fafcp_fn" value="no"/><label for="fafcp_fn_no">Disable</label>
  164. </div>
  165. </div>
  166. <strong>Tidy Profile</strong>
  167. <div class="control-panel-option">
  168. <div class="control-panel-item-1">
  169. <p>Add's a scroll bar to the the user profile section, if it's determined to be too long, to avoid unnesscessary scrolling.</p>
  170. </div>
  171. <div class="control-panel-item-2">
  172. <input type="radio" id="fafcp_tp_yes" name="fafcp_tp" value="yes"/><label for="fafcp_tp_yes">Enable</label><br/>
  173. <input type="radio" id="fafcp_tp_no" name="fafcp_tp" value="no"/><label for="fafcp_tp_no">Disable</label>
  174. </div>
  175. </div>
  176. <strong>NoteFix</strong>
  177. <div class="control-panel-option">
  178. <div class="control-panel-item-1">
  179. <p>Fixes the almost invisible textboxes/textarea's</p>
  180. </div>
  181. <div class="control-panel-item-2">
  182. <input type="radio" id="fafcp_nf_yes" name="fafcp_nf" value="yes"/><label for="fafcp_nf_yes">Enable</label><br/>
  183. <input type="radio" id="fafcp_nf_no" name="fafcp_nf" value="no"/><label for="fafcp_nf_no">Disable</label>
  184. </div>
  185. </div>
  186. <div class="button-nav">
  187. <div class="button-nav-item">
  188. <input class="button mobile-button" id="fafcp_saveit" type="button" value="Save FAFCP Settings*">
  189. </div>
  190. </div>
  191. <br/><b>*Updates take effect from the next page load</b><br/><span style="font-size:10px;">FAFCP by <a href="https://www.furaffinity.net/user/feralfrenzy" style="border-bottom:1px dotted white;">JaysonHusky</a></span>
  192. </div>
  193. `);
  194. }
  195. else {
  196. $('.footer').before(`<table cellpadding="0" cellspacing="1" border="0" class="section maintable" style="width: 60%; margin: 0 auto;">
  197. <tbody><tr>
  198. <td height="22" class="cat links">&nbsp;<strong>FurAffinity Fixes - Control Panel</strong> <span class="faf-update-status" style="font-weight: bold; color: #7cfc00; float:right; clear:right; display: none;">Update successful!</span></td>
  199. </tr>
  200. <tr>
  201.  
  202. <td class="alt1 addpad ucp-site-settings" align="center">
  203. <table cellpadding="0" cellspacing="1" border="0">
  204. <tbody>
  205. <tr>
  206. <th><strong>No Streams</strong></th>
  207. <td>
  208. <input type="radio" id="fafcp_hs_yes" name="fafcp_hs" value="yes"/><label for="fafcp_hs_yes">Enable</label><br/>
  209. <input type="radio" id="fafcp_hs_no" name="fafcp_hs" value="no"/><label for="fafcp_hs_no">Disable</label>
  210. </td>
  211. <td class="option-description">
  212. <p>Hides all stream notifications in the notifications centre.<br/><i><b>Important:</b> Does not change the notifications counter!</i></p>
  213. </td>
  214. </tr>
  215. <tr>
  216. <th><strong>Obvious Streams</strong></th>
  217. <td>
  218. <input type="radio" id="fafcp_os_yes" name="fafcp_os" value="yes"/><label for="fafcp_os_yes">Enable</label><br/>
  219. <input type="radio" id="fafcp_os_no" name="fafcp_os" value="no"/><label for="fafcp_os_no">Disable</label>
  220. </td>
  221. <td class="option-description">
  222. <p>Re-styles stream notifications to make them more obvious in the notification's centre.</p>
  223. </td>
  224. </tr>
  225.  
  226. <th class="noborder">&nbsp;</th>
  227. <td class="noborder">&nbsp;</td>
  228. <td class="option-description noborder">
  229. <br>
  230. <input class="button mobile-button" id="fafcp_saveit" type="button" value="Save FAFCP Settings*">
  231.  
  232. <br/><span style="font-size:10px;">FAFCP by <a href="https://www.furaffinity.net/user/feralfrenzy" style="border-bottom:1px dotted white;">JaysonHusky</a></span><br/><br/>
  233. <b>*Updates take effect from the next page load</b>
  234.  
  235. </td>
  236. </tr>
  237. </tbody></table>
  238. </td>
  239.  
  240. `);
  241. }
  242. }
  243. // Load the users settings
  244. $.each(["fafcp_nct","fafcp_sbg","fafcp_hs","fafcp_os","fafcp_sst","fafcp_fn","fafcp_tp","fafcp_nf"],function(i,l){
  245. FAFCP_LoadCP(l);
  246. });
  247. // Check and Run the Tweaks if required
  248. if(FAFCP_Load_Tweaks('fafcp_nct')=="yes"){ExecuteTweak('NoCustomThumbnails');} else { /* Do Nothing */ }
  249. if(FAFCP_Load_Tweaks('fafcp_sbg')=="yes"){ExecuteTweak('SidebarBeGone');} else { /* Do Nothing */ }
  250. if(FAFCP_Load_Tweaks('fafcp_hs')=="yes"){ExecuteTweak('HiddenStreams');} else { /* Do Nothing */ }
  251. if(FAFCP_Load_Tweaks('fafcp_os')=="yes"){ExecuteTweak('ObviousStreams');} else { /* Do Nothing */ }
  252. if(FAFCP_Load_Tweaks('fafcp_sst')=="yes"){ExecuteTweak('SameSizeThumbnails');} else { /* Do Nothing */ }
  253. if(FAFCP_Load_Tweaks('fafcp_fn')=="yes"){ExecuteTweak('FixedNavigation');} else { /* Do Nothing */ }
  254. if(FAFCP_Load_Tweaks('fafcp_tp')=="yes"){ExecuteTweak('TidyProfile');} else { /* Do Nothing */ }
  255. if(FAFCP_Load_Tweaks('fafcp_nf')=="yes"){ExecuteTweak('NoteFix');} else { /* Do Nothing */ }
  256. })();