// ==UserScript== // @name SubFilter // @namespace FurAffinity.net // @version 0.2.5 // @description Enable/Disable YCH and Stream notifications // @author JaysonHusky // @match *://www.furaffinity.net/* // @exclude *://www.furaffinity.net/login/ // @exclude *://www.furaffinity.net/logout/ // @exclude *://www.furaffinity.net/controls/submissions/ // @exclude *://www.furaffinity.net/controls/settings/ // @grant GM_getValue // @grant GM_setValue // @require http://code.jquery.com/jquery-latest.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; var TemplateStyle=$('body').attr('data-static-path'); var YCHSHidden=0;var StreamsHidden=0; console.log("Stream Setting: "+GM_getValue('stream_control')+ " ||| YCH Setting: "+GM_getValue('ych_control')); // Add Special Stylesheet for keywords var JaysCSS=document.createElement('style'); var jayStyle=document.createTextNode(` #customfacontrolpanel{ margin-top:20px; } .JaySB{ background: #36393d; padding: 7px 14px 14px 14px; } #speciallisting li{ margin-left:20px; } `); JaysCSS.appendChild(jayStyle); document.getElementsByTagName('body')[0].appendChild(JaysCSS); // Adapt JQuery :contains to function without case restriction jQuery.expr[':'].icontains=function(a, i, m){ return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0; }; // JS equiv of PHPs ucwords() for better presentation (Credit: rickycheers @ Github) String.prototype.ucwords=function(){ strtouc=this.toLowerCase(); return strtouc.replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,function(s){ return s.toUpperCase(); }); }; // Load Current Settings function SF_LoadCP(i){ var setting_returned = GM_getValue(i); if(setting_returned=="yes"){ if(i=="stream_control"){ $("select#streamid").val("yes"); } else { $("select#ychid").val("yes"); } } else if(setting_returned=="no") { if(i=="stream_control"){ $("select#streamid").val("no"); } else { $("select#ychid").val("no"); } } else { console.log('[DEBUG]: Setting: '+i+' Returned: '+setting_returned+' (Result not valid, or control not set)'); $("select#ychid").val("unset"); $("select#streamid").val("unset"); } } function SF_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 SF_SaveSettings(ych,stream){ GM_setValue('ych_control',ych);GM_setValue('stream_control',stream); } function ExecuteTweak(tweak){ switch(tweak) { case "noYCH": //Browse Page $("section figure figcaption").find("p:first a:icontains('ych')").parent().parent().parent().parent().css('display','none'); // Submission Inbox Page $("#messagecenter-submissions section figure figcaption").find("label p:first a:icontains('ych')").parent().parent().parent().parent().css('display','none'); YCHSHidden=YCHSHidden+1; break; case "noSTREAM": //Browse Page $("section figure figcaption").find("p:first a:icontains('stream')").parent().parent().parent().parent().css('display','none'); // Submission Inbox Page $("#messagecenter-submissions section figure figcaption").find("label p:first a:icontains('stream')").parent().parent().parent().parent().css('display','none'); StreamsHidden=StreamsHidden+1; break; default: /* No Code */ } } var pathx = window.location.pathname; if(~pathx.indexOf("/controls/user-settings/")){ // Update $(document.body).on('click', '#sf_saveit', function() { var sf_set_ych=$("select#ychid option:checked").val();var sf_set_stream=$("select#streamid option:checked").val(); SF_SaveSettings(sf_set_ych,sf_set_stream); $('.sf-update-status_x').fadeIn('slow'); setTimeout(function(){ $('.sf-update-status_x').fadeOut('slow'); }, 5000); }); if(TemplateStyle=="/themes/beta"){ $('.content .section-body').after(`
Enable/Disable the ability to see YCH submissions.
Enable/Disable the ability to see Stream submissions.
SubFilter | ||||||
|