diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..1624883 --- /dev/null +++ b/src/README.md @@ -0,0 +1,16 @@ +# borderify + +**This add-on injects JavaScript into web pages. The `addons.mozilla.org` domain disallows this operation, so this add-on will not work properly when it's run on pages in the `addons.mozilla.org` domain.** + +## What it does + +This extension just includes: + +* a content script, "borderify.js", that is injected into any pages +under "mozilla.org/" or any of its subdomains + +The content script draws a border around the document.body. + +## What it shows + +* how to inject content scripts declaratively using manifest.json diff --git a/src/button/mochafox-19.png b/src/button/mochafox-19.png new file mode 100644 index 0000000..fa5846e Binary files /dev/null and b/src/button/mochafox-19.png differ diff --git a/src/button/mochafox-38.png b/src/button/mochafox-38.png new file mode 100644 index 0000000..fa5846e Binary files /dev/null and b/src/button/mochafox-38.png differ diff --git a/src/icons/LICENSE b/src/icons/LICENSE new file mode 100644 index 0000000..9f3eac1 --- /dev/null +++ b/src/icons/LICENSE @@ -0,0 +1 @@ +The icon “border-48.png” is taken from the Google Material Design iconset, and is used under the terms of the Creative Commons Attribution-ShareAlike license: http://creativecommons.org/licenses/by-sa/3.0/. diff --git a/src/icons/mochafox-48.png b/src/icons/mochafox-48.png new file mode 100644 index 0000000..fa5846e Binary files /dev/null and b/src/icons/mochafox-48.png differ diff --git a/src/manifest.json b/src/manifest.json new file mode 100644 index 0000000..3913a5f --- /dev/null +++ b/src/manifest.json @@ -0,0 +1,36 @@ +{ + "browser_specific_settings": { + "gecko": { + "id": "mochafox@mochapowered.com" + } + }, + + "description": "Adds additional debugging features to Mocha pages", + "manifest_version": 2, + "name": "MochaFox", + "version": "1.0", + "homepage_url": "https://get.mochapowered.com/mochafox", + "icons": { + "48": "icons/mochafox-48.png" + }, + + "content_scripts": [ + { + "matches": [ "*://*.privatesuv.com/*" ], // ["*://*.mozilla.org/*"], + "js": [ + "mochafox.js" + ], + "css": ["mochafox.css"] + } + ], + "browser_action": { + "default_icon": { + "19": "button/mochafox-19.png", + "38": "button/mochafox-38.png" + }, + "default_title": "MochaFox", + "default_popup": "popup/index.html" + } + + +} diff --git a/src/mochafox.css b/src/mochafox.css new file mode 100644 index 0000000..789c08d --- /dev/null +++ b/src/mochafox.css @@ -0,0 +1,101 @@ +/** + * Copyright (C) 2025 Michael Becker + * + * This file is part of src. + * + * src is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * src is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with src. If not, see . + */ + + div.mcx-suvutils + { + display: flex; + height: 100%; + top: 0px; + pointer-events: none; +} + +div.mcx-suvutils > div.tab-buttons +{ + align-self: center; + pointer-events: all; +} + +div.mcx-suvutils > div.tab-content +{ + position: relative; + height: 100%; + background-color: #eee; + border-left: 1px solid #aaa; + width: 0px; + transition: all 0.3s; + pointer-events: all; +} + +div.mcx-suvutils.uwt-expanded > div.tab-content +{ + width: 512px; +} + +div.mcx-suvutils > div.tab-buttons > button +{ + border: 1px solid #aaaaaa; + display: block; + height: 80px; + width: 96px; + margin: 0px; + padding: 0px; + text-transform: uppercase; +} + +div.uwt-floating +{ + position: fixed; + z-index: 1000; +} +div.uwt-floating.uwt-dock-right +{ + right: 0px; +} + +div.tab-page +{ + position: absolute; + left: 0px; + right: 0px; + top: 0px; + bottom: 0px; + opacity: 0; + visibility: hidden; + + padding: 16px; +} +div.tab-page.uwt-selected +{ + opacity: 1; + visibility: visible; +} + +div.tab-page > iframe +{ + border: none; + + position: absolute; + left: 0px; + top: 0px; + right: 0px; + bottom: 0px; + + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/src/mochafox.js b/src/mochafox.js new file mode 100644 index 0000000..2e7d6ba --- /dev/null +++ b/src/mochafox.js @@ -0,0 +1,276 @@ +function expandCollapse(expanded) +{ + if (typeof(expanded) === 'boolean') + { + var suvutils = document.getElementById("suvutils"); + if (expanded) + { + suvutils.className = "uwt-floating uwt-docked uwt-dock-right mcx-suvutils uwt-expanded"; + suvutils.expanded = true; + } + else + { + suvutils.className = "uwt-floating uwt-docked uwt-dock-right mcx-suvutils"; + suvutils.expanded = false; + } + } + else + { + var suvutils = document.getElementById("suvutils"); + expandCollapse(!suvutils.expanded); + } +} + +function switchPage(index) +{ + var suvutils = document.getElementById("suvutils"); + if (suvutils.currentPage == index) + { + suvutils.currentPage = -1; + expandCollapse(false); + } + else + { + suvutils.currentPage = index; + expandCollapse(true); + } +} + +var suvutils = document.getElementById("suvutils"); +if (!suvutils) +{ + suvutils = document.createElement("div"); + suvutils.id = "suvutils"; + suvutils.className = "uwt-floating uwt-docked uwt-dock-right mcx-suvutils"; + document.body.appendChild(suvutils); +} +else +{ + suvutils.innerHTML = ""; +} +suvutils.currentPage = -1; +suvutils.expanded = false; + +suvutils.select_content = function (content) +{ + if (this.__selected_content == content) + { + expandCollapse(false); + this.__selected_content = null; + return; + } + else + { + expandCollapse(true); + } + + var contents = this.children[1]; + for (var i = 0; i < contents.children.length; i++) + { + if (contents.children[i] === content) + { + contents.children[i].className = "tab-page uwt-selected"; + this.__selected_content = content; + } + else + { + contents.children[i].className = "tab-page"; + } + } +}; + +function addButton(title, filename) +{ + var suvutils = document.getElementById("suvutils"); + var buttons = suvutils.children[0]; + var contents = suvutils.children[1]; + + var btn = document.createElement("button"); + btn.__filename = filename; + btn.innerHTML = title; + btn.addEventListener("click", function(e) + { + var suvutils = document.getElementById("suvutils"); + suvutils.select_content(this.__content); + + this.__content.innerHTML = ""; + + if (typeof (this.__filename) === 'string') { + var frame = document.createElement("iframe"); + this.__content.appendChild(frame); + + var url_obj = URL.parse(this.__filename); + if (url_obj !== null) { + frame.src = this.__filename; + } + else { + var url = browser.extension.getURL(this.__filename); + frame.src = url; + } + } + else if (typeof (this.__filename) === 'function') + { + var obj = this.__filename(); + this.__content.appendChild(obj); + } + }); + + buttons.appendChild(btn); + + var content = document.createElement("div"); + content.className = "tab-page"; + + var content_title = document.createElement("h1"); + content_title.innerHTML = title; + content.appendChild(content_title); + btn.__content = content; + + contents.appendChild(content); +} + +var divButtons = document.createElement("div"); +divButtons.className = "tab-buttons"; +suvutils.appendChild(divButtons); + +var divContent = document.createElement("div"); +divContent.className = "tab-content"; +suvutils.appendChild(divContent); + +addButton("Tasks", function () +{ + var div = document.createElement("div"); + var buttons = document.createElement("div"); + buttons.className = "uwt-toolbar"; + + var btnAdd = document.createElement("button"); + btnAdd.innerHTML = ""; + buttons.appendChild(btnAdd); + + var btnRemove = document.createElement("button"); + btnRemove.innerHTML = ""; + buttons.appendChild(btnRemove); + + div.appendChild(buttons); + + var lvTasks = document.createElement("table"); + lvTasks.className = "uwt-listview"; + + var thead = document.createElement("thead"); + var tr = document.createElement("tr"); + + var th1 = document.createElement("th"); + th1.innerHTML = "Task"; + tr.appendChild(th1); + + thead.appendChild(tr); + lvTasks.appendChild(thead); + + var tasks = + [ + { + "url": "/super/d/inst/1$1.htmld", + "title": "View Class (default tasks implementation)" + }, + { + "url": "/super/d/task/2997$12.htmld", + "title": "View Class (task, should use Initiating Element)" + }, + { + "url": "/super/d/inst/1$1/rel-task/2997$12.htmld", + "title": "View Class (related task on `Class`)" + } + ]; + + var tbody = document.createElement("tbody"); + + for (var i = 0; i < tasks.length; i++) + { + tr = document.createElement("tr"); + + var td = document.createElement("td"); + + var a = document.createElement("a"); + a.href = tasks[i].url; + a.innerHTML = tasks[i].title; + td.appendChild(a); + + tr.appendChild(td); + + tbody.appendChild(tr); + } + lvTasks.appendChild(tbody); + + div.appendChild(lvTasks); + + return div; +}); +addButton("Common", function () { + var div = document.createElement("div"); + + var lvTasks = document.createElement("table"); + lvTasks.className = "uwt-listview"; + + var thead = document.createElement("thead"); + var tr = document.createElement("tr"); + + var th1 = document.createElement("th"); + th1.innerHTML = "Task"; + tr.appendChild(th1); + + thead.appendChild(tr); + lvTasks.appendChild(thead); + + var tasks = + [ + { + "url": "/suv/suvinfo.html", + "title": "SUV Info", + "seeInNewWindow": true + } + ]; + + var tbody = document.createElement("tbody"); + + for (var i = 0; i < tasks.length; i++) + { + tr = document.createElement("tr"); + + var td = document.createElement("td"); + + var a = document.createElement("a"); + a.href = tasks[i].url; + a.innerHTML = tasks[i].title; + if (tasks[i].seeInNewWindow) + { + a.target = "_blank"; + } + td.appendChild(a); + + tr.appendChild(td); + + tbody.appendChild(tr); + } + lvTasks.appendChild(tbody); + + div.appendChild(lvTasks); + + return div; +}); +addButton("Changes", "panel-changes.html"); +// addButton("Bugs", "https://gitea.azcona-becker.net:3000/mochapowered/mocha-suv"); +addButton("Clipboard", function () +{ + var div = document.createElement("div"); + + var buttons = document.createElement("div"); + buttons.className = "uwt-toolbar"; + + var btn1 = document.createElement("button"); + btn1.innerHTML = "Copy"; + buttons.appendChild(btn1); + + div.appendChild(buttons); + return div; +}); + +expandCollapse(false); \ No newline at end of file diff --git a/src/mochafox.xpi b/src/mochafox.xpi new file mode 100644 index 0000000..3e5ec9e Binary files /dev/null and b/src/mochafox.xpi differ diff --git a/src/panel-changes.html b/src/panel-changes.html new file mode 100644 index 0000000..96612fb --- /dev/null +++ b/src/panel-changes.html @@ -0,0 +1,19 @@ + + diff --git a/src/panel-clipboard.html b/src/panel-clipboard.html new file mode 100644 index 0000000..96612fb --- /dev/null +++ b/src/panel-clipboard.html @@ -0,0 +1,19 @@ + + diff --git a/src/panel-common.html b/src/panel-common.html new file mode 100644 index 0000000..e596707 --- /dev/null +++ b/src/panel-common.html @@ -0,0 +1,20 @@ + + +

