FA Fixes Control Panel

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

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

  1. // ==UserScript==
  2. // @name FA Fixes Control Panel
  3. // @namespace FurAffinity.net
  4. // @version 1.3.2
  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){
  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);
  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. default:
  77. /* No Code */
  78. }
  79. }
  80. var pathx = window.location.pathname;
  81. if(~pathx.indexOf("/controls/user-settings/")){
  82. // Update
  83. $(document.body).on('click', '#fafcp_saveit', function() {
  84. var fafcp_set_nct = $("input[name='fafcp_nct']:checked").val();
  85. var fafcp_set_sbg = $("input[name='fafcp_sbg']:checked").val();
  86. var fafcp_set_hs = $("input[name='fafcp_hs']:checked").val();
  87. var fafcp_set_os = $("input[name='fafcp_os']:checked").val();
  88. var fafcp_set_sst = $("input[name='fafcp_sst']:checked").val();
  89. var fafcp_set_fn = $("input[name='fafcp_fn']:checked").val();
  90. var fafcp_set_tp = $("input[name='fafcp_tp']:checked").val();
  91. FAFCP_SaveSettings(fafcp_set_nct,fafcp_set_sbg,fafcp_set_hs,fafcp_set_os,fafcp_set_sst,fafcp_set_fn,fafcp_set_tp);
  92. $('.faf-update-status').fadeIn('slow');
  93. setTimeout(function() {
  94. $('.faf-update-status').fadeOut('slow');
  95. }, 5000);
  96. });
  97. if(STATIC_PATH=="/themes/beta"){
  98. $('.button-nav').after(`
  99. <div id="customfacontrolpanel" style="border:1px dashed white; background: rgba(1,0,0,0.1); padding: 5px; border-radius: 5px; margin-top: 20px;">
  100. <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>
  101. <br/>
  102. <strong>No Custom Thumbnails</strong>
  103. <div class="control-panel-option">
  104. <div class="control-panel-item-1">
  105. <p>Disables Furaffinity from showing custom thumbnails on all submissions. Replacing the original thumbnails with a scaled down version of the actual submission.</p>
  106. </div>
  107. <div class="control-panel-item-2">
  108. <input type="radio" id="fafcp_nct_yes" name="fafcp_nct" value="yes" /><label for="fafcp_nct_yes">Enable</label><br/>
  109. <input type="radio" id="fafcp_nct_no" name="fafcp_nct" value="no"/><label for="fafcp_nct_no">Disable</label>
  110. </div>
  111. </div>
  112. <strong>Sidebar-Be-Gone</strong>
  113. <div class="control-panel-option">
  114. <div class="control-panel-item-1">
  115. <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>
  116. </div>
  117. <div class="control-panel-item-2">
  118. <input type="radio" id="fafcp_sbg_yes" name="fafcp_sbg" value="yes"/><label for="fafcp_sbg_yes">Enable</label><br/>
  119. <input type="radio" id="fafcp_sbg_no" name="fafcp_sbg" value="no"/><label for="fafcp_sbg_no">Disable</label>
  120. </div>
  121. </div>
  122. <strong>No Streams</strong>
  123. <div class="control-panel-option">
  124. <div class="control-panel-item-1">
  125. <p>Hides all stream notifications in the notifications centre.<br/><i><b>Important:</b> Does not change the notifications counter!</i></p>
  126. </div>
  127. <div class="control-panel-item-2">
  128. <input type="radio" id="fafcp_hs_yes" name="fafcp_hs" value="yes"/><label for="fafcp_hs_yes">Enable</label><br/>
  129. <input type="radio" id="fafcp_hs_no" name="fafcp_hs" value="no"/><label for="fafcp_hs_no">Disable</label>
  130. </div>
  131. </div>
  132. <strong>Obvious Streams</strong>
  133. <div class="control-panel-option">
  134. <div class="control-panel-item-1">
  135. <p>Re-styles stream notifications to make them more obvious in the notification's centre.</p>
  136. </div>
  137. <div class="control-panel-item-2">
  138. <input type="radio" id="fafcp_os_yes" name="fafcp_os" value="yes"/><label for="fafcp_os_yes">Enable</label><br/>
  139. <input type="radio" id="fafcp_os_no" name="fafcp_os" value="no"/><label for="fafcp_os_no">Disable</label>
  140. </div>
  141. </div>
  142. <strong>Same Size Thumbnails</strong>
  143. <div class="control-panel-option">
  144. <div class="control-panel-item-1">
  145. <p>Adjusts all thumbnails on profile pages to be of the same size (150px x 150px)</p>
  146. </div>
  147. <div class="control-panel-item-2">
  148. <input type="radio" id="fafcp_sst_yes" name="fafcp_sst" value="yes"/><label for="fafcp_sst_yes">Enable</label><br/>
  149. <input type="radio" id="fafcp_sst_no" name="fafcp_sst" value="no"/><label for="fafcp_sst_no">Disable</label>
  150. </div>
  151. </div>
  152. <strong>Fixed Navigation</strong>
  153. <div class="control-panel-option">
  154. <div class="control-panel-item-1">
  155. <p>Places the navigation bar in a fixed position, so it scrolls with the page</p>
  156. </div>
  157. <div class="control-panel-item-2">
  158. <input type="radio" id="fafcp_fn_yes" name="fafcp_fn" value="yes"/><label for="fafcp_fn_yes">Enable</label><br/>
  159. <input type="radio" id="fafcp_fn_no" name="fafcp_fn" value="no"/><label for="fafcp_fn_no">Disable</label>
  160. </div>
  161. </div>
  162. <strong>Tidy Profile</strong>
  163. <div class="control-panel-option">
  164. <div class="control-panel-item-1">
  165. <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>
  166. </div>
  167. <div class="control-panel-item-2">
  168. <input type="radio" id="fafcp_tp_yes" name="fafcp_tp" value="yes"/><label for="fafcp_tp_yes">Enable</label><br/>
  169. <input type="radio" id="fafcp_tp_no" name="fafcp_tp" value="no"/><label for="fafcp_tp_no">Disable</label>
  170. </div>
  171. </div>
  172. <div class="button-nav">
  173. <div class="button-nav-item">
  174. <input class="button mobile-button" id="fafcp_saveit" type="button" value="Save FAFCP Settings*">
  175. </div>
  176. </div>
  177. <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>
  178. </div>
  179. `);
  180. }
  181. else {
  182. $('.footer').before(`<table cellpadding="0" cellspacing="1" border="0" class="section maintable" style="width: 60%; margin: 0 auto;">
  183. <tbody><tr>
  184. <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>
  185. </tr>
  186. <tr>
  187.  
  188. <td class="alt1 addpad ucp-site-settings" align="center">
  189. <table cellpadding="0" cellspacing="1" border="0">
  190. <tbody>
  191. <tr>
  192. <th><strong>No Streams</strong></th>
  193. <td>
  194. <input type="radio" id="fafcp_hs_yes" name="fafcp_hs" value="yes"/><label for="fafcp_hs_yes">Enable</label><br/>
  195. <input type="radio" id="fafcp_hs_no" name="fafcp_hs" value="no"/><label for="fafcp_hs_no">Disable</label>
  196. </td>
  197. <td class="option-description">
  198. <p>Hides all stream notifications in the notifications centre.<br/><i><b>Important:</b> Does not change the notifications counter!</i></p>
  199. </td>
  200. </tr>
  201. <tr>
  202. <th><strong>Obvious Streams</strong></th>
  203. <td>
  204. <input type="radio" id="fafcp_os_yes" name="fafcp_os" value="yes"/><label for="fafcp_os_yes">Enable</label><br/>
  205. <input type="radio" id="fafcp_os_no" name="fafcp_os" value="no"/><label for="fafcp_os_no">Disable</label>
  206. </td>
  207. <td class="option-description">
  208. <p>Re-styles stream notifications to make them more obvious in the notification's centre.</p>
  209. </td>
  210. </tr>
  211.  
  212. <th class="noborder">&nbsp;</th>
  213. <td class="noborder">&nbsp;</td>
  214. <td class="option-description noborder">
  215. <br>
  216. <input class="button mobile-button" id="fafcp_saveit" type="button" value="Save FAFCP Settings*">
  217.  
  218. <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/>
  219. <b>*Updates take effect from the next page load</b>
  220.  
  221. </td>
  222. </tr>
  223. </tbody></table>
  224. </td>
  225.  
  226. `);
  227. }
  228. }
  229. // Load the users settings
  230. $.each(["fafcp_nct","fafcp_sbg","fafcp_hs","fafcp_os","fafcp_sst","fafcp_fn","fafcp_tp"],function(i,l){
  231. FAFCP_LoadCP(l);
  232. });
  233. // Check and Run the Tweaks if required
  234. if(FAFCP_Load_Tweaks('fafcp_nct')=="yes"){ExecuteTweak('NoCustomThumbnails');} else { /* Do Nothing */ }
  235. if(FAFCP_Load_Tweaks('fafcp_sbg')=="yes"){ExecuteTweak('SidebarBeGone');} else { /* Do Nothing */ }
  236. if(FAFCP_Load_Tweaks('fafcp_hs')=="yes"){ExecuteTweak('HiddenStreams');} else { /* Do Nothing */ }
  237. if(FAFCP_Load_Tweaks('fafcp_os')=="yes"){ExecuteTweak('ObviousStreams');} else { /* Do Nothing */ }
  238. if(FAFCP_Load_Tweaks('fafcp_sst')=="yes"){ExecuteTweak('SameSizeThumbnails');} else { /* Do Nothing */ }
  239. if(FAFCP_Load_Tweaks('fafcp_fn')=="yes"){ExecuteTweak('FixedNavigation');} else { /* Do Nothing */ }
  240. if(FAFCP_Load_Tweaks('fafcp_tp')=="yes"){ExecuteTweak('TidyProfile');} else { /* Do Nothing */ }
  241. })();