<commit_before>/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace ns
*/
var ns = {};

/**
* @name iterAny
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/any}
*/
setReadOnly( ns, 'iterAny', require( '@stdlib/utils/iterators/any' ) );

/**
* @name iterConstant
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/constant}
*/
setReadOnly( ns, 'iterConstant', require( '@stdlib/utils/iterators/constant' ) );

/**
* @name iterEmpty
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/empty}
*/
setReadOnly( ns, 'iterEmpty', require( '@stdlib/utils/iterators/empty' ) );

/**
* @name iterEvery
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/every}
*/
setReadOnly( ns, 'iterEvery', require( '@stdlib/utils/iterators/every' ) );

/**
* @name iterFirst
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/first}
*/
setReadOnly( ns, 'iterFirst', require( '@stdlib/utils/iterators/first' ) );

/**
* @name iterForEach
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/for-each}
*/
setReadOnly( ns, 'iterForEach', require( '@stdlib/utils/iterators/for-each' ) );

/**
* @name iterLast
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/last}
*/
setReadOnly( ns, 'iterLast', require( '@stdlib/utils/iterators/last' ) );

/**
* @name iterMap
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/map}
*/
setReadOnly( ns, 'iterMap', require( '@stdlib/utils/iterators/map' ) );

/**
* @name iterNone
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/none}
*/
setReadOnly( ns, 'iterNone', require( '@stdlib/utils/iterators/none' ) );

/**
* @name iterNth
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/nth}
*/
setReadOnly( ns, 'iterNth', require( '@stdlib/utils/iterators/nth' ) );

/**
* @name iterSome
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/some}
*/
setReadOnly( ns, 'iterSome', require( '@stdlib/utils/iterators/some' ) );

// EXPORTS //

module.exports = ns;
<commit_msg>Update namespace<commit_after>/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace ns
*/
var ns = {};

/**
* @name iterAny
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/any}
*/
setReadOnly( ns, 'iterAny', require( '@stdlib/utils/iterators/any' ) );

/**
* @name iterAnyBy
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/any-by}
*/
setReadOnly( ns, 'iterAnyBy', require( '@stdlib/utils/iterators/any-by' ) );

/**
* @name iterConstant
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/constant}
*/
setReadOnly( ns, 'iterConstant', require( '@stdlib/utils/iterators/constant' ) );

/**
* @name iterEmpty
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/empty}
*/
setReadOnly( ns, 'iterEmpty', require( '@stdlib/utils/iterators/empty' ) );

/**
* @name iterEvery
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/every}
*/
setReadOnly( ns, 'iterEvery', require( '@stdlib/utils/iterators/every' ) );

/**
* @name iterFirst
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/first}
*/
setReadOnly( ns, 'iterFirst', require( '@stdlib/utils/iterators/first' ) );

/**
* @name iterForEach
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/for-each}
*/
setReadOnly( ns, 'iterForEach', require( '@stdlib/utils/iterators/for-each' ) );

/**
* @name iterLast
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/last}
*/
setReadOnly( ns, 'iterLast', require( '@stdlib/utils/iterators/last' ) );

/**
* @name iterMap
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/map}
*/
setReadOnly( ns, 'iterMap', require( '@stdlib/utils/iterators/map' ) );

/**
* @name iterNone
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/none}
*/
setReadOnly( ns, 'iterNone', require( '@stdlib/utils/iterators/none' ) );

/**
* @name iterNth
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/nth}
*/
setReadOnly( ns, 'iterNth', require( '@stdlib/utils/iterators/nth' ) );

/**
* @name iterSome
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/utils/iterators/some}
*/
setReadOnly( ns, 'iterSome', require( '@stdlib/utils/iterators/some' ) );

// EXPORTS //

module.exports = ns;
<|endoftext|>


<commit_before>import React from 'react';
import PropTypes from 'prop-types';

const Button = (props) => {
  const {
    handleClick,
    link,
    ...otherProps
  } = props;

  return (
    <button onSubmit={handleClick} {...otherProps} />
  );
};

Button.propTypes = {
  handleClick: PropTypes.func,
  link: PropTypes.string
};

Button.defaultProps = {
  handleClick: null,
  link: null
};

export default Button;
<commit_msg>removes unused prop in Button component<commit_after>import React from 'react';
import PropTypes from 'prop-types';

const Button = (props) => {
  const {
    handleClick,
    ...otherProps
  } = props;

  return (
    <button onSubmit={handleClick} {...otherProps} />
  );
};

Button.propTypes = {
  handleClick: PropTypes.func
};

Button.defaultProps = {
  handleClick: null
};

export default Button;
<|endoftext|>


<commit_before>;(function(module) {
  'use strict';

  module.config(function(localeProvider) {
    localeProvider.locale('sk', {
      language: 'sk',
      displayName: 'Slovak',
      messages: {
        'About': 'O programe',
        'Add server': 'Pridať server',
        'Add stream': 'Pridať stream',
        'Add to playlist': 'Pridať do playlistu',
        'Add to tracklist': 'Pridať do tracklistu',
        'Album artist': 'Album artist',
        'Album': 'Album',
        'Any': 'Ľubovoľné',
        'Artist': 'Artist',
        'Back': 'Späť',
        'Bitrate': 'bitrate',
        'Cancel': 'Zrušiť',
        'Clear cache': 'Vymazať cache',
        'Clear tracklist': 'Vymazať tracklist',
        'Clear': 'Vymazať',
        'Comment': 'Poznámka',
        'Composer': 'Skladateľ',
        'Configured servers': 'Nakonfigurované servre',
        'ConnectionError': 'Chyba pripojenia',
        'Consume mode': 'Consume mode',
        'Cover art': 'Cover art',
        'Create playlist': 'Vytvor playlist',
        'Date': 'Date',
        'Debug messages': 'Vyvovjové logy',
        'Default click action': 'Primárne kliknutie',
        'Default': 'Default',
        'Delete playlist': 'Vymaž playlist',
        'Delete': 'Vymaž',
        'Disc number': 'Číslo disku',
        'Done': 'Hotovo',
        'Duration': 'Trvanie',
        'Edit playlist': 'Edituj playlist',
        'Edit playlists': 'Edituj playlists',
        'Edit tracklist': 'Edituj tracklist',
        'Error': 'Chyba',
        'Exit': 'Koniec',
        'Find exact': 'Exaktné vyhľadávanie',
        'Genre': 'Genre',
        'Host': 'Host',
        'Ignore': 'Ignoruj',
        'Language': 'Jazyk',
        'Library': 'Knižnica',
        'Licenses': 'Licencie',
        'Logging': 'Logovanie',
        'Look and feel': 'Vzhľad a správanie',
        'Mopidy servers': 'Mopidy servre',
        'Name': 'Názov',
        'No servers found': 'Server nenájdený',
        'Nothing playing': 'Aktuálne žiadne prehrávanie',
        'OK': 'OK',
        'Path': 'Cesta',
        'Performer': 'Performer',
        'Play next': 'Následujúca',
        'Play now': 'Predchádzajúca',
        'Playback': 'Playback',
        'Playlists': 'Playlists',
        'Please make sure Zeroconf is enabled for any Mopidy servers in the same WiFi network as your device.': 'Prosím, skontrolujte zapnutie Zeroconf pre servre Mopidy vrámci rovnakého subnetu WiFi.',
        'Port': 'Port',
        'Pull to refresh': 'Načítať znova',
        'Remove server': 'Odstrániť server',
        'Replace tracklist': 'Nahradiť tracklist',
        'Request timeout': 'Čas požiadavky vypršal...',
        'Reset all settings to default values and restart application': 'Obnovovenie výrobných nastavení a reštart',
        'Reset': 'Reštart',
        'Restart application': 'Reštart aplikácie',
        'Restart': 'Reštart',
        'Retry': 'Opakuj',
        'Save as': 'Uložiť ako',
        'Save': 'Uložiť',
        'Search here': 'Vyhľadávanie tu',
        'Search results': 'Výsledky vyhľadávania',
        'Search term': 'Podmienky vyhľadávania',
        'Search {name}': 'Hľadaj {názov}',
        'Search': 'Vyhľadávanie',
        'Secure connection': 'Zabezpečené pripojenie',
        'ServerError': 'Chyba servera',
        'Settings': 'Nastavenia',
        'Share': 'Zdieľanie',
        'Show track info': 'Zobraz track info',
        'Sort by name': 'Zoradenie podľa mena',
        'Sort by scheme': 'Zoradenie podľa schémy',
        'Theme': 'Téma',
        'Then pull to refresh, or add a server manually.': 'Načítaj znova, alebo pridaj server ručne.',
        'TimeoutError': 'Čas požiadavky vypršal',
        'Track info': 'Info o skladbe',
        'Track number': 'Číslo skladby',
        'Track': 'Skladba',
        'Tracklist': 'Tracklist',
        'Translations': 'Preklad',
        'URI': 'URI',
        'URL': 'URL',
        'Volume keys': 'Hlasitosť',
        '{count} seconds': '{count, plural, =1{1 sekunda} =2{2 sekundy} =3{3 sekundy} =4{4 sekundy} other{# sekund}}',
        '{count} tracks': '{count, plural, =0{skladieb} =1{1 skladba} =2{2 skladby} =3{3 skladby} =4{4 skladby} other{# skladieb}}',
        '{index} of {count}': '{index} of {count}',
      }
    });
  });
})(angular.module('app.locale.sk', ['app.services.locale']));
<commit_msg>Update sk.js<commit_after>;(function(module) {
  'use strict';

  module.config(function(localeProvider) {
    localeProvider.locale('sk', {
      language: 'sk',
      displayName: 'Slovak',
      messages: {
        'About': 'O programe',
        'Add server': 'Pridať server',
        'Add stream': 'Pridať stream',
        'Add to playlist': 'Pridať do playlistu',
        'Add to tracklist': 'Pridať do zoznamu skladieb',
        'Album artist': 'Album interpreta',
        'Album': 'Album',
        'Any': 'Ľubovoľné',
        'Artist': 'Interpret',
        'Back': 'Späť',
        'Bitrate': 'bitrate',
        'Cancel': 'Zrušiť',
        'Clear cache': 'Vymazať cache',
        'Clear tracklist': 'Vymazať zoznam skladieb',
        'Clear': 'Vymazať',
        'Comment': 'Poznámka',
        'Composer': 'Skladateľ',
        'Configured servers': 'Nakonfigurované servre',
        'ConnectionError': 'Chyba pripojenia',
        'Consume mode': 'Užívateľský režim',
        'Cover art': 'Cover art',
        'Create playlist': 'Vytvor playlist',
        'Date': 'Dátum',
        'Debug messages': 'Vyvovjové logy',
        'Default click action': 'Primárne kliknutie',
        'Default': 'Výrobné nastavenie',
        'Delete playlist': 'Vymaž playlist',
        'Delete': 'Vymaž',
        'Disc number': 'Číslo disku',
        'Done': 'Hotovo',
        'Duration': 'Trvanie',
        'Edit playlist': 'Edituj playlist',
        'Edit playlists': 'Edituj playlisty',
        'Edit tracklist': 'Edituj zoznam skladieb',
        'Error': 'Chyba',
        'Exit': 'Koniec',
        'Find exact': 'Exaktné vyhľadávanie',
        'Genre': 'Štýl',
        'Host': 'Host',
        'Ignore': 'Ignoruj',
        'Language': 'Jazyk',
        'Library': 'Knižnica',
        'Licenses': 'Licencie',
        'Logging': 'Logovanie',
        'Look and feel': 'Vzhľad a správanie',
        'Mopidy servers': 'Mopidy servre',
        'Name': 'Názov',
        'No servers found': 'Server nenájdený',
        'Nothing playing': 'Aktuálne žiadne prehrávanie',
        'OK': 'OK',
        'Path': 'Cesta',
        'Performer': 'Umelec',
        'Play next': 'Následujúca',
        'Play now': 'Predchádzajúca',
        'Playback': 'Aktuálne hraje',
        'Playlists': 'Playlists',
        'Please make sure Zeroconf is enabled for any Mopidy servers in the same WiFi network as your device.': 'Prosím, skontrolujte zapnutie Zeroconf pre servre Mopidy vrámci rovnakého subnetu WiFi.',
        'Port': 'Port',
        'Pull to refresh': 'Načítať znova',
        'Remove server': 'Odstrániť server',
        'Replace tracklist': 'Nahradiť zoznam skladieb',
        'Request timeout': 'Čas požiadavky vypršal...',
        'Reset all settings to default values and restart application': 'Obnovovenie výrobných nastavení a reštart',
        'Reset': 'Reštart',
        'Restart application': 'Reštart aplikácie',
        'Restart': 'Reštart',
        'Retry': 'Opakuj',
        'Save as': 'Uložiť ako',
        'Save': 'Uložiť',
        'Search here': 'Vyhľadávanie tu',
        'Search results': 'Výsledky vyhľadávania',
        'Search term': 'Podmienky vyhľadávania',
        'Search {name}': 'Hľadaj {názov}',
        'Search': 'Vyhľadávanie',
        'Secure connection': 'Zabezpečené pripojenie',
        'ServerError': 'Chyba servera',
        'Settings': 'Nastavenia',
        'Share': 'Zdieľanie',
        'Show track info': 'Zobraz track info',
        'Sort by name': 'Zoradenie podľa mena',
        'Sort by scheme': 'Zoradenie podľa schémy',
        'Theme': 'Téma',
        'Then pull to refresh, or add a server manually.': 'Načítaj znova, alebo pridaj server ručne.',
        'TimeoutError': 'Čas požiadavky vypršal',
        'Track info': 'Info o skladbe',
        'Track number': 'Číslo skladby',
        'Track': 'Skladba',
        'Tracklist': 'Zoznam skladieb',
        'Translations': 'Preklad',
        'URI': 'URI',
        'URL': 'URL',
        'Volume keys': 'Hlasitosť',
        '{count} seconds': '{počet, plural, =1{1 sekunda} =2{2 sekundy} =3{3 sekundy} =4{4 sekundy} other{# sekund}}',
        '{count} tracks': '{počet, plural, =0{skladieb} =1{1 skladba} =2{2 skladby} =3{3 skladby} =4{4 skladby} other{# skladieb}}',
        '{index} of {count}': '{index} z {count}',
      }
    });
  });
})(angular.module('app.locale.sk', ['app.services.locale']));
<|endoftext|>


