summaryrefslogtreecommitdiff
path: root/extension/background.js
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2021-03-22 22:33:06 -0700
committerOmar Rizwan <omar@omar.website>2021-03-22 22:33:06 -0700
commitd539660c93aa5e335321b44838f4b58e39662580 (patch)
tree39bda132ed0384a8de84ee9029b2f7cb293a4ac5 /extension/background.js
parent2819f3325b203a8390a25bf2e073ff6968d295ef (diff)
downloadTabFS-d539660c93aa5e335321b44838f4b58e39662580.tar.gz
TabFS-d539660c93aa5e335321b44838f4b58e39662580.zip
extension: Remove html for now.
Diffstat (limited to 'extension/background.js')
-rw-r--r--extension/background.js85
1 files changed, 0 insertions, 85 deletions
diff --git a/extension/background.js b/extension/background.js
index 92421b6..fc9e7f8 100644
--- a/extension/background.js
+++ b/extension/background.js
@@ -536,91 +536,6 @@ Router["/runtime/reload"] = {
},
truncate() { return {}; }
};
-Router["/runtime/background.js.html"] = defineFile(async () => {
- const js = await window.fetch(chrome.runtime.getURL('background.js'))
- .then(r => r.text());
-
- const classes = [
- [/Router\["[^\]]+"\] = /, 'route']
- ];
-
- const classedJs =
- js.split('\n')
- .map((line, i) => {
- const class_ = classes.find(([re, class_]) => re.test(line));
- line = line
- .replace(/&/g, "&amp;")
- .replace(/</g, "&lt;")
- .replace(/>/g, "&gt;")
- .replace(/"/g, "&quot;")
- .replace(/'/g, "&#039;");
- if (!class_) { return `<div class="normal line">${line}</div>`; }
- return `<div class="${class_[1]} line">${line}</div>`;
- })
- .join('');
-
- return `
-<html>
- <head>
- <style>
- body { overflow-x: hidden; }
- .route { background-color: rgb(255, 196, 196); }
- .line { position: absolute; height: 15px; width: 100%; }
- .line { transition: height 0.5s cubic-bezier(0.64, 0.08, 0.24, 1), transform 0.5s cubic-bezier(0.64, 0.08, 0.24, 1); }
- </style>
- </head>
- <body>
- <!-- <dl>
- ${Object.entries(Router).map(([a, b]) => `
- <dt>${a}</dt>
- <dd>${b}</dd>
- `).join('\n')}
- </dl> -->
- <pre><code>${classedJs}</code></pre>
-
- <script>
- const lines = [...document.querySelectorAll('div.line')];
- function render() {
- let y = 0;
- for (let line of lines) {
- if (line.classList.contains('route') || line.dataset.expand == 'true') {
- line.style.height = '15px';
- line.style.transform = 'translate(0px, ' + y + 'px)';
- y += 15;
-
- } else {
- line.style.height = '15px';
- line.style.transform = 'translate(0px, ' + (y - 7.5) + 'px) scaleY(' + 2/15 + ')';
- y += 2;
- }
- }
- }
- render();
-
- for (let line of lines) {
- function treatNeighborLines(line, expand) {
- let neighborLine = line;
- while (neighborLine && !neighborLine.classList.contains('route')) {
- neighborLine.dataset.expand = expand;
- neighborLine = neighborLine.nextElementSibling;
- }
- neighborLine = line;
- while (neighborLine && !neighborLine.classList.contains('route')) {
- neighborLine.dataset.expand = expand;
- neighborLine = neighborLine.previousElementSibling;
- }
- render();
- }
- line.onmousedown = () => {
- treatNeighborLines(line, true);
- document.body.onmouseup = () => { treatNeighborLines(line, false); };
- };
- }
- </script>
- </body>
-</html>
- `;
-});
// Ensure that there are routes for all ancestors. This algorithm is
// probably not correct, but whatever. Basically, you need to start at