major restructuring, ui code separation and sequential processing

This commit is contained in:
jywarren
2017-01-06 01:39:03 -05:00
parent 55743961e3
commit 9e3f6b9aff
13 changed files with 3763 additions and 2355 deletions

26
src/UserInterface.js Normal file
View File

@@ -0,0 +1,26 @@
/*
* Default UI for ImageBoard
*/
module.exports = function UserInterface(options) {
options = options || {};
options.container = options.container || ".panels";
// method to create a UI for a given module
function create(o) {
o.random = o.random || parseInt(Math.random() * (new Date()).getTime() / 1000000);
o.uniqueSelector = o.uniqueSelector || o.selector + '-' + o.random;
$(options.container).append('<div class="panel ' + o.selector + ' ' + o.uniqueSelector + '"></div>');
o.el = o.el || $('.' + o.uniqueSelector);
return {
el: o.el,
uniqueSelector: o.uniqueSelector,
selector: o.selector
}
}
return {
create: create
}
}