<commit_before>{
	"Perimeter Ambush Point": "Randgebiet für Hinterhalt",
	"Lager im Randgebiet": "Perimeter Camp",
	"Phase Catalyst Node": "Phasenkatalysator-Knotenpunkt",
	"The Line": "Das Feld",

	"Perimeter Checkpoint": "Kontrollpunkt im Randgebiet",
	"Perimeter Hangar": "Perimeter Hangar",
	"The Ruins of Enclave Cohort 27": "Die Ruinen von Enclave Cohort 27",
	"Sleeper Data Sanctuary": "Datenheiligtum der Sleeper",

	"Fortification Frontier Stronghold": "Festung im Grenzgebiet",
	"Outpost Frontier Stronghold": "Bollwerk im Grenzgebiet",
	"Solar Cell": "Solarzelle",
	"The Oruze Construct": "Das Oruze-Konstrukt",

	"Frontier Barracks": "Kasernen im Grenzgebiet",
	"Frontier Command Post": "Kommandoposten im Grenzgebiet",
	"Integrated Terminus": "Endstation einbegriffen",
	"Sleeper Information Sanctum": "Informationsheiligtum der Sleeper",

	"Quarantine Area": "Quarantänegebiet",
	"Core Garrison": "Wichtige Garnison",
	"Core Stronghold": "Wichtige Festung",
	"Oruze Osobnyk": "Oruze Osobnyk",

	"Core Citadel": "Wichtige Zitadelle",
	"Core Bastion": "Wichtige Bastion",
	"Strange Energy Readings": "Merkwürdige Energie-Messungen",
	"The Mirror": "Der Spiegel",

	"Forgotten Perimeter Coronation Platform": "Vergessene Einsatzplattform im Außenbereich",
	"Forgotten Perimeter Power Array": "Vergessenes Energiefeld im Außenbereich",
	"Forgotten Perimeter Gateway": "Vergessenes Tor im Außenbereich",
	"Forgotten Perimeter Habitation Coils": "Vergessene Wohnsiedlung im Außenbereich",
	"Forgotten Frontier Quarantine Outpost": "Vergessener Quarantäne-Außenposten im Grenzgebiet",
	"Forgotten Frontier Recursive Depot": "Vergessenes Rücklauf-Depot im Grenzgebiet",
	"Forgotten Frontier Conversion Module": "Vergessenes Konversionsmodul im Grenzgebiet",
	"Forgotten Frontier Evacuation Center": "Vergessenes Evakuierungszentrum im Grenzgebiet",
	"Forgotten Core Data Field": "Vergessenes wichtiges Datenfeld",
	"Forgotten Core Information Pen": "Vergessenes wichtiges Informationszentrum",
	"Forgotten Core Assembly Hall": "Vergessene wichtige Montageanlage",
	"Forgotten Circuitry Disassembler": "Vergessener wichtiger Circuitry Disassembler",

	"Unsecured Perimeter Amplifier": "Ungesicherter Verstärker im Außenbereich",
	"Unsecured Perimeter Information Center": "Ungesichertes Informationszentrum im Außenbereich",
	"Unsecured Perimeter Comms Relay": "Ungesichertes Kommunikationsrelais",
	"Unsecured Perimeter Transponder Farm": "Ungesichertes Transponderfeld im Außenbereich",
	"Unsecured Frontier Database": "Ungesicherte Datenbank im Grenzgebiet",
	"Unsecured Frontier Receiver": "Ungesicherter Empfänger im Grenzgebiet",
	"Unsecured Frontier Digital Nexus": "Ungesicherter Digitalnexus im Grenzgebiet",
	"Unsecured Frontier Trinary Hub": "Ungesicherter Trinär-Knotenpunkt im Grenzgebiet",
	"Unsecured Frontier Enclave Relay": "Ungesicherte Grenzenklaven-Relaisstaion",
	"Unsecured Frontier Server Bank": "Ungesicherte Server-Datenbank im Grenzgebiet",
	"Unsecured Core Backup Array": "Ungesichertes wichtiges Datenfeld",
	"Unsecured Core Emergence": "Ungesicherter wichtiger Ort",

	"Average Frontier Deposit": "Gewöhnliche Erzvorkommen im Grenzgebiet",
	"Unexceptional Frontier Deposit": "Gewöhnliche Erzvorkommen im Grenzgebiet",
	"Common Perimeter Deposit": "Gemeinschaftliche Erzvorkommen",
	"Exceptional Core Deposit": "Besondere grundlegende Erzvorkommen",
	"Infrequent Core Deposit": "Seltene Kernablagerung",
	"Unusual Core Deposit": "Ungewöhnliche Kernablagerung",
	"Rarified Core Deposit": "Rare Kernablagerung",
	"Ordinary Perimeter Deposit": "Gewöhnliche Erzvorkommen",
	"Uncommon Core Deposit": "Ungewöhnliche Kernablagerung",
	"Isolated Core Deposit": "Vereinzelte grundlegende Erzvorkommen",

	"Barren Perimeter Reservoir": "Karges Erzgebiet",
	"Minor Perimeter Reservoir": "Unwesentliches Erzgebiet",
	"Ordinary Perimeter Reservoir": "Gewöhnliches Gasvorkommen",
	"Sizeable Perimeter Reservoir": "Geringfügiges Gasvorkommen",
	"Token Perimeter Reservoir": "Anzeichen eines Erzgebietes",
	"Bountiful Frontier Reservoir": "Üppiges Gasvorkommen im Grenzgebiet",
	"Vast Frontier Reservoir": "Großes Gasvorkommen im Grenzgebiet",
	"Instrumental Core Reservoir": "Nützliche grundlegende Erzvorkommen",
	"Vital Core Reservoir": "Wichtige grundlegende Erzvorkommen",

	"Unstable Wormhole": "Instabiles Wurmloch",

	"Combat": "Kampfgebiet",
	"Combat Site": "Kampfgebiet",
	"Ore": "Mineralien",
	"Ore Site": "Mineraliengebiet",
	"Data": "Datengebiet",
	"Data Site": "Datengebiet",
	"Relic": "Reliktgebiet",
	"Rellc Site": "Reliktgebiet",
	"WH": "Wurmloch",
	"Wormhole": "Wurmloch",
	"Cosmic Anomaly": "Kosmische Anomalie",
	"Cosmic Signature": "Kosmische Signatur",
	"Jumps": "Sprünge",
	"AU": "AE",
	"signature(s) shown": "signatur(en) gezeigt",
	"Gas Site": "Gasgebiet",
	"Gas": "Gasgebiet"
}<commit_msg>Update siggy german translations.<commit_after>{
	"Perimeter Ambush Point": "Randgebiet für Hinterhalt",
	"Lager im Randgebiet": "Perimeter Camp",
	"Phase Catalyst Node": "Phasenkatalysator-Knotenpunkt",
	"The Line": "Das Feld",

	"Perimeter Checkpoint": "Kontrollpunkt im Randgebiet",
	"Perimeter Hangar": "Perimeter Hangar",
	"The Ruins of Enclave Cohort 27": "Die Ruinen von Enclave Cohort 27",
	"Sleeper Data Sanctuary": "Datenheiligtum der Sleeper",

	"Fortification Frontier Stronghold": "Festung im Grenzgebiet",
	"Outpost Frontier Stronghold": "Bollwerk im Grenzgebiet",
	"Solar Cell": "Solarzelle",
	"The Oruze Construct": "Das Oruze-Konstrukt",

	"Frontier Barracks": "Kasernen im Grenzgebiet",
	"Frontier Command Post": "Kommandoposten im Grenzgebiet",
	"Integrated Terminus": "Endstation einbegriffen",
	"Sleeper Information Sanctum": "Informationsheiligtum der Sleeper",

	"Quarantine Area": "Quarantänegebiet",
	"Core Garrison": "Wichtige Garnison",
	"Core Stronghold": "Wichtige Festung",
	"Oruze Osobnyk": "Oruze Osobnyk",

	"Core Citadel": "Wichtige Zitadelle",
	"Core Bastion": "Wichtige Bastion",
	"Strange Energy Readings": "Merkwürdige Energie-Messungen",
	"The Mirror": "Der Spiegel",

	"Forgotten Perimeter Coronation Platform": "Vergessene Einsatzplattform im Außenbereich",
	"Forgotten Perimeter Power Array": "Vergessenes Energiefeld im Außenbereich",
	"Forgotten Perimeter Gateway": "Vergessenes Tor im Außenbereich",
	"Forgotten Perimeter Habitation Coils": "Vergessene Wohnsiedlung im Außenbereich",
	"Forgotten Frontier Quarantine Outpost": "Vergessener Quarantäne-Außenposten im Grenzgebiet",
	"Forgotten Frontier Recursive Depot": "Vergessenes Rücklauf-Depot im Grenzgebiet",
	"Forgotten Frontier Conversion Module": "Vergessenes Konversionsmodul im Grenzgebiet",
	"Forgotten Frontier Evacuation Center": "Vergessenes Evakuierungszentrum im Grenzgebiet",
	"Forgotten Core Data Field": "Vergessenes wichtiges Datenfeld",
	"Forgotten Core Information Pen": "Vergessenes wichtiges Informationszentrum",
	"Forgotten Core Assembly Hall": "Vergessene wichtige Montageanlage",
	"Forgotten Circuitry Disassembler": "Vergessener wichtiger Circuitry Disassembler",

	"Unsecured Perimeter Amplifier": "Ungesicherter Verstärker im Außenbereich",
	"Unsecured Perimeter Information Center": "Ungesichertes Informationszentrum im Außenbereich",
	"Unsecured Perimeter Comms Relay": "Ungesichertes Kommunikationsrelais",
	"Unsecured Perimeter Transponder Farm": "Ungesichertes Transponderfeld im Außenbereich",
	"Unsecured Frontier Database": "Ungesicherte Datenbank im Grenzgebiet",
	"Unsecured Frontier Receiver": "Ungesicherter Empfänger im Grenzgebiet",
	"Unsecured Frontier Digital Nexus": "Ungesicherter Digitalnexus im Grenzgebiet",
	"Unsecured Frontier Trinary Hub": "Ungesicherter Trinär-Knotenpunkt im Grenzgebiet",
	"Unsecured Frontier Enclave Relay": "Ungesicherte Grenzenklaven-Relaisstaion",
	"Unsecured Frontier Server Bank": "Ungesicherte Server-Datenbank im Grenzgebiet",
	"Unsecured Core Backup Array": "Ungesichertes wichtiges Datenfeld",
	"Unsecured Core Emergence": "Ungesicherter wichtiger Ort",

	"Average Frontier Deposit": "Gewöhnliche Erzvorkommen im Grenzgebiet",
	"Unexceptional Frontier Deposit": "Gewöhnliche Erzvorkommen im Grenzgebiet",
	"Common Perimeter Deposit": "Gemeinschaftliche Erzvorkommen",
	"Exceptional Core Deposit": "Besondere grundlegende Erzvorkommen",
	"Infrequent Core Deposit": "Unregelmäßig auftretende grundlegende Erzvorkommen",
	"Unusual Core Deposit": "Ungewöhnliche grundlegende Erzvorkommen",
	"Rarified Core Deposit": "Einzelne grundlegende Erzvorkommen",
	"Ordinary Perimeter Deposit": "Gewöhnliche Erzvorkommen",
	"Uncommon Core Deposit": "Ungewöhnliche grundlegende Erzvorkommen",
	"Isolated Core Deposit": "Vereinzelte grundlegende Erzvorkommen",

	"Barren Perimeter Reservoir": "Karges Gasvorkommen",
	"Minor Perimeter Reservoir": "Geringfügiges Gasvorkommen",
	"Ordinary Perimeter Reservoir": "Gewöhnliches Gasvorkommen",
	"Sizeable Perimeter Reservoir": "Erhebliches Gasvorkommen",
	"Token Perimeter Reservoir": "Anzeichen eines Gasvorkommens",
	"Bountiful Frontier Reservoir": "Üppiges Gasvorkommen im Grenzgebiet",
	"Vast Frontier Reservoir": "Großes Gasvorkommen im Grenzgebiet",
	"Instrumental Core Reservoir": "Nützliche grundlegendes Gasvorkommen",
	"Vital Core Reservoir": "Wichtige grundlegendes Gasvorkommen",

	"Unstable Wormhole": "Instabiles Wurmloch",

	"Combat": "Kampfgebiet",
	"Combat Site": "Kampfgebiet",
	"Ore": "Mineralien",
	"Ore Site": "Mineraliengebiet",
	"Data": "Datengebiet",
	"Data Site": "Datengebiet",
	"Relic": "Reliktgebiet",
	"Rellc Site": "Reliktgebiet",
	"WH": "Wurmloch",
	"Wormhole": "Wurmloch",
	"Cosmic Anomaly": "Kosmische Anomalie",
	"Cosmic Signature": "Kosmische Signatur",
	"Jumps": "Sprünge",
	"AU": "AE",
	"signature(s) shown": "signatur(en) gezeigt",
	"Gas Site": "Gasgebiet",
	"Gas": "Gasgebiet"
}<|endoftext|>


