// ==UserScript== // @name PTH Record label collages on search // @version 0.3 // @description Show record label collages on searches that include a record label // @author Chameleon // @include http*://redacted.ch/torrents.php*recordlabel=* // @grant none // @namespace https://greasyfork.org/users/87476 // @downloadURL https://update.greasyfork.icu/scripts/25799/PTH%20Record%20label%20collages%20on%20search.user.js // @updateURL https://update.greasyfork.icu/scripts/25799/PTH%20Record%20label%20collages%20on%20search.meta.js // ==/UserScript== (function() { 'use strict'; var recordLabel = window.location.href.split('recordlabel=')[1].split('&')[0]; var div=document.createElement('div'); var stylesheets=document.styleSheets; var color=false; for(var i=0; iGo to collage search'; } else if(result.length === 1) { var r=result[0]; div.innerHTML = 'Collage: '+r.collage+', authored by '+r.author+'
'+r.torrents+' torrents, '+r.subscribers+' subscribers
Last updated: '+r.updated; if(r.tags.length > 0) div.innerHTML += '
Tags: '+r.tags; } else { div.innerHTML = result.length+' collages match the label \''+recordLabel+'\'
Go to collage search'; for(var i=0; i'+r.torrents+' torrents, '+r.subscribers+' subscribers
Last updated: '+r.updated; if(r.tags.length > 0) div.innerHTML += '
Tags: '+r.tags; } } } function xhr_func(messageDiv, xhr, func, repeatFunc) { if(xhr.readyState == 4) { if(xhr.status == 200) func(xhr.responseText); else { messageDiv.innerHTML = 'Error: '+xhr.status+'
retrying in 1 second'; window.setTimeout(repeatFunc, 1000); } } }