Opens a login popup using NW.js's API version 0.12 or lower

@private
@method popupNWLogin
@param {Array|Object} params
769281
function popupNWLogin(params) {
	var url = core.REDIRECT_URL + 'oauth2/authorize?' + util.param(params);

  var win = nwGUI.Window.open(url, {
    title: 'Login with TwitchTV',
    width: WIDTH,
    height: HEIGHT,
    toolbar: false,
    show: false,
    resizable: true
  });

  win.on('loaded', function() {
    var w = win.window;
    if (w.location.hostname == 'api.twitch.tv' && w.location.pathname == '/kraken/') {
      core.setSession(util.parseFragment(w.location.hash));

      auth.getStatus(function(err, status) {
        if (status.authenticated) {
          core.events.emit('auth.login', status);
        }
      });

      win.close();
    }
    else {
      win.show();
      win.focus();
    }
  });
}
150600
function onStartAuthClick(e) {
    var elmBody = document.body;

    platform.isAuthenticated().catch(function (err) {
        // methods are registered globally for the popup to call on this main window
      window.onAuthCompleted = function() {
        // the platform SDK instance from the popup has
        // received a new auth token and saved it to the store.
        // Let's retrieve it for this instance.
        platform.refreshAuthFromStore();

        elmBody.innerHTML = compiledSuccess();
      };
      window.onAuthError = function() {
        elmBody.innerHTML = compiledError();
      };

      openPopup();
    });
  }
1342348
function open(selector) {
            if (p["--debug"] && host.runtime == host.RUNTIME_NODEJS) {
                return debug(p);
            }
            if (p["--ui"] && !ui) {
                if (!nw) {
                    allume.update(allume.STATUS_ERROR, MSG_UI_UNAVAILABLE);
                    return;
                }

                // spawn nw.js process for allume with parameters
                var findpath = nw.findpath;
                childProcess = childProcess || require("child_process");
                path = path || require("path");

                var PATH_NW = findpath();
                var PATH_APP = path.join(__dirname, "..");
                var PATH_CWD = process.cwd();
                var env = Object.create(process.env);
                env.PWD = process.cwd();

                process.argv.splice(1, 1);
                process.argv[0] = PATH_APP;
                for (var a in process.argv) {
                    process.argv[a] = process.argv[a].replace(/"/g, "\"");
                }

                var ls = childProcess.spawn(PATH_NW, process.argv, {"cwd": PATH_CWD, "env" : env});

                ls.stdout.on("data", function(data) {
                    console.log(data.toString().trim());
                });

                ls.stderr.on("data", function(data) {
                    console.error(data.toString().trim());
                });

                return;
            }

            var requests = [];
            var request = selector;
            if (p["--config"]) {
                var json;
                try {
                    json = JSON.parse(p["--config"].json);
                }
                catch(e) {
                    var e = new Error("Make sure the data you pass to the --config switch is valid JSON data.");
                    e.name = "error-invalid-configuration";
                    if (typeof document !== "undefined" && firstOpen) {
                        allume.update(e);
                    }
                    else {
                        console.error(e);
                    }
                    firstOpen = false;
                    return;
                }
                request = { "package" : selector, "configuration" : json };
            }
            requests.push(request);

            if (requests) {
                using.apply(using, requests).then(function () {
                    if (firstOpen) {
                        allume.hide();
                        firstOpen = false;
                    }
                }, function (loader) {
                    usingFailed(loader);
                    var e = new Error(err);
                    e.name = errName;
                    if (typeof document !== "undefined" && firstOpen) {
                        allume.update(e);
                        firstOpen = false;
                    }
                    else {
                        console.error(e);
                    }
                });
            }
        }
1297980
function sendHelperMessage(msg) {
  var port = chrome.runtime.connect({ name: 'popup' });
  port.postMessage(msg);
  port.onMessage.addListener(function (response) {
    console.log('Got response message: ', response);
  });
}
1077377
public void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams) {
        for (String authName : authNames) {
            Authentication auth = authentications.get(authName);
            if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
            auth.applyToParams(queryParams, headerParams);
        }
    }
