// ==UserScript== // @name FIMFiction - Remaining Words and Reading Time // @namespace Selbi // @include http*://fimfiction.net/* // @include http*://www.fimfiction.net/* // @version 2.1 // @description Displays average reading time left and overall story progress. // @downloadURL none // ==/UserScript== /////////////////// // Read Time // (Word Count / Time In Seconds) * 60 var WPM = 277; // This is my personal reading speed. Feel free to change it to your liking. /////////////////// var words, readstax, chapterstotal, rege, firstwords, currentstory=0, total, totalundread, currentwords, timeleft, totaltime, chaptersremaining, percentage, int, intx, block1, block2, block3; var alluls = document.getElementsByTagName('ul'); for (var int=0; int 2) { words[intx].innerHTML = '[~' + convertToTime(currentwords) + "]  " + words[intx].innerHTML; //} } timeleft = convertToTime(totalunread); totaltime = convertToTime(total); percentage = ((Math.round((totalunread/total)*10000))/100).toFixed(2); Npercentage = ((Math.round((1-(totalunread/total))*10000))/100).toFixed(2); chppercent = ((Math.round((chaptersremaining/chapterstotal)*10000))/100).toFixed(2); var sep = "   "; var sep2 = '  '; var B_ProgressBar = '' + Npercentage + '%'; var B_AvgWords = 'Avg. words/chapter: ' + Math.ceil(total/chapterstotal); var B_TotalTime = '[~' + totaltime + "]"; var B_TotalTime_Remaining = '[~' + timeleft + " / ~" + totaltime + ']'; var B_Status_Read = "✔" + " All chapters read."; var B_Status_Unread = "✘" + " Unread."; var B_Status_NullStory = "This story has no words."; var B_RemainingWords = '' + numberWithCommas(totalunread) + ""; var B_RestHTML = words[words.length-1].innerHTML; var WordBlockHTML = words[words.length-1]; if (isNaN(percentage)) { // empty story WordBlockHTML.innerHTML = B_Status_NullStory + sep + B_RestHTML; } else if (Npercentage == 0) { // unread story WordBlockHTML.innerHTML = B_Status_Unread + sep + B_ProgressBar + sep + B_TotalTime + sep2 + B_RestHTML; } else if (Npercentage == 100) { // read story WordBlockHTML.innerHTML = B_Status_Read + sep + B_ProgressBar + sep + B_TotalTime + sep2 + B_RestHTML; } else { // in-progress story WordBlockHTML.innerHTML = B_ProgressBar + sep + B_TotalTime_Remaining + sep + B_RemainingWords + sep + "/" + sep2 + B_RestHTML; } } } function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } function convertToTime(x) { var time = (Math.ceil(x/WPM)); if (time > 60) { time = ((Math.ceil(time/6))/10).toFixed(1) + " h"; } else { time += " min"; } return time; }