Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,51 @@
define(["exports"], function (exports) {
"use strict";
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
child.__proto__ = parent;
};
var AppendChildController = (function (Controller) {
var AppendChildController = function AppendChildController(options) {
Controller.call(this, options);
};
_extends(AppendChildController, Controller);
AppendChildController.prototype.teardown = function () {
this.view = null;
this.target = null;
};
AppendChildController.prototype.open = function (target) {
this.target = target;
this.view.open();
};
AppendChildController.prototype.submit = function (tagName) {
var child = document.createElement(tagName);
if (!child) {
window.alert("Error creating " + tagName);
return;
}
AddonService.generate(this.target, function (generator) {
generator.opAppendChild(tagName);
});
};
return AppendChildController;
})(Controller);
exports["default"] = AppendChildController;
});

View file

@ -0,0 +1,100 @@
define(["exports"], function (exports) {
"use strict";
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
child.__proto__ = parent;
};
var CopyMoveController = (function (Controller) {
var CopyMoveController = function CopyMoveController(options) {
Controller.call(this, options);
};
_extends(CopyMoveController, Controller);
CopyMoveController.prototype.teardown = function () {
this.view = null;
this.target = null;
};
CopyMoveController.prototype.open = function (target) {
this.target = target;
this.view.domTree.filter = "#" + window.__customizer__.mainController.view.el.id;
this.view.domTree.setRoot(document.documentElement);
this.view.domTree.render();
this.view.modal.open();
};
CopyMoveController.prototype.cancel = function () {
this.view.modal.close();
};
CopyMoveController.prototype.select = function () {
this.destination = this.view.domTree.selectedNode;
this.view.dialog.open();
};
CopyMoveController.prototype.setMode = function (mode) {
this.mode = mode;
};
CopyMoveController.prototype.before = function () {
var _this = this;
AddonService.generate(this.target, function (generator) {
var op = generator["op" + _this.mode + "Before"];
op.call(generator, _this.destination);
_this.view.dialog.close();
_this.view.modal.close();
});
};
CopyMoveController.prototype.after = function () {
var _this2 = this;
AddonService.generate(this.target, function (generator) {
var op = generator["op" + _this2.mode + "After"];
op.call(generator, _this2.destination);
_this2.view.dialog.close();
_this2.view.modal.close();
});
};
CopyMoveController.prototype.prepend = function () {
var _this3 = this;
AddonService.generate(this.target, function (generator) {
var op = generator["op" + _this3.mode + "Prepend"];
op.call(generator, _this3.destination);
_this3.view.dialog.close();
_this3.view.modal.close();
});
};
CopyMoveController.prototype.append = function () {
var _this4 = this;
AddonService.generate(this.target, function (generator) {
var op = generator["op" + _this4.mode + "Append"];
op.call(generator, _this4.destination);
_this4.view.dialog.close();
_this4.view.modal.close();
});
};
return CopyMoveController;
})(Controller);
exports["default"] = CopyMoveController;
});

View file

@ -0,0 +1,81 @@
define(["exports"], function (exports) {
"use strict";
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
child.__proto__ = parent;
};
var EditController = (function (Controller) {
var EditController = function EditController(options) {
Controller.call(this, options);
};
_extends(EditController, Controller);
EditController.prototype.teardown = function () {
this.view = null;
this.target = null;
this.changes = null;
};
EditController.prototype.open = function (target) {
this.target = target;
this.changes = {};
this.view.setTarget(target);
this.view.open();
};
EditController.prototype.close = function () {
if (this.changes.innerHTML || this.changes.script || this.changes.createAttributes || this.changes.removeAttributes || this.changes.properties) {
if (window.confirm("Are you sure you want to discard your changes?")) {
this.view.close();
}
} else {
this.view.close();
}
};
EditController.prototype.save = function () {
var _this = this;
AddonService.generate(this.target, function (generator) {
if (_this.changes.innerHTML) {
generator.opInnerHTML(_this.changes.innerHTML);
}
if (_this.changes.script) {
generator.opScript(_this.changes.script);
}
if (_this.changes.createAttributes) {
generator.opCreateAttributes(_this.changes.createAttributes);
}
if (_this.changes.removeAttributes) {
generator.opRemoveAttributes(_this.changes.removeAttributes);
}
if (_this.changes.properties) {
generator.opSetProperties(_this.changes.properties);
}
_this.changes = {};
_this.close();
});
};
return EditController;
})(Controller);
exports["default"] = EditController;
});

View file