<commit_before>$.nette.init();

$('#filter-button').on('click', function (e) {
    e.preventDefault();
    var height = $('#filter-container').height() + 95 + 41;
    var $filter = $('#control-bar');
    if ($filter.hasClass('active')) {
        $('#filter-buttons').hide();
        $filter.stop().animate({height: 95}, 200).removeClass('active');
    } else {
        $('#filter-buttons').show();
        $filter.stop().animate({height: height}, 200).addClass('active');
    }
});

// QUOTE
$('.new-reply-form').on('click', '.reply', function (e) {
    e.preventDefault();
    $(this).parent('div').append('<input type="hidden" value="' + $(this).data('reply') + '" name="reply-id"><textarea name="reply-content"></textarea>');
});

$(".new-comment-form textarea").keypress(function (event) {
    if (event.which == 13) {
        event.preventDefault();
        $(".new-comment-form").submit();
        $(this).val('');
    }
});

$('.new-reply-form').on('keypress', 'textarea', function (event) {
    if (event.which == 13) {
        event.preventDefault();
        $(".new-reply-form").submit();
        $('.new-reply-form textarea').remove();
    }
});

$('.flash i').on('click', function () {
    $(this).parent('.flash').remove();
});

$('#checkbox-reset').on('click', function (e) {
    e.preventDefault();
    $('.filter-checkbox').each(function () {
        $(this).attr('checked', false);
    });
});

