function parseGET() {
  // disable the fields below if the GET parameter `disablefields` is set to true
  const disableEditing = $._GET['disableediting'] === 'true' ? true : false;
  const params = [
    'firstname',
    'lastname',
    'dcinumber',
    'event',
    'eventdate',
    'eventlocation',
    'deckname',
    'deckdesigner',
    'deckmain',
    'deckside'
  ];

  // check for event, eventdate, or eventlocation and lock down those input fields
  params.forEach(function(param) {
    const field = '#' + param;

    if ($._GET[ param ] !== undefined) {
      $(field).val( $._GET[param] );    // set it to the GET variable

      if ((param !== 'deckmain') && (param !== 'deckside')) {
        $(field).prop('disabled', disableEditing);  // disable all decklist fields that are in the URL
      }
    }
  });

  // load the logo
  if ($._GET['logo'] === undefined) { $._GET['logo'] = 'dcilogo'; } // if logo isn't specified, use the DCI logo

  // Load SCG logos
  const scglogos = ['FUTcreature', 'FUTland', 'FUTmultiple', 'FUTsorcery', 'starcitygames.com-logo-lores'];
  scglogos.forEach(function(logo) {
    const element = document.createElement('script');

    element.src = 'images/' + logo + '.js';
    element.type = 'text/javascript';
    element.id = 'logo';

    document.getElementsByTagName('head')[0].appendChild(element);
  });

  const logos = ['dcilogo', 'legion', 'gpsanantonio'];

  logos.forEach(function(logo) {
    if ($._GET['logo'] === logo) {
      const element = document.createElement('script');

      element.src = 'images/' + logo + '.js';
      element.type = 'text/javascript';
      element.id = 'logo';
      element.onload = function () { generateDecklistPDF(); };

      document.getElementsByTagName('head')[0].appendChild(element);
    }
  });

  // switch to the proper decksheet; doing it this way in case we ever support other formats
  if ($._GET['decksheet'] !== undefined) {
    $('#decksheet-' + $._GET['decksheet']).click();
  }

  // make the upload button visible, if uploadURL exists
  if ($._GET[ 'uploadURL' ] !== undefined) {
    $('#upload').css('display', 'inline-block');
  }
}
// Parse the GET attributes, locking out fields as needed
Parse the GET attributes, locking out fields as needed
Parse the GET attributes locking out fields as needed
function parseGET() {
  const disableEditing = $._GET['disableediting'] === 'true' ? true : false;
  const params = [
    'firstname',
    'lastname',
    'dcinumber',
    'event',
    'eventdate',
    'eventlocation',
    'deckname',
    'deckdesigner',
    'deckmain',
    'deckside'
  ];
  params.forEach(function(param) {
    const field = '#' + param;
    if ($._GET[ param ] !== undefined) {
      $(field).val( $._GET[param] );    
      if ((param !== 'deckmain') && (param !== 'deckside')) {
        $(field).prop('disabled', disableEditing);  
      }
    }
  });
  if ($._GET['logo'] === undefined) { $._GET['logo'] = 'dcilogo'; } 
  const scglogos = ['FUTcreature', 'FUTland', 'FUTmultiple', 'FUTsorcery', 'starcitygames.com-logo-lores'];
  scglogos.forEach(function(logo) {
    const element = document.createElement('script');
    element.src = 'images/' + logo + '.js';
    element.type = 'text/javascript';
    element.id = 'logo';
    document.getElementsByTagName('head')[0].appendChild(element);
  });
  const logos = ['dcilogo', 'legion', 'gpsanantonio'];
  logos.forEach(function(logo) {
    if ($._GET['logo'] === logo) {
      const element = document.createElement('script');
      element.src = 'images/' + logo + '.js';
      element.type = 'text/javascript';
      element.id = 'logo';
      element.onload = function () { generateDecklistPDF(); };
      document.getElementsByTagName('head')[0].appendChild(element);
    }
  });
  if ($._GET['decksheet'] !== undefined) {
    $('#decksheet-' + $._GET['decksheet']).click();
  }
  if ($._GET[ 'uploadURL' ] !== undefined) {
    $('#upload').css('display', 'inline-block');
  }
}
function parseGET ( ) { const disableEditing = $ . _GET [ 'disableediting' ] === 'true' ? true : false ; const params = [ 'firstname' , 'lastname' , 'dcinumber' , 'event' , 'eventdate' , 'eventlocation' , 'deckname' , 'deckdesigner' , 'deckmain' , 'deckside' ] ; params . forEach ( function ( param ) { const field = '#' + param ; if ( $ . _GET [ param ] !== undefined ) { $ ( field ) . val ( $ . _GET [ param ] ) ; if ( ( param !== 'deckmain' ) && ( param !== 'deckside' ) ) { $ ( field ) . prop ( 'disabled' , disableEditing ) ; } } } ) ; if ( $ . _GET [ 'logo' ] === undefined ) { $ . _GET [ 'logo' ] = 'dcilogo' ; } const scglogos = [ 'FUTcreature' , 'FUTland' , 'FUTmultiple' , 'FUTsorcery' , 'starcitygames.com-logo-lores' ] ; scglogos . forEach ( function ( logo ) { const element = document . createElement ( 'script' ) ; element . src = 'images/' + logo + '.js' ; element . type = 'text/javascript' ; element . id = 'logo' ; document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( element ) ; } ) ; const logos = [ 'dcilogo' , 'legion' , 'gpsanantonio' ] ; logos . forEach ( function ( logo ) { if ( $ . _GET [ 'logo' ] === logo ) { const element = document . createElement ( 'script' ) ; element . src = 'images/' + logo + '.js' ; element . type = 'text/javascript' ; element . id = 'logo' ; element . onload = function ( ) { generateDecklistPDF ( ) ; } ; document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( element ) ; } } ) ; if ( $ . _GET [ 'decksheet' ] !== undefined ) { $ ( '#decksheet-' + $ . _GET [ 'decksheet' ] ) . click ( ) ; } if ( $ . _GET [ 'uploadURL' ] !== undefined ) { $ ( '#upload' ) . css ( 'display' , 'inline-block' ) ; } }
Parse the GET attributes, locking out fields as needed
Parse the GET attributes locking out fields as needed
// disable the fields below if the GET parameter `disablefields` is set to true // check for event, eventdate, or eventlocation and lock down those input fields // set it to the GET variable // disable all decklist fields that are in the URL // load the logo // if logo isn't specified, use the DCI logo // Load SCG logos // switch to the proper decksheet; doing it this way in case we ever support other formats // make the upload button visible, if uploadURL exists