Initial commit

This commit is contained in:
Michael Becker 2025-01-13 14:31:23 -05:00
parent 0132578d62
commit 3f408c909e
16 changed files with 689 additions and 0 deletions

16
src/README.md Normal file
View File

@ -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

BIN
src/button/mochafox-19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
src/button/mochafox-38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

1
src/icons/LICENSE Normal file
View File

@ -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/.

BIN
src/icons/mochafox-48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

36
src/manifest.json Normal file
View File

@ -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"
}
}

101
src/mochafox.css Normal file
View File

@ -0,0 +1,101 @@
/**
* Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
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%;
}

276
src/mochafox.js Normal file
View File

@ -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 = "<i class=\"fa fa-plus\"></i>";
buttons.appendChild(btnAdd);
var btnRemove = document.createElement("button");
btnRemove.innerHTML = "<i class=\"fa fa-minus\"></i>";
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);

BIN
src/mochafox.xpi Normal file

Binary file not shown.

19
src/panel-changes.html Normal file
View File

@ -0,0 +1,19 @@
<!--
Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
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 <https://www.gnu.org/licenses/>.
-->

19
src/panel-clipboard.html Normal file
View File

@ -0,0 +1,19 @@
<!--
Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
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 <https://www.gnu.org/licenses/>.
-->

20
src/panel-common.html Normal file
View File

@ -0,0 +1,20 @@
<!--
Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
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 <https://www.gnu.org/licenses/>.
-->
<p>common goes here</p>

20
src/panel-tasks.html Normal file
View File

@ -0,0 +1,20 @@
<!--
Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
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 <https://www.gnu.org/licenses/>.
-->
<h3>Blah blah said the blah blah</h3>

29
src/popup/index.html Normal file
View File

@ -0,0 +1,29 @@
<!--
Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
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 <https://www.gnu.org/licenses/>.
-->
<html>
<head>
<link rel="stylesheet" href="popup.css" />
</head>
<body>
<ul id="menu">
</ul>
<script src="popup.js"></script>
</body>
</html>

95
src/popup/popup.css Normal file
View File

@ -0,0 +1,95 @@
/**
* Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
@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;
}

57
src/popup/popup.js Normal file
View File

@ -0,0 +1,57 @@
// Copyright (C) 2025 Michael Becker <alcexhim@gmail.com>
//
// 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 <https://www.gnu.org/licenses/>.
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");