@ -0,0 +1,229 @@
define(["exports"], function (exports) {
"use strict";
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
child.__proto__ = parent;
};
var MainController = (function (Controller) {
var MainController = function MainController(options) {
Controller.call(this, options);
this._waitToBeOpened();
this._visibilitychangeHandler = this._visibilitychangeHandler.bind(this);
window.addEventListener("visibilitychange", this._visibilitychangeHandler);
// Wait 1 second before checking with Customizer Launcher to
// prevent the Customizer DOM from getting wiped out by the
// app initialization.
setTimeout(this._checkOpenFromLauncher.bind(this), 1000);
console.log("[Customizer] Initialized MainController", this);
};
_extends(MainController, Controller);
MainController.prototype.teardown = function () {
window.removeEventListener("visibilitychange", this._visibilitychangeHandler);
for (var property in this) {
if (this[property] instanceof Controller) {
this[property].teardown();
this[property] = null;
}
}
this.view.customizer.setRootNode(null);
this.view = null;
console.log("[Customizer] Cleaned up controllers and views");
window.__customizer__.mainController = new MainController({
manifestURL: this.manifestURL,
lazyLoadModules: false
});
};
MainController.prototype._lazyLoadModules = function () {
var _this = this;
return new Promise(function (resolve, reject) {
/*jshint evil:true*/
if (_this.lazyLoadModules) {
var source = window.localStorage.getItem("__CUSTOMIZER__componentsSource");
if (!source) {
reject();
return;
}
eval.call(window, source);
console.log("[Customizer] Lazy-loaded modules");
}
resolve();
});
};
MainController.prototype._initControllers = function () {
var _this2 = this;
return new Promise(function (resolve) {
var editView = new EditView();
var viewSourceView = new ViewSourceView();
var appendChildView = new AppendChildView();
var copyMoveView = new CopyMoveView();
var mainView = new MainView({
editView: editView,
viewSourceView: viewSourceView,
appendChildView: appendChildView,
copyMoveView: copyMoveView
});
_this2.editController = new EditController({
view: editView
});
_this2.viewSourceController = new ViewSourceController({
view: viewSourceView
});
_this2.appendChildController = new AppendChildController({
view: appendChildView
});
_this2.copyMoveController = new CopyMoveController({
view: copyMoveView
});
_this2.view = mainView;
mainView.init(_this2);
console.log("[Customizer] Initialized controllers and views");
resolve();
});
};
MainController.prototype._waitToBeOpened = function () {
var _this3 = this;
Gesture.detect({
type: "swipe", // Swipe:
numFingers: 2, // with two fingers,
startRegion: { // from bottom 30% of the screen (10% for SHB),
x0: 0, y0: 0.8, x1: 1, y1: 1.1
},
endRegion: { // up into the top 75% of the screen,
x0: 0, y0: 0, x1: 1, y1: 0.75
},
maxTime: 1000 }).then(function () {
return _this3.open();
});
};
MainController.prototype._waitToBeClosed = function () {
var _this4 = this;
Gesture.detect({
type: "swipe", // Swipe:
numFingers: 2, // with two fingers,
startRegion: { // from the middle ~half of the screen
x0: 0, y0: 0.3, x1: 1, y1: 0.7
},
endRegion: { // down into the bottom quarter of the screen
x0: 0, y0: 0.75, x1: 1, y1: 1
},
maxTime: 1000 }).then(function () {
return _this4.close();
});
};
MainController.prototype._checkOpenFromLauncher = function () {
var _this5 = this;
var requestXHR = new XMLHttpRequest();
try {
requestXHR.open("GET", "http://localhost:3215/request", true);
requestXHR.onload = function () {
if (requestXHR.responseText !== _this5.manifestURL) {
return;
}
_this5.open();
var confirmXHR = new XMLHttpRequest();
confirmXHR.open("GET", "http://localhost:3215/confirm?url=" + _this5.manifestURL, true);
console.log("Sending HTTP request confirmation to Customizer Launcher");
confirmXHR.send();
};
console.log("Sending HTTP request check to Customizer Launcher");
requestXHR.send();
} catch (e) {
console.log("HTTP request failed to Customizer Launcher", e);
}
};
MainController.prototype._visibilitychangeHandler = function () {
if (!document.hidden) {
this._checkOpenFromLauncher();
}
};
MainController.prototype.open = function () {
var _this6 = this;
if (this._isOpen) {
return;
}
this._isOpen = true;
this._lazyLoadModules().then(function () {
return _this6._initControllers();
}).then(function () {
return _this6.view.open();
}).then(function () {
_this6.view.customizer.setRootNode(document.documentElement);
_this6._waitToBeClosed();
});
};
MainController.prototype.close = function () {
var _this7 = this;
if (!this._isOpen) {
return;
}
this.view.close().then(function () {
return _this7.teardown();
});
this._isOpen = false;
};
MainController.prototype.openAddonManager = function () {
var activity = new MozActivity({
name: "configure",
data: {
target: "device",
section: "addons",
options: {
manifestURL: this.manifestURL
}
}
});
activity.onerror = function (e) {
console.error("Error opening \"Settings > Add-ons\" panel", e);
};
};
return MainController;
})(Controller);
exports["default"] = MainController;
});

