FA Fixes Control Panel

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         FA Fixes Control Panel
// @namespace    FurAffinity.net
// @version      1.0
// @description  Adds a control panel of fixes to the FurAffinity website, so you can enable/disable them at will.
// @author       JaysonHusky
// @match        *://www.furaffinity.net/*
// @grant       GM_getValue
// @grant       GM_setValue
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';
    // Load Current Settings
    function FAFCP_LoadCP(i){
        var setting_returned = GM_getValue(i);
        if(setting_returned=="yes"){
            $('#'+i+'_yes').prop("checked", true);
        }
        else if(setting_returned=="no") {
             $('#'+i+'_no').prop("checked", true);
        }
        else {
             console.log('Setting: '+i+' Returned: '+setting_returned+' (Other Result)');
        }
    }
    function FAFCP_Load_Tweaks(i){
        var setting_returned = GM_getValue(i);
        if(setting_returned=="yes"){
            return "yes";
        }
        else if(setting_returned=="no") {
             return "no";
        }
        else {
             return "undefined";
        }
    }
    function FAFCP_SaveSettings(fafcp_nct,fafcp_sbg,fafcp_hs,fafcp_os,fafcp_sst,fafcp_fn,fafcp_tp){
        GM_setValue('fafcp_nct',fafcp_nct);GM_setValue('fafcp_sbg',fafcp_sbg);GM_setValue('fafcp_hs',fafcp_hs);GM_setValue('fafcp_os',fafcp_os);
        GM_setValue('fafcp_sst',fafcp_sst);GM_setValue('fafcp_fn',fafcp_fn);GM_setValue('fafcp_tp',fafcp_tp);
    }
	function ExecuteTweak(tweak){
		switch(tweak) {
			case "NoCustomThumbnails":
				$("img[src*='t.facdn.net']").each(function(index){
					var thumburl=$(this).attr('src').replace("@150","@400");
					$(this).attr("src",thumburl);
				});
			break;
			case "SidebarBeGone":
				$("<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");
			break;
			case "HiddenStreams":
				$("<style>div#messagecenter-other ul.message-stream li.stream-notification{display:none;}</style>").appendTo("head");
			break;
			case "ObviousStreams":
				$("<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");
			break;
			case "SameSizeThumbnails":
				$("<style>.userpage-gallery-item img,.userpage-favorites-item img{height: 150px;width: 150px;}</style>").appendTo("head");
			break;
			case "FixedNavigation":
				$("<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");
			break;
			case "TidyProfile":
				var ProfileSize = 480; // (Defines max amount of profile that should be shown, the rest is still DOM loaded but hidden by overflow)
				if ($('.userpage-profile-info').height() > ProfileSize) { // Check for height
					$('.userpage-profile-info').css('height',''+ProfileSize+'px'); // Set new height
					$('.userpage-profile-info').css('overflow-y','auto'); // Allow overflow of remaining content
				}
			break;
			default:
			/* No Code */
		}
	}
     var pathx = window.location.pathname;
        if(~pathx.indexOf("/controls/user-settings/")){
    // Update
	$(document.body).on('click', '#fafcp_saveit', function() {
		var fafcp_set_nct = $("input[name='fafcp_nct']:checked").val();
		var fafcp_set_sbg = $("input[name='fafcp_sbg']:checked").val();
		var fafcp_set_hs = $("input[name='fafcp_hs']:checked").val();
		var fafcp_set_os = $("input[name='fafcp_os']:checked").val();
		var fafcp_set_sst = $("input[name='fafcp_sst']:checked").val();
        var fafcp_set_fn = $("input[name='fafcp_fn']:checked").val();
        var fafcp_set_tp = $("input[name='fafcp_tp']:checked").val();
		FAFCP_SaveSettings(fafcp_set_nct,fafcp_set_sbg,fafcp_set_hs,fafcp_set_os,fafcp_set_sst,fafcp_set_fn,fafcp_set_tp);
		$('.faf-update-status').fadeIn('slow');
			setTimeout(function() {
				$('.faf-update-status').fadeOut('slow');
			}, 5000);
		});
		$('.button-nav').after(`
		<div id="customfacontrolpanel" style="border:1px dashed white; background: rgba(1,0,0,0.1); padding: 5px; border-radius: 5px; margin-top: 20px;">
			<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>
			<br/>
			<strong>No Custom Thumbnails</strong>
			<div class="control-panel-option">
				<div class="control-panel-item-1">
					<p>Disables Furaffinity from showing custom thumbnails on all submissions. Replacing the original thumbnails with a scaled down version of the actual submission.</p>
				</div>
				<div class="control-panel-item-2">
					<input type="radio" id="fafcp_nct_yes" name="fafcp_nct" value="yes" /><label for="fafcp_nct_yes">Enable</label><br/>
					<input type="radio" id="fafcp_nct_no" name="fafcp_nct" value="no"/><label for="fafcp_nct_no">Disable</label>
				</div>
			</div>
			<strong>Sidebar-Be-Gone</strong>
			<div class="control-panel-option">
				<div class="control-panel-item-1">
					<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>
				</div>
				<div class="control-panel-item-2">
					<input type="radio" id="fafcp_sbg_yes" name="fafcp_sbg" value="yes"/><label for="fafcp_sbg_yes">Enable</label><br/>
					<input type="radio" id="fafcp_sbg_no" name="fafcp_sbg" value="no"/><label for="fafcp_sbg_no">Disable</label>
				</div>
			</div>
			<strong>No Streams</strong>
			<div class="control-panel-option">
				<div class="control-panel-item-1">
					<p>Hides all stream notifications in the notifications centre.<br/><i><b>Important:</b> Does not change the notifications counter!</i></p>
				</div>
				<div class="control-panel-item-2">
					<input type="radio" id="fafcp_hs_yes" name="fafcp_hs" value="yes"/><label for="fafcp_hs_yes">Enable</label><br/>
					<input type="radio" id="fafcp_hs_no" name="fafcp_hs" value="no"/><label for="fafcp_hs_no">Disable</label>
				</div>
			</div>
			<strong>Obvious Streams</strong>
				<div class="control-panel-option">
					<div class="control-panel-item-1">
						<p>Re-styles stream notifications to make them more obvious in the notification's centre.</p>
					</div>
					<div class="control-panel-item-2">
						<input type="radio" id="fafcp_os_yes" name="fafcp_os" value="yes"/><label for="fafcp_os_yes">Enable</label><br/>
						<input type="radio" id="fafcp_os_no" name="fafcp_os" value="no"/><label for="fafcp_os_no">Disable</label>
					</div>
				</div>
				<strong>Same Size Thumbnails</strong>
				<div class="control-panel-option">
					<div class="control-panel-item-1">
						<p>Adjusts all thumbnails on profile pages to be of the same size (150px x 150px)</p>
					</div>
					<div class="control-panel-item-2">
						<input type="radio" id="fafcp_sst_yes" name="fafcp_sst" value="yes"/><label for="fafcp_sst_yes">Enable</label><br/>
						<input type="radio" id="fafcp_sst_no" name="fafcp_sst" value="no"/><label for="fafcp_sst_no">Disable</label>
					</div>
				</div>
				<strong>Fixed Navigation</strong>
				<div class="control-panel-option">
					<div class="control-panel-item-1">
						<p>Places the navigation bar in a fixed position, so it scrolls with the page</p>
					</div>
					<div class="control-panel-item-2">
						<input type="radio" id="fafcp_fn_yes" name="fafcp_fn" value="yes"/><label for="fafcp_fn_yes">Enable</label><br/>
						<input type="radio" id="fafcp_fn_no" name="fafcp_fn" value="no"/><label for="fafcp_fn_no">Disable</label>
					</div>
				</div>
				<strong>Tidy Profile</strong>
				<div class="control-panel-option">
					<div class="control-panel-item-1">
						<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>
					</div>
					<div class="control-panel-item-2">
						<input type="radio" id="fafcp_tp_yes" name="fafcp_tp" value="yes"/><label for="fafcp_tp_yes">Enable</label><br/>
						<input type="radio" id="fafcp_tp_no" name="fafcp_tp" value="no"/><label for="fafcp_tp_no">Disable</label>
					</div>
				</div>
				<div class="button-nav">
					<div class="button-nav-item">
						<input class="button mobile-button" id="fafcp_saveit" type="button" value="Save FAFCP Settings*">
					</div>
				</div>
						<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>
		</div>
	`);
    }
    // Load the users settings
    FAFCP_LoadCP('fafcp_nct');FAFCP_LoadCP('fafcp_sbg');FAFCP_LoadCP('fafcp_hs');FAFCP_LoadCP('fafcp_os');FAFCP_LoadCP('fafcp_sst');FAFCP_LoadCP('fafcp_fn');FAFCP_LoadCP('fafcp_tp');
    // Check and Run the Tweaks if required
   if(FAFCP_Load_Tweaks('fafcp_nct')=="yes"){ExecuteTweak('NoCustomThumbnails');} else { /* Do Nothing */ }
    if(FAFCP_Load_Tweaks('fafcp_sbg')=="yes"){ExecuteTweak('SidebarBeGone');} else { /* Do Nothing */ }
    if(FAFCP_Load_Tweaks('fafcp_hs')=="yes"){ExecuteTweak('HiddenStreams');} else { /* Do Nothing */ }
    if(FAFCP_Load_Tweaks('fafcp_os')=="yes"){ExecuteTweak('ObviousStreams');} else { /* Do Nothing */ }
    if(FAFCP_Load_Tweaks('fafcp_sst')=="yes"){ExecuteTweak('SameSizeThumbnails');} else { /* Do Nothing */ }
    if(FAFCP_Load_Tweaks('fafcp_fn')=="yes"){ExecuteTweak('FixedNavigation');} else { /* Do Nothing */ }
    if(FAFCP_Load_Tweaks('fafcp_tp')=="yes"){ExecuteTweak('TidyProfile');} else { /* Do Nothing */ }
})();