<commit_before>/**
 * A map of HTML element types to the HTML attributes they can have.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
 * @module attributes-elements
 */

var HTML_ATTRIBUTES = {
  'accept': new Set([
    'form',
    'input',
  ]),

  'accept-charset': 'form',

  'accesskey': 'GLOBAL',

  'action': 'form',

  'align': new Set([
    'applet',
    'caption',
    'col',
    'colgroup',
    'hr',
    'iframe',
    'img',
    'table',
    'tbody',
    'td',
    'tfoot',
    'th',
    'thead',
    'tr',
  ]),

  'alt': new Set([
    'applet',
    'area',
    'img',
    'input',
  ]),

  'async': 'script',

  'autocomplete': new Set([
    'form',
    'input',
  ]),

  // TODO

  'href': new Set([
    'a',
    'area',
    'base',
    'link',
  ]),

  // TODO
};

function isStandardAttribute(attrName, tagName) {
  tagName = tagName.toLowerCase();
  var attr = HTML_ATTRIBUTES[attrName.toLowerCase()];
  return !!attr && (
    attr === 'GLOBAL' ||
    attr === tagName ||
    attr.has(tagName)
  );
}

module.exports = {
  isStandardAttribute: isStandardAttribute,
  HTML_ATTRIBUTES: HTML_ATTRIBUTES,
};
<commit_msg>1st half(ish) of attribute-element mappings<commit_after>/**
 * A map of HTML element types to the HTML attributes they can have.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
 * @module attributes-elements
 */

var HTML_ATTRIBUTES = {
  'accept': new Set([
    'form',
    'input',
  ]),

  'accept-charset': new Set([
    'form',
  ]),

  'accesskey': 'GLOBAL',

  'action': new Set([
    'form',
  ]),

  'align': new Set([
    'applet',
    'caption',
    'col',
    'colgroup',
    'hr',
    'iframe',
    'img',
    'table',
    'tbody',
    'td',
    'tfoot',
    'th',
    'thead',
    'tr',
  ]),

  'alt': new Set([
    'applet',
    'area',
    'img',
    'input',
  ]),

  'async': new Set([
    'script',
  ]),

  'autocomplete': new Set([
    'form',
    'input',
  ]),

  'autofocus': new Set([
    'button',
    'input',
    'keygen',
    'select',
    'textarea',
  ]),

  'autoplay': new Set([
    'audio',
    'video',
  ]),

  'autosave': new Set([
    'input',
  ]),

  'bgcolor': new Set([
    'body',
    'col',
    'colgroup',
    'marquee',
    'table',
    'tbody',
    'tfoot',
    'td',
    'th',
    'tr',
  ]),

  'border': new Set([
    'img',
    'object',
    'table',
  ]),

  'buffered': new Set([
    'audio',
    'video',
  ]),

  'challenge': new Set([
    'keygen',
  ]),

  'charset': new Set([
    'meta',
    'script',
  ]),

  'checked': new Set([
    'command',
    'input',
  ]),

  'cite': new Set([
    'blockquote',
    'del',
    'ins',
    'q',
  ]),

  'class': 'GLOBAL',

  'code': new Set([
    'applet',
  ]),

  'codebase': new Set([
    'applet',
  ]),

  'color': new Set([
    'basefont',
    'font',
    'hr',
  ]),

  'cols': new Set([
    'textarea',
  ]),

  'colspan': new Set([
    'td',
    'th',
  ]),

  'content': new Set([
    'meta',
  ]),

  'contenteditable': 'GLOBAL',

  'contextmenu': 'GLOBAL',

  'controls': new Set([
    'audio',
    'video',
  ]),

  'coords': new Set([
    'area',
  ]),

  'data': new Set([
    'object',
  ]),

  'datetime': new Set([
    'del',
    'ins',
    'time',
  ]),

  'default': new Set([
    'track',
  ]),

  'defer': new Set([
    'script',
  ]),

  'dir': 'GLOBAL',

  'dirname': new Set([
    'input',
    'textarea',
  ]),

  'disabled': new Set([
    'button',
    'command',
    'fieldset',
    'input',
    'keygen',
    'optgroup',
    'option',
    'select',
    'textarea',
  ]),

  'download': new Set([
    'a',
    'area',
  ]),

  'draggable': 'GLOBAL',

  'dropzone': 'GLOBAL',

  'enctype': new Set([
    'form',
  ]),

  // FIXME translate from htmlFor
  'for': new Set([
    'label',
    'output',
  ]),

  'form': new Set([
    'button',
    'fieldset',
    'input',
    'keygen',
    'label',
    'meter',
    'object',
    'output',
    'progress',
    'select',
    'textarea',
  ]),

  'formaction': new Set([
    'input',
    'button',
  ]),

  'headers': new Set([
    'td',
    'th',
  ]),

  'height': new Set([
    'canvas',
    'embed',
    'iframe',
    'img',
    'input',
    'object',
    'video',
  ]),

  'hidden': 'GLOBAL',

  'high': new Set([
    'meter',
  ]),

  'href': new Set([
    'a',
    'area',
    'base',
    'link',
  ]),

  // TODO
};

function isStandardAttribute(attrName, tagName) {
  tagName = tagName.toLowerCase();
  var attr = HTML_ATTRIBUTES[attrName.toLowerCase()];
  return !!attr && (
    attr === 'GLOBAL' ||
    attr.has(tagName)
  );
}

module.exports = {
  isStandardAttribute: isStandardAttribute,
  HTML_ATTRIBUTES: HTML_ATTRIBUTES,
};
<|endoftext|>


<commit_before>'use strict';

// Configure Require.js
var require = {
    // Default load path for js files
    baseUrl: 'client/app',
    shim: {
        // --- Use shim to mix together all THREE.js subcomponents
        ThreeCore: {exports: 'THREE'},
        SocketIO: {exports: 'io'},
        OrbitControls: {deps: ['ThreeCore'], exports: 'THREE'},
        PointerLockControls: {deps: ['ThreeCore'], exports: 'THREE'},
        StereoEffect: {deps: ['ThreeCore'], exports: 'THREE'},
        CSS3DRenderer: {deps: ['ThreeCore'], exports: 'THREE'},
        /**
         * --- end THREE sub-components
         */

        Detector: {exports: 'Detector'},
        Stats: {exports: 'Stats'}
    },
    /**
     * --- Third party code lives in client/lib
     */
    paths: {
        // --- start THREE sub-components
        Three: '../lib/Three',
        ThreeCore: '/node_modules/three/three.min',
        OrbitControls: '../lib/controls/OrbitControls',
        PointerLockControls: '../lib/controls/PointerLockControls',
        StereoEffect: '../lib/effects/StereoEffect',
        CSS3DRenderer: '../lib/renderers/CSS3DRenderer',
        SocketIO: '/socket.io/socket.io',
        /**
         * --- end THREE sub-components
         */

        Detector: '../lib/Detector',
        Stats: 'lib/Stats.min',

        /**
         * --- Require.js plugins
         */
        Text: 'lib/require_plugins/Text',
        Shader: 'lib/require_plugins/Shader',

        /**
         * --- Where to look for shader files
         */
        shaders: 'shaders'
    }
};
<commit_msg>Removed comments<commit_after>'use strict';

// Configure Require.js
var require = {
    // Default load path for js files
    baseUrl: 'client/app',
    shim: {
        ThreeCore: {exports: 'THREE'},
        SocketIO: {exports: 'io'},
        OrbitControls: {deps: ['ThreeCore'], exports: 'THREE'},
        PointerLockControls: {deps: ['ThreeCore'], exports: 'THREE'},
        StereoEffect: {deps: ['ThreeCore'], exports: 'THREE'},
        CSS3DRenderer: {deps: ['ThreeCore'], exports: 'THREE'},
        Detector: {exports: 'Detector'},
        Stats: {exports: 'Stats'}
    },
    paths: {
        Three: '../lib/Three',
        ThreeCore: '/node_modules/three/three.min',
        OrbitControls: '../lib/controls/OrbitControls',
        PointerLockControls: '../lib/controls/PointerLockControls',
        StereoEffect: '../lib/effects/StereoEffect',
        CSS3DRenderer: '../lib/renderers/CSS3DRenderer',
        SocketIO: '/socket.io/socket.io',
        Detector: '../lib/Detector',
        Stats: 'lib/Stats.min',
        Text: 'lib/require_plugins/Text',
        Shader: 'lib/require_plugins/Shader',
        shaders: 'shaders'
    }
};
<|endoftext|>


<commit_before>MM.Layout.Circle = Object.create(MM.Layout, {
	id: {value:"circle"},
	label: {value:"Circular"}
});
MM.Layout.ALL.push(MM.Layout.Circle);

MM.Layout.Circle.update = function(item) {
	if (item.getParent()) {
		var side = this.getChildDirection(item);
		var name = side.charAt(0).toUpperCase() + side.substring(1);
		MM.Layout.Graph[name].update(item);
	} else {
		this._layoutRoot(item);
	}
}

/**
 * @param {MM.Item} item Child node
 */
MM.Layout.Circle.getChildDirection = function(item) {
	while (item.getParent().getParent()) {
		item = item.getParent();
	}

	/* item is now the sub-root node */
	var side = item.getSide();
	if (side) { return side; } /* FIXME test for left/right values? */

	var counts = {left:0, right:0};
	var children = item.getParent().getChildren();
	for (var i=0;i<children.length;i++) {
		var side = children[i].getSide();
		if (!side) {
			side = (counts.right > counts.left ? "left" : "right");
			children[i].setSide(side);
		}
		counts[side]++;
	}

	return item.getSide();
}

MM.Layout.Circle.pickSibling = function(item, dir) {
	var parent = item.getParent();
	if (!parent) { return item; }

	var children = parent.getChildren();
	if (!parent.getParent()) {
		var side = this.getChildDirection(item);
		children = children.filter(function(child) {
			return (this.getChildDirection(child) == side);
		}, this);
	}

	var index = children.indexOf(item);
	index += dir;
	index = (index+children.length) % children.length;
	return children[index];
}

