您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
is that thing tagged drabble actually a drabble
- // ==UserScript==
- // @name drabble judgment
- // @namespace http://tampermonkey.net/
- // @version 0.2
- // @description is that thing tagged drabble actually a drabble
- // @author scriptfairy
- // @match http*://archiveofourown.org/*works*
- // @grant none
- // ==/UserScript==
- (function($) {
- var works = $('li.blurb');
- for (i=0;i<works.length;i++) {
- var freeforms = $('li.freeforms',works[i]), wordCount = $('dd.words',works[i]).text(), chapterCount = $('dd.chapters',works[i]).text();
- wordCount = parseInt(wordCount.replace(',',''));
- chapterCount = parseInt(chapterCount.substring(0,chapterCount.indexOf('/')));
- freeforms = freeforms.filter(function(index){
- return $(this).text().search(/[Dd]rabbles?$/) != -1;
- });
- if (freeforms.length >= 1 && (wordCount/chapterCount <= 90 || (wordCount/chapterCount >= 110) && wordCount/chapterCount <= 300)) {
- $('a',freeforms[0]).text('Probably not a Drabble');
- }
- else if (freeforms.length >=1 && wordCount/chapterCount > 300 && wordCount/chapterCount <= 1000) {
- $('a',freeforms[0]).text('Not actually a Drabble');
- }
- else if (freeforms.length >=1 && wordCount/chapterCount > 1000) {
- $('a',freeforms[0]).text('NOTHING LIKE A DRABBLE');
- }
- }
- })(window.jQuery);