Revert "widlockunlock: setting for location"

This reverts commit c84d3fa2c0.
pull/2606/head
Rob Pilling 2023-02-27 20:16:36 +00:00
parent 63711f6a0c
commit c4d5713471
4 changed files with 2 additions and 75 deletions

View File

@ -8,7 +8,6 @@
"tags": "widget,lock",
"supports": ["BANGLEJS","BANGLEJS2"],
"storage": [
{"name":"widlockunlock.wid.js","url":"widget.js"},
{"name":"widlockunlock.settings.js","url":"settings.js"}
{"name":"widlockunlock.wid.js","url":"widget.js"}
]
}

View File

@ -1,29 +0,0 @@
"use strict";
(function (back) {
var storage = require('Storage');
var filename = 'lockunlock.settings.json';
var settings = Object.assign(storage.readJSON(filename, true) || {}, { location: "tl" });
var save = function () {
return storage.writeJSON(filename, settings);
};
var locations = ["tl", "tr"];
var menu = {
'': { 'title': 'Lock/Unlock' },
'< Back': back,
'Location': {
value: (function () {
var i = locations.indexOf(settings.location);
return i < 0 ? 0 : i;
})(),
min: 0,
max: locations.length - 1,
wrap: true,
format: function (v) { return locations[v]; },
onchange: function (v) {
settings.location = locations[v];
save();
},
},
};
E.showMenu(menu);
});

View File

@ -1,39 +0,0 @@
((back: () => void) => {
type Location = "tl" | "tr";
type Settings = {
location: Location;
};
const storage = require('Storage');
const filename = 'lockunlock.settings.json';
const settings: Settings = Object.assign(
storage.readJSON(filename, true) || {},
{ location: "tl" }
);
const save = () =>
storage.writeJSON(filename, settings);
const locations: Array<Location> = [ "tl", "tr" ];
const menu = {
'': { 'title': 'Lock/Unlock' },
'< Back': back,
'Location': {
value: (() => {
const i = locations.indexOf(settings.location);
return i < 0 ? 0 : i;
})(),
min: 0,
max: locations.length - 1,
wrap: true,
format: (v: number) => locations[v]!,
onchange: (v: number) => {
settings.location = locations[v]!;
save();
},
},
};
E.showMenu(menu);
});

View File

@ -1,9 +1,5 @@
WIDGETS["lockunlock"] = {
area: (() => {
const settings = require("Storage")
.readJSON("lockunlock.settings.json", true) || {};
return settings.location || "tl";
})(),
area: "tl",
sortorder: 10,
width: 14,
draw: w => {