MM.Layout.Circle._layoutRoot = function(item) {
	var sides = this._splitRootChildren(item.getChildren());

	this._layoutChildren(item, right, 0, Math.PI);
	this._layoutChildren(item, left, Math.PI, 2*Math.PI);

	console.log(left);
	console.log(right);

	return;

	var dom = item.getDOM();

	var childrenLeft = [];
	var childrenRight = [];

	children.forEach(function(child, index) {
		var node = child.getDOM().node;
		var side = this.getChildDirection(child);

		if (side == "left") {
			childrenLeft.push(child);
		} else {
			childrenRight.push(child);
		}
	}, this);

	var bboxLeft = this._computeChildrenBBox(childrenLeft, 1);
	var bboxRight = this._computeChildrenBBox(childrenRight, 1);
	var height = Math.max(bboxLeft[1], bboxRight[1], dom.content.offsetHeight);

	var left = 0;
	this._layoutChildren(childrenLeft, "left", [left, Math.round((height-bboxLeft[1])/2)], bboxLeft);
	left += bboxLeft[0];

	if (childrenLeft.length) { left += this.SPACING_RANK; }
	dom.content.style.left = left + "px";
	left += dom.content.offsetWidth;

	if (childrenRight.length) { left += this.SPACING_RANK; }
	this._layoutChildren(childrenRight, "right", [left, Math.round((height-bboxRight[1])/2)], bboxRight);
	left += bboxRight[0];

	dom.content.style.top = Math.round((height - dom.content.offsetHeight)/2) + "px";
	dom.node.style.height = height + "px";
	dom.node.style.width = left + "px";

	this._anchorCanvas(item);
	this._drawHorizontalConnectors(item, "left", childrenLeft);
	this._drawHorizontalConnectors(item, "right", childrenRight);
}

MM.Layout.Circle._splitRootChildren = function(children) {
	var children = item.getChildren();
	var childrenHeights = children.map(function(child) {
		return child.getDOM().node.offsetHeight;
	});

	var height = childrenHeights.reduce(function(old, value) {
		return old+value;
	}, 0);
	var half = height/2;

	var left = children.slice();
	var right = [];

	while (half > 0) {
		right.push(left.shift());
		half -= childrenHeights.shift();
	}

	return
}
<commit_msg>experiments<commit_after>MM.Layout.Circle = Object.create(MM.Layout, {
	id: {value:"circle"},
	label: {value:"Circular"}
});
MM.Layout.ALL.push(MM.Layout.Circle);

MM.Layout.Circle.update = function(item) {
	if (item.getParent()) {
		var side = this.getChildDirection(item);
		var name = side.charAt(0).toUpperCase() + side.substring(1);
		MM.Layout.Graph[name].update(item);
	} else {
		this._layoutRoot(item);
	}
}

/**
 * @param {MM.Item} item Child node
 */
MM.Layout.Circle.getChildDirection = function(item) {
	while (item.getParent().getParent()) {
		item = item.getParent();
	}

	/* item is now the sub-root node */
	var side = item.getSide();
	if (side) { return side; } /* FIXME test for left/right values? */

	var counts = {left:0, right:0};
	var children = item.getParent().getChildren();
	for (var i=0;i<children.length;i++) {
		var side = children[i].getSide();
		if (!side) {
			side = (counts.right > counts.left ? "left" : "right");
			children[i].setSide(side);
		}
		counts[side]++;
	}

	return item.getSide();
}

MM.Layout.Circle.pickSibling = function(item, dir) {
	var parent = item.getParent();
	if (!parent) { return item; }

	var children = parent.getChildren();
	if (!parent.getParent()) {
		var side = this.getChildDirection(item);
		children = children.filter(function(child) {
			return (this.getChildDirection(child) == side);
		}, this);
	}

	var index = children.indexOf(item);
	index += dir;
	index = (index+children.length) % children.length;
	return children[index];
}

