// ==UserScript== // @name FA Journal Breakdown // @namespace FurAffinity // @version 10.0.0a // @description Provides a breakdown of your journal list // @author JaysonHusky // @grant GM_getValue // @grant GM_setValue // @match *://www.furaffinity.net/msg/others/* // @match *://www.furaffinity.net/controls/user-settings/* // @require https://code.jquery.com/jquery-latest.js // @downloadURL https://update.greasyfork.icu/scripts/26236/FA%20Journal%20Breakdown.user.js // @updateURL https://update.greasyfork.icu/scripts/26236/FA%20Journal%20Breakdown.meta.js // ==/UserScript== (function() { 'use strict'; var TemplateStyle=$('body').attr('data-static-path'); var staff_ident_mode=false; // Setup keywords var myKeywords; // Creating the var's var scx,theStreamCount,strtouc,nkm; // Begin loading function FAJBM_Load(){ var user_defined_keywords=GM_getValue('fajbm'); if(user_defined_keywords > ""){ myKeywords=user_defined_keywords.split(","); $('#fajbm_settings').val(user_defined_keywords.replace(/,/g,", ")); } else { console.log("Error occured while attempting to retrieve user keywords, ERR: KEYS_UNDEFINED"); //return "undefined"; } } // Add Special Stylesheet for keywords var JaysCSS=document.createElement('style'); var jayStyle=document.createTextNode(` i.fajbm{ margin-right:5px; padding:1px; } span.faf-update-status{ font-weight:bold; color:#04fd04; float:right; clear:right; display:none; } #customfacontrolpanel{ /*border:1px dashed white; background:rgba(1,0,0,0.1); padding:5px; border-radius:5px;*/ 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); // Save settings function FAJBM_SaveSettings(fajbm){ GM_setValue('fajbm',fajbm); } // Load Control Panel var pathx=window.location.pathname; if(~pathx.indexOf("/controls/user-settings/")){ // Update $(document.body).on('click', '#fajbm_saveit', function() { var fajbm_set=$("input[name='fajbm_setting']").val().replace(/ /g,"").replace(/ /g,""); FAJBM_SaveSettings(fajbm_set); $('.faf-update-status').fadeIn('slow'); setTimeout(function(){ $('.faf-update-status').fadeOut('slow'); }, 5000); }); if(TemplateStyle=="/themes/beta"){ $('.content .section-body').after(`
FA Journal Breakdown - Control Panel Update successful! | ||||||
Journal breakdown by term: '); } else { KeywordTitle=$("#messages-journals h3").first().append(' Journal breakdown by term:'); } // Sort Keywords alphabetically if(myKeywords===undefined){} else { myKeywords=myKeywords.sort(); } // 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(); }); }; var stafflist=["dragoneer","chase","shivadramon","asianeko","foxamoore","monique","quotingmungo","net-cat","pickra","fender"]; function CheckForConventionNaming(term){ // I know YCH is not a convention, but it needs to be termed as a all caps response var conventions=["ych","fc","mwff","mwf","fwa","blfc","cf","ac","sc","ef","ane","jftw","mp","bc","mff","af","ao","fau","ff","fm","fu","mcfc","nc","nfc","bff","bc","cc","ifc"]; if(conventions.indexOf(term)>-1){ scx=$("#messagecenter-other #messages-journals li strong a:icontains('"+term+"')").length; if(scx===0){theStreamCount=' '+term.toUpperCase()+': '+scx+' ';} else{theStreamCount=' '+term.toUpperCase()+': '+scx+' ';} } else if(term=="cfz"){ // Due to the way Confuzzled stylise their name, it has a unique condition here. scx=$("#messagecenter-other #messages-journals li strong a:icontains('"+term+"')").length; if(scx===0){theStreamCount=' CFz: '+scx+'';} else{theStreamCount=' CFz: '+scx+'';} } else{ scx=$("#messagecenter-other #messages-journals li:icontains('"+term+"')").length; if(scx===0){theStreamCount=' '+term.ucwords()+': '+scx+' ';} else{theStreamCount=' '+term.ucwords()+': '+scx+' ';} } } // Search for custom keywords if(staff_ident_mode=="false"){} else{ stafflist.forEach(function(staff){ $("#messagecenter-other #messages-journals li:icontains('"+staff+"') strong").first().before(' |