To confirm that the main frame displays a directory listing, you can inject custom styles. This can be achieved through user scripts with a script manager or by creating a web extension.
( function () {
'use strict';
var
style = document.createElement( 'style' ),
text = 'body { border: 1px solid black; }'; // modify to fit your requirements
if ( location.protocol === 'file:' && document.querySelector(
'link[ href = "chrome://global/skin/dirListing/dirListing.css" ]'
) ) {
style.textContent = text;
document.head.appendChild( style );
}
} () );
You can test this code by executing it in the devtools console.
If using a script manager as a web extension, you can store the CSS text within the manager itself. For a standalone web extension, treat the script as the content script and manage the CSS on an options page (found on about:addons) that stores the CSS in the extension's storage.
Common script managers include Tampermonkey and Greasemonkey, but there are other alternatives available. (Please note that this is not an endorsement as I do not personally use these tools.)
The manifest file for a web extension would resemble:
{
"manifest_version": 2,
"name": "Answer",
"description": "Answer a Stack Overflow question",
"version": "0.1",
"content_security_policy": "default-src 'none'; object-src 'none'",
"browser_specific_settings": {
"gecko": {
"id": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="64050a17130116240a050a0d0305170c0d080017010910071302110b001810125105141612151e18191205191d121d1808f6faeae9f6ffefa5ecaea1eae7efaaededece5ebade1eceabeede7eca1bfaba3" target="_blank">@</a>"
}
},
"content_scripts": [ {
"js": [ "content.js" ],
"matches": [ "file:///*" ]
} ],
"options_ui": {
"browser_style": true,
"page": "options.htm"
},
"permissions": [
"storage"
]
}
where content.js
represents the script, and options.htm
serves as the panel for managing CSS on the about:addons
page. The storage
permission allows access to the browser.storage
API for storing and retrieving CSS.