FA Fixes Control Panel

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

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

  1. // ==UserScript==
  2. // @name FA Fixes Control Panel
  3. // @namespace FurAffinity.net
  4. // @version 1.3.5
  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_sstpo,fafcp_fn,fafcp_tp,fafcp_nf,fafcp_bbf){
  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_sstpo',fafcp_sstpo);GM_setValue('fafcp_fn',fafcp_fn);GM_setValue('fafcp_tp',fafcp_tp);
  45. GM_setValue('fafcp_nf',fafcp_nf);GM_setValue('fafcp_bbf',fafcp_bbf);
  46. }
  47. function ExecuteTweak(tweak){
  48. switch(tweak) {
  49. case "NoCustomThumbnails":
  50. $("img[src*='t.facdn.net']").each(function(index){
  51. var thumburl=$(this).attr('src').replace("@150","@400");
  52. $(this).attr("src",thumburl);
  53. });
  54. break;
  55. case "SidebarBeGone":
  56. $("<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");
  57. break;
  58. case "HiddenStreams":
  59. $("<style>div#messagecenter-other ul.message-stream li.stream-notification{display:none;}</style>").appendTo("head");
  60. break;
  61. case "ObviousStreams":
  62. $("<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");
  63. break;
  64. case "SameSizeThumbnails":
  65. $("<style>b.r-general u s a img,b.r-mature u s a img,b.r-adult u s a img {height:150px;width:150px;}</style>").appendTo("head");
  66. break;
  67. case "SameSizeThumbnailsPO":
  68. $("<style>.userpage-gallery-item img,.userpage-favorites-item img{height: 150px;width: 150px;}</style>").appendTo("head");
  69. break;
  70. case "FixedNavigation":
  71. $("<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");
  72. break;
  73. case "TidyProfile":
  74. var ProfileSize = 480; // (Defines max amount of profile that should be shown, the rest is still DOM loaded but hidden by overflow)
  75. if ($('.userpage-profile-info').height() > ProfileSize) { // Check for height
  76. $('.userpage-profile-info').css('height',''+ProfileSize+'px'); // Set new height
  77. $('.userpage-profile-info').css('overflow-y','auto'); // Allow overflow of remaining content
  78. }
  79. break;
  80. case "NoteFix":
  81. $('<style>#JSMessage{background: #3c3c3c !important;}.textbox, .textarea{background: #3c3c3c !important;border-radius:5px;}</style>').appendTo("head");
  82. break;
  83. case "BringBackButtons":
  84. $('.flex-submission-container').before('<div style="width:31%;margin:5px auto;">'+$('.sidebar-section').html()+'</div>');
  85. break;
  86. default:
  87. /* No Code */
  88. }
  89. }
  90. var pathx = window.location.pathname;
  91. if(~pathx.indexOf("/controls/user-settings/")){
  92. // Update
  93. $(document.body).on('click', '#fafcp_saveit', function() {
  94. var fafcp_set_nct = $("input[name='fafcp_nct']:checked").val();
  95. var fafcp_set_sbg = $("input[name='fafcp_sbg']:checked").val();
  96. var fafcp_set_hs = $("input[name='fafcp_hs']:checked").val();
  97. var fafcp_set_os = $("input[name='fafcp_os']:checked").val();
  98. var fafcp_set_sst = $("input[name='fafcp_sst']:checked").val();
  99. var fafcp_set_sstpo = $("input[name='fafcp_sst']:checked").val();
  100. var fafcp_set_fn = $("input[name='fafcp_fn']:checked").val();
  101. var fafcp_set_tp = $("input[name='fafcp_tp']:checked").val();
  102. var fafcp_set_nf = $("input[name='fafcp_nf']:checked").val();
  103. var fafcp_set_bbf = $("input[name='fafcp_bbf']:checked").val();
  104. FAFCP_SaveSettings(fafcp_set_nct,fafcp_set_sbg,fafcp_set_hs,fafcp_set_os,fafcp_set_sst,fafcp_set_sstpo,fafcp_set_fn,fafcp_set_tp,fafcp_set_nf,fafcp_set_bbf);
  105. $('.faf-update-status').fadeIn('slow');
  106. setTimeout(function() {
  107. $('.faf-update-status').fadeOut('slow');
  108. }, 5000);
  109. });
  110. if(STATIC_PATH=="/themes/beta"){
  111. $('.content .section-divider').after(`
  112. <div id="customfacontrolpanel" style="border:1px dashed white; background: rgba(1,0,0,0.1); padding: 5px; border-radius: 5px; margin-top: 20px;">
  113. <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>
  114. <br/>
  115. <strong>No Custom Thumbnails</strong>
  116. <div class="control-panel-option">
  117. <div class="control-panel-item-1">
  118. <p>Disables Furaffinity from showing custom thumbnails on all submissions. Replacing the original thumbnails with a scaled down version of the actual submission.</p>
  119. </div>
  120. <div class="control-panel-item-2">
  121. <input type="radio" id="fafcp_nct_yes" name="fafcp_nct" value="yes" /><label for="fafcp_nct_yes">Enable</label><br/>
  122. <input type="radio" id="fafcp_nct_no" name="fafcp_nct" value="no"/><label for="fafcp_nct_no">Disable</label>
  123. </div>
  124. </div>
  125. <strong>Sidebar-Be-Gone</strong>
  126. <div class="control-panel-option">
  127. <div class="control-panel-item-1">
  128. <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>
  129. </div>
  130. <div class="control-panel-item-2">
  131. <input type="radio" id="fafcp_sbg_yes" name="fafcp_sbg" value="yes"/><label for="fafcp_sbg_yes">Enable</label><br/>
  132. <input type="radio" id="fafcp_sbg_no" name="fafcp_sbg" value="no"/><label for="fafcp_sbg_no">Disable</label>
  133. </div>
  134. </div>
  135. <strong>No Streams</strong>
  136. <div class="control-panel-option">
  137. <div class="control-panel-item-1">
  138. <p>Hides all stream notifications in the notifications centre.<br/><i><b>Important:</b> Does not change the notifications counter!</i></p>
  139. </div>
  140. <div class="control-panel-item-2">
  141. <input type="radio" id="fafcp_hs_yes" name="fafcp_hs" value="yes"/><label for="fafcp_hs_yes">Enable</label><br/>
  142. <input type="radio" id="fafcp_hs_no" name="fafcp_hs" value="no"/><label for="fafcp_hs_no">Disable</label>
  143. </div>
  144. </div>
  145. <strong>Obvious Streams</strong>
  146. <div class="control-panel-option">
  147. <div class="control-panel-item-1">
  148. <p>Re-styles stream notifications to make them more obvious in the notification's centre.</p>
  149. </div>
  150. <div class="control-panel-item-2">
  151. <input type="radio" id="fafcp_os_yes" name="fafcp_os" value="yes"/><label for="fafcp_os_yes">Enable</label><br/>
  152. <input type="radio" id="fafcp_os_no" name="fafcp_os" value="no"/><label for="fafcp_os_no">Disable</label>
  153. </div>
  154. </div>
  155. <strong>Same Size Thumbnails Submissions Only</strong>
  156. <div class="control-panel-option">
  157. <div class="control-panel-item-1">
  158. <p>Adjusts all thumbnails of submissions to be of the same size (150px x 150px)</p>
  159. </div>
  160. <div class="control-panel-item-2">
  161. <input type="radio" id="fafcp_sst_yes" name="fafcp_sst" value="yes"/><label for="fafcp_sst_yes">Enable</label><br/>
  162. <input type="radio" id="fafcp_sst_no" name="fafcp_sst" value="no"/><label for="fafcp_sst_no">Disable</label>
  163. </div>
  164. </div>
  165. <strong>Same Size Thumbnails Profiles Only</strong>
  166. <div class="control-panel-option">
  167. <div class="control-panel-item-1">
  168. <p>Adjusts all thumbnails on profile pages to be of the same size (150px x 150px)</p>
  169. </div>
  170. <div class="control-panel-item-2">
  171. <input type="radio" id="fafcp_sstpo_yes" name="fafcp_sstpo" value="yes"/><label for="fafcp_sstpo_yes">Enable</label><br/>
  172. <input type="radio" id="fafcp_sstpo_no" name="fafcp_sstpo" value="no"/><label for="fafcp_sstpo_no">Disable</label>
  173. </div>
  174. </div>
  175. <strong>Fixed Navigation</strong>
  176. <div class="control-panel-option">
  177. <div class="control-panel-item-1">
  178. <p>Places the navigation bar in a fixed position, so it scrolls with the page</p>
  179. </div>
  180. <div class="control-panel-item-2">
  181. <input type="radio" id="fafcp_fn_yes" name="fafcp_fn" value="yes"/><label for="fafcp_fn_yes">Enable</label><br/>
  182. <input type="radio" id="fafcp_fn_no" name="fafcp_fn" value="no"/><label for="fafcp_fn_no">Disable</label>
  183. </div>
  184. </div>
  185. <strong>Tidy Profile</strong>
  186. <div class="control-panel-option">
  187. <div class="control-panel-item-1">
  188. <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>
  189. </div>
  190. <div class="control-panel-item-2">
  191. <input type="radio" id="fafcp_tp_yes" name="fafcp_tp" value="yes"/><label for="fafcp_tp_yes">Enable</label><br/>
  192. <input type="radio" id="fafcp_tp_no" name="fafcp_tp" value="no"/><label for="fafcp_tp_no">Disable</label>
  193. </div>
  194. </div>
  195. <strong>NoteFix</strong>
  196. <div class="control-panel-option">
  197. <div class="control-panel-item-1">
  198. <p>Fixes the almost invisible textboxes/textarea's</p>
  199. </div>
  200. <div class="control-panel-item-2">
  201. <input type="radio" id="fafcp_nf_yes" name="fafcp_nf" value="yes"/><label for="fafcp_nf_yes">Enable</label><br/>
  202. <input type="radio" id="fafcp_nf_no" name="fafcp_nf" value="no"/><label for="fafcp_nf_no">Disable</label>
  203. </div>
  204. </div>
  205. <strong>Bring Back Buttons</strong>
  206. <div class="control-panel-option">
  207. <div class="control-panel-item-1">
  208. <p>Brings back the submission buttons when the sidebar is hidden <br/> For widths between 480px &amp; 1070px</p>
  209. </div>
  210. <div class="control-panel-item-2">
  211. <input type="radio" id="fafcp_bbf_yes" name="fafcp_bbf" value="yes"/><label for="fafcp_bbf_yes">Enable</label><br/>
  212. <input type="radio" id="fafcp_bbf_no" name="fafcp_bbf" value="no"/><label for="fafcp_bbf_no">Disable</label>
  213. </div>
  214. </div>
  215. <div class="button-nav">
  216. <div class="button-nav-item">
  217. <input class="button mobile-button" id="fafcp_saveit" type="button" value="Save FAFCP Settings*">
  218. </div>
  219. </div>
  220. <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>
  221. </div>
  222. `);
  223. }
  224. else {
  225. $('.footer').before(`<table cellpadding="0" cellspacing="1" border="0" class="section maintable" style="width: 60%; margin: 0 auto;">
  226. <tbody><tr>
  227. <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>
  228. </tr>
  229. <tr>
  230.  
  231. <td class="alt1 addpad ucp-site-settings" align="center">
  232. <table cellpadding="0" cellspacing="1" border="0">
  233. <tbody>
  234. <tr>
  235. <th><strong>No Streams</strong></th>
  236. <td>
  237. <input type="radio" id="fafcp_hs_yes" name="fafcp_hs" value="yes"/><label for="fafcp_hs_yes">Enable</label><br/>
  238. <input type="radio" id="fafcp_hs_no" name="fafcp_hs" value="no"/><label for="fafcp_hs_no">Disable</label>
  239. </td>
  240. <td class="option-description">
  241. <p>Hides all stream notifications in the notifications centre.<br/><i><b>Important:</b> Does not change the notifications counter!</i></p>
  242. </td>
  243. </tr>
  244. <tr>
  245. <th><strong>Obvious Streams</strong></th>
  246. <td>
  247. <input type="radio" id="fafcp_os_yes" name="fafcp_os" value="yes"/><label for="fafcp_os_yes">Enable</label><br/>
  248. <input type="radio" id="fafcp_os_no" name="fafcp_os" value="no"/><label for="fafcp_os_no">Disable</label>
  249. </td>
  250. <td class="option-description">
  251. <p>Re-styles stream notifications to make them more obvious in the notification's centre.</p>
  252. </td>
  253. </tr>
  254.  
  255. <th class="noborder">&nbsp;</th>
  256. <td class="noborder">&nbsp;</td>
  257. <td class="option-description noborder">
  258. <br>
  259. <input class="button mobile-button" id="fafcp_saveit" type="button" value="Save FAFCP Settings*">
  260.  
  261. <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/>
  262. <b>*Updates take effect from the next page load</b>
  263.  
  264. </td>
  265. </tr>
  266. </tbody></table>
  267. </td>
  268.  
  269. `);
  270. }
  271. }
  272. // Load the users settings
  273. $.each(["fafcp_nct","fafcp_sbg","fafcp_hs","fafcp_os","fafcp_sst","fafcp_sstpo","fafcp_fn","fafcp_tp","fafcp_nf","fafcp_bbf"],function(i,l){
  274. FAFCP_LoadCP(l);
  275. });
  276. // Check and Run the Tweaks if required
  277. if(FAFCP_Load_Tweaks('fafcp_nct')=="yes"){ExecuteTweak('NoCustomThumbnails');} else { /* Do Nothing */ }
  278. if(FAFCP_Load_Tweaks('fafcp_sbg')=="yes"){ExecuteTweak('SidebarBeGone');} else { /* Do Nothing */ }
  279. if(FAFCP_Load_Tweaks('fafcp_hs')=="yes"){ExecuteTweak('HiddenStreams');} else { /* Do Nothing */ }
  280. if(FAFCP_Load_Tweaks('fafcp_os')=="yes"){ExecuteTweak('ObviousStreams');} else { /* Do Nothing */ }
  281. if(FAFCP_Load_Tweaks('fafcp_sst')=="yes"){ExecuteTweak('SameSizeThumbnails');} else { /* Do Nothing */ }
  282. if(FAFCP_Load_Tweaks('fafcp_sstpo')=="yes"){ExecuteTweak('SameSizeThumbnailsPO');} else { /* Do Nothing */ }
  283. if(FAFCP_Load_Tweaks('fafcp_fn')=="yes"){ExecuteTweak('FixedNavigation');} else { /* Do Nothing */ }
  284. if(FAFCP_Load_Tweaks('fafcp_tp')=="yes"){ExecuteTweak('TidyProfile');} else { /* Do Nothing */ }
  285. if(FAFCP_Load_Tweaks('fafcp_nf')=="yes"){ExecuteTweak('NoteFix');} else { /* Do Nothing */ }
  286. if(FAFCP_Load_Tweaks('fafcp_bbf')=="yes"){ExecuteTweak('BringBackButtons');} else { /* Do Nothing */ }
  287. })();