// ==UserScript== // @name Crunchyroll Queue Tile Mode // @namespace http://tampermonkey.net/ // @version 2.11 // @description Changes the Crunchyroll queue to be shown as tiles instead of a list. // @author /u/mythriz // @match https://www.crunchyroll.com/home/queue // @grant GM_addStyle // @icon https://www.crunchyroll.com/i/beta/ios_icon/cr_ios.png // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js // @downloadURL none // ==/UserScript== // JQuery 1.11.1 seems to be the version loaded on Crunchyroll, so I put that in the @require meta key here too. (function() { 'use strict'; ///////////////// Options ///////////////// // Set this to auto to use the entire browser width, or f.ex. 1300px which should give 4 tiles per line var page_width = 'auto'; // Different modes for the show and episode information: // embed - overlays information on top of the preview image // below - shows the information under the preview image // float - hides the information, but shows it when you hold the mouse over the tile var show_information_mode = 'embed'; // This option decides whether to show the entire title of the anime or to crop it if it's too long (longer than one line) var show_full_title = 0; // Same as above but for the episode name var show_full_episode_name = 0; // In "float" mode it should be fine to show the full title and episode name, but for the other two modes it's better to crop them. // Changes the size of the preview image (and also the size of the tile if you use embedded mode) var preview_width = 300; // Calculate a 16:9 size height: var preview_height = preview_width/16*9; // But it will also work if you use a different height. Try square-shaped tiles if you want! // Replaces the "premium" preview image (with a crown in the corner) with the regular preview image var hide_premium_crown = 1; // Note that the script replaces the preview images with slightly larger versions (200x113 instead of 160x90), // but I couldn't find a larger version of the preview with the crown on it, so it'll stay 160x90 if you keep it. // The text and background color for the title and episode name box, set the last number inside "rgba" to 1 if you don't want it to be transparent // If you use float mode, setting the opacity to 1 is recommended. var info_bg_color = 'rgba(255, 255, 255, 0.7)'; var info_text_color = 'black'; // This value sets how opaque the info box is before you move the mouse over the tile. // You can set this to 0 to make the info box completely invisible until you move the mouse over the tile, // or set it to 1 to make it fully opaque (except for the BG color). var info_start_opacity = '0.7'; // This variable is ignored in "float" mode. // The color of the play button var play_button_fill_color = 'orange'; var play_button_outline_color = 'white'; var play_button_outline_width = '3px'; // You can also use only the outline with a transparent fill color if you want, for example: // var play_button_fill_color = 'transparent'; // var play_button_outline_color = 'orange'; // var play_button_outline_width = '4px'; ///////////////// The actual work ///////////////// // Makes the list fill the entire width of the browser window instead of being resized into a fixed-width column GM_addStyle('#template_container.template-container { width: '+page_width+'; padding: 40px}'); //GM_addStyle('#main_content { width: calc(100% - 300px); }'); GM_addStyle('#main_content { width: 100%; }'); // Using flexboxes instead of floating all the tiles to make them line up and wrap to a new line GM_addStyle('ul#sortable { display: flex; flex-wrap: wrap; }'); // Sets the tile width, also removes padding to make sure the episode preview fills the entire tile GM_addStyle('ul#sortable li { width: '+preview_width+'px; margin-right: 15px; margin-bottom: 10px;}'); GM_addStyle('#source_home .landscape-grid li .queue-wrapper { width: 100% !important; height: auto; }'); GM_addStyle('ul#sortable a.episode { width: 100% !important; padding: 0; }'); GM_addStyle('.episode-progress-bar { position: absolute; top: '+(preview_height)+'px; width: 100%; }'); // Replaces IMG element with a DIV element, setting the preview image as its background. // That way even with f.ex. square-shaped tiles, the image won't be stretched. $('#main_content .landscape-element img.landscape').each( function() { var image_url = $(this).attr('src'); if (hide_premium_crown) image_url = image_url.replace(/wide(star)?/g,'full'); else image_url = image_url.replace(/wide\.jpg?/g,'full.jpg'); $(this).replaceWith( $('