B2G/gaia/apps/system/js/modal_dialog.js
// Show relative dialog and set message/input value well
Show relative dialog and set message/input value well
Show relative dialog and set message / input value well
function md_show(target, origin) {
    if (!(origin in this.currentEvents))
      return;
    var _ = navigator.mozL10n.get;
    this.currentOrigin = origin;
    var evt = this.eventForCurrentOrigin;
    var message = evt.detail.message || '';
    var elements = this.elements;
    this.screen.classList.add('modal-dialog');
    function escapeHTML(str) {
      var stringHTML = str;
      stringHTML = stringHTML.replace(/\</g, '&#60;');
      stringHTML = stringHTML.replace(/(\r\n|\n|\r)/gm, '<br/>');
      stringHTML = stringHTML.replace(/\s\s/g, ' &nbsp;');
      return stringHTML.replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
    }
    var type = evt.detail.promptType || evt.detail.type;
    if (type !== 'selectone') {
      message = escapeHTML(message);
    }
    switch (type) {
      case 'alert':
        elements.alertMessage.innerHTML = message;
        elements.alert.classList.add('visible');
        this.setTitle('alert', '');
        elements.alertOk.textContent = evt.yesText ? evt.yesText : _('ok');
        elements.alert.focus();
        break;
      case 'prompt':
        elements.prompt.classList.add('visible');
        elements.promptInput.value = evt.detail.initialValue;
        elements.promptMessage.innerHTML = message;
        this.setTitle('prompt', '');
        elements.promptOk.textContent = evt.yesText ? evt.yesText : _('ok');
        elements.promptCancel.textContent = evt.noText ?
          evt.noText : _('cancel');
        elements.prompt.focus();
        break;
      case 'confirm':
        elements.confirm.classList.add('visible');
        elements.confirmMessage.innerHTML = message;
        this.setTitle('confirm', '');
        elements.confirmOk.textContent = evt.yesText ? evt.yesText : _('ok');
        elements.confirmCancel.textContent = evt.noText ?
          evt.noText : _('cancel');
        elements.confirm.focus();
        break;
      case 'selectone':
        this.buildSelectOneDialog(message);
        elements.selectOne.classList.add('visible');
        elements.selectOne.focus();
        break;
    }
    this.setHeight(window.innerHeight - StatusBar.height);
  }
function md_show ( target , origin ) { if ( ! ( origin in this . currentEvents ) ) return ; var _ = navigator . mozL10n . get ; this . currentOrigin = origin ; var evt = this . eventForCurrentOrigin ; var message = evt . detail . message || '' ; var elements = this . elements ; this . screen . classList . add ( 'modal-dialog' ) ; function escapeHTML ( str ) { var stringHTML = str ; stringHTML = stringHTML . replace ( / \< / g , '&#60;' ) ; stringHTML = stringHTML . replace ( / (\r\n|\n|\r) / gm , '<br/>' ) ; stringHTML = stringHTML . replace ( / \s\s / g , ' &nbsp;' ) ; return stringHTML . replace ( / " / g , '&quot;' ) . replace ( / ' / g , '&#x27;' ) ; } var type = evt . detail . promptType || evt . detail . type ; if ( type !== 'selectone' ) { message = escapeHTML ( message ) ; } switch ( type ) { case 'alert' : elements . alertMessage . innerHTML = message ; elements . alert . classList . add ( 'visible' ) ; this . setTitle ( 'alert' , '' ) ; elements . alertOk . textContent = evt . yesText ? evt . yesText : _ ( 'ok' ) ; elements . alert . focus ( ) ; break ; case 'prompt' : elements . prompt . classList . add ( 'visible' ) ; elements . promptInput . value = evt . detail . initialValue ; elements . promptMessage . innerHTML = message ; this . setTitle ( 'prompt' , '' ) ; elements . promptOk . textContent = evt . yesText ? evt . yesText : _ ( 'ok' ) ; elements . promptCancel . textContent = evt . noText ? evt . noText : _ ( 'cancel' ) ; elements . prompt . focus ( ) ; break ; case 'confirm' : elements . confirm . classList . add ( 'visible' ) ; elements . confirmMessage . innerHTML = message ; this . setTitle ( 'confirm' , '' ) ; elements . confirmOk . textContent = evt . yesText ? evt . yesText : _ ( 'ok' ) ; elements . confirmCancel . textContent = evt . noText ? evt . noText : _ ( 'cancel' ) ; elements . confirm . focus ( ) ; break ; case 'selectone' : this . buildSelectOneDialog ( message ) ; elements . selectOne . classList . add ( 'visible' ) ; elements . selectOne . focus ( ) ; break ; } this . setHeight ( window . innerHeight - StatusBar . height ) ; }
Show relative dialog and set message/input value well
Show relative dialog and set message / input value well