// ==UserScript==
// @name Supercharged Local Directory File Browser
// @version 3.2.5
// @description Makes file:/// directory ("Index of...") pages (and many server-generated index pages) actually useful. Adds sidebar and preview pane, keyboard navigation, audio and video player, markdown/plain text preview and editing, image and font previews and grid views, sorting, user-defined shortcuts, more.
// @author Gaspar Schott (Michael Schrauzer) mshroud@gmail.com
// @license GPL-3.0-or-later
// @homepageURL https://openuserjs.org/scripts/gaspar_schot/Supercharged_Local_Directory_File_Browser
// @contributionURL https://paypal.me/mschrauzer
// @include file://*/
// @include file://*/?*
// @include *!localhost*/
// @require https://code.jquery.com/jquery-latest.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.4.2/markdown-it.js
// @require https://cdnjs.cloudflare.com/ajax/libs/markdown-it-footnote/3.0.1/markdown-it-footnote.min.js
// @require https://cdn.jsdelivr.net/npm/markdown-it-toc-done-right@2.1.0/dist/markdown-it-toc-made-right.min.js
// @require https://cdn.jsdelivr.net/npm/markdown-it-sub@1.0.0/dist/markdown-it-sub.min.js
// @require https://cdn.jsdelivr.net/npm/markdown-it-sup@1.0.0/dist/markdown-it-sup.min.js
// @require https://cdn.jsdelivr.net/npm/markdown-it-deflist@2.0.3/dist/markdown-it-deflist.min.js
// @require https://cdn.jsdelivr.net/npm/markdown-it-multimd-table@3.1.3/dist/markdown-it-multimd-table.min.js
// @require https://cdn.jsdelivr.net/npm/markdown-it-center-text@1.0.4/dist/markdown-it-center-text.min.js
// NOTE: By default, userscripts will not run on file:/// urls, so for this script to work, you will have to enable it in your browser extension settings.
// E.G.: For Tampermonkey in Chrome, go to Chrome the extension page, click the details button on the Tampermonkey pane and check 'Allow access to file URLs'.
// NOTE: Safari does not allow local directories to be browsed, so the script will not work on local directories, but it will work on remote directories (or on local directories through a local server).
// NOTE: This script was developed in Vivaldi, running on Mac OS Mojave. It has been tested in several other Chrome and Gecko-based browsers.
// It has been very minimally tested on Windows and not at all on other OSes or browsers. It should work, but please report any issues.
// @namespace https://greasyfork.org/users/16170
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
var $ = jQuery;
// ***** USER SETTINGS ***** //
const $settings = {
// Paste your exported settings between the two lines below:
//--------------------------------------------------------//
shortcuts: // N.B.: Directory links must end with "/", file links must end with another character.
// You may add as many menus and links as you like; just copy the example below and edit as needed.
// Local directory shortcuts must begin with "file:///"; external shortcuts must begin with the correct protocol ("http://" or "ftp://", etc.).
// Hint: you can add query strings to your urls to override user settings on a site by site basis.
// Note that because of same-origin security concerns, the browser will not allow you to navigate from an external webpage to a local directory.
// (But see this page for possible workarounds: https://stackoverflow.com/questions/39007243/cannot-open-local-file-chrome-not-allowed-to-load-local-resource)
[
{
"menu_title":"My Sample Menu",
"links":
[
{ "link_name":"My Directory Link 1", "link":"file:///Path/To/My/Directory/" },
{ "link_name":"My Directory Link 2", "link":"file:///Path/To/My/Directory_2/" },
{ "link_name":"My External Link", "link":"https://www.mywebpage.com/" },
{ "link_name":"My File Link", "link":"file:///Path/To/My/File.ext" },
]
},
{
"menu_title":"My Second Sample Menu",
"links":
[
{ "link_name":"My Directory Link 1", "link":"file:///Path/To/My/Directory/" },
{ "link_name":"My Directory Link 2", "link":"file:///Path/To/My/Directory_2/" },
{ "link_name":"My External Link", "link":"https://www.mywebpage.com/" },
{ "link_name":"My File Link", "link":"file:///Path/To/My/File.ext" },
]
},
],
UI_font: // Choose an installed font for the UI.
'lucidagrande, sans-serif',
UI_font_size: // Choose a default UI font size; use any standard CSS units.
'13px',
alternate_background: // If true (default true), alternate sidebar row background color.
true,
ignore_files: // If true (default), ignored files (see "$row_settings" below, after Keybindings and Changelog) will be greyed-out (default) in the file list and will not be loaded in the content pane when selected;
// If false, they will be treated as normal files, so if they are selected, the browser will attempt to download any file types it can't handle (which makes keyboard navigation inconvenient).
true,
hide_ignored_files: // If true, ignored files will be completely hidden from the file list;
// If false (default), ignored files will appear greyed-out.
false,
hide_invisibles: // Un*x/Mac OS only: If true (default), files or directories beginning with a "." will be hidden.
true,
hide_details: // If true (default), hide file and directory details; if false, show them.
true,
default_sort: // Choose from: 'name', 'size', 'date', 'kind', 'ext', 'default'.
// default = Chrome sorting: dirs on top, files alphabetical.
'default',
dirs_on_top: // If true, directories will always be listed firs except when sorting by "name" (since otherwise sorting by "name" would equal "default").
// If false (default), directories and files will be sorted together. (In practice, dirs will typically still be separated when sorting by size, kind, and extension.)
false,
apps_as_dirs: // Un*x/Mac OS only: if true, treat apps as directories; allows app contents to be browsed. This is the default behavior for Chrome.
// If false (default), treat apps as ignored files.
false,
dark_theme: // If true (default: false), gives the content pane a dark background, and inverts html and text content.
false,
grid_image_size: // Default = 200
200,
grid_font_size: // Default = 1
1,
autoload_media: // If true (defautl: true), the first audio or video file found in a directory will be automatically selected and loaded for playback; also, cover art (if any, will be loaded in the preview pane).
true,
autoload_index_files: // If true (default: false), automatically select first "index.ext" file found in directory.
false,
use_custom_icons: // if true (default), use custom icons for dirs and files
// if false, use browser/server default icons
true,
// TEXT EDITING SETTINGS
preview_text: // If true (default), show rendered plain text and markdown file load;
// if false, show editable source text on file load.
// Note that split_view = true overrides this setting.
true,
split_view: // If true (default: false), show split view on plain text file load
// if false, use default preview_text setting.
false,
sync_scroll: // Sync scrolling in split view.
false
//--------------------------------------------------------//
// Paste your exported settings between the above two lines.
};
// $ROW_TYPES:
// DO NOT DELETE ANY EXISTING CATEGORIES!
// Add file extensions for sorting and custom icon display to the existing categories.
// You can also define your own new categories, but do not add an extension to more than one row_type category.
// Do not add leading "." to the extensions.
const $row_types = {
// myCategory: ['ext1','ext2',],
dir: ['/'],
app: ['app/','app','exe','msi'],
archive: ['zip','rar','cbr','7z','tar','gz','dmg','pkg','archive'],
audio: ['mp3','m4a','aac','aif','aiff','ape','flac','ogg','wav','opus'],
font: ['otf','ttf','woff','woff2','afm','pfb','pfm','tfm'],
graphics: ['indd','idml','indt','icml','ai','eps','pages','qxp','qxb','qxd','mif','sla','dtp','pmd','pub','fm','book','inx'],
htm: ['htm','html','xhtm','xhtml'],
image: ['jpg','jpeg','png','apng','gif','bmp','webp','svg','tif','tiff','psd','raw','dng','cr2','nef','arw'],
markdown: ['md','markdown','mdown','mkdn','mkd','mdwn','mdtxt','mdtext'],
office: ['doc','docx','epub','xls','xlsx','xlm','odt','odf','rtf'],
pdf: ['pdf'],
text: ['txt','log','nfo'],
code: ['bak','bash','c','cnf','codes','conf','csh','cshrc','cson','css','default','dist','example','gemspec','h','hd','ini','js','json','jsx','less','list','local','lock','login','logout','lua','old','php','pl','plist','pth','py','rb','rc','rdoc','sass','sh','strings','tcl','vue','xml','yaml','yml'],
video: ['mpeg','mov','m4v','webm','mp4'],
};
// $ROW_SETTINGS: Ignore or Exclude files by extension
const $row_settings = {
ignore: // Files with these extensions will not be loaded if selected in the sidebar (prevents the browser from attempting to download the file).
['exe','doc','docx','rtf','xls','xlsx','odt','odp','csv','msi','dll','indd','idml','pages','numbers','tif','tiff','raw','dng','cr2','nef','arw','eps','psd','ai','afm','pfb','pfm','tfm','zip','pkg','swf','pls','ics','DS_Store','ds_store','ds_store','alias','dmg','gz','qxp','icon.jpg','thumbs.db','ape','srf','epub'],
exclude: // Files with these exensions will not be inverted in dark mode
['htm','html','xhtm','xhtml'],
};
// ***** END USER SETTINGS ***** //
// ## FEATURES INCLUDE:
// - Resizable sidebar and directory/file preview pane.
// - Arrow navigation in sidebar:
// - Up and Down Arrows select next/prev item.
// - Left and Right Arrows select next/prev item of same type.
// - Navigate sidebar by typed string.
// - Show/Hide file details (size (if avail), date modified (if avail), kind, extension).
// - Sort sidebar items by name or file details.
// - Default sort = sort by name with folders on top.
// - Preview all file types supported by browser (html, text, images, pdf, audio, video) plus fonts.
// - Preview and edit markdown and plain text files.
// - Markdown rendered with markdownit.js ( https://github.com/markdown-it/markdown-it ).
// - Uses Github Markdown styles for preview ( https://github.com/sindresorhus/github-markdown-css ), with a few customizations.
// - Support for:
// - TOC creation ( `${toc}` ) ( https://github.com/nagaozen/markdown-it-toc-done-right )
// - Multimarkdown table syntax ( https://github.com/RedBug312/markdown-it-multimd-table )
// - Live checkboxes ( `\[ ], [x]` ), allowed in lists and deflists.
// - Superscript ( `^sup^` ) ( https://github.com/markdown-it/markdown-it-sup )
// - Subscript ( `~sub~` ) ( https://github.com/markdown-it/markdown-it-sub )
// - Definition lists ( https://github.com/markdown-it/markdown-it-deflist; for syntax, see http://pandoc.org/MANUAL.html#definition-lists )
// - Centered text ( `->centered<-` ) ( https://github.com/jay-hodgson/markdown-it-center-text )
// - Footnotes ( https://github.com/markdown-it/markdown-it-footnote )
// - View source text, preview, or split pane with proportional sync scroll.
// - Save edited source text or previewed HTML.
// - Audio and video playback, with shuffle, loop, skip audio +/- 10 or 30 sec via keyboard.
// - Preview other files (e.g., lyrics or cover art) in same directory while playing audio.
// - User setting to autoload cover art (if any images in directory, load "cover.ext" or first image found)
// - Grid view for images and fonts.
// - User settings (see $settings in code; some settings can be changed via the main menu in the UI and will be remembered in URL query):
// - Light or Dark theme.
// - Bookmarks for local or remote directories.
// - Default image grid size.
// - Default UI font size and font-family.
// - Default UI font and font-size.
// - Default file sorting.
// - Sort with directories on top.
// - Treat apps as directories (MacOS and *nix only)
// - Show or hide invisible files.
// - Show or hide ignored files in the ignored files list (see $row_settings in code below $settings).
// - Show or hide file details.
// - Use custom file icons or browser defaults.
// - Autoload index.ext files.
// - Autoload cover art in directories with audio files.
// - Text editing default view: split, source, or preview.
// - Text editing sync scroll: on or off.
// ## KEYBINDINGS (These don't work in all browsers):
// - Arrow Up/Down: Select prev/next item.
// - If audio is playing, and prev/next file is also audio, it will be highlighted but not loaded in the audio player; press return to load it.
// - Arrow Left/Right: Select prev/next row of the same kind as the current selection.
// - If current selection is a media file, select and begin playback of the next media item.
// - Opt/Alt + Arrow Left/Right: Skip audio ±10s
// - Opt/Alt + Shift + Arrow Left/Right: Skip audio ±30s
// - Cmd/Ctrl + Arrow Up: Go to parent directory
// - Cmd/Ctrl + Arrow Down: Open selected directory
// - Return: Open selected directory, select file, or pause/play media.
// - Space: Pause/Play media files
// - Cmd/Ctrl + D: Toggle file details (size, date modified) in some index page types.
// - Cmd/Ctrl + G: Show or Reset Grid
// - Cmd/Ctrl + I: Toggle Invisibles
// - Cmd/Ctrl + Shift + O: Open selected item in new window/tab
// - Cmd/Ctrl + R: Reload grids and previewed content, reset scaled images/fonts, reset media files to beginning.
// - Cmd/Ctrl + W: Close previewed content (doesn't work in all browsers; use close button instead), or close window if no content is being previewed.
// - Cmd/Ctrl + Shift + < or >: Scale preview items and grids.
// CHANGELOG:
// **3.2.4** More Markdown goodness
// **ADDED:** Multimarkdown table syntax (https://github.com/RedBug312/markdown-it-multimd-table)
// **ADDED:** Markdown `->`centered text`<-` (https://github.com/jay-hodgson/markdown-it-center-text)
// **ADDED:** Markdown definition lists (https://github.com/markdown-it/markdown-it-deflist; for syntax, see http://pandoc.org/MANUAL.html#definition-lists)
// **ADDED:** Github Markdown styles for preview (https://github.com/sindresorhus/github-markdown-css), with a few customizations.
// **IMPROVED:** Allow checkboxes in definition lists (in both term and details).
// **FIXED:** Various issues with checkboxes and live updating.
// **FIXED:** Allow empty text files to be edited.
// **FIXED:** Markdown preview: Clicking up arrow on hovered header will scroll to TOC inserted with `${toc}` (if present) or to top of previewed text (wasn't working before).
// **FIXED:** Some long-standing bugs with image grid display.
// **FIXED:** A long-standing bug with clicking left and right arrows in preview pane; only images and fonts should be selected.
// **OTHER:** Improved documentation.
// **3.2.3** Markdown extensions
// **ADDED:** Markdown TOC (https://github.com/nagaozen/markdown-it-toc-done-right): Insert ${toc} in your text where you want the TOC to appear.
// **ADDED:** Markdown footnotes (https://github.com/markdown-it/markdown-it-footnote).
// **ADDED:** Markdown subscript (~sub~) (https://github.com/markdown-it/markdown-it-sub).
// **ADDED:** Markdown superscript (^sup^) (https://github.com/markdown-it/markdown-it-sup).
// **IMPROVED:** Added basic HTML head and body elements on save.
// **IMPROVED:** Markdown: made sync-scrolling proportional.
// **IMPROVED:** Markdown table styling.
// **OTHER:** Added 'opus' to the default list of supported audio formats.
// 3.2.2 More bug fixes.
// FIXED: Markdown source text was being interpreted as HTML.
// FIXED: Markdown checkboxes added to source weren't "live."
// IMPROVED: Markdown live preview update on input.
// IMPROVED: Markdown Nested blockquote styling.
// 3.2.1
// FIXED: A bad bug with saving source text.
// ADDED: Made text split-view resizable.
// IMPROVED: Various UI tweaks for text editing.
// 3.2.0
// **NEW!:** Preview, edit, and save Markdown and plain-text files. (Now how much would you pay? Or donate?)
// - Basic Markdown syntax is rendered via markdownit.js (https://github.com/markdown-it/markdown-it).
// - View editable source text or rendered HTML preview, or both in split pane.
// - Live preview of source edits in split-pane view.
// - Render Checkboxes/Checklists with [x] and [ ], with live updating of source text.
// - Save edited source text or rendered HTML.
// - More to come.
// - *Caveat:* You must manually save your work if you want to keep it; autosave is not possible.
// - Moreover, because of security concerns with local files, the editing iframe cannot communicate with the parent index page, or vice versa.
// - * It is therefore entirely possible to navigate away from the page and LOSE YOUR WORK. *
// To help prevent loss of work, the script will attempt to warn you when the editing pane loses focus (if you have made any edits),
// e.g., when you click in the script sidebar or in the browser UI, or when the browser tab/window or the browser itself loses focus.
// But note that if the editing pane is already unfocused, the warning will not be issued.
// ADDED: New user settings: set default view for markdown/text files: source or preview, or split pane view. See user settings for details.
// IMPROVED: Plain text and code file type detection.
// CHANGED: Treat files without extensions as text (code) files. (Extension-less binary files will still initiate a download.)
// FIXED: Malformed URI error if file name included "%".
// FIXED: Some issues with image zoom.
// FIXED: An issue with content pane sizing.
// FIXED: An issue with parent directory navigation.
// ***** GENERAL SETUP ***** //
// ************************************ //
// DON'T EDIT ANYTHING BELOW THIS LINE. //
// ************************************ //
const $userAgent = navigator.userAgent;
// PATHS
// Fix "%" error in file name; see https://stackoverflow.com/questions/7449588/why-does-decodeuricomponent-lock-up-my-browser
function decodeURIComponentSafe(uri, mod) {
var out = '', arr, i = 0, l, x;
typeof mod === "undefined" ? mod = 0 : 0;
arr = uri.split(/(%(?:d0|d1)%.{2})/);
for (l = arr.length; i < l; i++) {
try {
x = decodeURIComponent(arr[i]);
} catch (e) {
x = mod ? arr[i].replace(/%(?!\d+)/g, '%25') : arr[i];
}
out += x;
}
return out;
}
var $href = decodeURIComponentSafe(window.location.href); // complete URL including query string: http://www.host.com/path/to/my_dir/?query_string
var $location = decodeURIComponentSafe( [location.protocol, '//', location.host, location.pathname].join('') );
var $location_arr = $location.split('/');
var $current_dir_path = $location.replace(/\//g,'/').replace(/_/g,'_').replace(/—/g,'—').replace(/\\/g,'/'); // URL w/o query string for display
var $current_dir_name = $location.replace(/%20/g,' ').slice(0,-1);
$current_dir_name = $current_dir_name.slice($current_dir_name.lastIndexOf('/') + 1); // Dir name without parents for display: "my_dir"
// QUERY PREFS
var getQueryPrefs = function() { return new URLSearchParams( window.location.search ); };
var $query_prefs = getQueryPrefs();
var $UI_pref_width = $query_prefs.get('width') === null ? '25' : (Math.round(100*($query_prefs.get('width'))/window.innerWidth)).toString(); // number string
var $UI_pref_theme = $query_prefs.get('dark_theme') === null ? $settings.dark_theme : JSON.parse( $query_prefs.get('dark_theme') ); // bool
var $UI_pref_background = $query_prefs.get('alternate_background') === null ? $settings.alternate_background : JSON.parse( $query_prefs.get('alternate_background') ); // bool
var $UI_pref_details = $query_prefs.get('hide_details') === null ? $settings.hide_details : JSON.parse( $query_prefs.get('hide_details') );
var $UI_pref_sort = $query_prefs.get('sort') === null ? $settings.default_sort.toLowerCase() : $query_prefs.get('sort');
var $UI_pref_file = $query_prefs.get('file') === null ? '' : $query_prefs.get('file');
var $UI_pref_autoload_media = $query_prefs.get('autoload_media') === null ? $settings.autoload_media : JSON.parse( $query_prefs.get('autoload_media') );
var $UI_pref_split_view = $settings.split_view;
var $UI_pref_preview_text = $settings.preview_text;
// var $UI_pref_invisibles = $query_prefs.get('hide_invisibles') == null ? $settings.hide_invisibles.toLowerCase() : $query_prefs.get('hide_invisibles');
var $UI_pref_selected = $query_prefs.get('selected') === null ? '' : JSON.parse( $query_prefs.get('selected') );
var $UI_pref_history = $query_prefs.get('history') === null ? '' : $query_prefs.get('history');
var $UI_pref_history_arr;
var $grid_image_size = $settings.grid_image_size ? $settings.grid_image_size : 150;
var $grid_font_size = $settings.grid_font_size ? $settings.grid_font_size : 1;
// set query key/value
function setQuery(key, value) {
$query_prefs = getQueryPrefs();
$query_prefs.set( key, value );
updateQuery();
}
// toggle query key
function toggleQuery(key) {
var value;
$query_prefs = getQueryPrefs();
value = $query_prefs.has(key) ? JSON.parse( $query_prefs.get(key) ) : $settings[key];
value === true ? $query_prefs.set( key, 'false' ) : $query_prefs.set( key, 'true' );
updateQuery();
}
// update query string
function updateQuery() {
$query_prefs = decodeURIComponent($query_prefs);
window.history.replaceState({}, document.title, window.location.pathname +'?'+ $query_prefs);
}
// Styles for iFrame Directory Index pages
const $fileName = window.location.pathname.slice(window.location.pathname.lastIndexOf('/') + 1);
const $textFiles = $row_types.markdown.concat($row_types.text, $row_types.code);
if ( ( window.frameElement !== null || window.top !== window.self ) && window.location.href.endsWith('/') ) {
const $custom_iframe_styles = document.createElement("style");
const $font_size_units = $settings.UI_font_size.replace(/\d*/,'');
var $iframe_styles
= 'a.up { background:transparent; }' // B
+ ':root, html, body { background-color:#BBB; }'
+ 'body > table > thead, body > table > tbody > tr, body ul li { background:rgba(221,221,221,0.5); }'
+ 'body > table > tbody > tr:nth-of-type(odd), body > ul > li:nth-of-type(odd) { background:rgba(221,221,221,1); }'
+ 'body > table > tbody > tr:hover, body > ul > li:hover:not(:first-of-type) { background:#ABABAB; }'
+ ':root, html, body { border:0 !important; }'
+ 'body > table { border-top:solid 1px #888888; }'
+ 'body > ul > li:first-of-type { border-bottom:solid 1px #888888; }'
+ 'html, body { border-radius:0; }'
+ 'body > table { border-collapse:collapse; }'
+ 'html, body { box-sizing:border-box; }'
+ '#parentDirLinkBox span { color:transparent; }' // C
+ 'a:hover { color:#000000; }'
+ 'a, #parentDirLinkBox span:before { color:#111111; }'
+ '#parentDirLinkBox span:before { content:"Parent Directory"; }'
+ '#UI_goUp a.up:before { display:none; }' // D
+ 'a, li { display:block; }'
+ '#UI_goUp, #UI_showHidden { display:inline-table; }'
+ 'body > table table a:before { float:left; }' // F
+ ':root, html, body, * { font-family:'+ $settings.UI_font +'; }'
+ 'html, body { font-size:'+ parseFloat($settings.UI_font_size) * 0.875 + $font_size_units +'; }'
+ 'body > div, body > table, thead, body p { font-size: 1em; }'
+ 'body > ul > li:first-of-type, #parentDirLinkBox span:before, #UI_goUp a { font-weight:bold; }'
+ 'html { height:100%; }' // H
+ 'body { height:auto; }'
+ '#UI_goUp, #UI_showHidden, #UI_showHidden label { height:1.5em !important; }'
+ 'body > table > tbody > tr, body > ul > li { line-height:1.5; }' // L
+ '#UI_goUp, #UI_showHidden { line-height:2; }'
+ 'body > ul { list-style:none; }'
+ 'html, body, body div, body > ul > li a, #UI_goUp, #UI_showHidden, #parentDirLink, #parentDirLinkBox { margin:0; }' // M
+ 'body > div { margin:1em; }'
+ 'body p { margin:1rem; }'
+ 'body > ul > li { margin-bottom:0; }'
+ '.up { margin-inline-start:0; }'
+ '.dir::before, .file > img { margin-inline-end: 6px; }'
+ 'body table tr, body ul li, body > table > tbody > tr:hover { outline:0; }' // O
+ ':root, html, body, body > div, body > ul > li, .up { padding:0; }' // P
+ 'body > table > tbody > tr > td, body > table > thead > tr > th, body > ul > li a, #parentDirLinkBox, #UI_goUp, #UI_showHidden { padding-top:3px; }'
+ 'body > table > tbody > tr > td:first-of-type, body > table > thead > tr > th:first-of-type, body > ul > li a { padding-right:0; }'
+ 'body > table th:last-of-type, body > table > tbody > tr > td:last-of-type, body > ul > li a, #parentDirLinkBox, #UI_showHidden { padding-right:1em; }'
+ '#parentDirLinkBox { padding-bottom:0; }'
+ 'body > table > tbody > tr > td, body > table > thead > tr > th, body > ul > li a, #parentDirLinkBox, #UI_goUp, #UI_showHidden { padding-bottom:3px; }'
+ 'body > ul { padding-left:0; }'
+ 'body > table > tbody > tr > td:first-of-type, body > table > thead > tr > th:first-of-type, body > ul > li a, #parentDirLinkBox, #UI_goUp { padding-left:1em; }'
+ 'th:not(:first-of-type) { text-align:right; }' // T
+ 'th:first-of-type { text-align:left; }'
+ 'a, a:hover, td:hover, li:hover { text-decoration:none !important; }'
+ 'a.icon { text-indent:2px; }'
+ '#UI_goUp, #UI_showHidden { vertical-align:middle; }' // V
+ 'html, body, body > table { width:100%; }' // W
+ 'thead th:first-of-type { width:50%; }'
+ 'html, body { max-width:100%; }'
+ 'html, body { min-width:100%; }';
$('body').css({'font-family':$settings.UI_font});
$('body > h1, address, body > hr').remove();
$('body > table > tbody').find('hr').closest('tr').remove();
$('body > table th:contains("Name")').css({'text-align':'left'});
$('body > table th:contains("Size")').css({'text-align':'right'});
// pre type
if ( $('body > pre').length ) {
let $list_items = $('body pre').html();
let $parent_dir = $('body pre').find('a:contains("Parent")').first().attr('href');
$list_items = '
');
const $sample_string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 [(!@#$%^&*;:)]';
const $lorem_string = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
const $specimen = $('