654168
function pongOnTheFlyOpenDlg(id, modalName, resourceURL, params) {
  log( "PoNG-OnTheFly", "Open " + id + " " + modalName + " " + resourceURL );
  var viewCfg = getViewConfig( id );
  log( "PoNG-OnTheFly", "GET " + resourceURL + '/' + viewCfg.type );
  $.getJSON( resourceURL + '/' + viewCfg.type, function(pluginConfig) {
    log( "PoNG-OnTheFly", "Config loaded from " + resourceURL + '/'
        + viewCfg.type );
    $( '#' + id + modalName + 'Dialog' ).dialog( 'open' );
    $( '#' + id + modalName + 'DialogConfig' ).val(
        JSON.stringify( pluginConfig, null, "  " ) );
  } );
  if ( params && params.assistUrl ) {
    $.get( 
        params.assistUrl, 
        function(assistTxt) {
          log( "PoNG-OnTheFly", "Assistance loaded from " + params.assistUrl );
          $( '#' + id + modalName + 'DialogAssist' ).val( assistTxt );
        } 
      ).fail(
          function() { publishEvent( 'feedback', {'text': 'Can not load assistance ' } ) }
      );
  }
}
1294874
function loginP(authParams) {
  return new Promise((resolve, reject) =>
    this.login(authParams, (success, data) => {
      if (success) resolve(data);
      else reject(new Error(data));
    }));
}
185298
function (methodInvocation, options) {
  for (var i = 0; i < loginHandlers.length; ++i) {
    var handler = loginHandlers[i];

    var result = tryLoginMethod(
      handler.name,
      function () {
        return handler.handler.call(methodInvocation, options);
      }
    );

    if (result)
      return result;
    else if (result !== undefined)
      throw new Meteor.Error(400, "A login handler should return a result or undefined");
  }

  return {
    type: null,
    error: new Meteor.Error(400, "Unrecognized options for login request")
  };
}
1348560
function(params){
        var allDataMatches = true;
        for(var k = 0; k < query[params.name].length; k++){
          var data = query[params.name][k];
          var operator = data.operator;
          var value = data.value;
          var field = data.field;
          var matches;
          
          if( operator != null && value != null ){
            
            var fieldVal = params.fieldValue(field);
            var fieldStr = !$$.is.string(fieldVal) && !$$.is.number(fieldVal) ? '' : '' + fieldVal;
            var valStr = '' + value;
            
            var caseInsensitive = false;
            if( operator.charAt(0) == '@' ){
              fieldStr = fieldStr.toLowerCase();
              valStr = valStr.toLowerCase();
              
              operator = operator.substring(1);
              caseInsensitive = true;
            }
            
            // if we're doing a case insensitive comparison, then we're using a STRING comparison
            // even if we're comparing numbers
            if( caseInsensitive ){
              value = valStr.toLowerCase();
              fieldVal = fieldStr.toLowerCase();
            }

            switch(operator){
            case '*=':
              matches = fieldStr.search(valStr) >= 0;
              break;
            case '$=':
              matches = new RegExp(valStr + '$').exec(fieldStr) != null;
              break;
            case '^=':
              matches = new RegExp('^' + valStr).exec(fieldStr) != null;
              break;
            case '=':
              matches = fieldVal === value;
              break;
            case '!=':
              matches = fieldVal !== value;
              break;
            case '>':
              matches = fieldVal > value;
              break;
            case '>=':
              matches = fieldVal >= value;
              break;
            case '<':
              matches = fieldVal < value;
              break;
            case '<=':
              matches = fieldVal <= value;
              break;
            default:
              matches = false;
              break;
              
            }
          } else if( operator != null ){
            switch(operator){
            case '?':
              matches = params.fieldTruthy(field);
              break;
            case '!':
              matches = !params.fieldTruthy(field);
              break;
            case '^':
              matches = params.fieldUndefined(field);
              break;
            }
          } else {   
            matches = !params.fieldUndefined(field);
          }
          
          if( !matches ){
            allDataMatches = false;
            break;
          }
        } // for
        
        return allDataMatches;
      }
