// ==UserScript== // @name FA Journal Breakdown (For use with Tampermonkey) // @namespace FurAffinity // @version 1.8 // @description Provides a breakdown of your journal list // @author JaysonHusky // @grant GM_getValue // @grant GM_setValue // @match https://www.furaffinity.net/msg/others/ // @match https://www.furaffinity.net/controls/user-settings/ // @require https://code.jquery.com/jquery-latest.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Setup keywords var myKeywords; // 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 { return "undefined"; } } // 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(STATIC_PATH=="/themes/beta"){ $('.content .section-divider').after(`

FA Journal Breakdown Control Panel


Custom Keywords

Enter keywords here for the addon to identify in journal titles.
Keywords MUST be comma seperated and usernames MUST match the username of the page, NOT the URL.
Singular terms like "Stream" will match "Streams" etc.
Please do NOT use the terms "posted by" or "hours ago" as they will match every journal.
It is preferred not to have spaces between keywords, but the addon will edit them out should they be included.


*Updates take effect from the next page load
FA Journal Breakdown by JaysonHusky
`); } else { $('.footer').before(`
Custom Keywords

Enter keywords here for the addon to identify in journal titles.
Keywords MUST be comma seperated and usernames MUST match the username of the page, NOT the URL.
Singular terms like "Stream" will match "Streams" etc.
Please do NOT use the terms "posted by" or "hours ago" as they will match every journal.
It is preferred not to have spaces between keywords, but the addon will edit them out should they be included.

   

FA Journal Breakdown by JaysonHusky

*Updates take effect from the next page load
`); } } FAJBM_Load(); // Setup the hook var KeywordTitle; if(STATIC_PATH=="/themes/beta"){ KeywordTitle=$("#messages-journals h2").append('
Journal breakdown by term:'); } else { KeywordTitle=$("#messages-journals h3").first().append('
Journal breakdown by term:'); } // Sort Keywords alphabetically myKeywords = myKeywords.sort(); // Creating the var's var StreamCounter,scx,theStreamCount2,strtouc,CommCounter; // 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(); }); }; // Search for custom keywords myKeywords.forEach(function(keyword) { scx=$("#messagecenter-other #messages-journals li:icontains('"+keyword+"')").length; theStreamCount2='   '+keyword+': '+scx+''; // Add custom keywords to Journal header $(KeywordTitle).append(theStreamCount2.ucwords()); // Highlight when clicked (deselect all others) $("."+keyword).click(function(){ if(STATIC_PATH=="/themes/beta"){ $("#messagecenter-other #messages-journals li:icontains('"+keyword+"')").css('background','#535d75'); $("#messagecenter-other #messages-journals li:not(:icontains("+keyword+"))").css('background','transparent'); } else { $("#messagecenter-other #messages-journals li:icontains('"+keyword+"')").css('background','rgba(1,0,0,0.2'); $("#messagecenter-other #messages-journals li:not(:icontains("+keyword+"))").css('background','transparent'); } }); }); })();