$('#user-controls-toggle').on('click', function (e) {
    e.preventDefault();
    userCpControl();
});

$('body').on('click', '#toggle-button', function (e) {
    e.preventDefault();
    var topMenu = $('#top-menu');
    if ($(this).hasClass('active')) {
        $('#top-nav').attr('style', 'top:0px');
        topMenu.hide();
        topMenu.height(54);
        $(this).removeClass('active');
    } else {
        $('#top-nav').attr('style', 'top: 0px !important');
        topMenu.show();
        topMenu.height($(window).height() - 54);
        $(this).addClass('active');
    }
});
$('body').on('click', '#optional-toggle', function () {
    if ($(this).hasClass('active')) {
        $('#optional-content').hide();
    } else {
        $('#optional-content').show();
    }
    $(this).toggleClass('active');
});

$('html').on('click', function (e) {
    var target = $(e.target);
    if ($('#page-search-button').hasClass('active')) {
        if (target.parents('#top-nav').size() == 0 && target.parents('.ui-autocomplete').size() == 0) {
            searchBoxControl();
        }
    }
    if ($('#user-controls').hasClass('active')) {
        if (target.parents('#user-cp').size() == 0) {
            userCpControl();
        }
    }
});

$('#page-search-button').click(function (e) {
    e.preventDefault();
    searchBoxControl();
});

function userCpControl() {
    var c = $('#user-controls');
    if (c.hasClass('active')) {
        $('#top-nav').attr('style', 'top:0px');
        c.stop().animate({top: 50, opacity: 0}, 150, function () {
            $(this).hide();
        });
        c.removeClass('active');
        $('#user-controls-toggle').removeClass('active');
    } else {
        $('#top-nav').attr('style', 'top: 0px !important');
        c.stop().show().animate({top: 60, opacity: 1}, 150);
        c.addClass('active');
        $('#user-controls-toggle').addClass('active');
    }
}

function searchBoxControl() {
    var button = $('#page-search-button');
    var box = $('#page-search-box');

    if (button.hasClass('active')) {
        $('#top-nav').attr('style', 'top:0px');
        button.removeClass('active');
        box.animate({width: 0, paddingLeft: 0, paddingRight: 0}, 100, function () {
            box.val('');
            box.focus();
        });
    } else {
        $('#top-nav').attr('style', 'top: 0px !important');
        box.animate({
            width: box.offset().left - $('#nav-container').offset().left - $('#logo').outerWidth() - 15,
            paddingLeft: 15,
            paddingRight: 15
        }, 100, function () {
            box.val('');
            box.focus();
        });
        button.addClass('active');
    }
}

$('#top-nav').autoHidingNavbar({
    hideOffset: 100
});

$('body').on('click', '.avatar-pick', function () {
    $('.avatar-pick').removeClass('active');
    $(this).addClass('active');
    $('.acc-avatar-input').val($(this).data('avatar'));

});<commit_msg>comment reply autofocus<commit_after>$.nette.init();

$('#filter-button').on('click', function (e) {
    e.preventDefault();
    var height = $('#filter-container').height() + 95 + 41;
    var $filter = $('#control-bar');
    if ($filter.hasClass('active')) {
        $('#filter-buttons').hide();
        $filter.stop().animate({height: 95}, 200).removeClass('active');
    } else {
        $('#filter-buttons').show();
        $filter.stop().animate({height: height}, 200).addClass('active');
    }
});

// QUOTE
$('.new-reply-form').on('click', '.reply', function (e) {
    e.preventDefault();
    $(this).parent('div').append('<input type="hidden" value="' + $(this).data('reply') + '" name="reply-id"><textarea name="reply-content"></textarea>');
    $('textarea').focus();
});

$(".new-comment-form textarea").keypress(function (event) {
    if (event.which == 13) {
        event.preventDefault();
        $(".new-comment-form").submit();
        $(this).val('');
    }
});

$('.new-reply-form').on('keypress', 'textarea', function (event) {
    if (event.which == 13) {
        event.preventDefault();
        $(".new-reply-form").submit();
        $('.new-reply-form textarea').remove();
    }
});

$('.flash i').on('click', function () {
    $(this).parent('.flash').remove();
});

$('#checkbox-reset').on('click', function (e) {
    e.preventDefault();
    $('.filter-checkbox').each(function () {
        $(this).attr('checked', false);
    });
});

$('#user-controls-toggle').on('click', function (e) {
    e.preventDefault();
    userCpControl();
});

$('body').on('click', '#toggle-button', function (e) {
    e.preventDefault();
    var topMenu = $('#top-menu');
    if ($(this).hasClass('active')) {
        $('#top-nav').attr('style', 'top:0px');
        topMenu.hide();
        topMenu.height(54);
        $(this).removeClass('active');
    } else {
        $('#top-nav').attr('style', 'top: 0px !important');
        topMenu.show();
        topMenu.height($(window).height() - 54);
        $(this).addClass('active');
    }
});
$('body').on('click', '#optional-toggle', function () {
    if ($(this).hasClass('active')) {
        $('#optional-content').hide();
    } else {
        $('#optional-content').show();
    }
    $(this).toggleClass('active');
});

$('html').on('click', function (e) {
    var target = $(e.target);
    if ($('#page-search-button').hasClass('active')) {
        if (target.parents('#top-nav').size() == 0 && target.parents('.ui-autocomplete').size() == 0) {
            searchBoxControl();
        }
    }
    if ($('#user-controls').hasClass('active')) {
        if (target.parents('#user-cp').size() == 0) {
            userCpControl();
        }
    }
});

$('#page-search-button').click(function (e) {
    e.preventDefault();
    searchBoxControl();
});

function userCpControl() {
    var c = $('#user-controls');
    if (c.hasClass('active')) {
        $('#top-nav').attr('style', 'top:0px');
        c.stop().animate({top: 50, opacity: 0}, 150, function () {
            $(this).hide();
        });
        c.removeClass('active');
        $('#user-controls-toggle').removeClass('active');
    } else {
        $('#top-nav').attr('style', 'top: 0px !important');
        c.stop().show().animate({top: 60, opacity: 1}, 150);
        c.addClass('active');
        $('#user-controls-toggle').addClass('active');
    }
}

function searchBoxControl() {
    var button = $('#page-search-button');
    var box = $('#page-search-box');

    if (button.hasClass('active')) {
        $('#top-nav').attr('style', 'top:0px');
        button.removeClass('active');
        box.animate({width: 0, paddingLeft: 0, paddingRight: 0}, 100, function () {
            box.val('');
            box.focus();
        });
    } else {
        $('#top-nav').attr('style', 'top: 0px !important');
        box.animate({
            width: box.offset().left - $('#nav-container').offset().left - $('#logo').outerWidth() - 15,
            paddingLeft: 15,
            paddingRight: 15
        }, 100, function () {
            box.val('');
            box.focus();
        });
        button.addClass('active');
    }
}

$('#top-nav').autoHidingNavbar({
    hideOffset: 100
});

$('body').on('click', '.avatar-pick', function () {
    $('.avatar-pick').removeClass('active');
    $(this).addClass('active');
    $('.acc-avatar-input').val($(this).data('avatar'));

});<|endoftext|>


<commit_before>import $ from 'jquery'
import EsriJSON from 'ol/format/EsriJSON'

import VectorSource from 'ol/source/Vector'
import { get as getProj, transformExtent } from 'ol/proj'
import { Debug } from '../Debug'
import { take } from '../utilitiesObject'

/**
 * Please note that a 'BBOX' or 'TILE' loadingStrategy is required
 * @typedef {module:ol/source/Vector~Options} ArcGISRESTFeatureSourceOptions
 * @property {object} [params] the params to be passed to the ArcGIS REST Feature Service. The params f, returnGeometry,
 *    geometry, geometryType, inSR and outSr can not be set as they are filled automatically. The SR parameters will
 *    be set to the projection of the source if one is given. geometry and geometryType will always be an
 *    'esriGeometryEnvelope'. f will be json and returnGeometry true.
 *    The parameters spatialRel and outFields can be altered and default to 'esriSpatialRelIntersects' and '*'.
 * @property {string} [dataType=json] can be json or jsonp
 */

export class ArcGISRESTFeatureSource extends VectorSource {
  constructor (options) {
    if (options.loadingStrategyType === 'ALL') {
      Debug.error('ArcRESTFeatureSource does not support loading strategy "ALL". Please use BBOX or TILE')
    }

    const url = take(options, 'url')
    const params = take(options, 'params')
    // const geometrySR = take(options, 'geometrySR')

    options.loader = (...args) => this.loader(...args)

    super(options)

    this.url_ = url
    this.params_ = params || {}
    this.projection_ = options.projection ? getProj(options.projection) : undefined
    this.format_ = new EsriJSON()
    this.dataType_ = options.dataType || 'json'
  }