MM.Layout.Circle._layoutRoot = function(item) {
	var dom = item.getDOM();
	var sides = this._splitRootChildren(item.getChildren());
	var contentSize = [dom.content.offsetWidth, dom.content.offsetHeight];
	var totalSize = [0, 0];

	var bboxLeft = this._computeBBox(sides[0]);
	var bboxRight = this._computeBBox(sides[1]);
	totalSize[1] = Math.max(bboxLeft[1], bboxRight[1], contentSize[1]);

	this._positionTop(sides[0]
}

MM.Layout.Circle._splitRootChildren = function(children) {
	var children = item.getChildren();
	var childrenHeights = children.map(function(child) {
		return child.getDOM().node.offsetHeight;
	});

	var height = childrenHeights.reduce(function(old, value) {
		return old+value;
	}, 0);
	var half = height/2;

	var left = children.slice();
	var right = [];

	while (half > 0) {
		right.push(left.shift());
		half -= childrenHeights.shift();
	}

	return [left.reverse(), right];
}

/**
 * @param {number} angle 0..Math.PI
 * @returns {number}
 */
MM.Layout.Circle._angleToOffset = function(angle) {
	return 100*Math.sin(angle); /* FIXME */
}
<|endoftext|>


<commit_before>/*jslint nomen: false, onevar: false */
/*global _: false, lib: false */

// Mixin which gives an object event handling capabilities. Call
// lib.hasEvent(_public, _protected, 'foo') to generate two methods for this event:
// onFoo(), which takes a handler to be called when the event is triggered, and
// triggerFoo(), which triggers the event. Any arguments passed to triggerFoo()
// are passed through to the event handlers.
//
// This mixin also creates general methods on() and trigger(), which behave
// like the methods above, but take an event name as their first argument.
lib.hasEvent = function (_public, _protected, event_names) {

    _protected.event_handlers = _protected.event_handlers || {};

    // Register a new event handler for an arbitrary event name.
    _public.on = _public.on || function (name, handler) {
        _protected.event_handlers[name] = _protected.event_handlers[name] || [];
        _protected.event_handlers[name].push(handler);
    };

    _public.removeHandler = _public.removeHandler || function (name, handler) {
        var handlers = _protected.event_handlers[name];
        if (!handlers) {
            return;
        }
        var index = handlers.indexOf(handler);
        if (index < 0) {
            return; // no such handler
        }
        return handlers.splice(index, 1)[0];
    };

    // Trigger the event handlers for an arbitrary event name.
    _public.trigger = _public.trigger || function (name) {
        var args = Array.prototype.slice.apply(arguments).slice(1), that = this;

        if (_protected.event_handlers.hasOwnProperty(name)) {
            _(_protected.event_handlers[name]).each(function (handler) {
                handler.apply(that, args);
            });
        }
    };

    // Allow either lib.hasEvent(_p, _p, ['a', 'b', 'c']),
    //           or lib.hasEvent(_p, _p, 'a', 'b', 'c')
    if (!_(event_names).isArray()) {
        event_names = _(arguments).toArray().slice(2);
    }

    _(event_names).each(function (event_name) {

        _protected.event_handlers[event_name] = _protected.event_handlers[event_name] || [];

        var handlers = _protected.event_handlers[event_name];

        // Register a new event handler for this specific event.
        _public['on' + _(event_name).camelize()] = function (handler) {
            handlers.push(handler);
        };

        // Trigger the event handlers for this specific event.
        _public['trigger' + _(event_name).camelize()] = function () {
            var args = arguments, that = this;
            _(handlers).each(function (handler) {
                handler.apply(that, args);
            });
        };
    });
};
<commit_msg>add ability to remove the handlers for a given event.<commit_after>/*jslint nomen: false, onevar: false */
/*global _: false, lib: false */

// Mixin which gives an object event handling capabilities. Call
// lib.hasEvent(_public, _protected, 'foo') to generate two methods for this event:
// onFoo(), which takes a handler to be called when the event is triggered, and
// triggerFoo(), which triggers the event. Any arguments passed to triggerFoo()
// are passed through to the event handlers.
//
// This mixin also creates general methods on() and trigger(), which behave
// like the methods above, but take an event name as their first argument.
lib.hasEvent = function (_public, _protected, event_names) {

    _protected.event_handlers = _protected.event_handlers || {};

    // Register a new event handler for an arbitrary event name.
    _public.on = _public.on || function (name, handler) {
        _protected.event_handlers[name] = _protected.event_handlers[name] || [];
        _protected.event_handlers[name].push(handler);
    };

    _public.removeHandlers = _public.removeHandlers || function (name) {
        _protected.event_handlers[name] = [];
    };

    _public.removeHandler = _public.removeHandler || function (name, handler) {
        var handlers = _protected.event_handlers[name];
        if (!handlers) {
            return;
        }
        var index = handlers.indexOf(handler);
        if (index < 0) {
            return; // no such handler
        }
        return handlers.splice(index, 1)[0];
    };

    // Trigger the event handlers for an arbitrary event name.
    _public.trigger = _public.trigger || function (name) {
        var args = Array.prototype.slice.apply(arguments).slice(1), that = this;

        if (_protected.event_handlers.hasOwnProperty(name)) {
            _(_protected.event_handlers[name]).each(function (handler) {
                handler.apply(that, args);
            });
        }
    };

    // Allow either lib.hasEvent(_p, _p, ['a', 'b', 'c']),
    //           or lib.hasEvent(_p, _p, 'a', 'b', 'c')
    if (!_(event_names).isArray()) {
        event_names = _(arguments).toArray().slice(2);
    }

    _(event_names).each(function (event_name) {

        _protected.event_handlers[event_name] = _protected.event_handlers[event_name] || [];

        var handlers = _protected.event_handlers[event_name];

        // Register a new event handler for this specific event.
        _public['on' + _(event_name).camelize()] = function (handler) {
            handlers.push(handler);
        };

        // Trigger the event handlers for this specific event.
        _public['trigger' + _(event_name).camelize()] = function () {
            var args = arguments, that = this;
            _(handlers).each(function (handler) {
                handler.apply(that, args);
            });
        };
    });
};
<|endoftext|>


<commit_before>import {getFaucet, getTestFaucet} from "../branding";

export const blockTradesAPIs = {
    BASE: "https://api.blocktrades.us/v2",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const openledgerAPIs = {
    BASE: "https://ol-api1.openledger.info/api/v0/ol/support",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount",
    RPC_URL: "https://openledger.info/api/"
};

export const rudexAPIs = {
    BASE: "https://gateway.rudex.org/api/rudex",
    COINS_LIST: "/coins",
    NEW_DEPOSIT_ADDRESS: "/simple-api/initiate-trade"
};

export const bitsparkAPIs = {
    BASE: "https://dex-api.bitspark.io/api/v1",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const cryptoBridgeAPIs = {
    BASE: "https://api.crypto-bridge.org/api/v1",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/wallets",
    MARKETS: "/markets",
    TRADING_PAIRS: "/trading-pairs"
};

export const citadelAPIs = {
    BASE: "https://citadel.li/trade",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const gdex2APIs = {
    BASE: "https://api.52bts.net/adjust",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs"
};

// Legacy Deposit/Withdraw
export const gdexAPIs = {
    BASE: "https://api.52bts.net",
    ASSET_LIST: "/gateway/asset/assetList",
    ASSET_DETAIL: "/gateway/asset/assetDetail",
    GET_DEPOSIT_ADDRESS: "/gateway/address/getAddress",
    CHECK_WITHDRAY_ADDRESS: "/gateway/address/checkAddress",
    DEPOSIT_RECORD_LIST: "/gateway/deposit/recordList",
    DEPOSIT_RECORD_DETAIL: "/gateway/deposit/recordDetail",
    WITHDRAW_RECORD_LIST: "/gateway/withdraw/recordList",
    WITHDRAW_RECORD_DETAIL: "/gateway/withdraw/recordDetail",
    GET_USER_INFO: "/gateway/user/getUserInfo",
    USER_AGREEMENT: "/gateway/user/isAgree",
    WITHDRAW_RULE: "/gateway/withdraw/rule"
};

export const xbtsxAPIs = {
    BASE: "https://apis.xbts.io/api/v1",
    COINS_LIST: "/coin"
};

export const nodeRegions = [
    // region of the node follows roughly https://en.wikipedia.org/wiki/Subregion#/media/File:United_Nations_geographical_subregions.png
    "Northern Europe",
    "Western Europe",
    "Southern Europe",
    "Eastern Europe",
    "Northern Asia",
    "Western Asia",
    "Southern Asia",
    "Eastern Asia",
    "Central Asia",
    "Southeastern Asia",
    "Australia and New Zealand",
    "Melanesia",
    "Polynesia",
    "Micronesia",
    "Northern Africa",
    "Western Africa",
    "Middle Africa",
    "Eastern Africa",
    "Southern Africa",
    "Northern America",
    "Central America",
    "Caribbean",
    "South America"
];

export const settingsAPIs = {
    // If you want a location to be translated, add the translation to settings in locale-xx.js
    // and use an object {translate: key} in WS_NODE_LIST
    DEFAULT_WS_NODE: "wss://fake.automatic-selection.com",
    WS_NODE_LIST: [
        {
            url: "wss://fake.automatic-selection.com",
            location: {translate: "settings.api_closest"}
        },
        {
            url: "ws://127.0.0.1:8090",
            location: "Locally hosted"
        },
        {
            url: "wss://nexus01.co.uk/ws",
            region: "Northern Europe",
            country: "England",
            location: "Gloucester",
            operator: "Witness: nexus01",
            contact: "telegram:rosswlkr"
        },
        {
            url: "wss://dex.iobanker.com/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Frankfurt",
            operator: "Witness: iobanker-core",
            contact: "email:admin@iobanker.com"
        },
        {
            url: "wss://api.bitshares.rocks/ws",
            region: "Northern America",
            country: "U.S.A.",
            location: "AZ, Phoenix",
            operator: "Vagnavs",
            contact: "telegram:Maximat00"
        },
        {
            url: "wss://ws.gdex.top",
            region: "Eastern Asia",
            country: "China",
            location: "Shanghai",
            operator: "Witness: gdex-witness",
            contact: "telegram:BrianZhang"
        },
        {
            url: "wss://api.bts.btspp.io:10100",
            region: "Eastern Asia",
            country: "China",
            location: "Hangzhou",
            operator: "Witness: btspp-witness",
            contact: "telegram:btsplusplus"
        },
        {
            url: "wss://api.bts.mobi/ws",
            region: "Northern America",
            country: "U.S.A.",
            location: "Virginia",
            operator: "Witness: in.abit",
            contact: "telegram:abitmore"
        },
        {
            url: "wss://btsws.roelandp.nl/ws",
            region: "Northern Europe",
            country: "Finland",
            location: "Helsinki",
            operator: "Witness: roelandp",
            contact: "telegram:roelandp"
        },
        {
            url: "wss://api.bitshares.bhuz.info/ws",
            region: "Northern America",
            country: "Canada",
            operator: "Witness: bhuz",
            contact: "telegram:bhuzor"
        },
        {
            url: "wss://api.btsgo.net/ws",
            region: "Southeastern Asia",
            location: "Singapore",
            operator: "Witness: xn-delegate",
            contact: "wechat:Necklace"
        },
        {
            url: "wss://bts.open.icowallet.net/ws",
            region: "Eastern Asia",
            country: "China",
            location: "Hangzhou",
            operator: "Witness: magicwallet.witness",
            contact: "telegram:plus_wave"
        },
        {
            url: "wss://freedom.bts123.cc:15138/",
            region: "Eastern Asia",
            country: "China",
            location: "Changsha",
            operator: "Witness: delegate.freedom",
            contact: "telegram:eggplant"
        },
        {
            url: "wss://bitshares.bts123.cc:15138/",
            region: "Eastern Asia",
            country: "China",
            location: "Hangzhou",
            operator: "Witness: delegate.freedom",
            contact: "telegram:eggplant"
        },
        // TODO the owner said it's temporarily closed. Recheck later.
        //{
        //    url: "wss://api.bts.ai",
        //    region: "Eastern Asia",
        //    country: "China",
        //    location: "Beijing",
        //    operator: "Witness: witness.hiblockchain",
        //    contact: "telegram:vianull;wechat:strugglingl"
        //},
        {
            url: "wss://api.61bts.com",
            region: "Eastern Asia",
            country: "China",
            location: "Shandong",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://api-us.61bts.com",
            region: "Northern America",
            country: "USA",
            location: "St. Louis",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://api.dex.trading/",
            region: "Western Europe",
            country: "France",
            location: "Paris",
            operator: "Witness: zapata42-witness",
            contact: "telegram:Zapata_42"
        },
        {
            url: "wss://api.bitshares.org/ws",
            region: "Western Europe",
            country: "France",
            location: "",
            operator: "bitshares.org",
            contact: ""
        },
        {
            url: "wss://us.api.bitshares.org/ws",
            region: "Western Europe",
            country: "France",
            location: "",
            operator: "bitshares.org",
            contact: ""
        },
        {
            url: "wss://asia.api.bitshares.org/ws",
            region: "Western Europe",
            country: "France",
            location: "",
            operator: "bitshares.org",
            contact: ""
        },
        {
            url: "wss://eu.nodes.bitshares.ws",
            region: "Western Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: blocksights",
            contact: "telegram:blocksights"
        },
        {
            url: "wss://api-bts.liondani.com/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Falkenstein",
            operator: "Witness: liondani",
            contact: "telegram:liondani"
        },
        {
            url: "wss://public.xbts.io/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://cloud.xbts.io/ws",
            region: "Northern America",
            country: "U.S.A.",
            location: "VG, Ashburn",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://node.xbts.io/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Falkenstein",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://bts.mypi.win",
            region: "Northern America",
            country: "U.S.A.",
            location: "Seattle, CA",
            operator: "Witness: gbac-ety001",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://hongkong.bitshares.im/ws",
            region: "East Asia",
            country: "China",
            location: "Hong Kong",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://singapore.bitshares.im/ws",
            region: "Southeast Asia",
            country: "Singapore",
            location: "Singapore",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://newyork.bitshares.im/ws",
            region: "Northern America",
            country: "U.S.A.",
            location: "New York",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://api.btslebin.com/ws",
            region: "Eastern Asia",
            country: "China",
            location: "Hong Kong",
            operator: "Witness: lebin-witness",
            contact: "telegram: lebinbit"
        },
        // Testnet
        {
            url: "wss://eu.nodes.testnet.bitshares.ws",
            region: "TESTNET - Western Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: blocksights",
            contact: "telegram:blocksights"
        },
        {
            url: "wss://testnet.dex.trading/",
            region: "TESTNET - Western Europe",
            country: "France",
            location: "Paris",
            operator: "Witness: zapata42-witness",
            contact: "telegram:Zapata_42"
        },
        {
            url: "wss://testnet.xbts.io/ws",
            region: "TESTNET - Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://testnet.bitshares.im/ws",
            region: "Eastern Asia",
            country: "Japan",
            location: "Tokyo",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://api-testnet.61bts.com/ws",
            region: "Eastern Asia",
            country: "China",
            location: "Shandong",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://api-us-testnet.61bts.com/ws",
            region: "Northern America",
            country: "USA",
            location: "St. Louis",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        }
    ],
    ES_WRAPPER_LIST: [
        {
            url: "https://api.bitshares.ws/openexplorer",
            region: "Western Europe",
            country: "Germany",
            operator: "blocksights.info",
            contact: "telegram:blocksights"
        }
    ],
    DEFAULT_FAUCET: getFaucet().url,
    TESTNET_FAUCET: getTestFaucet().url
};
<commit_msg>Removing api.bitshares.rocks API node<commit_after>import {getFaucet, getTestFaucet} from "../branding";

export const blockTradesAPIs = {
    BASE: "https://api.blocktrades.us/v2",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const openledgerAPIs = {
    BASE: "https://ol-api1.openledger.info/api/v0/ol/support",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount",
    RPC_URL: "https://openledger.info/api/"
};

export const rudexAPIs = {
    BASE: "https://gateway.rudex.org/api/rudex",
    COINS_LIST: "/coins",
    NEW_DEPOSIT_ADDRESS: "/simple-api/initiate-trade"
};

export const bitsparkAPIs = {
    BASE: "https://dex-api.bitspark.io/api/v1",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const cryptoBridgeAPIs = {
    BASE: "https://api.crypto-bridge.org/api/v1",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/wallets",
    MARKETS: "/markets",
    TRADING_PAIRS: "/trading-pairs"
};

export const citadelAPIs = {
    BASE: "https://citadel.li/trade",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const gdex2APIs = {
    BASE: "https://api.52bts.net/adjust",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs"
};

// Legacy Deposit/Withdraw
export const gdexAPIs = {
    BASE: "https://api.52bts.net",
    ASSET_LIST: "/gateway/asset/assetList",
    ASSET_DETAIL: "/gateway/asset/assetDetail",
    GET_DEPOSIT_ADDRESS: "/gateway/address/getAddress",
    CHECK_WITHDRAY_ADDRESS: "/gateway/address/checkAddress",
    DEPOSIT_RECORD_LIST: "/gateway/deposit/recordList",
    DEPOSIT_RECORD_DETAIL: "/gateway/deposit/recordDetail",
    WITHDRAW_RECORD_LIST: "/gateway/withdraw/recordList",
    WITHDRAW_RECORD_DETAIL: "/gateway/withdraw/recordDetail",
    GET_USER_INFO: "/gateway/user/getUserInfo",
    USER_AGREEMENT: "/gateway/user/isAgree",
    WITHDRAW_RULE: "/gateway/withdraw/rule"
};

export const xbtsxAPIs = {
    BASE: "https://apis.xbts.io/api/v1",
    COINS_LIST: "/coin"
};

export const nodeRegions = [
    // region of the node follows roughly https://en.wikipedia.org/wiki/Subregion#/media/File:United_Nations_geographical_subregions.png
    "Northern Europe",
    "Western Europe",
    "Southern Europe",
    "Eastern Europe",
    "Northern Asia",
    "Western Asia",
    "Southern Asia",
    "Eastern Asia",
    "Central Asia",
    "Southeastern Asia",
    "Australia and New Zealand",
    "Melanesia",
    "Polynesia",
    "Micronesia",
    "Northern Africa",
    "Western Africa",
    "Middle Africa",
    "Eastern Africa",
    "Southern Africa",
    "Northern America",
    "Central America",
    "Caribbean",
    "South America"
];

export const settingsAPIs = {
    // If you want a location to be translated, add the translation to settings in locale-xx.js
    // and use an object {translate: key} in WS_NODE_LIST
    DEFAULT_WS_NODE: "wss://fake.automatic-selection.com",
    WS_NODE_LIST: [
        {
            url: "wss://fake.automatic-selection.com",
            location: {translate: "settings.api_closest"}
        },
        {
            url: "ws://127.0.0.1:8090",
            location: "Locally hosted"
        },
        {
            url: "wss://nexus01.co.uk/ws",
            region: "Northern Europe",
            country: "England",
            location: "Gloucester",
            operator: "Witness: nexus01",
            contact: "telegram:rosswlkr"
        },
        {
            url: "wss://dex.iobanker.com/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Frankfurt",
            operator: "Witness: iobanker-core",
            contact: "email:admin@iobanker.com"
        },
        {
            url: "wss://ws.gdex.top",
            region: "Eastern Asia",
            country: "China",
            location: "Shanghai",
            operator: "Witness: gdex-witness",
            contact: "telegram:BrianZhang"
        },
        {
            url: "wss://api.bts.btspp.io:10100",
            region: "Eastern Asia",
            country: "China",
            location: "Hangzhou",
            operator: "Witness: btspp-witness",
            contact: "telegram:btsplusplus"
        },
        {
            url: "wss://api.bts.mobi/ws",
            region: "Northern America",
            country: "U.S.A.",
            location: "Virginia",
            operator: "Witness: in.abit",
            contact: "telegram:abitmore"
        },
        {
            url: "wss://btsws.roelandp.nl/ws",
            region: "Northern Europe",
            country: "Finland",
            location: "Helsinki",
            operator: "Witness: roelandp",
            contact: "telegram:roelandp"
        },
        {
            url: "wss://api.bitshares.bhuz.info/ws",
            region: "Northern America",
            country: "Canada",
            operator: "Witness: bhuz",
            contact: "telegram:bhuzor"
        },
        {
            url: "wss://api.btsgo.net/ws",
            region: "Southeastern Asia",
            location: "Singapore",
            operator: "Witness: xn-delegate",
            contact: "wechat:Necklace"
        },
        {
            url: "wss://bts.open.icowallet.net/ws",
            region: "Eastern Asia",
            country: "China",
            location: "Hangzhou",
            operator: "Witness: magicwallet.witness",
            contact: "telegram:plus_wave"
        },
        {
            url: "wss://freedom.bts123.cc:15138/",
            region: "Eastern Asia",
            country: "China",
            location: "Changsha",
            operator: "Witness: delegate.freedom",
            contact: "telegram:eggplant"
        },
        {
            url: "wss://bitshares.bts123.cc:15138/",
            region: "Eastern Asia",
            country: "China",
            location: "Hangzhou",
            operator: "Witness: delegate.freedom",
            contact: "telegram:eggplant"
        },
        // TODO the owner said it's temporarily closed. Recheck later.
        //{
        //    url: "wss://api.bts.ai",
        //    region: "Eastern Asia",
        //    country: "China",
        //    location: "Beijing",
        //    operator: "Witness: witness.hiblockchain",
        //    contact: "telegram:vianull;wechat:strugglingl"
        //},
        {
            url: "wss://api.61bts.com",
            region: "Eastern Asia",
            country: "China",
            location: "Shandong",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://api-us.61bts.com",
            region: "Northern America",
            country: "USA",
            location: "St. Louis",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://api.dex.trading/",
            region: "Western Europe",
            country: "France",
            location: "Paris",
            operator: "Witness: zapata42-witness",
            contact: "telegram:Zapata_42"
        },
        {
            url: "wss://api.bitshares.org/ws",
            region: "Western Europe",
            country: "France",
            location: "",
            operator: "bitshares.org",
            contact: ""
        },
        {
            url: "wss://us.api.bitshares.org/ws",
            region: "Western Europe",
            country: "France",
            location: "",
            operator: "bitshares.org",
            contact: ""
        },
        {
            url: "wss://asia.api.bitshares.org/ws",
            region: "Western Europe",
            country: "France",
            location: "",
            operator: "bitshares.org",
            contact: ""
        },
        {
            url: "wss://eu.nodes.bitshares.ws",
            region: "Western Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: blocksights",
            contact: "telegram:blocksights"
        },
        {
            url: "wss://api-bts.liondani.com/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Falkenstein",
            operator: "Witness: liondani",
            contact: "telegram:liondani"
        },
        {
            url: "wss://public.xbts.io/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://cloud.xbts.io/ws",
            region: "Northern America",
            country: "U.S.A.",
            location: "VG, Ashburn",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://node.xbts.io/ws",
            region: "Western Europe",
            country: "Germany",
            location: "Falkenstein",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://bts.mypi.win",
            region: "Northern America",
            country: "U.S.A.",
            location: "Seattle, CA",
            operator: "Witness: gbac-ety001",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://hongkong.bitshares.im/ws",
            region: "East Asia",
            country: "China",
            location: "Hong Kong",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://singapore.bitshares.im/ws",
            region: "Southeast Asia",
            country: "Singapore",
            location: "Singapore",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://newyork.bitshares.im/ws",
            region: "Northern America",
            country: "U.S.A.",
            location: "New York",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://api.btslebin.com/ws",
            region: "Eastern Asia",
            country: "China",
            location: "Hong Kong",
            operator: "Witness: lebin-witness",
            contact: "telegram: lebinbit"
        },
        // Testnet
        {
            url: "wss://eu.nodes.testnet.bitshares.ws",
            region: "TESTNET - Western Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: blocksights",
            contact: "telegram:blocksights"
        },
        {
            url: "wss://testnet.dex.trading/",
            region: "TESTNET - Western Europe",
            country: "France",
            location: "Paris",
            operator: "Witness: zapata42-witness",
            contact: "telegram:Zapata_42"
        },
        {
            url: "wss://testnet.xbts.io/ws",
            region: "TESTNET - Europe",
            country: "Germany",
            location: "Nuremberg",
            operator: "Witness: xbtsio-wallet",
            contact: "telegram: xbtsio"
        },
        {
            url: "wss://testnet.bitshares.im/ws",
            region: "Eastern Asia",
            country: "Japan",
            location: "Tokyo",
            operator: "Witness: clone",
            contact: "telegram: yexiao"
        },
        {
            url: "wss://api-testnet.61bts.com/ws",
            region: "Eastern Asia",
            country: "China",
            location: "Shandong",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        },
        {
            url: "wss://api-us-testnet.61bts.com/ws",
            region: "Northern America",
            country: "USA",
            location: "St. Louis",
            operator: "Witness: liuye",
            contact: "email:work@akawa.ink"
        }
    ],
    ES_WRAPPER_LIST: [
        {
            url: "https://api.bitshares.ws/openexplorer",
            region: "Western Europe",
            country: "Germany",
            operator: "blocksights.info",
            contact: "telegram:blocksights"
        }
    ],
    DEFAULT_FAUCET: getFaucet().url,
    TESTNET_FAUCET: getTestFaucet().url
};
<|endoftext|>


<commit_before>'use strict';

var Meetup = function(meetupURL,
											maxEvents) {
	this.meetupURL = (typeof meetupURL!=='undefined') ? meetupURL :
	"https://api.meetup.com/2/events?offset=0&format=json&limited_events=False&group_urlname=techcorridorio&page=200&fields=&order=time&desc=false&status=upcoming&sig_id=168857872&sig=e659cc6038d27adf6eae600a44905c69196c77df";
	// If maxEvents==0, show all.
	this.maxEvents = (typeof maxEvents!=='undefined') ? maxEvents : 0;

	var printDate = function(date) {
		// Pretty print the event date
		var day = [ "Sunday", "Monday", "Tuesday", "Wednesday",
								"Thursday", "Friday", "Saturday"];
		var months = [
			"January", "February", "March", "April",
			"May", "June", "July", "August",
			"September", "October", "November", "December"
		];

		return day[date.getDay()]  + ', '
			+ months[date.getMonth()] + ' '
			+ date.getDate() + ', '
			+ date.getFullYear()
			+ ' at '
			+ (date.getHours() % 12) + ':'
			+ (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes())
			+ ' '
			+ (date.getHours() < 12 ? 'AM' : 'PM');
	}

	var printVenue = function(venue) {
		// Pretty print the event venue
		return ''
			+ venue.name
			+ '';
	}

	var createEventPanel = function(event) {
		// Generates a Bootstrap panel for each event
		var panelHTML = '
'
			+ ''
				+ event.name
			+ '
'
			+ '
'
				+ '
'
					+ event.description
				+ '
'
				+ '
'
					+ 'WHEN: ' + printDate(new Date(event.time))
					+ '
'
					+ 'WHERE: ' + printVenue(event.venue)
					+ '
'
					+ 'WHO: ' + event.yes_rsvp_count + ' already going'
				+ '
'
			+ '
';

		$("
", {
			"class": "panel panel-default",
			html: panelHTML
		}).appendTo("#meetup-events");
	}

	this.getEvents = function(callback) {
		$.ajax({
			url: this.meetupURL,
			dataType: 'jsonp'
		})
		.done(function(data) {
			$.each(data.results, function(i, event) {
				// Generate Bootstrap panels for each event
				if (maxEvents === undefined || i < maxEvents) {
					createEventPanel(event);
				}
			})
		})
		.fail(function(error) {
			console.log("Meetup API Request Failed");
		});
	}
};<commit_msg>Fixed whitespace<commit_after>'use strict';

var Meetup = function(meetupURL, maxEvents) {
	this.meetupURL = (typeof meetupURL!=='undefined') ? meetupURL :
	"https://api.meetup.com/2/events?offset=0&format=json&limited_events=False&group_urlname=techcorridorio&page=200&fields=&order=time&desc=false&status=upcoming&sig_id=168857872&sig=e659cc6038d27adf6eae600a44905c69196c77df";
	// If maxEvents==0, show all.
	this.maxEvents = (typeof maxEvents!=='undefined') ? maxEvents : 0;

	var printDate = function(date) {
		// Pretty print the event date
		var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
		var months = [
			"January", "February", "March", "April",
			"May", "June", "July", "August",
			"September", "October", "November", "December"
		];

		return day[date.getDay()]  + ', '
			+ months[date.getMonth()] + ' '
			+ date.getDate() + ', '
			+ date.getFullYear()
			+ ' at '
			+ (date.getHours() % 12) + ':'
			+ (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes())
			+ ' '
			+ (date.getHours() < 12 ? 'AM' : 'PM');
	}

	var printVenue = function(venue) {
		// Pretty print the event venue
		return ''
			+ venue.name
			+ '';
	}

	var createEventPanel = function(event) {
		// Generates a Bootstrap panel for each event
		var panelHTML = '
'
			+ ''
				+ event.name
			+ '
'
			+ '
'
				+ '
'
					+ event.description
				+ '
'
				+ '
'
					+ 'WHEN: ' + printDate(new Date(event.time))
					+ '
'
					+ 'WHERE: ' + printVenue(event.venue)
					+ '
'
					+ 'WHO: ' + event.yes_rsvp_count + ' already going'
				+ '
'
			+ '
';

		$("
", {
			"class": "panel panel-default",
			html: panelHTML
		}).appendTo("#meetup-events");
	}

	this.getEvents = function(callback) {
		$.ajax({
			url: this.meetupURL,
			dataType: 'jsonp'
		})
		.done(function(data) {
			$.each(data.results, function(i, event) {
				// Generate Bootstrap panels for each event
				if (maxEvents === undefined || i < maxEvents) {
					createEventPanel(event);
				}
			})
		})
		.fail(function(error) {
			console.log("Meetup API Request Failed");
		});
	}
};<|endoftext|>


<commit_before>// perfect singleton
window.engine = (new (function() {

  this.Q = MathJax.Hub.queue;
  this.tex = null;
  this.mml = null;
  this.buffer = [];

    //jax to MathML
    function toMathML(jax,callback) {
        var mml,
            success = false;
        try {
            mml = jax.root.toMathML('');
            if( mml.indexOf('<mtext mathcolor="red">') == -1 ){
                success = true;
            }
        } catch(err) {
            if (!err.restart) {throw err;} // an actual error
            return MathJax.Callback.After([toMathML,jax,callback],err.restart);
        }
        MathJax.Callback(callback)(mml,success);
    }

  // bind helper.
  this.bind = function(method) {
    var engine = this;
    return function() {
      return method.apply(engine, arguments);
    };
  };

  // Initialize engine.
  this._init = function() {
    this.Q.Push(this.bind(function () {
      this.tex = {
        div: document.getElementById("math-tex"),
        jax: MathJax.Hub.getAllJax("math-tex")[0],
        last_width: null,
        last_q: ''
      }
      this.mml = {
        div: document.getElementById("math-mml"),
        jax: MathJax.Hub.getAllJax("math-mml")[0],
        last_width: null,
        last_q: ''
      }
      this._process_buffered();
    }));
  };

  // This helper function determines whether or not a <text> node inside the SVG
  // output from MathJax is an error message.  It uses the default error message
  // fill color.  Note that the constant #C00 could be overriden by the MathJax
  // config!!
  this._text_is_error = function(txt) {
    return txt.getAttribute("fill") == "#C00" &&
      txt.getAttribute("stroke") == "none";
  };

  // Serialize an (svg) element
  this._serialize = function(svg) {
    var tmpDiv = document.createElement('div');
    tmpDiv.appendChild(svg);
    return tmpDiv.innerHTML;
  };

  // MathJax keeps parts of SVG symbols in one hidden svg at
  // the begining of the DOM, this function should take two
  // SVGs and return one stand-alone svg which could be
  // displayed like an image on some different page.
  this._merge = function(svg) {
    var origDefs = document.getElementById('MathJax_SVG_Hidden')
      .nextSibling.childNodes[0];
    var defs = origDefs.cloneNode(false);

    // append shallow defs and change xmlns.
    svg.insertBefore(defs, svg.childNodes[0]);
    svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");

    // clone and copy all used paths into local defs.
    // xlink:href in uses FIX
    var uses = svg.getElementsByTagName("use");
    for (var k = 0; k < uses.length; ++k) {
      var id = uses[k].getAttribute("href");
      defs.appendChild(
        document.getElementById(id.substr(1)).cloneNode(true)
      );
      uses[k].setAttribute("xlink:href", id);
    }

    svg.style.position = "static";
    return this._serialize(svg);
  };

  // If someone calls process() before init is complete,
  // that call will be stored into a buffer. After the init
  // is complete, all buffer stuff will get resolved.
  this._process_buffered = function() {
    for (var i = 0; i < this.buffer.length; ++i) {
      this.process(this.buffer[i][0], this.buffer[i][1]);
    }
    this.buffer = [];
  };

  // When process() is finished, the callback cb will be invoked with an
  // array [<q string>, <svg out>].
  // If there is an error during the rendering then the second
  // element, instead of a string, will be a nested array with
  // one string element giving the error message.
  this.process = function(query, cb) {
    // For debugging, the console doesn't work from here, but you can return dummy
    // data, as follows.  It will show up in the browser instead of the real results.
    //cb([query.num, query.q, ["debug message"]]);
    //return;

    var type = query.type;
    if (this[type] === null || this[type].jax === null) {
      this.buffer.push( [query, cb] );
    }
    else {

      var q = query.q,
          width = query.width,
          format = query.format,
          t = this[type],
          div = t.div,
          jax = t.jax,
          success = false;

      if (width === null) {
        //div.removeAttribute('style');
        // Let's just use a default width of 1000 (arbitrary)
        div.setAttribute('style', 'width: 1000px');
      }
      else {
        div.setAttribute('style', 'width: ' + width + 'px');
      }

      // Possibilities:
      // - if q and width are the same as last time, no need to Rerender
      // - if q is the same, but width is not, then Rerender() (calling
      //   Text() does not work)
      // - if q is not the same, call Text()

      if (t.last_q == q && t.last_width !== width) {
        this.Q.Push(["Rerender", jax]);
      }
      else if (t.last_q != q) {
        this.Q.Push(["Text", jax, q]);
      }
      t.last_q = q;
      t.last_width = width;

      this.Q.Push(this.bind(function() {
        var svg_elem = div.getElementsByTagName("svg")[0];
        var ret = null;
        if (!svg_elem) {
          ret = ['MathJax error'];
          cb([query, ret, '', false]);
        } else {
            ret = this._merge(svg_elem.cloneNode(true));
            toMathML(jax,function (mml,success) {
                cb([query, ret, mml, success]);
            })
        }
          //This does not work (for the WMF setup)
/**        else {
          var texts = svg_elem.getElementsByTagName("text");
          for (var i = 0; i < texts.length; ++i) {
            if (this._text_is_error(texts[i])) {
              ret = [texts[i].textContent];
              break;
            }
          }
        }*/
;
      }));
    }
  };

  this._init();
}));
<commit_msg>Fix: Remove MathML out if used as input<commit_after>// Version
var VERSION = '0.1-dev';

var system = require('system');
var args = system.args;
var server = require('webserver').create();
var page = require('webpage').create();
var fs = require('fs');

var usage =
    'Usage: phantomjs main.js [options]\n' +
        'Options:\n' +
        '  -h,--help            Print this usage message and exit\n' +
        '  -v,--version         Print the version number and exit\n' +
        '  -p,--port <port>     IP port on which to start the server\n' +
        '  -r,--requests <num>  Process this many requests and then exit.  -1 means \n' +
        '                       never stop.\n' +
        '  -b,--bench <page>    Use alternate bench page (default is index.html)\n' +
        '  -d,--debug           Enable verbose debug messages\n';

var port = 16000;
var requests_to_serve = -1;
var bench_page = 'index.html';
var debug = false;

// Parse command-line options.  This keeps track of which one we are on
var arg_num = 1;

// Helper function for option parsing.  Allow option/arg in any of
// these forms:
//    1: -p 1234
//    2: --po 1234
//    3: --po=1234
// Returns:
//    1 or 2: true
//    3:      '1234'
//    else:   false
function option_match(name, takes_optarg, arg) {
    var ieq = arg.indexOf('=');

    var arg_key;
    if (arg.substr(0, 2) == '--' && (takes_optarg && ieq != -1)) {  // form #3
        arg_key = arg.substring(2, ieq);
        if (name.substr(0, arg_key.length) == arg_key) {
            return arg.substr(ieq + 1);
        }
        return false;
    }

    if (arg.substr(0, 2) == '--') {
        arg_key = arg.substr(2);
    }
    else if (arg.substr(0, 1) == '-') {
        arg_key = arg.substr(1);
    }
    else {
        return false;
    }
    return name.substr(0, arg_key.length) == arg_key;
}

// This helper handles one option that takes an option-argument
function option_arg_parse(name) {
    var arg = args[arg_num];
    match = option_match(name, true, arg);
    if (!match) return false;

    if (typeof match != 'string') {
        if (arg_num + 1 < args.length) {
            arg_num++;
            match = args[arg_num];
        }
        else {
            phantom.exit(1);
        }
    }

    if (name == 'port') {
        port = match - 0;
    }
    else if (name == 'requests') { requests_to_serve = match - 0; }
    else if (name == 'bench') { bench_page = match; }

    arg_num++;
    return true;
}

var to_exit = false;
while (arg_num < args.length) {
    var arg = args[arg_num];

    if (option_match('help', false, arg)) {
        console.log(usage);
        phantom.exit(0);
        break;
    }

    if (option_match('version', false, arg)) {
        console.log('svgtex version ' + VERSION);
        phantom.exit(0);
        break;
    }

    if (option_match('debug', false, arg)) {
        debug = true;
        arg_num++;
        continue;
    }

    if (option_arg_parse('port')) {
        continue;
    }
    if (option_arg_parse('requests')) {
        continue;
    }
    if (option_arg_parse('bench')) {
        continue;
    }

    console.error("Unrecognized argument: '" + arg + "'. Use '--help' for usage info.");
    phantom.exit(1);
    break;
}

/*
 console.log(
 'port = ' + port + ", " +
 'requests_to_serve = ' + requests_to_serve + ", " +
 'bench_page = ' + bench_page + ", " +
 'debug = ' + debug + "\n"
 );
 */

// activeRequests holds information about any active MathJax requests.  It is
// a hash, with a sequential number as the key.  request_num gets incremented
// for *every* HTTP request, but only requests that get passed to MathJax have an
// entry in activeRequests.  Each element of activeRequests
// is an array of [<response object>, <start time>].
var request_num = 0;
var activeRequests = {};

// This will hold the test HTML form, which is read once, the first time it is
// requested, from test.html.
var test_form_filename = 'test.html';
var test_form = null;

var service = null;

// thanks to:
// stackoverflow.com/questions/5515869/string-length-in-bytes-in-javascript
function utf8_strlen(str) {
    var m = encodeURIComponent(str).match(/%[89ABab]/g);
    return str.length + (m ? m.length : 0);
}

// This is the callback that gets invoked after the math has been converted.
// The argument, data, is an array that holds the three arguments from the
// process() function in engine.js:  the request number, the original
// text, and either the converted svg, or an array of one element
// that holds an error message.
page.onCallback = function(data) {
    var query = data[0],
        num = query.num,
        src = query.q,
        type = query.type,
        svg_or_error = data[1],
        mml = data[2],
        record = activeRequests[num],
        resp = record[0],
        start_time = record[1],
        duration = (new Date()).getTime() - start_time,
        duration_msg = ', took ' + duration + 'ms.',
        log ,
        validRequest = false,
        success = data[3];
    if( (typeof svg_or_error) === 'string'){
        validRequest = true;
        log = num + ': ' + src.substr(0, 30) + '.. ' +
            src.length + 'B query, OK ' + svg_or_error.length + 'B result' +
            duration_msg;
    } else {
        log = src.substr(0, 30) + '.. ' +
            src.length + 'B query, error: ' + svg_or_error[0] + duration_msg;
    }
    if(query.format == 'json'){
        if ( validRequest ) {
            resp.statusCode = 200;
            console.log(mml);
            //Temporary fix for BUG 62921
            if (query.type == 'mml'){
                mml = '';
                src = 'mathml';
            }
            //End of fix
            out = JSON.stringify({input:src,
                svg:svg_or_error,
                mml:""+mml,
                log:log,
                success:success});//out="hello";
            resp.setHeader('Content-Type', 'application/json');
            resp.setHeader('Content-Length', utf8_strlen(out).toString() );
            resp.write(out);
        } else {
            resp.statusCode = 400;
            out = JSON.stringify({input:src,
                err:svg_or_error[0],
                mml:mml,
                log:log,
                success:success});
            //out = JSON.stringify({err:data[1][0],svg:data[1],mml:data[2],'log':log,'sucess':false});
            resp.write(out);
            console.log(log);
            phantom.exit(1);
        }
    } else {
        if ((typeof svg_or_error) === 'string') {
            resp.statusCode = 200;
            resp.setHeader("Content-Type", "image/svg+xml; charset=utf-8");
            resp.setHeader("Content-Length", utf8_strlen(svg_or_error));
            resp.write(svg_or_error);
            console.log(log);
        }
        else {
            resp.statusCode = 400;    // bad request
            resp.write(svg_or_error[0]);
            console.log(num, log);
        }
        resp.close();
    }
    delete(activeRequests[num]);

    if (!(--requests_to_serve)) {
        phantom.exit();
    }
}

// Parse the request and return an object with the parsed values.
// It will either have an error indication, e.g.
//   { num: 5, status_code: 400, error: "message" }
// Or indicate that the test form should be returned, e.g.
//   { num: 5, test_form: 1 }
// or a valid request, e.g.
//   { num: 5, type: 'tex', q: 'n^2', width: '500' }

function parse_request(req) {
    // Set any defaults here:
    var query = {
        num: request_num++,
        type: 'tex',
        width: null,
        format: 'svg' //possible svg or json
    };

    if (debug) {
        if (req.method == 'POST') {
            console.log("  req.postRaw = '" + req.postRaw + "'");
        }
        else {
            console.log("  req.url = '" + req.url + "'");
        }
    }

    var qs;   // will store the content of the (tex or mml) math
    if (req.method == 'GET') {
        var url = req.url;

        if (url == '' || url == '/') {
            // User has requested the test form
            if (test_form == null && fs.isReadable(test_form_filename)) {
                test_form = fs.read(test_form_filename);  // set the global variable
            }
            if (test_form != null) {
                query.test_form = 1;
            }
            else {
                query.status_code = 500;  // Internal server error
                query.error = "Can't find test form";
            }
            return query;
        }

        var iq = url.indexOf("?");
        if (iq == -1) {  // no query string
            query.status_code = 400;  // bad request
            query.error = "Missing query string";
            return query;
        }

        qs = url.substr(iq+1);
    }

    else if (req.method == 'POST') {
        if (typeof req.postRaw !== 'string') {   // which can happen
            query.status_code = 400;  // bad request
            query.error = "Missing post content";
            return query;
        }
        qs = req.postRaw;
    }

    else {  // method is not GET or POST
        query.status_code = 400;  // bad request
        query.error = "Method " + req.method + " not supported";
        return query;
    }

    var param_strings = qs.split(/&/);
    var num_param_strings = param_strings.length;

    for (var i = 0; i < num_param_strings; ++i) {
        var ps = param_strings[i];
        var ie = ps.indexOf('=');
        if (ie == -1) {
            query.status_code = 400;  // bad request
            query.error = "Can't decipher request parameter";
            return query;
        }
        var key = ps.substr(0, ie);
        var val = decodeURIComponent(ps.substr(ie+1).replace(/\+/g, ' '));
        if (key == 'type') {
            query.type = val;
        }
        else if (key == 'q') {
            query.q = val;
        }
        else if (key == 'width') {
            query.width = parseInt(val) || null;
        }
        else if (key == 'format') {
            query.format = val;
        }
        else {
            query.status_code = 400;  // bad request
            query.error = "Unrecognized parameter name: " + key;
            return query;
        }
    }
    if (!query.q) {   // no source math
        query.status_code = 400;  // bad request
        query.error = "No source math detected in input";
        return query;
    }

    return query;
}

function listenLoop() {
    // Set up the listener that will respond to every new request
    service = server.listen('0.0.0.0:' + port, function(req, resp) {
        var query = parse_request(req);
        var request_num = query.num;
        console.log(request_num + ': ' + "received: " + req.method + " " +
            req.url.substr(0, 30) + " ..");

        if (query.test_form) {
            console.log(request_num + ": returning test form");
            resp.write(test_form);
            resp.close();
        }
        else {
            if (query.error) {
                console.log(request_num + ": error: " + query.error);
                resp.statusCode = query.status_code;
                resp.write(query.error);
                resp.close();
            }

            else {
                // The following evaluates the function argument in the page's context,
                // with query -> _query. That, in turn, calls the process() function in
                // engine.js, which causes MathJax to render the math.  The callback is
                // PhantomJS's callPhantom() function, which in turn calls page.onCallback(),
                // above.  This just queues up the call, and will return at once.
                activeRequests[request_num] = [resp, (new Date()).getTime()];
                page.evaluate(function(_query) {
                    window.engine.process(_query, window.callPhantom);
                }, query);
            }
        }
    });

    if (!service) {
        console.log("server failed to start on port " + port);
        phantom.exit(1);
    }
    else {
        console.log("Server started on port " + port);
        console.log("Point your brownser at http://localhost:" + port + " for a test form.");
    }
}

console.log("Loading bench page " + bench_page);
page.open(bench_page, listenLoop);

/* These includeJs calls would allow us to specify the MathJax location as a
 command-line parameter, but then you'd have to take the <script> tags out of
 index.html, and we'd lose the ability to debug by loading that in a browser
 directly.
 page.open('index.html', function (status) {
 page.includeJs('mathjax/MathJax.js?config=TeX-AMS-MML_SVG', function() {
 page.includeJs('engine.js', listenLoop);
 });
 });
 */

<|endoftext|>


<commit_before>(function( dust, resolvePath ){
  dust.onLoad = function ( template, done ){
    var script = document.createElement("script")
    script.src = resolvePath+template+".js"
    script.async = false
    document.head.appendChild(script)
    var ok
    script.onload = function( e ){
      ok || done()
      ok = true
    }
    script.onerror = function( e ){
      ok || done()
      ok = true
    }
  }
}( dust || {}, "resolvePath" ))<commit_msg>format<commit_after>(function( dust, resolvePath ){
  dust.onLoad = function ( template, done ){
    var script = document.createElement("script")
    script.src = resolvePath+template+".js"
    script.async = false
    document.head.appendChild(script)
    var ok
      , error = null
    script.onload = function( e ){
      ok || done(error)
      ok = true
    }
    script.onerror = function( e ){
      ok || done(error = e)
      ok = true
    }
  }
}( dust || {}, "resolvePath" ))<|endoftext|>


<commit_before>export const blockTradesAPIs = {
    BASE: "https://api.blocktrades.us/v2",
    // BASE_OL: "https://api.blocktrades.us/ol/v2",
    BASE_OL: "https://ol-api1.openledger.info/api/v0/ol/support",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const rudexAPIs = {
    BASE: "https://gateway.rudex.org/api/v0_1",
    COINS_LIST: "/coins",
    NEW_DEPOSIT_ADDRESS: "/new-deposit-address"
};

export const widechainAPIs = {
    BASE : "https://gateway.winex.pro/api/v0/ol/support",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    NEW_DEPOSIT_ADDRESS: "/new-deposit-address",
    WITHDRAW_HISTORY:"/latelyWithdraw",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_HISTORY:"/latelyRecharge"
};

export const settingsAPIs = {
    DEFAULT_WS_NODE: "wss://fake.automatic-selection.com",
    WS_NODE_LIST: [
        {url: "wss://fake.automatic-selection.com", location: {translate: "settings.api_closest"}},
        {url: "ws://127.0.0.1:8090", location: "Locally hosted"},
        {url: "wss://bitshares.openledger.info/ws", location: "Nuremberg, Germany"},
        {url: "wss://eu.openledger.info/ws", location: "Berlin, Germany"},
        {url: "wss://bit.btsabc.org/ws", location: "Hong Kong"},
        {url: "wss://bts.ai.la/ws", location: "Hong Kong"},
        {url: "wss://bitshares.apasia.tech/ws", location: "Bangkok, Thailand"},
        {url: "wss://japan.bitshares.apasia.tech/ws", location: "Tokyo, Japan"},
        {url: "wss://bitshares.dacplay.org/ws", location:  "Hangzhou, China"},
        {url: "wss://bitshares-api.wancloud.io/ws", location:  "China"},
        {url: "wss://openledger.hk/ws", location: "Hong Kong"},
        {url: "wss://bitshares.crypto.fans/ws", location: "Munich, Germany"},
        {url: "wss://ws.gdex.top", location: "China"},
        {url: "wss://dex.rnglab.org", location: "Netherlands"},
        {url: "wss://dexnode.net/ws", location: "Dallas, USA"},
        {url: "wss://kc-us-dex.xeldal.com/ws", location: "Kansas City, USA"},
        {url: "wss://btsza.co.za:8091/ws", location: "Cape Town, South Africa"},
        {url: "wss://api.bts.blckchnd.com", location: "Falkenstein, Germany"},
        {url: "wss://eu.nodes.bitshares.ws", location: "Central Europe - BitShares Infrastructure Program"},
        {url: "wss://us.nodes.bitshares.ws", location: "U.S. West Coast - BitShares Infrastructure Program"},
        {url: "wss://sg.nodes.bitshares.ws", location: "Singapore - BitShares Infrastructure Program"},
        {url: "wss://ws.winex.pro", location: "Singapore"},
        // Testnet
        {url: "wss://node.testnet.bitshares.eu", location: "TESTNET - BitShares Europe (Frankfurt, Germany)"},
        {url: "wss://testnet.nodes.bitshares.ws", location: "TESTNET - BitShares Infrastructure Program"}
    ],
    DEFAULT_FAUCET: "https://faucet.bitshares.eu/onboarding",  // 2017-12-infrastructure worker proposal
    TESTNET_FAUCET: "https://faucet.testnet.bitshares.eu",
    RPC_URL: "https://openledger.info/api/"
};

export const  gdexAPIs = {
    BASE: "https://api.gdex.io",
    ASSET_LIST: "/gateway/asset/assetList",
    ASSET_DETAIL: "/gateway/asset/assetDetail",
    GET_DEPOSIT_ADDRESS: "/gateway/address/getAddress",
    CHECK_WITHDRAY_ADDRESS: "/gateway/address/checkAddress",
    DEPOSIT_RECORD_LIST: "/gateway/deposit/recordList",
    DEPOSIT_RECORD_DETAIL: "/gateway/deposit/recordDetail",
    WITHDRAW_RECORD_LIST: "/gateway/withdraw/recordList",
    WITHDRAW_RECORD_DETAIL: "/gateway/withdraw/recordDetail",
    GET_USER_INFO: "/gateway/user/getUserInfo",
    USER_AGREEMENT: "/gateway/user/isAgree",
    WITHDRAW_RULE: "/gateway/withdraw/rule"
}
<commit_msg>Added RU API node<commit_after>export const blockTradesAPIs = {
    BASE: "https://api.blocktrades.us/v2",
    // BASE_OL: "https://api.blocktrades.us/ol/v2",
    BASE_OL: "https://ol-api1.openledger.info/api/v0/ol/support",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_LIMIT: "/deposit-limits",
    ESTIMATE_OUTPUT: "/estimate-output-amount",
    ESTIMATE_INPUT: "/estimate-input-amount"
};

export const rudexAPIs = {
    BASE: "https://gateway.rudex.org/api/v0_1",
    COINS_LIST: "/coins",
    NEW_DEPOSIT_ADDRESS: "/new-deposit-address"
};

export const widechainAPIs = {
    BASE : "https://gateway.winex.pro/api/v0/ol/support",
    COINS_LIST: "/coins",
    ACTIVE_WALLETS: "/active-wallets",
    NEW_DEPOSIT_ADDRESS: "/new-deposit-address",
    WITHDRAW_HISTORY:"/latelyWithdraw",
    TRADING_PAIRS: "/trading-pairs",
    DEPOSIT_HISTORY:"/latelyRecharge"
};

export const settingsAPIs = {
    DEFAULT_WS_NODE: "wss://fake.automatic-selection.com",
    WS_NODE_LIST: [
        {url: "wss://fake.automatic-selection.com", location: {translate: "settings.api_closest"}},
        {url: "ws://127.0.0.1:8090", location: "Locally hosted"},
        {url: "wss://bitshares.openledger.info/ws", location: "Nuremberg, Germany"},
        {url: "wss://eu.openledger.info/ws", location: "Berlin, Germany"},
        {url: "wss://bit.btsabc.org/ws", location: "Hong Kong"},
        {url: "wss://bts.ai.la/ws", location: "Hong Kong"},
        {url: "wss://bitshares.apasia.tech/ws", location: "Bangkok, Thailand"},
        {url: "wss://japan.bitshares.apasia.tech/ws", location: "Tokyo, Japan"},
        {url: "wss://bitshares.dacplay.org/ws", location:  "Hangzhou, China"},
        {url: "wss://bitshares-api.wancloud.io/ws", location:  "China"},
        {url: "wss://openledger.hk/ws", location: "Hong Kong"},
        {url: "wss://bitshares.crypto.fans/ws", location: "Munich, Germany"},
        {url: "wss://ws.gdex.top", location: "China"},
        {url: "wss://dex.rnglab.org", location: "Netherlands"},
        {url: "wss://dexnode.net/ws", location: "Dallas, USA"},
        {url: "wss://kc-us-dex.xeldal.com/ws", location: "Kansas City, USA"},
        {url: "wss://btsza.co.za:8091/ws", location: "Cape Town, South Africa"},
        {url: "wss://api.bts.blckchnd.com", location: "Falkenstein, Germany"},
        {url: "wss://api-ru.bts.blckchnd.com", location: "Moscow, Russia"},
        {url: "wss://eu.nodes.bitshares.ws", location: "Central Europe - BitShares Infrastructure Program"},
        {url: "wss://us.nodes.bitshares.ws", location: "U.S. West Coast - BitShares Infrastructure Program"},
        {url: "wss://sg.nodes.bitshares.ws", location: "Singapore - BitShares Infrastructure Program"},
        {url: "wss://ws.winex.pro", location: "Singapore"},
        // Testnet
        {url: "wss://node.testnet.bitshares.eu", location: "TESTNET - BitShares Europe (Frankfurt, Germany)"},
        {url: "wss://testnet.nodes.bitshares.ws", location: "TESTNET - BitShares Infrastructure Program"}
    ],
    DEFAULT_FAUCET: "https://faucet.bitshares.eu/onboarding",  // 2017-12-infrastructure worker proposal
    TESTNET_FAUCET: "https://faucet.testnet.bitshares.eu",
    RPC_URL: "https://openledger.info/api/"
};

export const  gdexAPIs = {
    BASE: "https://api.gdex.io",
    ASSET_LIST: "/gateway/asset/assetList",
    ASSET_DETAIL: "/gateway/asset/assetDetail",
    GET_DEPOSIT_ADDRESS: "/gateway/address/getAddress",
    CHECK_WITHDRAY_ADDRESS: "/gateway/address/checkAddress",
    DEPOSIT_RECORD_LIST: "/gateway/deposit/recordList",
    DEPOSIT_RECORD_DETAIL: "/gateway/deposit/recordDetail",
    WITHDRAW_RECORD_LIST: "/gateway/withdraw/recordList",
    WITHDRAW_RECORD_DETAIL: "/gateway/withdraw/recordDetail",
    GET_USER_INFO: "/gateway/user/getUserInfo",
    USER_AGREEMENT: "/gateway/user/isAgree",
    WITHDRAW_RULE: "/gateway/withdraw/rule"
}
<|endoftext|>


<commit_before>"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require('@angular/core');
var AppComponent = (function () {
    function AppComponent() {
    }
    AppComponent = __decorate([
        core_1.Component({
            selector: 'my-app',
            template: "\n
\u00A1Forms Forms Forms!
\n    \n        Template Driven\n        Form Builder\n    \n    <router-outlet></router-outlet>\n    "
        }),
        __metadata('design:paramtypes', [])
    ], AppComponent);
    return AppComponent;
}());
exports.AppComponent = AppComponent;
//# sourceMappingURL=app.component.js.map<commit_msg>Remove: js from ts compilation<commit_after><|endoftext|>


<commit_before>/* Enigma machine emulator.
 * Author: Matheus Vieira Portela
 * GitHub: https://github.com/matheusportela/
 *
 * This is a simulator for the Enigma machine, one of the most incredible
 * applications of cryptography during World War I and II. German militaries
 * would send encrypted messages through the air using telegraphs about bombing
 * locations with security, considering one would have to know the precise
 * combination of rotor positioning, plugboard configuration, and other pieces
 * in order to decode captured messages.
 *
 * Even though several weaknesses were discovered - specially by the Allies
 * forces - allowing one to break the code, the Enigma encryption algorithm is
 * a fun way to study a little bit of cryptography.
 *
 * Of course, studying the Enigma is also a tribute to Alan Turing.
 *
 * References:
 * - Enigma machine https://en.wikipedia.org/wiki/Enigma_machine
 * - Enigma simulator http://enigma.louisedade.co.uk/howitworks.html
 */
var expect = require('chai').expect;

describe('Plugboard', function() {
    describe('addPlug', function() {
        it('expect add letter to plugs', function() {
            var plugboard = new Plugboard();
            plugboard.addPlug('A', 'B');
            expect(plugboard.plugs['A']).to.be.equal('B');
        });

        it('expect add inverse letter to plugs', function() {
            var plugboard = new Plugboard();
            plugboard.addPlug('A', 'B');
            expect(plugboard.plugs['B']).to.be.equal('A');
        });
    });

    describe('encode', function() {
        it('expect non-plugged letter encode to itself', function() {
            var plugboard = new Plugboard();
            expect(plugboard.encode('A')).to.be.equal('A');
        });

        it('expect plugged letter encode to its plug output', function() {
            var plugboard = new Plugboard();
            plugboard.addPlug('A', 'B');
            expect(plugboard.encode('A')).to.be.equal('B');
        });
    });

    describe('addPlugs', function() {
        it('expect plugged letters encode to their plugs', function() {
            var plugboard = new Plugboard();
            plugboard.addPlugs('ABC', 'DEF');
            expect(plugboard.encode('A')).to.be.equal('D');
            expect(plugboard.encode('B')).to.be.equal('E');
            expect(plugboard.encode('C')).to.be.equal('F');
        });

        it('expect non-plugged letters encode to themselves', function() {
            var plugboard = new Plugboard();
            plugboard.addPlugs('ABC', 'DEF');
            expect(plugboard.encode('G')).to.be.equal('G');
            expect(plugboard.encode('H')).to.be.equal('H');
            expect(plugboard.encode('I')).to.be.equal('I');
        });
    });

    describe('constructor', function() {
        it('expect plugboard be configured through constructor', function() {
            var plugboard = new Plugboard('ABC', 'DEF');
            expect(plugboard.encode('A')).to.be.equal('D');
            expect(plugboard.encode('B')).to.be.equal('E');
            expect(plugboard.encode('C')).to.be.equal('F');
            expect(plugboard.encode('G')).to.be.equal('G');
            expect(plugboard.encode('H')).to.be.equal('H');
            expect(plugboard.encode('I')).to.be.equal('I');
        });
    });
});

describe('Rotor', function() {
    describe('addWire', function() {
        it('expect add wiring to rotor', function() {
            var rotor = new Rotor();
            rotor.addWire('A', 'B');
            expect(rotor.wires['A']).to.be.equal('B');
        });
    });

    describe('setWireTable', function() {
        it('expect rotor wire table to configure wires', function() {
            var rotor = new Rotor();
            rotor.setWireTable('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['A']).to.be.equal('E');
            expect(rotor.wires['B']).to.be.equal('K');
            expect(rotor.wires['Z']).to.be.equal('J');
        });
    });

    describe('encode', function() {
        it('expect rotor to encode with wire table', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.encode('A')).to.be.equal('E');
            expect(rotor.encode('B')).to.be.equal('K');
            expect(rotor.encode('Z')).to.be.equal('J');
        });
    });

    describe('constructor', function() {
        it('expect rotor be configured through constructor', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['A']).to.be.equal('E');
            expect(rotor.wires['B']).to.be.equal('K');
            expect(rotor.wires['Z']).to.be.equal('J');
        });
    });

    describe('step', function() {
        it('expect step change first encoded letter', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['A']).to.be.equal('E');
            rotor.step();
            expect(rotor.wires['A']).to.be.equal('K');
        });

        it('expect step change last encoded letter', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['Z']).to.be.equal('J');
            rotor.step();
            expect(rotor.wires['Z']).to.be.equal('E');
        });
    });

    describe('turnover', function() {
        it('expect turnover to be reached after 26 steps', function() {
            var rotor1 = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            var rotor2 = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');

            rotor1.nextRotor = rotor2;

            expect(rotor1.wires['A']).to.be.equal('E');
            expect(rotor2.wires['A']).to.be.equal('E');

            for (var i = 0; i < 26; i++)
                rotor1.step();

            expect(rotor1.wires['A']).to.be.equal('E');
            expect(rotor2.wires['A']).to.be.equal('K');
        });

        it('expect turnover without next rotor maintain encoding', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');

            expect(rotor.wires['A']).to.be.equal('E');

            for (var i = 0; i < 26; i++)
                rotor.step();

            expect(rotor.wires['A']).to.be.equal('E');
        });
    });
});