View file

@ -0,0 +1,109 @@
define(["exports"], function (exports) {
"use strict";
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
child.__proto__ = parent;
};
/*global Controller*/
// When injected in the System app, this selector can identify
// the currently-focused <iframe> (app window).
var ACTIVE_WINDOW_SELECTOR = "#windows > .active iframe";
var TouchForwarderController = (function (Controller) {
var TouchForwarderController = function TouchForwarderController(options) {
Controller.call(this, options);
var firstTouchStartEvt = null;
var isForwarding = false;
window.addEventListener("touchstart", function (evt) {
if (evt.touches.length === 1) {
firstTouchStartEvt = evt;
return;
}
if (evt.touches.length !== 2) {
return;
}
var iframe = document.querySelector(ACTIVE_WINDOW_SELECTOR);
iframe.sendTouchEvent.apply(iframe, unsynthesizeEvent(firstTouchStartEvt));
iframe.sendTouchEvent.apply(iframe, unsynthesizeEvent(evt));
isForwarding = true;
});
window.addEventListener("touchmove", function (evt) {
if (!isForwarding) {
return;
}
var iframe = document.querySelector(ACTIVE_WINDOW_SELECTOR);
iframe.sendTouchEvent.apply(iframe, unsynthesizeEvent(evt));
});
window.addEventListener("touchend", function (evt) {
if (!isForwarding) {
return;
}
if (evt.touches.length === 0) {
isForwarding = false;
}
var iframe = document.querySelector(ACTIVE_WINDOW_SELECTOR);
iframe.sendTouchEvent.apply(iframe, unsynthesizeEvent(evt));
});
console.log("[Customizer] Initialized TouchForwarderController", this);
};
_extends(TouchForwarderController, Controller);
return TouchForwarderController;
})(Controller);
exports["default"] = TouchForwarderController;
/**
* Taken from System app:
* https://github.com/mozilla-b2g/gaia/blob/600fd8249960b8256af9de67d9171025bb9a3ff3/apps/system/js/touch_forwarder.js#L93
*/
function unsynthesizeEvent(e) {
var type = e.type;
var relevantTouches = (e.type === "touchend") ? e.changedTouches : e.touches;
var identifiers = [];
var xs = [];
var ys = [];
var rxs = [];
var rys = [];
var rs = [];
var fs = [];
var modifiers = 0;
for (var i = 0; i < relevantTouches.length; i++) {
var t = relevantTouches[i];
identifiers.push(t.identifier);
xs.push(t.pageX);
ys.push(t.pageY - 50); // Shift Y position up to remain in-bounds
rxs.push(t.radiusX);
rys.push(t.radiusY);
rs.push(t.rotationAngle);
fs.push(t.force);
}
return [type, identifiers, xs, ys, rxs, rys, rs, fs, xs.length, modifiers];
}
});

View file

@ -0,0 +1,73 @@
define(["exports"], function (exports) {
"use strict";
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
child.__proto__ = parent;
};
var ViewSourceController = (function (Controller) {
var ViewSourceController = function ViewSourceController(options) {
Controller.call(this, options);
};
_extends(ViewSourceController, Controller);
ViewSourceController.prototype.teardown = function () {
this.view = null;
this.target = null;
};
ViewSourceController.prototype.open = function (target) {
console.log("view source controller open");
this.target = target;
var url = target.src || target.href;
var filename = url.substring(url.lastIndexOf("/") + 1);
this.view.setTitle(filename);
this.view.setSource("Loading...");
this.fetchAndDisplay(url);
this.view.open();
};
ViewSourceController.prototype.close = function () {
this.view.close();
this.view.setSource("");
};
ViewSourceController.prototype.fetchAndDisplay = function (url) {
var self = this;
try {
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = "text";
xhr.send();
xhr.onload = function () {
if (xhr.status === 200) {
self.view.setSource(xhr.response);
} else {
self.view.setSource(xhr.status + ":" + xhr.statusText);
}
};
xhr.onerror = function () {
self.view.setSource(xhr.error.name);
};
} catch (e) {
// Surprisingly, the xhr.send() call above can throw an exception
// if the URL is malformed.
self.view.setSource(e.toString());
}
};
return ViewSourceController;
})(Controller);
exports["default"] = ViewSourceController;
});