868986
function createNewDialog() {
  var usersIds = [];
  var usersNames = [];

  $('#users_list .users_form.active').each(function(index) {
    usersIds[index] = $(this).attr('id');
    usersNames[index] = $(this).text();
  });

  $("#add_new_dialog").modal("hide");
  $('#add_new_dialog .progress').show();

  var dialogName;
  var dialogOccupants;
  var dialogType;

  if (usersIds.length > 1) {
    if (usersNames.indexOf(currentUser.login) > -1) {
      dialogName = usersNames.join(', ');
    }else{
      dialogName = currentUser.login + ', ' + usersNames.join(', ');
    }
    dialogOccupants = usersIds;
    dialogType = 2;
  } else {
    dialogOccupants = usersIds;
    dialogType = 3;
  }

  var params = {
    type: dialogType,
    occupants_ids: dialogOccupants,
    name: dialogName
  };

  // create a dialog
  //
  console.log("Creating a dialog with params: " + JSON.stringify(params));

  QB.chat.dialog.create(params, function(err, createdDialog) {
    if (err) {
      console.log(err);
    } else {
      console.log("Dialog " + createdDialog._id + " created with users: " + dialogOccupants);

      // save dialog to local storage
      var dialogId = createdDialog._id;
      dialogs[dialogId] = createdDialog;

      currentDialog = createdDialog;

      joinToNewDialogAndShow(createdDialog);

      notifyOccupants(createdDialog.occupants_ids, createdDialog._id, 1);

      triggerDialog(createdDialog._id);

      $('a.users_form').removeClass('active');
    }
  });
}
34503
function onPopupRedirectProviderClick(event) {
  var providerId = $(event.currentTarget).data('provider');
  var provider = null;
  switch (providerId) {
    case 'google.com':
      provider = new firebase.auth.GoogleAuthProvider();
      break;
    case 'facebook.com':
      provider = new firebase.auth.FacebookAuthProvider();
      break;
    case 'github.com':
      provider = new firebase.auth.GithubAuthProvider();
      break;
    case 'twitter.com':
      provider = new firebase.auth.TwitterAuthProvider();
      break;
    default:
      return;
  }
  signInWithPopupRedirect(provider);
}
998770
function(params) {
			$.extend(globalConfig, params || {});

			this.startAll(document.documentElement);

			this.fire('init');
			initialized = true;
		}
353283
function (callback) {
      var _this = this;

      var guid = _emberMetalUtils.guidFor(this);

      _emberViewsSystemJquery.default(window).on('popstate.ember-location-' + guid, function (e) {
        // Ignore initial page load popstate event in Chrome
        if (!popstateFired) {
          popstateFired = true;
          if (_this.getURL() === _this._previousURL) {
            return;
          }
        }
        callback(_this.getURL());
      });
    }
319011
function showNewDialogPopup() {
    $("#add_new_dialog").modal("show");
    $('#add_new_dialog .progress').hide();

    // get and show users
    retrieveUsersForDialogCreation(function(users) {
      if(users === null || users.length === 0){
        return;
      }

      clearUsers();

      $.each(users, function(index, item){
        if(this.user.id != currentUser.id){ // do not show current user
          showUser(this.user.full_name, this.user.id);
        }
      });
    });
}
994531
void openPopup() {

        try {
            if (m_popup == null) {
                m_popup = new CmsPopup(Messages.get().key(Messages.GUI_LOCATION_DIALOG_TITLE_0), hasMap() ? 1020 : 420);
                m_popupContent = new CmsLocationPopupContent(
                    this,
                    new CmsLocationSuggestOracle(this),
                    getModeItems(),
                    getTypeItems(),
                    getZoomItems());
                setFieldVisibility();
                m_popup.setMainContent(m_popupContent);
                m_popup.addDialogClose(null);
            }
            m_popup.center();
            m_popup.show();
            initialize();
            updateForm();
        } catch (Throwable t) {
            CmsErrorDialog.handleException(t);
        }
    }