var Plugboard = function(letters1, letters2) {
    this.plugs = {};

    if (letters1 && letters2)
        this.addPlugs(letters1, letters2);
};

Plugboard.prototype.addPlug = function(letter1, letter2) {
    this.plugs[letter1] = letter2;
    this.plugs[letter2] = letter1;
};

Plugboard.prototype.addPlugs = function(letters1, letters2) {
    for (var i = 0; i < letters1.length; i++)
        this.plugs[letters1[i]] = letters2[i];
};

Plugboard.prototype.encode = function(letter) {
    if (letter in this.plugs)
        return this.plugs[letter];
    return letter;
};

var Rotor = function(wireTable) {
    this.letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    this.wires = {};
    this.nextRotor = null;
    this.turnoverCountdown = 26;

    if (wireTable)
        this.setWireTable(wireTable);
};

Rotor.prototype.addWire = function(letter1, letter2) {
    this.wires[letter1] = letter2;
};

Rotor.prototype.setWireTable = function(wireTable) {
    for (var i = 0; i < this.letters.length; i++)
        this.wires[this.letters[i]] = wireTable[i];
};

Rotor.prototype.encode = function(letter) {
    return this.wires[letter];
};

Rotor.prototype.step = function() {
    var new_wires = {};
    var currentLetter;
    var nextLetter;

    for (var i = 0; i < this.letters.length; i++) {
        currentLetter = this.letters[i];
        nextLetter = this.letters[(i + 1) % this.letters.length];
        new_wires[currentLetter] = this.wires[nextLetter];
    }

    this.wires = new_wires;

    this.turnover();
};

