Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Profile Folder/chrome/JS/dino.uc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// ==UserScript==
// @name dino manifest loader
// @manifest dino
// ==/UserScript==
61 changes: 61 additions & 0 deletions Profile Folder/chrome/JS/userChrome.uc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
window.addEventListener("load", function() {
const chromeRedirects = {
"chrome://settings": "about:preferences",
"chrome://extensions": "about:addons",
"chrome://history": "about:history",
"chrome://downloads": "about:downloads",
"chrome://bookmarks": "about:bookmarks",
};
const chromeDirect = {
"chrome://dino": "chrome://dino/content/dino.html",
};
const reverseRedirects = {};
for (let [chrome, about] of Object.entries(chromeRedirects)) {
reverseRedirects[about] = chrome;
}
let lastTypedChrome = null;
function spoofURL(url) {
if (lastTypedChrome) {
gURLBar.value = lastTypedChrome;
lastTypedChrome = null;
return;
}
if (url.startsWith("about:") && !url.startsWith("about:newtab") && !url.startsWith("about:blank") && !url.startsWith("about:home")) {
gURLBar.value = reverseRedirects[url] || url.replace("about:", "chrome://");
}
}
setTimeout(() => spoofURL(gBrowser.selectedBrowser.currentURI.spec), 500);
gBrowser.addTabsProgressListener({
onLocationChange(browser, progress, request, location) {
if (browser === gBrowser.selectedBrowser) {
spoofURL(location.spec);
}
}
});
gBrowser.tabContainer.addEventListener("TabSelect", function() {
setTimeout(() => spoofURL(gBrowser.selectedBrowser.currentURI.spec), 500);
});
gURLBar.addEventListener("keydown", function(e) {
if (e.key === "Enter") {
let val = gURLBar.value.trim();
if (val.startsWith("chrome://")) {
e.preventDefault();
e.stopPropagation();
gURLBar.view.close();
if (chromeDirect[val]) {
lastTypedChrome = val;
gBrowser.loadURI(Services.io.newURI(chromeDirect[val]), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
});
} else {
let real = chromeRedirects[val] || val.replace("chrome://", "about:");
lastTypedChrome = val;
gBrowser.loadURI(Services.io.newURI(real), {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
});
}
gBrowser.selectedBrowser.focus();
}
}
}, true);
});
Loading