common goes here

\ No newline at end of file diff --git a/src/panel-tasks.html b/src/panel-tasks.html new file mode 100644 index 0000000..6f45211 --- /dev/null +++ b/src/panel-tasks.html @@ -0,0 +1,20 @@ + + +

Blah blah said the blah blah

diff --git a/src/popup/index.html b/src/popup/index.html new file mode 100644 index 0000000..0cde8dd --- /dev/null +++ b/src/popup/index.html @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/popup/popup.css b/src/popup/popup.css new file mode 100644 index 0000000..8002b1a --- /dev/null +++ b/src/popup/popup.css @@ -0,0 +1,95 @@ +/** + * Copyright (C) 2025 Michael Becker + * + * This file is part of src. + * + * src is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * src is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with src. If not, see . + */ + +@media (prefers-color-scheme: dark) { + /* Dark theme styles go here */ + body + { + background-color: #242426; + color: #aaa; + } + ul > li > a + { + color: #fff; + } + ul > li > a:hover + { + background-color: #666; + } + ul > li > a:active + { + background-color: #444; + } +} +@media (prefers-color-scheme: light) { + /* Light theme styles go here */ + body + { + background-color: #fffffc; + color: #797a72; + } + ul > li > a + { + color: #161017; + } + ul > li > a:hover + { + background-color: #d3d3d0; + } + ul > li > a:active + { + background-color: #b0b0ad; + } +} + +body +{ + cursor: default; + padding: 0px; + font-family: sans-serif; + font-size: 10pt; + -moz-user-select: none; + user-select: none; +} +ul +{ + margin: 0px; + padding: 0px; + list-style-type: none; +} +ul > li +{ + padding: 10px; +} +ul > li > a +{ + cursor: default; + display: block; + margin: -8px; + padding: 8px; + text-decoration: none; + border-radius: 8px; +} +ul > li.uwt-menu-item-header +{ + font-size: 8pt; + text-transform: uppercase; + text-align: center; + letter-spacing: 0.2ch; +} \ No newline at end of file diff --git a/src/popup/popup.js b/src/popup/popup.js new file mode 100644 index 0000000..38076ac --- /dev/null +++ b/src/popup/popup.js @@ -0,0 +1,57 @@ +// Copyright (C) 2025 Michael Becker +// +// This file is part of src. +// +// src is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// src is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with src. If not, see . + + +var menu = document.getElementById("menu"); + +function addCommandMenuItem(title, url) +{ + var li = document.createElement("li"); + li.className = "uwt-menu-item-command"; + var a = document.createElement("a"); + a.href = "#"; + a.innerHTML = title; + li.appendChild(a); + li.addEventListener("click", function() + { + if (typeof (url) === 'string') { + window.open(url); + } + window.close(); + }); + menu.appendChild(li); + return li; +} +function addHeaderMenuItem(title) +{ + var li = document.createElement("li"); + li.className = "uwt-menu-item-header"; + var span = document.createElement("span"); + span.innerHTML = title; + li.appendChild(span); + menu.appendChild(li); + return li; +} + +addHeaderMenuItem("Running"); +addCommandMenuItem("i-041280314785ab494", "https://i-041280314785ab494.privatesuv.com/"); +addHeaderMenuItem("Custom"); +addCommandMenuItem("justin's war"); +addCommandMenuItem("impl"); +addHeaderMenuItem("Manage SUVs"); +addCommandMenuItem("Manage SUV Connections"); +addCommandMenuItem("Refresh SUV Connections"); \ No newline at end of file