").append( jQuery.parseHTML( responseText ) ).find( selector ) :
-
- // Otherwise use the full result
- responseText );
-
- }).complete( callback && function( jqXHR, status ) {
- self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
- });
- }
-
- return this;
-};
-
-
-
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
- jQuery.fn[ type ] = function( fn ) {
- return this.on( type, fn );
- };
-});
-
-
-
-
-jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
-};
-
-
-
-
-
-var docElem = window.document.documentElement;
-
-/**
- * Gets a window from an element
- */
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-
-jQuery.offset = {
- setOffset: function( elem, options, i ) {
- var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
- position = jQuery.css( elem, "position" ),
- curElem = jQuery( elem ),
- props = {};
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- curOffset = curElem.offset();
- curCSSTop = jQuery.css( elem, "top" );
- curCSSLeft = jQuery.css( elem, "left" );
- calculatePosition = ( position === "absolute" || position === "fixed" ) &&
- jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-jQuery.fn.extend({
- offset: function( options ) {
- if ( arguments.length ) {
- return options === undefined ?
- this :
- this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- var docElem, win,
- box = { top: 0, left: 0 },
- elem = this[ 0 ],
- doc = elem && elem.ownerDocument;
-
- if ( !doc ) {
- return;
- }
-
- docElem = doc.documentElement;
-
- // Make sure it's not a disconnected DOM node
- if ( !jQuery.contains( docElem, elem ) ) {
- return box;
- }
-
- // If we don't have gBCR, just use 0,0 rather than error
- // BlackBerry 5, iOS 3 (original iPhone)
- if ( typeof elem.getBoundingClientRect !== strundefined ) {
- box = elem.getBoundingClientRect();
- }
- win = getWindow( doc );
- return {
- top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
- left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
- };
- },
-
- position: function() {
- if ( !this[ 0 ] ) {
- return;
- }
-
- var offsetParent, offset,
- parentOffset = { top: 0, left: 0 },
- elem = this[ 0 ];
-
- // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
- if ( jQuery.css( elem, "position" ) === "fixed" ) {
- // we assume that getBoundingClientRect is available when computed position is fixed
- offset = elem.getBoundingClientRect();
- } else {
- // Get *real* offsetParent
- offsetParent = this.offsetParent();
-
- // Get correct offsets
- offset = this.offset();
- if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
- parentOffset = offsetParent.offset();
- }
-
- // Add offsetParent borders
- parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
- parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
- }
-
- // Subtract parent offsets and element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- return {
- top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
- left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || docElem;
-
- while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent || docElem;
- });
- }
-});
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
- var top = /Y/.test( prop );
-
- jQuery.fn[ method ] = function( val ) {
- return access( this, function( elem, method, val ) {
- var win = getWindow( elem );
-
- if ( val === undefined ) {
- return win ? (prop in win) ? win[ prop ] :
- win.document.documentElement[ method ] :
- elem[ method ];
- }
-
- if ( win ) {
- win.scrollTo(
- !top ? val : jQuery( win ).scrollLeft(),
- top ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- elem[ method ] = val;
- }
- }, method, val, arguments.length, null );
- };
-});
-
-// Add the top/left cssHooks using jQuery.fn.position
-// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
-// getComputedStyle returns percent when specified for top/left/bottom/right
-// rather than make the css module depend on the offset module, we just check for it here
-jQuery.each( [ "top", "left" ], function( i, prop ) {
- jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
- function( elem, computed ) {
- if ( computed ) {
- computed = curCSS( elem, prop );
- // if curCSS returns percentage, fallback to offset
- return rnumnonpx.test( computed ) ?
- jQuery( elem ).position()[ prop ] + "px" :
- computed;
- }
- }
- );
-});
-
-
-// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
-jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
- // margin is only for outerHeight, outerWidth
- jQuery.fn[ funcName ] = function( margin, value ) {
- var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
- extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
-
- return access( this, function( elem, type, value ) {
- var doc;
-
- if ( jQuery.isWindow( elem ) ) {
- // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
- // isn't a whole lot we can do. See pull request at this URL for discussion:
- // https://github.com/jquery/jquery/pull/764
- return elem.document.documentElement[ "client" + name ];
- }
-
- // Get document width or height
- if ( elem.nodeType === 9 ) {
- doc = elem.documentElement;
-
- // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
- // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
- return Math.max(
- elem.body[ "scroll" + name ], doc[ "scroll" + name ],
- elem.body[ "offset" + name ], doc[ "offset" + name ],
- doc[ "client" + name ]
- );
- }
-
- return value === undefined ?
- // Get width or height on the element, requesting but not forcing parseFloat
- jQuery.css( elem, type, extra ) :
-
- // Set width or height on the element
- jQuery.style( elem, type, value, extra );
- }, type, chainable ? margin : undefined, chainable, null );
- };
- });
-});
-
-
-// The number of elements contained in the matched element set
-jQuery.fn.size = function() {
- return this.length;
-};
-
-jQuery.fn.andSelf = jQuery.fn.addBack;
-
-
-
-
-// Register as a named AMD module, since jQuery can be concatenated with other
-// files that may use define, but not via a proper concatenation script that
-// understands anonymous AMD modules. A named AMD is safest and most robust
-// way to register. Lowercase jquery is used because AMD module names are
-// derived from file names, and jQuery is normally delivered in a lowercase
-// file name. Do this after creating the global so that if an AMD module wants
-// to call noConflict to hide this version of jQuery, it will work.
-
-// Note that for maximum portability, libraries that are not jQuery should
-// declare themselves as anonymous modules, and avoid setting a global if an
-// AMD loader is present. jQuery is a special case. For more information, see
-// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
-
-if ( typeof define === "function" && define.amd ) {
- define( "jquery", [], function() {
- return jQuery;
- });
-}
-
-
-
-
-var
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$;
-
-jQuery.noConflict = function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
-};
-
-// Expose jQuery and $ identifiers, even in
-// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
-// and CommonJS for browser emulators (#13566)
-if ( typeof noGlobal === strundefined ) {
- window.jQuery = window.$ = jQuery;
-}
-
-
-
-
-return jQuery;
-
-}));
\ No newline at end of file
diff --git a/nano/js/libraries/jquery.timers.js b/nano/js/libraries/jquery.timers.js
deleted file mode 100644
index ce66eaf476..0000000000
--- a/nano/js/libraries/jquery.timers.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * jQuery.timers - Timer abstractions for jQuery
- * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
- * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
- * Date: 2009/10/16
- *
- * @author Blair Mitchelmore
- * @version 1.2
- *
- **/
-
-jQuery.fn.extend({
- everyTime: function(interval, label, fn, times) {
- return this.each(function() {
- jQuery.timer.add(this, interval, label, fn, times);
- });
- },
- oneTime: function(interval, label, fn) {
- return this.each(function() {
- jQuery.timer.add(this, interval, label, fn, 1);
- });
- },
- stopTime: function(label, fn) {
- return this.each(function() {
- jQuery.timer.remove(this, label, fn);
- });
- }
-});
-
-jQuery.extend({
- timer: {
- global: [],
- guid: 1,
- dataKey: "jQuery.timer",
- regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
- powers: {
- // Yeah this is major overkill...
- 'ms': 1,
- 'cs': 10,
- 'ds': 100,
- 's': 1000,
- 'das': 10000,
- 'hs': 100000,
- 'ks': 1000000
- },
- timeParse: function(value) {
- if (value == undefined || value == null)
- return null;
- var result = this.regex.exec(jQuery.trim(value.toString()));
- if (result[2]) {
- var num = parseFloat(result[1]);
- var mult = this.powers[result[2]] || 1;
- return num * mult;
- } else {
- return value;
- }
- },
- add: function(element, interval, label, fn, times) {
- var counter = 0;
-
- if (jQuery.isFunction(label)) {
- if (!times)
- times = fn;
- fn = label;
- label = interval;
- }
-
- interval = jQuery.timer.timeParse(interval);
-
- if (typeof interval != 'number' || isNaN(interval) || interval < 0)
- return;
-
- if (typeof times != 'number' || isNaN(times) || times < 0)
- times = 0;
-
- times = times || 0;
-
- var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
-
- if (!timers[label])
- timers[label] = {};
-
- fn.timerID = fn.timerID || this.guid++;
-
- var handler = function() {
- if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
- jQuery.timer.remove(element, label, fn);
- };
-
- handler.timerID = fn.timerID;
-
- if (!timers[label][fn.timerID])
- timers[label][fn.timerID] = window.setInterval(handler,interval);
-
- this.global.push( element );
-
- },
- remove: function(element, label, fn) {
- var timers = jQuery.data(element, this.dataKey), ret;
-
- if ( timers ) {
-
- if (!label) {
- for ( label in timers )
- this.remove(element, label, fn);
- } else if ( timers[label] ) {
- if ( fn ) {
- if ( fn.timerID ) {
- window.clearInterval(timers[label][fn.timerID]);
- delete timers[label][fn.timerID];
- }
- } else {
- for ( var fn in timers[label] ) {
- window.clearInterval(timers[label][fn]);
- delete timers[label][fn];
- }
- }
-
- for ( ret in timers[label] ) break;
- if ( !ret ) {
- ret = null;
- delete timers[label];
- }
- }
-
- for ( ret in timers ) break;
- if ( !ret )
- jQuery.removeData(element, this.dataKey);
- }
- }
- }
-});
-
-jQuery(window).bind("unload", function() {
- jQuery.each(jQuery.timer.global, function(index, item) {
- jQuery.timer.remove(item);
- });
-});
\ No newline at end of file
diff --git a/nano/js/nano_base_callbacks.js b/nano/js/nano_base_callbacks.js
deleted file mode 100644
index fb5a86ee3d..0000000000
--- a/nano/js/nano_base_callbacks.js
+++ /dev/null
@@ -1,126 +0,0 @@
-// NanoBaseCallbacks is where the base callbacks (common to all templates) are stored
-NanoBaseCallbacks = function ()
-{
- // _canClick is used to disable clicks for a short period after each click (to avoid mis-clicks)
- var _canClick = true;
-
- var _baseBeforeUpdateCallbacks = {}
-
- var _baseAfterUpdateCallbacks = {
- // this callback is triggered after new data is processed
- // it updates the status/visibility icon and adds click event handling to buttons/links
- status: function (updateData) {
- var uiStatusClass;
- if (updateData['config']['status'] == 2)
- {
- uiStatusClass = 'icon24 uiStatusGood';
- $('.linkActive').removeClass('inactive');
- }
- else if (updateData['config']['status'] == 1)
- {
- uiStatusClass = 'icon24 uiStatusAverage';
- $('.linkActive').addClass('inactive');
- }
- else
- {
- uiStatusClass = 'icon24 uiStatusBad'
- $('.linkActive').addClass('inactive');
- }
- $('#uiStatusIcon').attr('class', uiStatusClass);
-
- $('.linkActive').stopTime('linkPending');
- $('.linkActive').removeClass('linkPending');
-
- $('.linkActive')
- .off('click')
- .on('click', function (event) {
- event.preventDefault();
- var href = $(this).data('href');
- if (href != null && _canClick)
- {
- _canClick = false;
- $('body').oneTime(300, 'enableClick', function () {
- _canClick = true;
- });
- if (updateData['config']['status'] == 2)
- {
- $(this).oneTime(300, 'linkPending', function () {
- $(this).addClass('linkPending');
- });
- }
- window.location.href = href;
- }
- });
-
- return updateData;
- },
- nanomap: function (updateData) {
- $('.mapIcon')
- .off('mouseenter mouseleave')
- .on('mouseenter',
- function (event) {
- var self = this;
- $('#uiMapTooltip')
- .html($(this).children('.tooltip').html())
- .show()
- .stopTime()
- .oneTime(5000, 'hideTooltip', function () {
- $(this).fadeOut(500);
- });
- }
- );
-
- $('.zoomLink')
- .off('click')
- .on('click', function (event) {
- event.preventDefault();
- var zoomLevel = $(this).data('zoomLevel');
- var uiMapObject = $('#uiMap');
- var uiMapWidth = uiMapObject.width() * zoomLevel;
- var uiMapHeight = uiMapObject.height() * zoomLevel;
-
- uiMapObject.css({
- zoom: zoomLevel,
- left: '50%',
- top: '50%',
- marginLeft: '-' + Math.floor(uiMapWidth / 2) + 'px',
- marginTop: '-' + Math.floor(uiMapHeight / 2) + 'px'
- });
- });
-
- $('#uiMapImage').attr('src', 'nanomap_z' + updateData['config']['mapZLevel'] + '.png');
-
- return updateData;
- }
- };
-
- return {
- addCallbacks: function () {
- NanoStateManager.addBeforeUpdateCallbacks(_baseBeforeUpdateCallbacks);
- NanoStateManager.addAfterUpdateCallbacks(_baseAfterUpdateCallbacks);
- },
- removeCallbacks: function () {
- for (var callbackKey in _baseBeforeUpdateCallbacks)
- {
- if (_baseBeforeUpdateCallbacks.hasOwnProperty(callbackKey))
- {
- NanoStateManager.removeBeforeUpdateCallback(callbackKey);
- }
- }
- for (var callbackKey in _baseAfterUpdateCallbacks)
- {
- if (_baseAfterUpdateCallbacks.hasOwnProperty(callbackKey))
- {
- NanoStateManager.removeAfterUpdateCallback(callbackKey);
- }
- }
- }
- };
-} ();
-
-
-
-
-
-
-
diff --git a/nano/js/nano_base_helpers.js b/nano/js/nano_base_helpers.js
deleted file mode 100644
index e3258dd065..0000000000
--- a/nano/js/nano_base_helpers.js
+++ /dev/null
@@ -1,230 +0,0 @@
-// NanoBaseHelpers is where the base template helpers (common to all templates) are stored
-NanoBaseHelpers = function ()
-{
- var _baseHelpers = {
- // change ui styling to "syndicate mode"
- syndicateMode: function() {
- $('body').css("background-color","#8f1414");
- $('body').css("background-image","url('uiBackground-Syndicate.png')");
- $('body').css("background-position","50% 0");
- $('body').css("background-repeat","repeat-x");
-
- $('#uiTitleFluff').css("background-image","url('uiTitleFluff-Syndicate.png')");
- $('#uiTitleFluff').css("background-position","50% 50%");
- $('#uiTitleFluff').css("background-repeat", "no-repeat");
-
- return '';
- },
- // Generate a Byond link
- link: function( text, icon, parameters, status, elementClass, elementId) {
-
- var iconHtml = '';
- var iconClass = 'noIcon';
- if (typeof icon != 'undefined' && icon)
- {
- iconHtml = '
';
- iconClass = 'hasIcon';
- }
-
- if (typeof elementClass == 'undefined' || !elementClass)
- {
- elementClass = 'link';
- }
-
- var elementIdHtml = '';
- if (typeof elementId != 'undefined' && elementId)
- {
- elementIdHtml = 'id="' + elementId + '"';
- }
-
- if (typeof status != 'undefined' && status)
- {
- return '
' + iconHtml + text + '
';
- }
-
- return '
' + iconHtml + text + '
';
- },
- // Round a number to the nearest integer
- round: function(number) {
- return Math.round(number);
- },
- // Returns the number fixed to 1 decimal
- fixed: function(number) {
- return Math.round(number * 10) / 10;
- },
- // Round a number down to integer
- floor: function(number) {
- return Math.floor(number);
- },
- // Round a number up to integer
- ceil: function(number) {
- return Math.ceil(number);
- },
- abs: function(number) {
- return Math.abs(number);
- },
- // Format a string (~string("Hello {0}, how are {1}?", 'Martin', 'you') becomes "Hello Martin, how are you?")
- string: function() {
- if (arguments.length == 0)
- {
- return '';
- }
- else if (arguments.length == 1)
- {
- return arguments[0];
- }
- else if (arguments.length > 1)
- {
- stringArgs = [];
- for (var i = 1; i < arguments.length; i++)
- {
- stringArgs.push(arguments[i]);
- }
- return arguments[0].format(stringArgs);
- }
- return '';
- },
- formatNumber: function(x) {
- // From http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript
- var parts = x.toString().split(".");
- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
- return parts.join(".");
- },
- // Capitalize the first letter of a string. From http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript
- capitalizeFirstLetter: function(string) {
- return string.charAt(0).toUpperCase() + string.slice(1);
- },
- // Display a bar. Used to show health, capacity, etc. Use difClass if the entire display bar class should be different
- displayBar: function(value, rangeMin, rangeMax, styleClass, showText, difClass, direction) {
-
- if (rangeMin < rangeMax)
- {
- if (value < rangeMin)
- {
- value = rangeMin;
- }
- else if (value > rangeMax)
- {
- value = rangeMax;
- }
- }
- else
- {
- if (value > rangeMin)
- {
- value = rangeMin;
- }
- else if (value < rangeMax)
- {
- value = rangeMax;
- }
- }
-
- if (typeof styleClass == 'undefined' || !styleClass)
- {
- styleClass = '';
- }
-
- if (typeof showText == 'undefined' || !showText)
- {
- showText = '';
- }
-
- if (typeof difClass == 'undefined' || !difClass)
- {
- difClass = ''
- }
-
- if(typeof direction == 'undefined' || !direction)
- {
- direction = 'width'
- }
- else
- {
- direction = 'height'
- }
-
- var percentage = Math.round((value - rangeMin) / (rangeMax - rangeMin) * 100);
-
- return '
';
- },
- // Display DNA Blocks (for the DNA Modifier UI)
- displayDNABlocks: function(dnaString, selectedBlock, selectedSubblock, blockSize, paramKey) {
- if (!dnaString)
- {
- return '
Please place a valid subject into the DNA modifier.
';
- }
-
- var characters = dnaString.split('');
-
- var html = '
1
';
- var block = 1;
- var subblock = 1;
- for (index in characters)
- {
- if (!characters.hasOwnProperty(index) || typeof characters[index] === 'object')
- {
- continue;
- }
-
- var parameters;
- if (paramKey.toUpperCase() == 'UI')
- {
- parameters = { 'selectUIBlock' : block, 'selectUISubblock' : subblock };
- }
- else
- {
- parameters = { 'selectSEBlock' : block, 'selectSESubblock' : subblock };
- }
-
- var status = 'linkActive';
- if (block == selectedBlock && subblock == selectedSubblock)
- {
- status = 'selected';
- }
-
- html += '
' + characters[index] + '
'
-
- index++;
- if (index % blockSize == 0 && index < characters.length)
- {
- block++;
- subblock = 1;
- html += '
' + block + '
';
- }
- else
- {
- subblock++;
- }
- }
-
- html += '
';
-
- return html;
- }
- };
-
- return {
- addHelpers: function ()
- {
- NanoTemplate.addHelpers(_baseHelpers);
- },
- removeHelpers: function ()
- {
- for (var helperKey in _baseHelpers)
- {
- if (_baseHelpers.hasOwnProperty(helperKey))
- {
- NanoTemplate.removeHelper(helperKey);
- }
- }
- }
- };
-} ();
-
-
-
-
-
-
-
diff --git a/nano/js/nano_state.js b/nano/js/nano_state.js
deleted file mode 100644
index 92965d1ab2..0000000000
--- a/nano/js/nano_state.js
+++ /dev/null
@@ -1,119 +0,0 @@
-// This is the base state class, it is not to be used directly
-
-function NanoStateClass() {
- /*if (typeof this.key != 'string' || !this.key.length)
- {
- alert('ERROR: Tried to create a state with an invalid state key: ' + this.key);
- return;
- }
-
- this.key = this.key.toLowerCase();
-
- NanoStateManager.addState(this);*/
-}
-
-NanoStateClass.prototype.key = null;
-NanoStateClass.prototype.layoutRendered = false;
-NanoStateClass.prototype.contentRendered = false;
-NanoStateClass.prototype.mapInitialised = false;
-
-NanoStateClass.prototype.isCurrent = function () {
- return NanoStateManager.getCurrentState() == this;
-};
-
-NanoStateClass.prototype.onAdd = function (previousState) {
- // Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
-
- NanoBaseCallbacks.addCallbacks();
- NanoBaseHelpers.addHelpers();
-};
-
-NanoStateClass.prototype.onRemove = function (nextState) {
- // Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
-
- NanoBaseCallbacks.removeCallbacks();
- NanoBaseHelpers.removeHelpers();
-};
-
-NanoStateClass.prototype.onBeforeUpdate = function (data) {
- // Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
-
- data = NanoStateManager.executeBeforeUpdateCallbacks(data);
-
- return data; // Return data to continue, return false to prevent onUpdate and onAfterUpdate
-};
-
-NanoStateClass.prototype.onUpdate = function (data) {
- // Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
-
- try
- {
- if (!this.layoutRendered || (data['config'].hasOwnProperty('autoUpdateLayout') && data['config']['autoUpdateLayout']))
- {
- $("#uiLayout").html(NanoTemplate.parse('layout', data)); // render the 'layout' template to the #uiLayout div
- this.layoutRendered = true;
- }
- if (!this.contentRendered || (data['config'].hasOwnProperty('autoUpdateContent') && data['config']['autoUpdateContent']))
- {
- $("#uiContent").html(NanoTemplate.parse('main', data)); // render the 'main' template to the #uiContent div
- this.contentRendered = true;
- }
- if (NanoTemplate.templateExists('mapContent'))
- {
- if (!this.mapInitialised)
- {
- // Add drag functionality to the map ui
- $('#uiMap').draggable();
-
- $('#uiMapTooltip')
- .off('click')
- .on('click', function (event) {
- event.preventDefault();
- $(this).fadeOut(400);
- });
-
- this.mapInitialised = true;
- }
-
- $("#uiMapContent").html(NanoTemplate.parse('mapContent', data)); // render the 'mapContent' template to the #uiMapContent div
-
- if (data['config'].hasOwnProperty('showMap') && data['config']['showMap'])
- {
- $('#uiContent').addClass('hidden');
- $('#uiMapWrapper').removeClass('hidden');
- }
- else
- {
- $('#uiMapWrapper').addClass('hidden');
- $('#uiContent').removeClass('hidden');
- }
- }
- if (NanoTemplate.templateExists('mapHeader'))
- {
- $("#uiMapHeader").html(NanoTemplate.parse('mapHeader', data)); // render the 'mapHeader' template to the #uiMapHeader div
- }
- if (NanoTemplate.templateExists('mapFooter'))
- {
- $("#uiMapFooter").html(NanoTemplate.parse('mapFooter', data)); // render the 'mapFooter' template to the #uiMapFooter div
- }
- }
- catch(error)
- {
- alert('ERROR: An error occurred while rendering the UI: ' + error.message);
- return;
- }
-};
-
-NanoStateClass.prototype.onAfterUpdate = function (data) {
- // Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
-
- NanoStateManager.executeAfterUpdateCallbacks(data);
-};
-
-NanoStateClass.prototype.alertText = function (text) {
- // Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
-
- alert(text);
-};
-
-
diff --git a/nano/js/nano_state_default.js b/nano/js/nano_state_default.js
deleted file mode 100644
index 65493b8c87..0000000000
--- a/nano/js/nano_state_default.js
+++ /dev/null
@@ -1,14 +0,0 @@
-
-NanoStateDefaultClass.inheritsFrom(NanoStateClass);
-var NanoStateDefault = new NanoStateDefaultClass();
-
-function NanoStateDefaultClass() {
-
- this.key = 'default';
-
- //this.parent.constructor.call(this);
-
- this.key = this.key.toLowerCase();
-
- NanoStateManager.addState(this);
-}
\ No newline at end of file
diff --git a/nano/js/nano_state_manager.js b/nano/js/nano_state_manager.js
deleted file mode 100644
index bcc60cef9b..0000000000
--- a/nano/js/nano_state_manager.js
+++ /dev/null
@@ -1,224 +0,0 @@
-// NanoStateManager handles data from the server and uses it to render templates
-NanoStateManager = function ()
-{
- // _isInitialised is set to true when all of this ui's templates have been processed/rendered
- var _isInitialised = false;
-
- // the data for this ui
- var _data = null;
-
- // this is an array of callbacks which are called when new data arrives, before it is processed
- var _beforeUpdateCallbacks = {};
- // this is an array of callbacks which are called when new data arrives, before it is processed
- var _afterUpdateCallbacks = {};
-
- // this is an array of state objects, these can be used to provide custom javascript logic
- var _states = {};
-
- var _currentState = null;
-
- // the init function is called when the ui has loaded
- // this function sets up the templates and base functionality
- var init = function ()
- {
- // We store initialData and templateData in the body tag, it's as good a place as any
- _data = $('body').data('initialData');
-
- if (_data == null || !_data.hasOwnProperty('config') || !_data.hasOwnProperty('data'))
- {
- alert('Error: Initial data did not load correctly.');
- }
-
- var stateKey = 'default';
- if (_data['config'].hasOwnProperty('stateKey') && _data['config']['stateKey'])
- {
- stateKey = _data['config']['stateKey'].toLowerCase();
- }
-
- NanoStateManager.setCurrentState(stateKey);
-
- $(document).on('templatesLoaded', function () {
- doUpdate(_data);
-
- _isInitialised = true;
- });
- };
-
- // Receive update data from the server
- var receiveUpdateData = function (jsonString)
- {
- var updateData;
-
- //alert("recieveUpdateData called." + "
Type: " + typeof jsonString); //debug hook
- try
- {
- // parse the JSON string from the server into a JSON object
- updateData = jQuery.parseJSON(jsonString);
- }
- catch (error)
- {
- alert("recieveUpdateData failed. " + "
Error name: " + error.name + "
Error Message: " + error.message);
- return;
- }
-
- //alert("recieveUpdateData passed trycatch block."); //debug hook
-
- if (!updateData.hasOwnProperty('data'))
- {
- if (_data && _data.hasOwnProperty('data'))
- {
- updateData['data'] = _data['data'];
- }
- else
- {
- updateData['data'] = {};
- }
- }
-
- if (_isInitialised) // all templates have been registered, so render them
- {
- doUpdate(updateData);
- }
- else
- {
- _data = updateData; // all templates have not been registered. We set _data directly here which will be applied after the template is loaded with the initial data
- }
- };
-
- // This function does the update by calling the methods on the current state
- var doUpdate = function (data)
- {
- if (_currentState == null)
- {
- return;
- }
-
- data = _currentState.onBeforeUpdate(data);
-
- if (data === false)
- {
- alert('data is false, return');
- return; // A beforeUpdateCallback returned a false value, this prevents the render from occuring
- }
-
- _data = data;
-
- _currentState.onUpdate(_data);
-
- _currentState.onAfterUpdate(_data);
- };
-
- // Execute all callbacks in the callbacks array/object provided, updateData is passed to them for processing and potential modification
- var executeCallbacks = function (callbacks, data)
- {
- for (var key in callbacks)
- {
- if (callbacks.hasOwnProperty(key) && jQuery.isFunction(callbacks[key]))
- {
- data = callbacks[key].call(this, data);
- }
- }
-
- return data;
- };
-
- return {
- init: function ()
- {
- init();
- },
- receiveUpdateData: function (jsonString)
- {
- receiveUpdateData(jsonString);
- },
- addBeforeUpdateCallback: function (key, callbackFunction)
- {
- _beforeUpdateCallbacks[key] = callbackFunction;
- },
- addBeforeUpdateCallbacks: function (callbacks) {
- for (var callbackKey in callbacks) {
- if (!callbacks.hasOwnProperty(callbackKey))
- {
- continue;
- }
- NanoStateManager.addBeforeUpdateCallback(callbackKey, callbacks[callbackKey]);
- }
- },
- removeBeforeUpdateCallback: function (key)
- {
- if (_beforeUpdateCallbacks.hasOwnProperty(key))
- {
- delete _beforeUpdateCallbacks[key];
- }
- },
- executeBeforeUpdateCallbacks: function (data) {
- return executeCallbacks(_beforeUpdateCallbacks, data);
- },
- addAfterUpdateCallback: function (key, callbackFunction)
- {
- _afterUpdateCallbacks[key] = callbackFunction;
- },
- addAfterUpdateCallbacks: function (callbacks) {
- for (var callbackKey in callbacks) {
- if (!callbacks.hasOwnProperty(callbackKey))
- {
- continue;
- }
- NanoStateManager.addAfterUpdateCallback(callbackKey, callbacks[callbackKey]);
- }
- },
- removeAfterUpdateCallback: function (key)
- {
- if (_afterUpdateCallbacks.hasOwnProperty(key))
- {
- delete _afterUpdateCallbacks[key];
- }
- },
- executeAfterUpdateCallbacks: function (data) {
- return executeCallbacks(_afterUpdateCallbacks, data);
- },
- addState: function (state)
- {
- if (!(state instanceof NanoStateClass))
- {
- alert('ERROR: Attempted to add a state which is not instanceof NanoStateClass');
- return;
- }
- if (!state.key)
- {
- alert('ERROR: Attempted to add a state with an invalid stateKey');
- return;
- }
- _states[state.key] = state;
- },
- setCurrentState: function (stateKey)
- {
- if (typeof stateKey == 'undefined' || !stateKey) {
- alert('ERROR: No state key was passed!');
- return false;
- }
- if (!_states.hasOwnProperty(stateKey))
- {
- alert('ERROR: Attempted to set a current state which does not exist: ' + stateKey);
- return false;
- }
-
- var previousState = _currentState;
-
- _currentState = _states[stateKey];
-
- if (previousState != null) {
- previousState.onRemove(_currentState);
- }
-
- _currentState.onAdd(previousState);
-
- return true;
- },
- getCurrentState: function ()
- {
- return _currentState;
- }
- };
-} ();
-
\ No newline at end of file
diff --git a/nano/js/nano_template.js b/nano/js/nano_template.js
deleted file mode 100644
index b50df1281a..0000000000
--- a/nano/js/nano_template.js
+++ /dev/null
@@ -1,120 +0,0 @@
-
-var NanoTemplate = function () {
-
- var _templateData = {};
- var _templateSources = {};
-
- var _templates = {};
- var _compiledTemplates = {};
-
- var _helpers = {};
-
- var init = function () {
- // We store templateData in the body tag, it's as good a place as any
- _templateData = $('body').data('templateData');
-
- if (_templateData == null)
- {
- alert('Error: Template data did not load correctly.');
- }
-
- if (('nanouiTemplateBundle' in window) && (typeof nanouiTemplateBundle === 'function')) {
- _templateSources = nanouiTemplateBundle(); // From nanoui_templates.js
- }
- var templateLoadingPromises = $.map(_templateData, function(filename, key) {
- var fetchSourcePromise;
- if (_templateSources && _templateSources.hasOwnProperty(filename)) {
- // Its in the bundle, just do it
- fetchSourcePromise = $.Deferred().resolve(_templateSources[filename]).promise();
- } else {
- // Otherwise fetch from ze network
- fetchSourcePromise = $.ajax({
- url: filename,
- cache: false,
- dataType: 'text'
- });
- }
-
- return fetchSourcePromise.done(function(templateMarkup) {
- templateMarkup += '
';
- try {
- NanoTemplate.addTemplate(key, templateMarkup);
- } catch(error) {
- alert('ERROR: An error occurred while loading the UI: ' + error.message);
- return;
- }
- }).fail(function () {
- alert('ERROR: Loading template ' + key + '(' + _templateData[key] + ') failed!');
- });
- });
-
- // Wait for all of them to be done and then trigger the event.
- $.when.apply(this, templateLoadingPromises).done(function() {
- $(document).trigger('templatesLoaded');
- });
- };
-
- var compileTemplates = function () {
-
- for (var key in _templates) {
- try {
- _compiledTemplates[key] = doT.template(_templates[key], null, _templates)
- }
- catch (error) {
- alert(error.message);
- }
- }
- };
-
- return {
- init: function () {
- init();
- },
- addTemplate: function (key, templateString) {
- _templates[key] = templateString;
- },
- templateExists: function (key) {
- return _templates.hasOwnProperty(key);
- },
- parse: function (templateKey, data) {
- if (!_compiledTemplates.hasOwnProperty(templateKey) || !_compiledTemplates[templateKey]) {
- if (!_templates.hasOwnProperty(templateKey)) {
- alert('ERROR: Template "' + templateKey + '" does not exist in _compiledTemplates!');
- return '
Template error (does not exist)
';
- }
- compileTemplates();
- }
- if (typeof _compiledTemplates[templateKey] != 'function') {
- alert(_compiledTemplates[templateKey]);
- alert('ERROR: Template "' + templateKey + '" failed to compile!');
- return '
Template error (failed to compile)
';
- }
- return _compiledTemplates[templateKey].call(this, data['data'], data['config'], _helpers);
- },
- addHelper: function (helperName, helperFunction) {
- if (!jQuery.isFunction(helperFunction)) {
- alert('NanoTemplate.addHelper failed to add ' + helperName + ' as it is not a function.');
- return;
- }
-
- _helpers[helperName] = helperFunction;
- },
- addHelpers: function (helpers) {
- for (var helperName in helpers) {
- if (!helpers.hasOwnProperty(helperName))
- {
- continue;
- }
- NanoTemplate.addHelper(helperName, helpers[helperName]);
- }
- },
- removeHelper: function (helperName) {
- if (helpers.hasOwnProperty(helperName))
- {
- delete _helpers[helperName];
- }
- }
- }
-}();
-
-
diff --git a/nano/js/nano_utility.js b/nano/js/nano_utility.js
deleted file mode 100644
index e65b7bbd13..0000000000
--- a/nano/js/nano_utility.js
+++ /dev/null
@@ -1,169 +0,0 @@
-// NanoUtility is the place to store utility functions
-var NanoUtility = function ()
-{
- var _urlParameters = {}; // This is populated with the base url parameters (used by all links), which is probaby just the "src" parameter
-
- return {
- init: function ()
- {
- var body = $('body'); // We store data in the body tag, it's as good a place as any
-
- _urlParameters = body.data('urlParameters');
- },
- // generate a Byond href, combines _urlParameters with parameters
- generateHref: function (parameters)
- {
- var queryString = '?';
-
- for (var key in _urlParameters)
- {
- if (_urlParameters.hasOwnProperty(key))
- {
- if (queryString !== '?')
- {
- queryString += ';';
- }
- queryString += key + '=' + _urlParameters[key];
- }
- }
-
- for (var key in parameters)
- {
- if (parameters.hasOwnProperty(key))
- {
- if (queryString !== '?')
- {
- queryString += ';';
- }
- queryString += key + '=' + parameters[key];
- }
- }
- return queryString;
- }
- }
-} ();
-
-if (typeof jQuery == 'undefined') {
- alert('ERROR: Javascript library failed to load!');
-}
-if (typeof doT == 'undefined') {
- alert('ERROR: Template engine failed to load!');
-}
-
-(function() {
- var _alert = window.alert;
- window.alert = function(str) {
- window.location = "byond://?nano_err=" + encodeURIComponent(str);
- _alert(str);
- };
-})();
-
-// All scripts are initialised here, this allows control of init order
-$(document).ready(function () {
- NanoUtility.init();
- NanoStateManager.init();
- NanoTemplate.init();
-});
-
-if (!Array.prototype.indexOf)
-{
- Array.prototype.indexOf = function(elt /*, from*/)
- {
- var len = this.length;
-
- var from = Number(arguments[1]) || 0;
- from = (from < 0)
- ? Math.ceil(from)
- : Math.floor(from);
- if (from < 0)
- from += len;
-
- for (; from < len; from++)
- {
- if (from in this &&
- this[from] === elt)
- return from;
- }
- return -1;
- };
-};
-
-if (!String.prototype.format)
-{
- String.prototype.format = function (args) {
- var str = this;
- return str.replace(String.prototype.format.regex, function(item) {
- var intVal = parseInt(item.substring(1, item.length - 1));
- var replace;
- if (intVal >= 0) {
- replace = args[intVal];
- } else if (intVal === -1) {
- replace = "{";
- } else if (intVal === -2) {
- replace = "}";
- } else {
- replace = "";
- }
- return replace;
- });
- };
- String.prototype.format.regex = new RegExp("{-?[0-9]+}", "g");
-};
-
-Object.size = function(obj) {
- var size = 0, key;
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) size++;
- }
- return size;
-};
-
-if(!window.console) {
- window.console = {
- log : function(str) {
- return false;
- }
- };
-};
-
-String.prototype.toTitleCase = function () {
- var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|vs?\.?|via)$/i;
-
- return this.replace(/([^\W_]+[^\s-]*) */g, function (match, p1, index, title) {
- if (index > 0 && index + p1.length !== title.length &&
- p1.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
- title.charAt(index - 1).search(/[^\s-]/) < 0) {
- return match.toLowerCase();
- }
-
- if (p1.substr(1).search(/[A-Z]|\../) > -1) {
- return match;
- }
-
- return match.charAt(0).toUpperCase() + match.substr(1);
- });
-};
-
-$.ajaxSetup({
- cache: false
-});
-
-Function.prototype.inheritsFrom = function (parentClassOrObject) {
- this.prototype = new parentClassOrObject;
- this.prototype.constructor = this;
- this.prototype.parent = parentClassOrObject.prototype;
- return this;
-};
-
-if (!String.prototype.trim) {
- String.prototype.trim = function () {
- return this.replace(/^\s+|\s+$/g, '');
- };
-}
-
-// Replicate the ckey proc from BYOND
-if (!String.prototype.ckey) {
- String.prototype.ckey = function () {
- return this.replace(/\W/g, '').toLowerCase();
- };
-}
\ No newline at end of file
diff --git a/nano/templates/TemplatesGuide.txt b/nano/templates/TemplatesGuide.txt
deleted file mode 100644
index f333e45467..0000000000
--- a/nano/templates/TemplatesGuide.txt
+++ /dev/null
@@ -1,10 +0,0 @@
---------------------------------
-Nano UI Template Guide
---------------------------------
-
-Nano UI uses templates, which are comprised of HTML and a markup syntax. The markup allows you
-to easily add conditionals (if statements), loops (for loops) and custom formatting (using helpers).
-
-Templates are stored in the /nano/templates folder and the file extension is .tmpl.
-
-This guide is being replaced with a wiki entry, found here: http://wiki.baystation12.net/NanoUI
\ No newline at end of file
diff --git a/nano/templates/layout_basic.tmpl b/nano/templates/layout_basic.tmpl
deleted file mode 100644
index 67fcd51f80..0000000000
--- a/nano/templates/layout_basic.tmpl
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/nano/templates/layout_default.tmpl b/nano/templates/layout_default.tmpl
deleted file mode 100644
index 53701e3030..0000000000
--- a/nano/templates/layout_default.tmpl
+++ /dev/null
@@ -1,67 +0,0 @@
-{{if data.PC_hasheader}}
-
-
-
- | {{:helper.link('Shutdown', null, {'PC_shutdown' : 1})}}
- {{if data.PC_showexitprogram}}
- | {{:helper.link('Exit Program', null, {'PC_exit' : 1})}}
- | {{:helper.link('Minimize Program', null, {'PC_minimize' : 1})}}
- {{/if}}
- |
-
-
-{{/if}}
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vorestation.dme b/vorestation.dme
index 4ce0162a4d..95e546239b 100644
--- a/vorestation.dme
+++ b/vorestation.dme
@@ -258,7 +258,6 @@
#include "code\controllers\subsystems\machines.dm"
#include "code\controllers\subsystems\mapping.dm"
#include "code\controllers\subsystems\mobs.dm"
-#include "code\controllers\subsystems\nanoui.dm"
#include "code\controllers\subsystems\nightshift.dm"
#include "code\controllers\subsystems\open_space.dm"
#include "code\controllers\subsystems\orbits.dm"
@@ -2939,26 +2938,6 @@
#include "code\modules\multiz\structures_vr.dm"
#include "code\modules\multiz\turf.dm"
#include "code\modules\multiz\zshadow.dm"
-#include "code\modules\nano\nanoexternal.dm"
-#include "code\modules\nano\nanomanager.dm"
-#include "code\modules\nano\nanomapgen.dm"
-#include "code\modules\nano\nanoui.dm"
-#include "code\modules\nano\interaction\admin.dm"
-#include "code\modules\nano\interaction\base.dm"
-#include "code\modules\nano\interaction\conscious.dm"
-#include "code\modules\nano\interaction\contained.dm"
-#include "code\modules\nano\interaction\default.dm"
-#include "code\modules\nano\interaction\default_vr.dm"
-#include "code\modules\nano\interaction\interactive.dm"
-#include "code\modules\nano\interaction\inventory.dm"
-#include "code\modules\nano\interaction\inventory_deep.dm"
-#include "code\modules\nano\interaction\inventory_vr.dm"
-#include "code\modules\nano\interaction\outside.dm"
-#include "code\modules\nano\interaction\physical.dm"
-#include "code\modules\nano\interaction\remote.dm"
-#include "code\modules\nano\interaction\self.dm"
-#include "code\modules\nano\interaction\zlevel.dm"
-#include "code\modules\nano\modules\nano_module.dm"
#include "code\modules\nifsoft\nif.dm"
#include "code\modules\nifsoft\nif_softshop.dm"
#include "code\modules\nifsoft\nif_statpanel.dm"
@@ -3526,6 +3505,7 @@
#include "code\modules\tgs\includes.dm"
#include "code\modules\tgui\external.dm"
#include "code\modules\tgui\modal.dm"
+#include "code\modules\tgui\nanomapgen.dm"
#include "code\modules\tgui\states.dm"
#include "code\modules\tgui\tgui.dm"
#include "code\modules\tgui\tgui_window.dm"