Rotor.prototype.turnover = function() {
    if (this.nextRotor) {
        this.turnoverCountdown -= 1;

        if (this.turnoverCountdown === 0) {
            this.nextRotor.step();
            this.turnoverCountdown = 26;
        }
    }
};<commit_msg>Creating basic Enigma class, with just a plugboard.<commit_after>/* Enigma machine emulator.
 * Author: Matheus Vieira Portela
 * GitHub: https://github.com/matheusportela/
 *
 * This is a simulator for the Enigma machine, one of the most incredible
 * applications of cryptography during World War I and II. German militaries
 * would send encrypted messages through the air using telegraphs about bombing
 * locations with security, considering one would have to know the precise
 * combination of rotor positioning, plugboard configuration, and other pieces
 * in order to decode captured messages.
 *
 * Even though several weaknesses were discovered - specially by the Allies
 * forces - allowing one to break the code, the Enigma encryption algorithm is
 * a fun way to study a little bit of cryptography.
 *
 * Of course, studying the Enigma is also a tribute to Alan Turing.
 *
 * References:
 * - Enigma machine https://en.wikipedia.org/wiki/Enigma_machine
 * - Enigma simulator http://enigma.louisedade.co.uk/howitworks.html
 */
var expect = require('chai').expect;

describe('Plugboard', function() {
    describe('addPlug', function() {
        it('expect add letter to plugs', function() {
            var plugboard = new Plugboard();
            plugboard.addPlug('A', 'B');
            expect(plugboard.plugs['A']).to.be.equal('B');
        });

        it('expect add inverse letter to plugs', function() {
            var plugboard = new Plugboard();
            plugboard.addPlug('A', 'B');
            expect(plugboard.plugs['B']).to.be.equal('A');
        });
    });

    describe('encode', function() {
        it('expect non-plugged letter encode to itself', function() {
            var plugboard = new Plugboard();
            expect(plugboard.encode('A')).to.be.equal('A');
        });

        it('expect plugged letter encode to its plug output', function() {
            var plugboard = new Plugboard();
            plugboard.addPlug('A', 'B');
            expect(plugboard.encode('A')).to.be.equal('B');
        });
    });

    describe('addPlugs', function() {
        it('expect plugged letters encode to their plugs', function() {
            var plugboard = new Plugboard();
            plugboard.addPlugs('ABC', 'DEF');
            expect(plugboard.encode('A')).to.be.equal('D');
            expect(plugboard.encode('B')).to.be.equal('E');
            expect(plugboard.encode('C')).to.be.equal('F');
        });

        it('expect non-plugged letters encode to themselves', function() {
            var plugboard = new Plugboard();
            plugboard.addPlugs('ABC', 'DEF');
            expect(plugboard.encode('G')).to.be.equal('G');
            expect(plugboard.encode('H')).to.be.equal('H');
            expect(plugboard.encode('I')).to.be.equal('I');
        });
    });

    describe('constructor', function() {
        it('expect plugboard be configured through constructor', function() {
            var plugboard = new Plugboard('ABC', 'DEF');
            expect(plugboard.encode('A')).to.be.equal('D');
            expect(plugboard.encode('B')).to.be.equal('E');
            expect(plugboard.encode('C')).to.be.equal('F');
            expect(plugboard.encode('G')).to.be.equal('G');
            expect(plugboard.encode('H')).to.be.equal('H');
            expect(plugboard.encode('I')).to.be.equal('I');
        });

        it('expect plugboard to be reciprocal', function() {
            var plugboard = new Plugboard('ABC', 'DEF');
            expect(plugboard.encode('D')).to.be.equal('A');
            expect(plugboard.encode('E')).to.be.equal('B');
            expect(plugboard.encode('F')).to.be.equal('C');
        });
    });
});