  /**
   * @param {module:ol/extent~Extent} extent
   * @param {number} resolution
   * @param {module:ol/proj/Projection} projection
   */
  loader (extent, resolution, projection) {
    let sr
    if (this.projection_) {
      extent = transformExtent(extent, projection, this.projection_)
      sr = parseInt(this.projection_.getCode().split(':')[1])
    }

    const geometry = {
      xmin: extent[0],
      ymin: extent[1],
      xmax: extent[2],
      ymax: extent[3]
    }
    if (this.projection_) {
      geometry.spatialReference = {
        wkid: sr
      }
    }

    const params = Object.assign({
      spatialRel: 'esriSpatialRelIntersects',
      outFields: '*'
    }, this.params_, {
      f: 'json',
      returnGeometry: 'true',
      geometry: JSON.stringify(geometry),
      geometryType: 'esriGeometryEnvelope'
    })

    if (this.projection_) {
      params.inSR = sr
      params.outSR = sr
    }

    const url = this.url_.clone()
    for (const key in params) {
      if (params.hasOwnProperty(key)) {
        url.addParam(`${key}=${params[key]}`)
      }
    }

    $.ajax({
      url: url.finalize(),
      dataType: this.dataType_,
      success: response => {
        if (response.error) {
          Debug.error(response.error.message + '\n' +
            response.error.details.join('\n'))
        } else {
          // dataProjection will be read from document
          var features = this.format_.readFeatures(response, {
            dataProjection: this.projection_,
            featureProjection: projection
          })
          if (features.length > 0) {
            this.addFeatures(features)
          }
        }
      }
    })
  }
}
<commit_msg>some documentation<commit_after>import $ from 'jquery'
import EsriJSON from 'ol/format/EsriJSON'

import VectorSource from 'ol/source/Vector'
import { get as getProj, transformExtent } from 'ol/proj'
import { Debug } from '../Debug'
import { take } from '../utilitiesObject'

/**
 * Please note that a 'BBOX' or 'TILE' loadingStrategy is required
 * @typedef {module:ol/source/Vector~Options} ArcGISRESTFeatureSourceOptions
 * @property {object} [params] the params to be passed to the ArcGIS REST Feature Service. The params f, returnGeometry,
 *    geometry, geometryType, inSR and outSr can not be set as they are filled automatically. The SR parameters will
 *    be set to the projection of the source if one is given. geometry and geometryType will always be an
 *    'esriGeometryEnvelope'. f will be 'json' and returnGeometry 'true'.
 *    The parameters spatialRel and outFields can be altered and default to 'esriSpatialRelIntersects' and '*'.
 * @property {string} [dataType=json] can be 'json' or 'jsonp'
 */

export class ArcGISRESTFeatureSource extends VectorSource {
  constructor (options) {
    if (options.loadingStrategyType === 'ALL') {
      Debug.error('ArcRESTFeatureSource does not support loading strategy "ALL". Please use BBOX or TILE')
    }

    const url = take(options, 'url')
    const params = take(options, 'params')
    // const geometrySR = take(options, 'geometrySR')

    options.loader = (...args) => this.loader(...args)

    super(options)

    this.url_ = url
    this.params_ = params || {}
    this.projection_ = options.projection ? getProj(options.projection) : undefined
    this.format_ = new EsriJSON()
    this.dataType_ = options.dataType || 'json'
  }

  /**
   * @param {module:ol/extent~Extent} extent
   * @param {number} resolution
   * @param {module:ol/proj/Projection} projection
   */
  loader (extent, resolution, projection) {
    let sr
    if (this.projection_) {
      extent = transformExtent(extent, projection, this.projection_)
      sr = parseInt(this.projection_.getCode().split(':')[1])
    }

    const geometry = {
      xmin: extent[0],
      ymin: extent[1],
      xmax: extent[2],
      ymax: extent[3]
    }
    if (this.projection_) {
      geometry.spatialReference = {
        wkid: sr
      }
    }

    const params = Object.assign({
      spatialRel: 'esriSpatialRelIntersects',
      outFields: '*'
    }, this.params_, {
      f: 'json',
      returnGeometry: 'true',
      geometry: JSON.stringify(geometry),
      geometryType: 'esriGeometryEnvelope'
    })

    if (this.projection_) {
      params.inSR = sr
      params.outSR = sr
    }

    const url = this.url_.clone()
    for (const key in params) {
      if (params.hasOwnProperty(key)) {
        url.addParam(`${key}=${params[key]}`)
      }
    }

    $.ajax({
      url: url.finalize(),
      dataType: this.dataType_,
      success: response => {
        if (response.error) {
          Debug.error(response.error.message + '\n' +
            response.error.details.join('\n'))
        } else {
          // dataProjection will be read from document
          var features = this.format_.readFeatures(response, {
            dataProjection: this.projection_,
            featureProjection: projection
          })
          if (features.length > 0) {
            this.addFeatures(features)
          }
        }
      }
    })
  }
}
<|endoftext|>


<commit_before>// Attach jQuery to the window for backwards compatibility
import jQuery from 'jquery';
window.jQuery = jQuery;
window.$ = jQuery;

// Mailcheck, for email validation & suggestions
import 'mailcheck';

// jQuery Once plugin
import 'jquery-once';

// $.unveil plugin for lazy-loading images
import 'unveil';

// IE8 polyfill for $.ajax CORS support
import 'jquery.iecors';

// RequestAnimationFrame polyfill
import 'raf.js';

// Filament Group's fixed-sticky polyfill for `position: sticky`
import 'fixed-sticky';

// WHATWG fetch API polyfill
import 'whatwg-fetch';
<commit_msg>Use CommonJS imports for libraries.<commit_after>// Attach jQuery to the window for backwards compatibility
require('jquery');

// Mailcheck, for email validation & suggestions
require('mailcheck');

// jQuery Once plugin
require('jquery-once');

// window.requestAnimationFrame polyfill
require('raf.js');

// Filament Group's fixed-sticky polyfill for `position: sticky`
require('fixed-sticky');

// WHATWG fetch API polyfill
require('whatwg-fetch');
<|endoftext|>


<commit_before>/**
 * @class Echo.StreamServer.Controls.Submit.Plugins.FormAuth
 * Adds the authentication section to the Echo Submit control
 *
 *     var identityManager = {"width": 400, "height": 240, "url": "http://example.com/auth"};
 *
 *     new Echo.StreamServer.Controls.Submit({
 *         "target": document.getElementById("submit"),
 *         "appkey": "test.aboutecho.com",
 *         "plugins": [{
 *             "name": "FormAuth",
 *             "submitPermissions": "forceLogin",
 *             "identityManager": {
 *                 "login": identityManager,
 *                 "signup": identityManager
 *             }
 *         }]
 *     });
 *
 * @extends Echo.Plugin
 */
var plugin = Echo.Plugin.manifest("FormAuth", "Echo.StreamServer.Controls.Submit");

plugin.init = function() {
	if (this._userStatus() === "forcedLogin") {
		this.extendTemplate("replace", "header", plugin.templates.forcedLogin);
	}
	this.extendTemplate("insertBefore", "header", plugin.templates.auth);
	this.component.addPostValidator(this._validator());
};

plugin.config = {
	/**
	 * @cfg {Object} identityManager The list of handlers for login, edit and signup action. If some action is ommited then it will not be available for users in the Auth control. Each handler accepts sessionID as GET parameter. This parameter is necessary for communication with Backplane server. When handler finishes working it constructs the corresponding Backplane message (for login, signup or user data update) and sends this message to Backplane server.
	 * @cfg {Object} [identityManager.login] Encapsulates data for login workflow
	 * @cfg {Number} [identityManager.login.width] Specifies the width of the visible auth area
	 * @cfg {Number} [identityManager.login.height] Specifies the height of the visible auth area
	 * @cfg {String} [identityManager.login.url] Specifies the URL to be opened as an auth handler
	 * @cfg {Object} [identityManager.signup] Encapsulates data for signup workflow
	 * @cfg {Number} [identityManager.signup.width] Specifies the width of the visible auth area
	 * @cfg {Number} [identityManager.signup.height] Specifies the height of the visible auth area
	 * @cfg {String} [identityManager.signup.url] Specifies the URL to be opened as an auth handler
	 * @cfg {Object} [identityManager.edit] Encapsulates data for edit workflow
	 * @cfg {Number} [identityManager.edit.width] Specifies the width of the visible auth area
	 * @cfg {Number} [identityManager.edit.height] Specifies the height of the visible auth area
	 * @cfg {String} [identityManager.edit.url] Specifies the URL to be opened as an auth handler
	 */
	"identityManager": {},
	/**
	 * @cfg {String} submitPermissions
	 * Specifies the permitted commenting modes. The two options are: "allowGuest" and "forceLogin".
	 */
	"submitPermissions": "allowGuest"
};

plugin.enabled = function() {
	return (this.component.user.get("sessionID") &&
		this.config.get("identityManager.login") &&
		this.config.get("identityManager.signup"));
};

plugin.dependencies = [{
	"url": "sdk/identity-server.pack.js",
	"loaded": function() {
		return Echo.Utils.isComponentDefined("Echo.IdentityServer.Controls.Auth");
	}
}];

plugin.labels = {
	/**
	 * @echo_label
	 */
	"youMustBeLoggedIn": "You must be logged in to comment"
};

plugin.templates.auth = '

';

plugin.templates.forcedLogin =
	'
' +
		'' +
			'{plugin.label:youMustBeLoggedIn}' +
		'' +
	'
';

/**
 * @echo_renderer
 */
plugin.component.renderers.header = function(element) {
	var plugin = this;
	if (this._userStatus() === "logged") {
		return element.empty();
	}
	return plugin.parentRenderer("header", arguments);
};

/**
 * @echo_renderer
 */
plugin.component.renderers.container = function(element) {
	var plugin = this;
	plugin.parentRenderer("container", arguments);
	var _class = function(postfix) {
		return plugin.cssPrefix + postfix;
	};
	return element
		.removeClass($.map(["logged", "anonymous", "forcedLogin"], _class).join(" "))
		.addClass(_class(plugin._userStatus()));
};

/**
 * @echo_renderer
 */
