Support for multiple namespaces, switching, init
parent
1d9c13640d
commit
185ff1f626
|
|
@ -1127,6 +1127,7 @@
|
||||||
<a href=# class=exp-board>Export board...</a>
|
<a href=# class=exp-board>Export board...</a>
|
||||||
<a href="#" class="switch-theme">Use <i>light</i><b>dark</b> theme</a>
|
<a href="#" class="switch-theme">Use <i>light</i><b>dark</b> theme</a>
|
||||||
<a href="#" class="switch-fsize">Use <i>smaller</i><b>larger</b> font</a>
|
<a href="#" class="switch-fsize">Use <i>smaller</i><b>larger</b> font</a>
|
||||||
|
<a href="#" class="switch-namespace">Set namespace</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1602,13 +1603,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
globalStorage = new MultiDatabase(
|
|
||||||
new NamespacedDatabase("1", new HTTPCRUD()),
|
|
||||||
//new NamespacedDatabase("A", new Local()),
|
|
||||||
//new NamespacedDatabase("B", new Local()),
|
|
||||||
//new Bomber(),
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* poor mans error handling -- $fixme
|
* poor mans error handling -- $fixme
|
||||||
*/
|
*/
|
||||||
|
|
@ -2726,7 +2720,7 @@
|
||||||
var raw = ev.originalEvent;
|
var raw = ev.originalEvent;
|
||||||
var caps = raw.getModifierState && raw.getModifierState( 'CapsLock' );
|
var caps = raw.getModifierState && raw.getModifierState( 'CapsLock' );
|
||||||
|
|
||||||
if (caps) $('body').addClass('reveal');
|
if (!caps) $('body').addClass('reveal');
|
||||||
else $('body').removeClass('reveal');
|
else $('body').removeClass('reveal');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3009,6 +3003,16 @@
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.config .switch-namespace').click(function() {
|
||||||
|
var namespace = prompt("Namespace", getCurrentNamespace());
|
||||||
|
if (namespace != getCurrentNamespace())
|
||||||
|
{
|
||||||
|
setGlobalNamespace(namespace);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
$('.config .switch-theme').click(function() {
|
$('.config .switch-theme').click(function() {
|
||||||
var $body = $('body');
|
var $body = $('body');
|
||||||
$body.toggleClass('dark');
|
$body.toggleClass('dark');
|
||||||
|
|
@ -3145,33 +3149,61 @@
|
||||||
adjustLayout();
|
adjustLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
function setGlobalNamespace(namespace)
|
||||||
if (globalStorage.get('nullboard.theme') == 'dark')
|
|
||||||
$('body').addClass('dark');
|
|
||||||
|
|
||||||
if (globalStorage.get('nullboard.fsize') == 'z1')
|
|
||||||
$('body').addClass('z1');
|
|
||||||
|
|
||||||
//
|
|
||||||
var board_id = globalStorage.get('nullboard.last_board');
|
|
||||||
|
|
||||||
if (board_id)
|
|
||||||
document.board = loadBoard(board_id);
|
|
||||||
|
|
||||||
updateBoardIndex();
|
|
||||||
|
|
||||||
if (! document.board && ! $('.config .load-board').length)
|
|
||||||
{
|
{
|
||||||
var demo_id = createDemoBoard();
|
globalStorage = new MultiDatabase(
|
||||||
document.board = loadBoard(demo_id);
|
new NamespacedDatabase(namespace, new HTTPCRUD()),
|
||||||
|
new NamespacedDatabase(namespace, new Local()),
|
||||||
|
new Bomber(),
|
||||||
|
new NamespacedDatabase(namespace + "teehee", new Local()),
|
||||||
|
);
|
||||||
|
|
||||||
|
setCurrentNamespace(namespace);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (globalStorage.get('nullboard.theme') == 'dark')
|
||||||
|
$('body').addClass('dark');
|
||||||
|
else
|
||||||
|
$('body').removeClass('dark');
|
||||||
|
|
||||||
|
if (globalStorage.get('nullboard.fsize') == 'z1')
|
||||||
|
$('body').addClass('z1');
|
||||||
|
else
|
||||||
|
$('body').removeClass('z1');
|
||||||
|
|
||||||
|
//
|
||||||
|
var board_id = globalStorage.get('nullboard.last_board');
|
||||||
|
|
||||||
|
if (board_id)
|
||||||
|
document.board = loadBoard(board_id);
|
||||||
|
|
||||||
updateBoardIndex();
|
updateBoardIndex();
|
||||||
|
|
||||||
|
if (! document.board && ! $('.config .load-board').length)
|
||||||
|
{
|
||||||
|
var demo_id = createDemoBoard();
|
||||||
|
document.board = loadBoard(demo_id);
|
||||||
|
updateBoardIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.board)
|
||||||
|
{
|
||||||
|
showBoard(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.board)
|
function setCurrentNamespace(namespace)
|
||||||
{
|
{
|
||||||
showBoard(true);
|
return new Local().set("namespace", namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentNamespace()
|
||||||
|
{
|
||||||
|
return new Local().get("namespace") || "initial";
|
||||||
|
}
|
||||||
|
|
||||||
|
setGlobalNamespace(getCurrentNamespace());
|
||||||
|
|
||||||
//
|
//
|
||||||
setInterval(adjustListScroller, 100);
|
setInterval(adjustListScroller, 100);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue