normalize moto module header

This commit is contained in:
Stewart Allen 2021-12-26 22:49:41 -05:00
commit 8927501eca
11 changed files with 40 additions and 42 deletions

View file

@ -4,14 +4,12 @@
(function() {
if (!self.moto) self.moto = {};
if (self.moto.Ajax) return;
let moto = self.moto = self.moto || {};
if (moto.Ajax) return;
const MOTO = self.moto;
moto.Ajax = Ajax;
MOTO.Ajax = Ajax;
MOTO.callAjax = function(url, handler) {
moto.callAjax = function(url, handler) {
new Ajax(handler).request(url);
};
@ -21,7 +19,7 @@
TIME = function() { return new Date().getTime() },
MOKEY = moto.id = KV.getItem(KEY) || (TIME().toString(36)+rnd()+rnd());
MOTO.restore = function(id) {
moto.restore = function(id) {
MOKEY = moto.id = id;
KV.setItem(KEY, MOKEY);
}

View file

@ -4,7 +4,7 @@
(function() {
let moto = self.moto = self.moto = {};
let moto = self.moto = self.moto || {};
if (moto.KV) return;
function KV() {

View file

@ -2,10 +2,10 @@
(function() {
if (!self.moto) self.moto = {};
if (self.moto.OBJ) return;
let moto = self.moto = self.moto || {};
if (moto.TMF) return;
self.moto.TMF = {
moto.TMF = {
parseAsync
};

View file

@ -1,8 +1,14 @@
'use strict';
(function() {
if (!self.moto) self.moto = {};
if (self.moto.File) return;
let moto = self.moto = self.moto || {};
if (moto.File) return;
moto.File = {
load_data,
load
};
function load_data(data, file, ext) {
ext = ext || name.toLowerCase().split('.').pop();
@ -52,9 +58,4 @@
});
}
self.moto.File = {
load_data,
load
};
})();

View file

@ -2,10 +2,10 @@
(function() {
if (!self.moto) self.moto = {};
if (self.moto.OBJ) return;
let moto = self.moto = self.moto || {};
if (moto.OBJ) return;
self.moto.OBJ = {
moto.OBJ = {
parse,
parseAsync
};

View file

@ -8,13 +8,13 @@
(function() {
if (!self.moto) self.moto = {};
if (self.moto.STL) return;
let moto = self.moto = self.moto || {};
if (moto.STL) return;
const SP = STL.prototype;
const CDH = 'Content-Disposition';
self.moto.STL = STL;
moto.STL = STL;
/**
* @constructor

View file

@ -2,10 +2,10 @@
(function() {
if (!self.moto) self.moto = {};
if (self.moto.SVG) return;
let moto = self.moto = self.moto || {};
if (moto.SVG) return;
self.moto.SVG = {
moto.SVG = {
parse,
parseAsync
};

View file

@ -1,8 +1,13 @@
'use strict';
(function() {
if (!self.moto) self.moto = {};
if (self.moto.URL) return;
let moto = self.moto = self.moto || {};
if (moto.URL) return;
moto.URL = {
load
};
const CDH = 'Content-Disposition';
@ -77,8 +82,4 @@
});
};
self.moto.URL = {
load
};
})();

View file

@ -7,13 +7,13 @@
* http://codeincomplete.com/posts/2011/5/7/bin_packing/
*/
(function (){
(function () {
if (!self.moto) self.moto = {};
if (self.moto.Pack) return;
let moto = self.moto = self.moto || {};
if (moto.Pack) return;
self.moto.Pack = Packer;
self.moto.Sort = function (a, b) {
moto.Pack = Packer;
moto.Sort = function (a, b) {
let aa = (a.w * a.h);
let ab = (b.w * b.h);
if (Math.abs(aa-ab) < 1) {

View file

@ -4,9 +4,7 @@
(function() {
if (!self.moto) self.moto = {};
let MOTO = self.moto,
let MOTO = self.moto = self.moto || {},
WIN = window,
DOC = document,
SCENE = new THREE.Scene(),

View file

@ -4,7 +4,7 @@
(function() {
if (!self.moto) self.moto = {};
let moto = self.moto = self.moto || {};
if (moto.ui) return;
let SELF = self,