plugin.renderers.auth = function(element) {
	var plugin = this;
	new Echo.IdentityServer.Controls.Auth(plugin.config.assemble({
		"target": element,
		"identityManager": plugin.config.get("identityManager")
	}));
	return element;
};

plugin.methods._validator = function() {
	var plugin = this, submit = this.component;
	return function() {
		if (!submit.user.is("logged") && plugin._permissions() === "forceLogin") {
			plugin.dom.get("forcedLoginMessage").addClass(plugin.cssPrefix + "error");
			return false;
		}
		return true;
	}
};

plugin.methods._permissions = function() {
	return this.config.get("submitPermissions");
};

plugin.methods._userStatus = function(application) {
	return this.component.user.is("logged")
		? "logged"
		: this._permissions() == "forceLogin"
			? "forcedLogin"
			: "anonymous";
};

plugin.css =
	'.{plugin.class:forcedLoginMessage} { font-size: 14px; font-weight: bold; }' +
	'.{plugin.class:error} { color: red; }';

Echo.Plugin.create(plugin);
<commit_msg>[CR] FormAuth plugin - minor updates<commit_after>(function(){
/**
 * @class Echo.StreamServer.Controls.Submit.Plugins.FormAuth
 * Adds the authentication section to the Echo Submit control
 *
 *     var identityManager = {"width": 400, "height": 240, "url": "http://example.com/auth"};
 *
 *     new Echo.StreamServer.Controls.Submit({
 *         "target": document.getElementById("submit"),
 *         "appkey": "test.aboutecho.com",
 *         "plugins": [{
 *             "name": "FormAuth",
 *             "submitPermissions": "forceLogin",
 *             "identityManager": {
 *                 "login": identityManager,
 *                 "signup": identityManager
 *             }
 *         }]
 *     });
 *
 * @extends Echo.Plugin
 */
var plugin = Echo.Plugin.manifest("FormAuth", "Echo.StreamServer.Controls.Submit");

plugin.init = function() {
	if (this._userStatus() === "forcedLogin") {
		this.extendTemplate("replace", "header", plugin.templates.forcedLogin);
	}
	this.extendTemplate("insertBefore", "header", plugin.templates.auth);
	this.component.addPostValidator(this._validator());
};

plugin.config = {
	/**
	 * @cfg {Object} identityManager The list of handlers for login, edit and signup action. If some action is ommited then it will not be available for users in the Auth control. Each handler accepts sessionID as GET parameter. This parameter is necessary for communication with Backplane server. When handler finishes working it constructs the corresponding Backplane message (for login, signup or user data update) and sends this message to Backplane server.
	 * @cfg {Object} [identityManager.login] Encapsulates data for login workflow
	 * @cfg {Number} [identityManager.login.width] Specifies the width of the visible auth area
	 * @cfg {Number} [identityManager.login.height] Specifies the height of the visible auth area
	 * @cfg {String} [identityManager.login.url] Specifies the URL to be opened as an auth handler
	 * @cfg {Object} [identityManager.signup] Encapsulates data for signup workflow
	 * @cfg {Number} [identityManager.signup.width] Specifies the width of the visible auth area
	 * @cfg {Number} [identityManager.signup.height] Specifies the height of the visible auth area
	 * @cfg {String} [identityManager.signup.url] Specifies the URL to be opened as an auth handler
	 * @cfg {Object} [identityManager.edit] Encapsulates data for edit workflow
	 * @cfg {Number} [identityManager.edit.width] Specifies the width of the visible auth area
	 * @cfg {Number} [identityManager.edit.height] Specifies the height of the visible auth area
	 * @cfg {String} [identityManager.edit.url] Specifies the URL to be opened as an auth handler
	 */
	"identityManager": {},
	/**
	 * @cfg {String} submitPermissions
	 * Specifies the permitted commenting modes. The two options are: "allowGuest" and "forceLogin".
	 */
	"submitPermissions": "allowGuest"
};

plugin.dependencies = [{
	"url": "sdk/identity-server.pack.js",
	"loaded": function() {
		return Echo.Utils.isComponentDefined("Echo.IdentityServer.Controls.Auth");
	}
}];

plugin.enabled = function() {
	return (this.component.user.get("sessionID") &&
		this.config.get("identityManager.login") &&
		this.config.get("identityManager.signup"));
};

plugin.labels = {
	/**
	 * @echo_label
	 */
	"youMustBeLoggedIn": "You must be logged in to comment"
};

plugin.templates.auth = '

';

plugin.templates.forcedLogin =
	'
' +
		'' +
			'{plugin.label:youMustBeLoggedIn}' +
		'' +
	'
';

/**
 * @echo_renderer
 */
plugin.component.renderers.header = function(element) {
	var plugin = this;
	if (plugin._userStatus() === "logged") {
		return element.empty();
	}
	return plugin.parentRenderer("header", arguments);
};

/**
 * @echo_renderer
 */
plugin.component.renderers.container = function(element) {
	var plugin = this;
	plugin.parentRenderer("container", arguments);
	var _class = function(postfix) {
		return plugin.cssPrefix + postfix;
	};
	return element
		.removeClass($.map(["logged", "anonymous", "forcedLogin"], _class).join(" "))
		.addClass(_class(plugin._userStatus()));
};

/**
 * @echo_renderer
 */
plugin.renderers.auth = function(element) {
	var plugin = this;
	new Echo.IdentityServer.Controls.Auth(plugin.config.assemble({
		"target": element,
		"identityManager": plugin.config.get("identityManager")
	}));
	return element;
};

plugin.methods._validator = function() {
	var plugin = this, submit = this.component;
	return function() {
		if (!submit.user.is("logged") && plugin._permissions() === "forceLogin") {
			plugin.dom.get("forcedLoginMessage").addClass(plugin.cssPrefix + "error");
			return false;
		}
		return true;
	}
};

plugin.methods._permissions = function() {
	return this.config.get("submitPermissions");
};

plugin.methods._userStatus = function() {
	return this.component.user.is("logged")
		? "logged"
		: this._permissions() === "forceLogin"
			? "forcedLogin"
			: "anonymous";
};

plugin.css =
	'.{plugin.class:forcedLoginMessage} { font-size: 14px; font-weight: bold; }' +
	'.{plugin.class:error} { color: red; }';

Echo.Plugin.create(plugin);

});<|endoftext|>


<commit_before>module.exports = {
  env: {
    browser: true,
    es6: true,
    node: true,
    'shared-node-browser': true
  },

  parserOptions: {
    sourceType: 'module',
    ecmaFeatures: {
      experimentalObjectRestSpread: true,
      classes: true
    }
  },

  plugins: ['filenames'],

  extends: [
    'eslint:recommended',
    'eslint-config-airbnb-base',
    'eslint-config-airbnb-base/rules/strict',
    'plugin:no-unused-vars-rest/recommended'
  ],

  rules: {
    'no-console': 'error',
    'comma-dangle': ['error', 'never'],
    'max-len': ['error', 120],
    'one-var': ['error', {uninitialized: 'always', initialized: 'never'}],
    'one-var-declaration-per-line': ['error', 'initializations'],
    'filenames/match-regex': ['error', '^[a-z0-9\\-\\.]+$'],
    'new-cap': ['error', {capIsNewExceptions: ['Map']}],
    yoda: ['error', 'always'],
    'handle-callback-err': 'error',
    'object-curly-spacing': ['error', 'never'],
    'import/prefer-default-export': 'off',
    'arrow-parens': ['error', 'as-needed'],
    'global-require': 'off',
    'no-underscore-dangle': ['error', {allow: ['_links', '_embedded']}]
  }
};
<commit_msg>fix(immutable-list): allowed immutable lists to use uppercase w/o `new`<commit_after>module.exports = {
  env: {
    browser: true,
    es6: true,
    node: true,
    'shared-node-browser': true
  },

  parserOptions: {
    sourceType: 'module',
    ecmaFeatures: {
      experimentalObjectRestSpread: true,
      classes: true
    }
  },

  plugins: ['filenames'],

  extends: [
    'eslint:recommended',
    'eslint-config-airbnb-base',
    'eslint-config-airbnb-base/rules/strict',
    'plugin:no-unused-vars-rest/recommended'
  ],

  rules: {
    'no-console': 'error',
    'comma-dangle': ['error', 'never'],
    'max-len': ['error', 120],
    'one-var': ['error', {uninitialized: 'always', initialized: 'never'}],
    'one-var-declaration-per-line': ['error', 'initializations'],
    'filenames/match-regex': ['error', '^[a-z0-9\\-\\.]+$'],
    'new-cap': ['error', {capIsNewExceptions: ['Map', 'List']}],
    yoda: ['error', 'always'],
    'handle-callback-err': 'error',
    'object-curly-spacing': ['error', 'never'],
    'import/prefer-default-export': 'off',
    'arrow-parens': ['error', 'as-needed'],
    'global-require': 'off',
    'no-underscore-dangle': ['error', {allow: ['_links', '_embedded']}]
  }
};
<|endoftext|>


<commit_before>
/**
 * Initialisation
 ******************************************/