describe('Rotor', function() {
    describe('addWire', function() {
        it('expect add wiring to rotor', function() {
            var rotor = new Rotor();
            rotor.addWire('A', 'B');
            expect(rotor.wires['A']).to.be.equal('B');
        });
    });

    describe('setWireTable', function() {
        it('expect rotor wire table to configure wires', function() {
            var rotor = new Rotor();
            rotor.setWireTable('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['A']).to.be.equal('E');
            expect(rotor.wires['B']).to.be.equal('K');
            expect(rotor.wires['Z']).to.be.equal('J');
        });
    });

    describe('encode', function() {
        it('expect rotor to encode with wire table', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.encode('A')).to.be.equal('E');
            expect(rotor.encode('B')).to.be.equal('K');
            expect(rotor.encode('Z')).to.be.equal('J');
        });
    });

    describe('constructor', function() {
        it('expect rotor be configured through constructor', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['A']).to.be.equal('E');
            expect(rotor.wires['B']).to.be.equal('K');
            expect(rotor.wires['Z']).to.be.equal('J');
        });
    });

    describe('step', function() {
        it('expect step change first encoded letter', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['A']).to.be.equal('E');
            rotor.step();
            expect(rotor.wires['A']).to.be.equal('K');
        });

        it('expect step change last encoded letter', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            expect(rotor.wires['Z']).to.be.equal('J');
            rotor.step();
            expect(rotor.wires['Z']).to.be.equal('E');
        });
    });

    describe('turnover', function() {
        it('expect turnover to be reached after 26 steps', function() {
            var rotor1 = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');
            var rotor2 = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');

            rotor1.nextRotor = rotor2;

            expect(rotor1.wires['A']).to.be.equal('E');
            expect(rotor2.wires['A']).to.be.equal('E');

            for (var i = 0; i < 26; i++)
                rotor1.step();

            expect(rotor1.wires['A']).to.be.equal('E');
            expect(rotor2.wires['A']).to.be.equal('K');
        });

        it('expect turnover without next rotor maintain encoding', function() {
            var rotor = new Rotor('EKMFLGDQVZNTOWYHXUSPAIBRCJ');

            expect(rotor.wires['A']).to.be.equal('E');

            for (var i = 0; i < 26; i++)
                rotor.step();

            expect(rotor.wires['A']).to.be.equal('E');
        });
    });
});