234125
function setParameters(params) {
  var modal = _getModal$getInput$setFocusStyle.getModal();

  var $title = modal.querySelector('h2');
  var $text = modal.querySelector('p');
  var $cancelBtn = modal.querySelector('button.cancel');
  var $confirmBtn = modal.querySelector('button.confirm');

  /*
   * Title
   */
  $title.innerHTML = params.html ? params.title : _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.title).split('\n').join('<br>');

  /*
   * Text
   */
  $text.innerHTML = params.html ? params.text : _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.text || '').split('\n').join('<br>');
  if (params.text) _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.show($text);

  /*
   * Custom class
   */
  if (params.customClass) {
    _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass(modal, params.customClass);
    modal.setAttribute('data-custom-class', params.customClass);
  } else {
    // Find previously set classes and remove them
    var customClass = modal.getAttribute('data-custom-class');
    _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.removeClass(modal, customClass);
    modal.setAttribute('data-custom-class', '');
  }

  /*
   * Icon
   */
  _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.hide(modal.querySelectorAll('.sa-icon'));

  if (params.type && !_isIE8.isIE8()) {
    var _ret = (function () {

      var validType = false;

      for (var i = 0; i < alertTypes.length; i++) {
        if (params.type === alertTypes[i]) {
          validType = true;
          break;
        }
      }

      if (!validType) {
        logStr('Unknown alert type: ' + params.type);
        return {
          v: false
        };
      }

      var typesWithIcons = ['success', 'error', 'warning', 'info'];
      var $icon = undefined;

      if (typesWithIcons.indexOf(params.type) !== -1) {
        $icon = modal.querySelector('.sa-icon.' + 'sa-' + params.type);
        _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.show($icon);
      }

      var $input = _getModal$getInput$setFocusStyle.getInput();

      // Animate icon
      switch (params.type) {

        case 'success':
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon, 'animate');
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-tip'), 'animateSuccessTip');
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-long'), 'animateSuccessLong');
          break;

        case 'error':
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon, 'animateErrorIcon');
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-x-mark'), 'animateXMark');
          break;

        case 'warning':
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon, 'pulseWarning');
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-body'), 'pulseWarningIns');
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-dot'), 'pulseWarningIns');
          break;

        case 'input':
        case 'prompt':
          $input.setAttribute('type', params.inputType);
          $input.setAttribute('placeholder', params.inputPlaceholder);
          _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass(modal, 'show-input');
          setTimeout(function () {
            $input.focus();
            $input.addEventListener('keyup', swal.resetInputError);
          }, 400);
          break;
      }
    })();

    if (typeof _ret === 'object') {
      return _ret.v;
    }
  }

  /*
   * Custom image
   */
  if (params.imageUrl) {
    var $customIcon = modal.querySelector('.sa-icon.sa-custom');

    $customIcon.style.backgroundImage = 'url(' + params.imageUrl + ')';
    _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.show($customIcon);

    var _imgWidth = 80;
    var _imgHeight = 80;

    if (params.imageSize) {
      var dimensions = params.imageSize.toString().split('x');
      var imgWidth = dimensions[0];
      var imgHeight = dimensions[1];

      if (!imgWidth || !imgHeight) {
        logStr('Parameter imageSize expects value with format WIDTHxHEIGHT, got ' + params.imageSize);
      } else {
        _imgWidth = imgWidth;
        _imgHeight = imgHeight;
      }
    }

    $customIcon.setAttribute('style', $customIcon.getAttribute('style') + 'width:' + _imgWidth + 'px; height:' + _imgHeight + 'px');
  }

  /*
   * Show cancel button?
   */
  modal.setAttribute('data-has-cancel-button', params.showCancelButton);
  if (params.showCancelButton) {
    $cancelBtn.style.display = 'inline-block';
  } else {
    _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.hide($cancelBtn);
  }

  /*
   * Show confirm button?
   */
  modal.setAttribute('data-has-confirm-button', params.showConfirmButton);
  if (params.showConfirmButton) {
    $confirmBtn.style.display = 'inline-block';
  } else {
    _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.hide($confirmBtn);
  }

  /*
   * Custom text on cancel/confirm buttons
   */
  if (params.cancelButtonText) {
    $cancelBtn.innerHTML = _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.cancelButtonText);
  }
  if (params.confirmButtonText) {
    $confirmBtn.innerHTML = _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.confirmButtonText);
  }

  /*
   * Custom color on confirm button
   */
  if (params.confirmButtonColor) {
    // Set confirm button to selected background color
    $confirmBtn.style.backgroundColor = params.confirmButtonColor;

    // Set box-shadow to default focused button
    _getModal$getInput$setFocusStyle.setFocusStyle($confirmBtn, params.confirmButtonColor);
  }

  /*
   * Allow outside click
   */
  modal.setAttribute('data-allow-outside-click', params.allowOutsideClick);

  /*
   * Callback function
   */
  var hasDoneFunction = params.doneFunction ? true : false;
  modal.setAttribute('data-has-done-function', hasDoneFunction);

  /*
   * Animation
   */
  if (!params.animation) {
    modal.setAttribute('data-animation', 'none');
  } else if (typeof params.animation === 'string') {
    modal.setAttribute('data-animation', params.animation); // Custom animation
  } else {
    modal.setAttribute('data-animation', 'pop');
  }

  /*
   * Timer
   */
  modal.setAttribute('data-timer', params.timer);
}
163570
function login(){
    console.log('Login called');
    var username = document.getElementById('login-username').value;
    var password = document.getElementById('login-password').value;
// {username:username, password:password}
    grout.login('google').then(function (loginInfo){
      console.log('successful login:', loginInfo);
      setStatus();
    }, function (err){
      console.error('login() : Error logging in:', err);
    });
  }