(function ($)
{
    var options = {
        selectors: {
            ajaxModal: '#ajax-modal'
        }
    };

    $(document).ready(function ()
    {
        $(document).initAdvancedElements();

        $.initSelect2PermissifNoAjax();

        $(options.selectors.ajaxModal).on("show.bs.modal", function (e) {
            var link = $(e.relatedTarget);
            $(this).load(link.attr("href"), function () {
                $(this).initAdvancedElements();
            });
        });
        $(options.selectors.ajaxModal).on("hidden.bs.modal", function (e) {
            $(this).html("");
        });
    });
    $.fn.initAdvancedElements = function () {

        var element = $(this);

        $(this).find('.input-float').inputNumberFormat({'decimal': 4, 'decimalAuto': 2});
        $(this).find('.input-integer').inputNumberFormat({'decimal': 0, 'decimalAuto': 0});

        $(this).find("select2").select2({
            allowClear: true
        });
        $(this).find("select.select2").select2({
            allowClear: true
        });

        $(this).find(".select2autocomplete").each(function () {
            var urlAjax = $(this).data('ajax');
            var defaultValue = $(this).val();
            var defaultValueSplitted = defaultValue.split(',');
            var select2 = $(this);
            $(this).select2({
                onselected: function () {
                    console.log('fre');
                },
                initSelection: function (element, callback) {
                    if (defaultValue != '') {
                        callback({id: defaultValueSplitted[0], text: defaultValueSplitted[1]});
                        select2.val(defaultValueSplitted[0]);
                    }
                },
                placeholder: 'Entrer un nom',
                minimumInputLength: 3,
                allowClear: true,
                ajax: {
                    quietMillis: 150,
                    url: urlAjax,
                    dataType: 'json',
                    type: "GET",
                    data: function (term, page) {
                        return {
                            q: term
                        };
                    },
                    results: function (data) {
                        var results = [];
                        $.each(data, function (index, item) {
                            results.push({
                                id: index,
                                text: item
                            });
                        });
                        return {
                            results: results
                        }

                    }}
            });
            $(this).on('choose', function () {
                console.log('select');
            });
        });

        $.initSelect2PermissifNoAjax = function ()
        {
            if ($('.select2permissifNoAjax').length) {
                var lastValue = null;
                $('.select2permissifNoAjax').select2({
                    data: JSON.parse($('input.select2permissifNoAjax').attr('data-choices')),
                    multiple: false,
                    placeholder: true,
                    createSearchChoice: function (term, data) {
                        if ($(data).filter(function () {
                            return this.text.localeCompare(term) === 0;
                        }).length === 0) {
                            return {id: term, text: term + ' (nouveau)'};
                        }
                    }
                }).on("select2-close", function () {
                    var old_choices = JSON.parse($('input.select2permissifNoAjax').attr('data-choices'));
                    old_choices.push({id: lastValue, text: lastValue + ' (nouveau)'});
                    $('input.select2permissifNoAjax').select2("val", lastValue);
                    $('input.select2permissifNoAjax').val(lastValue);
                    $('.select2permissifNoAjax .select2-chosen').text(lastValue);
                }).on("select2-highlight", function (e) {
                    lastValue = e.val;
                })
            }
        }

        $(this).find('.hamzastyle').each(function() {
            var select2 = $(this);
            select2.select2({
                multiple: true,
                data: function() {
                    var data = [];
                    element.find(select2.attr('data-hamzastyle-container')).find('.hamzastyle-item').each(function() {
                        data = data.concat(JSON.parse($(this).attr('data-words')));
                    });

                    var data = unique(data.sort());

                    dataFinal = [];
                    for(key in data) {
                        if(data[key]+"") {
                            dataFinal.push({ id: key, text: (data[key]+"") });
                        }
                    }

                    return { results: dataFinal };
                }
            })
        });

        $(this).find('.hamzastyle').on("change", function(e) {
            var selectedWords = $(this).select2("data");
            element.find($(this).attr('data-hamzastyle-container')).find('.hamzastyle-item').each(function() {
                var words = $(this).attr('data-words');
                var find = true;
                for(key in selectedWords) {
                    var word = selectedWords[key].text;
                    if (words.indexOf(word) === -1) {
                        find = false;
                    }
                }
                if (find) {
                    $(this).show();
                } else {
                    $(this).hide();
                }
             });

        })

        $(this).find('.hamzastyle-item').each(function(){
            $(this).find('.anchor_to_hamza_style').click(function(){
                var anchor = $(this).attr('href').replace(/_/g, " ").replace('#',"");
               console.log(anchor) ;
            });

        });

        $(this).find('.input-group.date').datetimepicker({
            locale: 'fr_FR',
            format: 'L',
            allowInputToggle: true,
            focusOnShow: true,
            useCurrent: false
        });

        $(this).find("form.form-ajax-modal").on('submit', function () {
            var form = $(this);
            var callback = $(this).attr('callback');
            $.post($(this).attr('action'),
                    $(this).serialize(),
                    function (data)
                    {
                        if (!data.success) {
                            var content = form.find(form.attr('data-content')).html(data.content);
                            content.initAdvancedElements();
                            return;
                        }

                        if (form.data('related-element')) {
                            $(form.data('related-element')).trigger("modal_callback", data);
                        }

                        $(options.selectors.ajaxModal).modal('hide');
                    }, "json");

            return false;
        });

        $(this).find('.modal-autoshow').modal({
            'show': true
        });

        $(this).find('.link-submit').on('click', function () {
            var form = $($(this).attr('data-form'));
            form.attr('action', $(this).attr('href'));
            form.submit();

            return false;
        });
        $(this).find('.pointer').on('click', function () {
            if ($(this).attr('data-pointer')) {
                $($(this).attr('data-pointer')).click();
            }

            return false;
        });

        $(this).find('.dynamic-element-add').on('click', function () {
            var content = $($($(this).attr('data-template')).html().replace(/var---nbItem---/g, UUID.generate()));
            $($(this).attr('data-container')).append(content);
            content.initAdvancedElements();
        });

        $(this).find('.dynamic-element-delete').on('click', function () {
            $($(this).attr('data-line')).remove();
            if ($($(this).attr('data-lines')).length < 1 && $(this).attr('data-add')) {
                $($(this).attr('data-add')).trigger('click');
            }
        });

    }

})(jQuery);<commit_msg>Traduction select2<commit_after>
/**
 * Initialisation
 ******************************************/

(function ($)
{

    var options = {
        selectors: {
            ajaxModal: '#ajax-modal'
        }
    };

    $(document).ready(function ()
    {
        $(document).initAdvancedElements();

        $.initSelect2PermissifNoAjax();

        $(options.selectors.ajaxModal).on("show.bs.modal", function (e) {
            var link = $(e.relatedTarget);
            $(this).load(link.attr("href"), function () {
                $(this).initAdvancedElements();
            });
        });
        $(options.selectors.ajaxModal).on("hidden.bs.modal", function (e) {
            $(this).html("");
        });
    });

    $.fn.initAdvancedElements = function () {

        var element = $(this);

        $(this).find('.input-float').inputNumberFormat({'decimal': 4, 'decimalAuto': 2});
        $(this).find('.input-integer').inputNumberFormat({'decimal': 0, 'decimalAuto': 0});

        $(this).find("select2").select2({
            allowClear: true
        });
        $(this).find("select.select2").select2({
            allowClear: true
        });

        $(this).find(".select2autocomplete").each(function () {
            var urlAjax = $(this).data('ajax');
            var defaultValue = $(this).val();
            var defaultValueSplitted = defaultValue.split(',');
            var select2 = $(this);
            $(this).select2({
                onselected: function () {
                    console.log('fre');
                },
                initSelection: function (element, callback) {
                    if (defaultValue != '') {
                        callback({id: defaultValueSplitted[0], text: defaultValueSplitted[1]});
                        select2.val(defaultValueSplitted[0]);
                    }
                },

                placeholder: 'Entrer un nom',
                minimumInputLength: 3,
                formatInputTooShort: function (input, min) {
                	var n = min - input.length;
                	return  min + " caractère" + (n == 1 ? "" : "s") + " min";
                },
                formatNoMatches: function () {
                	return "Aucun résultat";
                },
                formatSearching: function () {
                	return "Recherche…";
                },
                allowClear: true,
                ajax: {
                    quietMillis: 150,
                    url: urlAjax,
                    dataType: 'json',
                    type: "GET",
                    data: function (term, page) {
                        return {
                            q: term
                        };
                    },
                    results: function (data) {
                        var results = [];
                        $.each(data, function (index, item) {
                            results.push({
                                id: index,
                                text: item
                            });
                        });
                        return {
                            results: results
                        }

                    }}
            });
            $(this).on('choose', function () {
                console.log('select');
            });
        });

        $.initSelect2PermissifNoAjax = function ()
        {
            if ($('.select2permissifNoAjax').length) {
                var lastValue = null;
                $('.select2permissifNoAjax').select2({
                    data: JSON.parse($('input.select2permissifNoAjax').attr('data-choices')),
                    multiple: false,
                    placeholder: true,
                    createSearchChoice: function (term, data) {
                        if ($(data).filter(function () {
                            return this.text.localeCompare(term) === 0;
                        }).length === 0) {
                            return {id: term, text: term + ' (nouveau)'};
                        }
                    }
                }).on("select2-close", function () {
                    var old_choices = JSON.parse($('input.select2permissifNoAjax').attr('data-choices'));
                    old_choices.push({id: lastValue, text: lastValue + ' (nouveau)'});
                    $('input.select2permissifNoAjax').select2("val", lastValue);
                    $('input.select2permissifNoAjax').val(lastValue);
                    $('.select2permissifNoAjax .select2-chosen').text(lastValue);
                }).on("select2-highlight", function (e) {
                    lastValue = e.val;
                })
            }
        }

        $(this).find('.hamzastyle').each(function() {
            var select2 = $(this);
            select2.select2({
                multiple: true,
                data: function() {
                    var data = [];
                    element.find(select2.attr('data-hamzastyle-container')).find('.hamzastyle-item').each(function() {
                        data = data.concat(JSON.parse($(this).attr('data-words')));
                    });

                    var data = unique(data.sort());

                    dataFinal = [];
                    for(key in data) {
                        if(data[key]+"") {
                            dataFinal.push({ id: key, text: (data[key]+"") });
                        }
                    }

                    return { results: dataFinal };
                }
            })
        });

        $(this).find('.hamzastyle').on("change", function(e) {
            var selectedWords = $(this).select2("data");
            element.find($(this).attr('data-hamzastyle-container')).find('.hamzastyle-item').each(function() {
                var words = $(this).attr('data-words');
                var find = true;
                for(key in selectedWords) {
                    var word = selectedWords[key].text;
                    if (words.indexOf(word) === -1) {
                        find = false;
                    }
                }
                if (find) {
                    $(this).show();
                } else {
                    $(this).hide();
                }
             });

        })

        $(this).find('.hamzastyle-item').each(function(){
            $(this).find('.anchor_to_hamza_style').click(function(){
                var anchor = $(this).attr('href').replace(/_/g, " ").replace('#',"");
               console.log(anchor) ;
            });

        });

        $(this).find('.input-group.date').datetimepicker({
            locale: 'fr_FR',
            format: 'L',
            allowInputToggle: true,
            focusOnShow: true,
            useCurrent: false
        });

        $(this).find("form.form-ajax-modal").on('submit', function () {
            var form = $(this);
            var callback = $(this).attr('callback');
            $.post($(this).attr('action'),
                    $(this).serialize(),
                    function (data)
                    {
                        if (!data.success) {
                            var content = form.find(form.attr('data-content')).html(data.content);
                            content.initAdvancedElements();
                            return;
                        }

                        if (form.data('related-element')) {
                            $(form.data('related-element')).trigger("modal_callback", data);
                        }

                        $(options.selectors.ajaxModal).modal('hide');
                    }, "json");

            return false;
        });

        $(this).find('.modal-autoshow').modal({
            'show': true
        });

        $(this).find('.link-submit').on('click', function () {
            var form = $($(this).attr('data-form'));
            form.attr('action', $(this).attr('href'));
            form.submit();

            return false;
        });
        $(this).find('.pointer').on('click', function () {
            if ($(this).attr('data-pointer')) {
                $($(this).attr('data-pointer')).click();
            }

            return false;
        });

        $(this).find('.dynamic-element-add').on('click', function () {
            var content = $($($(this).attr('data-template')).html().replace(/var---nbItem---/g, UUID.generate()));
            $($(this).attr('data-container')).append(content);
            content.initAdvancedElements();
        });

        $(this).find('.dynamic-element-delete').on('click', function () {
            $($(this).attr('data-line')).remove();
            if ($($(this).attr('data-lines')).length < 1 && $(this).attr('data-add')) {
                $($(this).attr('data-add')).trigger('click');
            }
        });

    }

})(jQuery);<|endoftext|>


