Select Git revision
app.js 40.29 KiB
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var firmwarewizard = function() {
var app = {};
// helper functions
function $(s) {
return document.querySelector(s);
}
function toggleClass(e, cssClass) {
setClass(e, cssClass, !hasClass(e, cssClass));
}
function hasClass(e, cssClass) {
var searchstring = (' ' + e.className + ' ').replace(/[\n\t]/g, " ");
return (searchstring.indexOf(' ' + cssClass+ ' ') !== -1);
}
function setClass(e, cssClass, active) {
if (active && !hasClass(e, cssClass)) {
e.className = (e.className+' '+cssClass).trim();
} else if (!active && hasClass(e, cssClass)) {
e.className = e.className.replace(cssClass, '');
}
}
function show_inline(s) {
$(s).style.display = 'inline-block';
}
function show_block(s) {
$(s).style.display = 'block';
}
function hide(s) {
$(s).style.display = 'none';
}
function sortCaseInsensitive(a, b) {
return a.localeCompare(b, 'en', {'sensitivity': 'base'});
}
// Object.values() replacement
function ObjectValues(obj) {
return Object.keys(obj).map(function(key) { return obj[key]; });
}
function isEmptyObject(obj) {
for (var name in obj) {
return false;
}
return true;
}
function scrollDown() {
try {
window.scrollBy({