describe('Enigma', function() {
    describe('encode', function() {
        it('expect encode to return a letter different from the given one',
            function() {
                var enigma = new Enigma();
                expect(enigma.encode('A')).to.not.be.equal('A');
        });

        it('expect encode with encoded letter to be the original one',
            function() {
                var enigma = new Enigma();
                var input = 'A';
                var output = enigma.encode(input);
                expect(enigma.encode(output)).to.be.equal(input);
        });
    });
});

var Plugboard = function(letters1, letters2) {
    this.plugs = {};

    if (letters1 && letters2)
        this.addPlugs(letters1, letters2);
};

Plugboard.prototype.addPlug = function(letter1, letter2) {
    this.plugs[letter1] = letter2;
    this.plugs[letter2] = letter1;
};

Plugboard.prototype.addPlugs = function(letters1, letters2) {
    for (var i = 0; i < letters1.length; i++)
        this.addPlug(letters1[i], letters2[i]);
};

Plugboard.prototype.encode = function(letter) {
    if (letter in this.plugs)
        return this.plugs[letter];
    return letter;
};

var Rotor = function(wireTable) {
    this.letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    this.wires = {};
    this.nextRotor = null;
    this.turnoverCountdown = 26;

    if (wireTable)
        this.setWireTable(wireTable);
};

Rotor.prototype.addWire = function(letter1, letter2) {
    this.wires[letter1] = letter2;
};

Rotor.prototype.setWireTable = function(wireTable) {
    for (var i = 0; i < this.letters.length; i++)
        this.wires[this.letters[i]] = wireTable[i];
};

Rotor.prototype.encode = function(letter) {
    return this.wires[letter];
};

Rotor.prototype.step = function() {
    var new_wires = {};
    var currentLetter;
    var nextLetter;

    for (var i = 0; i < this.letters.length; i++) {
        currentLetter = this.letters[i];
        nextLetter = this.letters[(i + 1) % this.letters.length];
        new_wires[currentLetter] = this.wires[nextLetter];
    }

    this.wires = new_wires;

    this.turnover();
};

Rotor.prototype.turnover = function() {
    if (this.nextRotor) {
        this.turnoverCountdown -= 1;

        if (this.turnoverCountdown === 0) {
            this.nextRotor.step();
            this.turnoverCountdown = 26;
        }
    }
};

var Enigma = function() {
    this.plugboard = new Plugboard('A', 'B');
};

Enigma.prototype.encode = function(letter) {
    return this.plugboard.encode(letter);
};<|endoftext|>