<commit_before>var graphql = require('graphql'),
    Doctor = require('./doctor');

var RestifyGraphQL = function RestifyGraphQL(schema) {
    return function (req, res, next) {
        graphql.graphql(schema, req.query.query).then(
            result => { res.send(200, result); next(); },
            reason => {
                console.log(reason);
                res.send(404);
                next();
            }
        );
    }
};

module.exports.RestifyGraphQL = RestifyGraphQL;

module.exports.init = function (server, connection) {

    var doctorType = new graphql.GraphQLObjectType({
        name: 'Doctor',
        description: 'A single incarnation of The Doctor',
        fields: function () {
            return {
                id: {
                    type: graphql.GraphQLInt,
                    description: 'Doctor ID'
                },
                incarnation: {
                    type: graphql.GraphQLString,
                    description: 'Name of this incarnation of The Doctor'
                },
                actor: {
                    type: graphql.GraphQLString,
                    description: 'Name of the actor who portrayed this incarnation of The Doctor'
                }
            }
        }
    });

    var schema = new graphql.GraphQLSchema({
        query: new graphql.GraphQLObjectType({
            name: 'RootQueryType',
            fields: {
                doctor: {
                    type: doctorType,
                    args: {
                        id: {
                            description: 'Doctor ID',
                            type: graphql.GraphQLInt
                        }
                    },
                    resolve: (root, { id }) => {
                        return new Promise(function (resolve, reject) {
                            Doctor.forID(connection, id).then(
                                (value) => resolve(value),
                                (reason) => reject(reason)
                            );
                        })
                    },
                }
            }
        })
    });

    server.get({ path: 'graphql', version: '1.0.0' }, RestifyGraphQL(schema));
}

<commit_msg>Fleshed out the rest of the GraphQL basics<commit_after>var graphql = require('graphql'),
    Doctor = require('./doctor'),
    Director = require('./director'),
    Writer = require('./writer'),
    Season = require('./season'),
    Serial = require('./serial');

var RestifyGraphQL = function RestifyGraphQL(schema) {
    return function (req, res, next) {
        graphql.graphql(schema, req.query.query).then(
            result => { res.send(200, result); next(); },
            reason => {
                console.log(reason);
                res.send(404);
                next();
            }
        );
    }
};

module.exports.RestifyGraphQL = RestifyGraphQL;

module.exports.init = function (server, connection) {

    var doctorType = new graphql.GraphQLObjectType({
        name: 'Doctor',
        description: 'A single incarnation of The Doctor',
        fields: function () {
            return {
                id: {
                    type: graphql.GraphQLInt,
                    description: 'Doctor ID'
                },
                incarnation: {
                    type: graphql.GraphQLString,
                    description: 'Name of this incarnation of The Doctor'
                },
                actor: {
                    type: graphql.GraphQLString,
                    description: 'Name of the actor who portrayed this incarnation of The Doctor'
                }
            }
        }
    });

    var directorType = new graphql.GraphQLObjectType({
        name: 'Director',
        description: 'The director of an episode',
        fields: function () {
            return {
                id: {
                    type: graphql.GraphQLID,
                    description: 'Director ID'
                },
                name: {
                    type: graphql.GraphQLString,
                    description: 'Director name'
                }
            }
        }
    });

    var writerType = new graphql.GraphQLObjectType({
        name: 'Writer',
        description: 'The writer of an episode',
        fields: function () {
            return {
                id: {
                    type: graphql.GraphQLID,
                    description: 'Writer ID'
                },
                name: {
                    type: graphql.GraphQLString,
                    description: 'Writer name'
                }
            }
        }
    });

    var seasonType = new graphql.GraphQLObjectType({
        name: 'Season',
        description: 'A season of the show',
        fields: function () {
            return {
                id: {
                    type: graphql.GraphQLID,
                    description: 'Season ID'
                },
                name: {
                    type: graphql.GraphQLString,
                    description: 'Season name'
                }
            }
        }
    });

    var serialType = new graphql.GraphQLObjectType({
        name: 'Serial',
        description: 'A serial or single episode',
        fields: function () {
            return {
                id: {
                    type: graphql.GraphQLID,
                    description: 'Serial ID'
                },
                season: {
                    type: graphql.GraphQLInt,
                    description: 'Season ID'
                },
                story: {
                    type: graphql.GraphQLInt,
                    description: 'Story number'
                },
                serial: {
                    type: graphql.GraphQLInt,
                    description: 'Serial episode number'
                },
                title: {
                    type: graphql.GraphQLString,
                    description: 'Serial title'
                },
                productionCode: {
                    type: graphql.GraphQLString,
                    description: 'Serial production code'
                }
            }
        }
    });

    var schema = new graphql.GraphQLSchema({
        query: new graphql.GraphQLObjectType({
            name: 'RootQueryType',
            fields: {
                doctor: {
                    type: doctorType,
                    args: {
                        id: {
                            description: 'Doctor ID',
                            type: graphql.GraphQLID
                        }
                    },
                    resolve: (root, { id }) => {
                        return new Promise(function (resolve, reject) {
                            Doctor.forID(connection, id).then(
                                (value) => resolve(value),
                                (reason) => reject(reason)
                            );
                        })
                    },
                },
                director: {
                    type: directorType,
                    args: {
                        id: {
                            description: 'Director ID',
                            type: graphql.GraphQLID
                        }
                    },
                    resolve: (root, { id }) => {
                        return new Promise(function (resolve, reject) {
                            Director.forID(connection, id).then(
                                (value) => resolve(value),
                                (reason) => reject(reason)
                            );
                        })
                    }
                },
                writer: {
                    type: writerType,
                    args: {
                        id: {
                            description: 'Writer ID',
                            type: graphql.GraphQLID
                        }
                    },
                    resolve: (root, { id }) => {
                        return new Promise(function (resolve, reject) {
                            Writer.forID(connection, id).then(
                                (value) => resolve(value),
                                (reason) => reject(reason)
                            );
                        })
                    }
                },
                season: {
                    type: seasonType,
                    args: {
                        id: {
                            description: 'Season ID',
                            type: graphql.GraphQLID
                        }
                    },
                    resolve: (root, { id }) => {
                        return new Promise(function (resolve, reject) {
                            Season.forID(connection, id).then(
                                (value) => resolve(value),
                                (reason) => reject(reason)
                            );
                        })
                    }
                },
                serial: {
                    type: serialType,
                    args: {
                        id: {
                            description: 'Serial ID',
                            type: graphql.GraphQLID
                        }
                    },
                    resolve: (root, { id }) => {
                        return new Promise(function (resolve, reject) {
                            Serial.forID(connection, id).then(
                                (value) => function (value) {
                                    value.season = value.seasonID;
                                    value.seasonID = undefined;
                                    resolve(value);
                                },
                                (reason) => reject(reason)
                            );
                        })
                    }
                }
            }
        })
    });

    server.get({ path: 'graphql', version: '1.0.0' }, RestifyGraphQL(schema));
}

<|endoftext|>