{"action":"created","comment":{"url":"https://api.github.com/repos/limonte/sweetalert2/pulls/comments/64783256","id":64783256,"diff_hunk":"@@ -266,967 +266,1013 @@ var lastFocusedButton;\n \n // Reset the page to its previous state\n var resetPrevState = function() {\n-  var modal = getModal();\n-  window.onkeydown = previousWindowKeyDown;\n-  document.onclick = previousDocumentClick;\n-  if (previousActiveElement) {\n-    previousActiveElement.focus();\n-  }\n-  lastFocusedButton = undefined;\n-  clearTimeout(modal.timeout);\n-\n-  // Remove dynamically created media query\n-  var head = document.getElementsByTagName('head')[0];\n-  var mediaquery = document.getElementById(mediaqueryId);\n-  if (mediaquery) {\n-    head.removeChild(mediaquery);\n-  }\n+    var modal = getModal();\n+    window.onkeydown = previousWindowKeyDown;\n+    document.onclick = previousDocumentClick;\n+    if (previousActiveElement) {\n+        previousActiveElement.focus();\n+    }\n+    lastFocusedButton = undefined;\n+    clearTimeout(modal.timeout);\n+\n+    // Remove dynamically created media query\n+    var head = document.getElementsByTagName('head')[0];\n+    var mediaquery = document.getElementById(mediaqueryId);\n+    if (mediaquery) {\n+        head.removeChild(mediaquery);\n+    }\n };\n \n /*\n  * Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color)\n  */\n var colorLuminance = function(hex, lum) {\n-  // Validate hex string\n-  hex = String(hex).replace(/[^0-9a-f]/gi, '');\n-  if (hex.length < 6) {\n-    hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];\n-  }\n-  lum = lum || 0;\n-\n-  // Convert to decimal and change luminosity\n-  var rgb = '#';\n-  for (var i = 0; i < 3; i++) {\n-    var c = parseInt(hex.substr(i * 2, 2), 16);\n-    c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);\n-    rgb += ('00' + c).substr(c.length);\n-  }\n-\n-  return rgb;\n+    // Validate hex string\n+    hex = String(hex).replace(/[^0-9a-f]/gi, '');\n+    if (hex.length < 6) {\n+        hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];\n+    }\n+    lum = lum || 0;\n+\n+    // Convert to decimal and change luminosity\n+    var rgb = '#';\n+    for (var i = 0; i < 3; i++) {\n+        var c = parseInt(hex.substr(i * 2, 2), 16);\n+        c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);\n+        rgb += ('00' + c).substr(c.length);\n+    }\n+\n+    return rgb;\n };\n \n /*\n  * Set type, text and actions on modal\n  */\n var setParameters = function(params) {\n-  var i;\n-  var modal = getModal();\n-\n-  // set modal width, padding and margin-left\n-  modal.style.width = params.width + 'px';\n-  modal.style.padding = params.padding + 'px';\n-  modal.style.marginLeft = -params.width / 2 + 'px';\n-  modal.style.background = params.background;\n-\n-  // add dynamic media query css\n-  var head = document.getElementsByTagName('head')[0];\n-  var cssNode = document.createElement('style');\n-  cssNode.type = 'text/css';\n-  cssNode.id = mediaqueryId;\n-  var margin = 5; // %\n-  var mediaQueryMaxWidth = params.width + parseInt(params.width * (margin/100) * 2, 10);\n-  cssNode.innerHTML =\n-    '@media screen and (max-width: ' + mediaQueryMaxWidth + 'px) {' +\n-      '.' + swalClasses.modal + ' {' +\n+    var i;\n+    var modal = getModal();\n+\n+    // set modal width, padding and margin-left\n+    modal.style.width = params.width + 'px';\n+    modal.style.padding = params.padding + 'px';\n+    modal.style.marginLeft = -params.width / 2 + 'px';\n+    modal.style.background = params.background;\n+\n+    // add dynamic media query css\n+    var head = document.getElementsByTagName('head')[0];\n+    var cssNode = document.createElement('style');\n+    cssNode.type = 'text/css';\n+    cssNode.id = mediaqueryId;\n+    var margin = 5; // %\n+    var mediaQueryMaxWidth = params.width + parseInt(params.width * (margin / 100) * 2, 10);\n+    cssNode.innerHTML =\n+        '@media screen and (max-width: ' + mediaQueryMaxWidth + 'px) {' +\n+        '.' + swalClasses.modal + ' {' +\n         'width: auto !important;' +\n         'left: ' + margin + '% !important;' +\n         'right: ' + margin + '% !important;' +\n         'margin-left: 0 !important;' +\n-      '}' +\n-    '}';\n-  head.appendChild(cssNode);\n-\n-  var $title = modal.querySelector('h2');\n-  var $content = modal.querySelector('.' + swalClasses.content);\n-  var $confirmBtn = modal.querySelector('button.' + swalClasses.confirm);\n-  var $cancelBtn = modal.querySelector('button.' + swalClasses.cancel);\n-  var $spacer = modal.querySelector('.' + swalClasses.spacer);\n-  var $closeButton = modal.querySelector('.' + swalClasses.close);\n-\n-  // Title\n-  $title.innerHTML = params.title.split('\\n').join('<br>');\n-\n-  // Content\n-  if (params.text || params.html) {\n-    if (typeof params.html === 'object') {\n-      $content.innerHTML = '';\n-      if (0 in params.html) {\n-        for (i = 0; i in params.html; i++) {\n-          $content.appendChild(params.html[i]);\n+        '}' +\n+        'html,body {position: relative; height: 100%; overflow: hidden;}' +\n+        '}';\n+    head.appendChild(cssNode);\n+\n+    var $title = modal.querySelector('h2');\n+    var $content = modal.querySelector('.' + swalClasses.content);\n+    var $confirmBtn = modal.querySelector('button.' + swalClasses.confirm);\n+    var $cancelBtn = modal.querySelector('button.' + swalClasses.cancel);\n+    var $spacer = modal.querySelector('.' + swalClasses.spacer);\n+    var $closeButton = modal.querySelector('.' + swalClasses.close);\n+\n+    // Title\n+    $title.innerHTML = params.title.split('\\n').join('<br>');\n+\n+    // Content\n+    if (params.text || params.html) {\n+        if (typeof params.html === 'object') {\n+            $content.innerHTML = '';\n+            if (0 in params.html) {\n+                for (i = 0; i in params.html; i++) {\n+                    $content.appendChild(params.html[i]);\n+                }\n+            } else {\n+                $content.appendChild(params.html);\n+            }\n+        } else {\n+            $content.innerHTML = params.html || (params.text.split('\\n').join('<br>'));\n         }\n-      } else {\n-        $content.appendChild(params.html);\n-      }\n+        show($content);\n     } else {\n-      $content.innerHTML = params.html || (params.text.split('\\n').join('<br>'));\n+        hide($content);\n     }\n-    show($content);\n-  } else {\n-    hide($content);\n-  }\n-\n-  // Close button\n-  if (params.showCloseButton) {\n-    show($closeButton);\n-  } else {\n-    hide($closeButton);\n-  }\n-\n-  // Custom Class\n-  modal.className = swalClasses.modal;\n-  if (params.customClass) {\n-    addClass(modal, params.customClass);\n-  }\n-\n-  // Icon\n-  hide(modal.querySelectorAll('.' + swalClasses.icon));\n-  if (params.type) {\n-    var validType = false;\n-    for (var iconType in swalClasses.iconTypes) {\n-      if (params.type === iconType) {\n-        validType = true;\n-        break;\n-      }\n+\n+    // Close button\n+    if (params.showCloseButton) {\n+        show($closeButton);\n+    } else {\n+        hide($closeButton);\n     }\n-    if (!validType) {\n-      console.error('Unknown alert type: ' + params.type);\n-      return false;\n+\n+    // Custom Class\n+    modal.className = swalClasses.modal;\n+    if (params.customClass) {\n+        addClass(modal, params.customClass);\n     }\n-    var $icon = modal.querySelector('.' + swalClasses.icon + '.' + swalClasses.iconTypes[params.type]);\n-    show($icon);\n-\n-    // Animate icon\n-    switch (params.type) {\n-      case 'success':\n-        addClass($icon, 'animate');\n-        addClass($icon.querySelector('.tip'), 'animate-success-tip');\n-        addClass($icon.querySelector('.long'), 'animate-success-long');\n-        break;\n-      case 'error':\n-        addClass($icon, 'animate-error-icon');\n-        addClass($icon.querySelector('.x-mark'), 'animate-x-mark');\n-        break;\n-      case 'warning':\n-        addClass($icon, 'pulse-warning');\n-        break;\n-      default:\n-        break;\n+\n+    // Icon\n+    hide(modal.querySelectorAll('.' + swalClasses.icon));\n+    if (params.type) {\n+        var validType = false;\n+        for (var iconType in swalClasses.iconTypes) {\n+            if (params.type === iconType) {\n+                validType = true;\n+                break;\n+            }\n+        }\n+        if (!validType) {\n+            console.error('Unknown alert type: ' + params.type);\n+            return false;\n+        }\n+        var $icon = modal.querySelector('.' + swalClasses.icon + '.' + swalClasses.iconTypes[params.type]);\n+        show($icon);\n+\n+        // Animate icon\n+        switch (params.type) {\n+            case 'success':\n+                addClass($icon, 'animate');\n+                addClass($icon.querySelector('.tip'), 'animate-success-tip');\n+                addClass($icon.querySelector('.long'), 'animate-success-long');\n+                break;\n+            case 'error':\n+                addClass($icon, 'animate-error-icon');\n+                addClass($icon.querySelector('.x-mark'), 'animate-x-mark');\n+                break;\n+            case 'warning':\n+                addClass($icon, 'pulse-warning');\n+                break;\n+            default:\n+                break;\n+        }\n+\n+    }\n+\n+    // Custom image\n+    var $customImage = modal.querySelector('.' + swalClasses.image);\n+    if (params.imageUrl) {\n+        $customImage.setAttribute('src', params.imageUrl);\n+        show($customImage);\n+\n+        if (params.imageWidth) {\n+            $customImage.setAttribute('width', params.imageWidth);\n+        }\n+\n+        if (params.imageHeight) {\n+            $customImage.setAttribute('height', params.imageHeight);\n+        }\n+\n+        if (params.imageClass) {\n+            addClass($customImage, params.imageClass);\n+        }\n+    } else {\n+        hide($customImage);\n     }\n \n-  }\n+    // input, select\n+    var inputTypes = ['input', 'select', 'radio', 'checkbox', 'textarea'];\n+    var input;\n+    for (i = 0; i < inputTypes.length; i++) {\n+        var inputClass = swalClasses[inputTypes[i]];\n+        input = getChildByClass(modal, inputClass);\n+\n+        // set attributes\n+        while (input.attributes.length > 0) {\n+            input.removeAttribute(input.attributes[0].name);\n+        }\n+        for (var attr in params.inputAttributes) {\n+            input.setAttribute(attr, params.inputAttributes[attr]);\n+        }\n \n-  // Custom image\n-  var $customImage = modal.querySelector('.' + swalClasses.image);\n-  if (params.imageUrl) {\n-    $customImage.setAttribute('src', params.imageUrl);\n-    show($customImage);\n+        // set class\n+        input.className = inputClass;\n+        if (params.inputClass) {\n+            addClass(input, params.inputClass);\n+        }\n \n-    if (params.imageWidth) {\n-      $customImage.setAttribute('width', params.imageWidth);\n+        _hide(input);\n+    }\n+    switch (params.input) {\n+        case 'text':\n+        case 'email':\n+        case 'password':\n+            input = getChildByClass(modal, swalClasses.input);\n+            input.value = params.inputValue;\n+            input.placeholder = params.inputPlaceholder;\n+            input.type = params.input;\n+            _show(input);\n+            break;\n+        case 'select':\n+            var select = getChildByClass(modal, swalClasses.select);\n+            select.innerHTML = '';\n+            if (params.inputPlaceholder) {\n+                var placeholder = document.createElement('option');\n+                placeholder.innerHTML = params.inputPlaceholder;\n+                placeholder.value = '';\n+                placeholder.disabled = true;\n+                placeholder.selected = true;\n+                select.appendChild(placeholder);\n+            }\n+            for (var optionValue in params.inputOptions) {\n+                var option = document.createElement('option');\n+                option.value = optionValue;\n+                option.innerHTML = params.inputOptions[optionValue];\n+                if (params.inputValue === optionValue) {\n+                    option.selected = true;\n+                }\n+                select.appendChild(option);\n+            }\n+            _show(select);\n+            break;\n+        case 'radio':\n+            var radio = getChildByClass(modal, swalClasses.radio);\n+            radio.innerHTML = '';\n+            for (var radioValue in params.inputOptions) {\n+                var id = 1;\n+                var radioInput = document.createElement('input');\n+                var radioLabel = document.createElement('label');\n+                var radioLabelSpan = document.createElement('span');\n+                radioInput.type = 'radio';\n+                radioInput.name = swalClasses.radio;\n+                radioInput.value = radioValue;\n+                radioInput.id = swalClasses.radio + '-' + (id++);\n+                if (params.inputValue === radioValue) {\n+                    radioInput.checked = true;\n+                }\n+                radioLabelSpan.innerHTML = params.inputOptions[radioValue];\n+                radioLabel.appendChild(radioInput);\n+                radioLabel.appendChild(radioLabelSpan);\n+                radioLabel.for = radioInput.id;\n+                radio.appendChild(radioLabel);\n+            }\n+            _show(radio);\n+            break;\n+        case 'checkbox':\n+            var checkbox = getChildByClass(modal, swalClasses.checkbox);\n+            var checkboxInput = modal.querySelector('#' + swalClasses.checkbox);\n+            checkboxInput.value = 1;\n+            checkboxInput.checked = Boolean(params.inputValue);\n+            var label = checkbox.getElementsByTagName('span');\n+            if (label.length) {\n+                checkbox.removeChild(label[0]);\n+            }\n+            label = document.createElement('span');\n+            label.innerHTML = params.inputPlaceholder;\n+            checkbox.appendChild(label);\n+            _show(checkbox);\n+            break;\n+        case 'textarea':\n+            var textarea = getChildByClass(modal, swalClasses.textarea);\n+            textarea.value = params.inputValue;\n+            textarea.placeholder = params.inputPlaceholder;\n+            _show(textarea);\n+            break;\n+        case null:\n+            break;\n+        default:\n+            console.error('Unexpected type of input! Expected \"text\" or \"email\" or \"password\", \"select\", \"checkbox\" or \"textarea\", got ' + typeof arguments[0]);\n+            break;\n     }\n \n-    if (params.imageHeight) {\n-      $customImage.setAttribute('height', params.imageHeight);\n+    // Cancel button\n+    if (params.showCancelButton) {\n+        $cancelBtn.style.display = 'inline-block';\n+    } else {\n+        hide($cancelBtn);\n     }\n \n-    if (params.imageClass) {\n-      addClass($customImage, params.imageClass);\n+    // Confirm button\n+    if (params.showConfirmButton) {\n+        removeStyleProperty($confirmBtn, 'display');\n+    } else {\n+        hide($confirmBtn);\n     }\n-  } else {\n-    hide($customImage);\n-  }\n-\n-  // input, select\n-  var inputTypes = ['input', 'select', 'radio', 'checkbox', 'textarea'];\n-  var input;\n-  for (i = 0; i < inputTypes.length; i++) {\n-    var inputClass = swalClasses[inputTypes[i]];\n-    input = getChildByClass(modal, inputClass);\n-\n-    // set attributes\n-    while (input.attributes.length > 0) {\n-      input.removeAttribute(input.attributes[0].name);\n+\n+    // Buttons spacer\n+    if (!params.showConfirmButton && !params.showCancelButton) {\n+        hide($spacer);\n+    } else {\n+        show($spacer);\n     }\n-    for (var attr in params.inputAttributes) {\n-      input.setAttribute(attr, params.inputAttributes[attr]);\n+\n+    // Edit text on cancel and confirm buttons\n+    $confirmBtn.innerHTML = params.confirmButtonText;\n+    $cancelBtn.innerHTML = params.cancelButtonText;\n+\n+    // Set buttons to selected background colors\n+    if (params.buttonsStyling) {\n+        $confirmBtn.style.backgroundColor = params.confirmButtonColor;\n+        $cancelBtn.style.backgroundColor = params.cancelButtonColor;\n     }\n \n-    // set class\n-    input.className = inputClass;\n-    if (params.inputClass) {\n-      addClass(input, params.inputClass);\n+    // Add buttons custom classes\n+    $confirmBtn.className = swalClasses.confirm;\n+    addClass($confirmBtn, params.confirmButtonClass);\n+    $cancelBtn.className = swalClasses.cancel;\n+    addClass($cancelBtn, params.cancelButtonClass);\n+\n+    // Buttons styling\n+    if (params.buttonsStyling) {\n+        addClass($confirmBtn, 'styled');\n+        addClass($cancelBtn, 'styled');\n+    } else {\n+        removeClass($confirmBtn, 'styled');\n+        removeClass($cancelBtn, 'styled');\n+\n+        $confirmBtn.style.backgroundColor = $confirmBtn.style.borderLeftColor = $confirmBtn.style.borderRightColor = '';\n+        $cancelBtn.style.backgroundColor = $cancelBtn.style.borderLeftColor = $cancelBtn.style.borderRightColor = '';\n     }\n \n-    _hide(input);\n-  }\n-  switch (params.input) {\n-    case 'text':\n-    case 'email':\n-    case 'password':\n-      input = getChildByClass(modal, swalClasses.input);\n-      input.value = params.inputValue;\n-      input.placeholder = params.inputPlaceholder;\n-      input.type = params.input;\n-      _show(input);\n-      break;\n-    case 'select':\n-      var select = getChildByClass(modal, swalClasses.select);\n-      select.innerHTML = '';\n-      if (params.inputPlaceholder) {\n-        var placeholder = document.createElement('option');\n-        placeholder.innerHTML = params.inputPlaceholder;\n-        placeholder.value = '';\n-        placeholder.disabled = true;\n-        placeholder.selected = true;\n-        select.appendChild(placeholder);\n-      }\n-      for (var optionValue in params.inputOptions) {\n-        var option = document.createElement('option');\n-        option.value = optionValue;\n-        option.innerHTML = params.inputOptions[optionValue];\n-        if (params.inputValue === optionValue) {\n-          option.selected = true;\n-        }\n-        select.appendChild(option);\n-      }\n-      _show(select);\n-      break;\n-    case 'radio':\n-      var radio = getChildByClass(modal, swalClasses.radio);\n-      radio.innerHTML = '';\n-      for (var radioValue in params.inputOptions) {\n-        var id = 1;\n-        var radioInput = document.createElement('input');\n-        var radioLabel = document.createElement('label');\n-        var radioLabelSpan = document.createElement('span');\n-        radioInput.type = 'radio';\n-        radioInput.name = swalClasses.radio;\n-        radioInput.value = radioValue;\n-        radioInput.id = swalClasses.radio + '-' + (id++);\n-        if (params.inputValue === radioValue) {\n-          radioInput.checked = true;\n-        }\n-        radioLabelSpan.innerHTML = params.inputOptions[radioValue];\n-        radioLabel.appendChild(radioInput);\n-        radioLabel.appendChild(radioLabelSpan);\n-        radioLabel.for = radioInput.id;\n-        radio.appendChild(radioLabel);\n-      }\n-      _show(radio);\n-      break;\n-    case 'checkbox':\n-      var checkbox = getChildByClass(modal, swalClasses.checkbox);\n-      var checkboxInput = modal.querySelector('#' + swalClasses.checkbox);\n-      checkboxInput.value = 1;\n-      checkboxInput.checked = Boolean(params.inputValue);\n-      var label = checkbox.getElementsByTagName('span');\n-      if (label.length) {\n-        checkbox.removeChild(label[0]);\n-      }\n-      label = document.createElement('span');\n-      label.innerHTML = params.inputPlaceholder;\n-      checkbox.appendChild(label);\n-      _show(checkbox);\n-      break;\n-    case 'textarea':\n-      var textarea = getChildByClass(modal, swalClasses.textarea);\n-      textarea.value = params.inputValue;\n-      textarea.placeholder = params.inputPlaceholder;\n-      _show(textarea);\n-      break;\n-    case null:\n-      break;\n-    default:\n-      console.error('Unexpected type of input! Expected \"text\" or \"email\" or \"password\", \"select\", \"checkbox\" or \"textarea\", got ' + typeof arguments[0]);\n-      break;\n-  }\n-\n-  // Cancel button\n-  if (params.showCancelButton) {\n-    $cancelBtn.style.display = 'inline-block';\n-  } else {\n-    hide($cancelBtn);\n-  }\n-\n-  // Confirm button\n-  if (params.showConfirmButton) {\n-    removeStyleProperty($confirmBtn, 'display');\n-  } else {\n-    hide($confirmBtn);\n-  }\n-\n-  // Buttons spacer\n-  if (!params.showConfirmButton && !params.showCancelButton) {\n-    hide($spacer);\n-  } else {\n-    show($spacer);\n-  }\n-\n-  // Edit text on cancel and confirm buttons\n-  $confirmBtn.innerHTML = params.confirmButtonText;\n-  $cancelBtn.innerHTML = params.cancelButtonText;\n-\n-  // Set buttons to selected background colors\n-  if (params.buttonsStyling) {\n-    $confirmBtn.style.backgroundColor = params.confirmButtonColor;\n-    $cancelBtn.style.backgroundColor = params.cancelButtonColor;\n-  }\n-\n-  // Add buttons custom classes\n-  $confirmBtn.className = swalClasses.confirm;\n-  addClass($confirmBtn, params.confirmButtonClass);\n-  $cancelBtn.className = swalClasses.cancel;\n-  addClass($cancelBtn, params.cancelButtonClass);\n-\n-  // Buttons styling\n-  if (params.buttonsStyling) {\n-    addClass($confirmBtn, 'styled');\n-    addClass($cancelBtn, 'styled');\n-  } else {\n-    removeClass($confirmBtn, 'styled');\n-    removeClass($cancelBtn, 'styled');\n-\n-    $confirmBtn.style.backgroundColor = $confirmBtn.style.borderLeftColor = $confirmBtn.style.borderRightColor = '';\n-    $cancelBtn.style.backgroundColor = $cancelBtn.style.borderLeftColor = $cancelBtn.style.borderRightColor = '';\n-  }\n-\n-  // CSS animation\n-  if (params.animation === true) {\n-    removeClass(modal, 'no-animation');\n-  } else {\n-    addClass(modal, 'no-animation');\n-  }\n+    // CSS animation\n+    if (params.animation === true) {\n+        removeClass(modal, 'no-animation');\n+    } else {\n+        addClass(modal, 'no-animation');\n+    }\n };\n \n /*\n  * Animations\n  */\n var openModal = function() {\n-  var modal = getModal();\n-  fadeIn(getOverlay(), 10);\n-  show(modal);\n-  addClass(modal, 'show-swal2');\n-  removeClass(modal, 'hide-swal2');\n+    var modal = getModal();\n+    fadeIn(getOverlay(), 10);\n+    show(modal);\n+    addClass(modal, 'show-swal2');\n+    removeClass(modal, 'hide-swal2');\n \n-  previousActiveElement = document.activeElement;\n+    previousActiveElement = document.activeElement;\n \n-  addClass(modal, 'visible');\n+    addClass(modal, 'visible');\n };\n \n /*\n  * Set 'margin-top'-property on modal based on its computed height\n  */\n var fixVerticalPosition = function() {\n-  var modal = getModal();\n+    var modal = getModal();\n \n-  modal.style.marginTop = getTopMargin(getModal());\n+    modal.style.marginTop = getTopMargin(getModal());\n };\n \n function modalDependant() {\n \n-  if (arguments[0] === undefined) {\n-    console.error('sweetAlert2 expects at least 1 attribute!');\n-    return false;\n-  }\n-\n-  var params = extend({}, defaultParams);\n-\n-  switch (typeof arguments[0]) {\n-\n-    case 'string':\n-      params.title = arguments[0];\n-      params.text  = arguments[1] || '';\n-      params.type  = arguments[2] || '';\n-\n-      break;\n-\n-    case 'object':\n-      params.title              = arguments[0].title || defaultParams.title;\n-      params.text               = arguments[0].text || defaultParams.text;\n-      params.html               = arguments[0].html || defaultParams.html;\n-      params.type               = arguments[0].type || defaultParams.type;\n-      params.animation          = arguments[0].animation !== undefined ? arguments[0].animation : defaultParams.animation;\n-      params.customClass        = arguments[0].customClass || params.customClass;\n-      params.allowOutsideClick  = arguments[0].allowOutsideClick !== undefined ? arguments[0].allowOutsideClick : defaultParams.allowOutsideClick;\n-      params.allowEscapeKey     = arguments[0].allowEscapeKey !== undefined ? arguments[0].allowEscapeKey : defaultParams.allowEscapeKey;\n-      params.showConfirmButton  = arguments[0].showConfirmButton !== undefined ? arguments[0].showConfirmButton : defaultParams.showConfirmButton;\n-      params.showCancelButton   = arguments[0].showCancelButton !== undefined ? arguments[0].showCancelButton : defaultParams.showCancelButton;\n-      params.preConfirm         = arguments[0].preConfirm || defaultParams.preConfirm;\n-      params.timer              = parseInt(arguments[0].timer, 10) || defaultParams.timer;\n-      params.width              = parseInt(arguments[0].width, 10) || defaultParams.width;\n-      params.padding            = parseInt(arguments[0].padding, 10) || defaultParams.padding;\n-      params.background         = arguments[0].background !== undefined ? arguments[0].background : defaultParams.background;\n-\n-      params.confirmButtonText  = arguments[0].confirmButtonText || defaultParams.confirmButtonText;\n-      params.confirmButtonColor = arguments[0].confirmButtonColor || defaultParams.confirmButtonColor;\n-      params.confirmButtonClass = arguments[0].confirmButtonClass || params.confirmButtonClass;\n-      params.cancelButtonText   = arguments[0].cancelButtonText || defaultParams.cancelButtonText;\n-      params.cancelButtonColor  = arguments[0].cancelButtonColor || defaultParams.cancelButtonColor;\n-      params.cancelButtonClass  = arguments[0].cancelButtonClass || params.cancelButtonClass;\n-      params.buttonsStyling     = arguments[0].buttonsStyling !== undefined ? arguments[0].buttonsStyling : defaultParams.buttonsStyling;\n-      params.reverseButtons     = arguments[0].reverseButtons !== undefined ? arguments[0].reverseButtons : defaultParams.reverseButtons;\n-      params.showCloseButton    = arguments[0].showCloseButton !== undefined ? arguments[0].showCloseButton : defaultParams.showCloseButton;\n-      params.imageUrl           = arguments[0].imageUrl || defaultParams.imageUrl;\n-      params.imageWidth         = arguments[0].imageWidth || defaultParams.imageWidth;\n-      params.imageHeight        = arguments[0].imageHeight || defaultParams.imageHeight;\n-      params.imageClass         = arguments[0].imageClass || defaultParams.imageClass;\n-\n-      params.input              = arguments[0].input || defaultParams.input;\n-      params.inputPlaceholder   = arguments[0].inputPlaceholder || defaultParams.inputPlaceholder;\n-      params.inputValue         = arguments[0].inputValue || defaultParams.inputValue;\n-      params.inputOptions       = arguments[0].inputOptions || defaultParams.inputOptions;\n-      params.inputAutoTrim      = arguments[0].inputAutoTrim !== undefined ? arguments[0].inputAutoTrim : defaultParams.inputAutoTrim;\n-      params.inputClass         = arguments[0].inputClass || defaultParams.inputClass;\n-      params.inputAttributes    = arguments[0].inputAttributes || defaultParams.inputAttributes;\n-      params.inputValidator     = arguments[0].inputValidator || defaultParams.inputValidator;\n-\n-      params.extraParams        = arguments[0].extraParams;\n-\n-      if (params.input === 'email' && params.inputValidator === null) {\n-        params.inputValidator = function(email) {\n-          return new Promise(function(resolve, reject) {\n-            var emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$/;\n-            if (emailRegex.test(email)) {\n-              resolve();\n-            } else {\n-              reject('Invalid email address');\n-            }\n-          });\n-        };\n-      }\n-\n-      break;\n-\n-    default:\n-      console.error('Unexpected type of argument! Expected \"string\" or \"object\", got ' + typeof arguments[0]);\n-      return false;\n+    if (arguments[0] === undefined) {\n+        console.error('sweetAlert2 expects at least 1 attribute!');\n+        return false;\n+    }\n \n-  }\n+    var params = extend({}, defaultParams);\n+\n+    switch (typeof arguments[0]) {\n+\n+        case 'string':\n+            params.title = arguments[0];\n+            params.text = arguments[1] || '';\n+            params.type = arguments[2] || '';\n+\n+            break;\n+\n+        case 'object':\n+            params.title = arguments[0].title || defaultParams.title;\n+            params.text = arguments[0].text || defaultParams.text;\n+            params.html = arguments[0].html || defaultParams.html;\n+            params.type = arguments[0].type || defaultParams.type;\n+            params.animation = arguments[0].animation !== undefined ? arguments[0].animation : defaultParams.animation;\n+            params.customClass = arguments[0].customClass || params.customClass;\n+            params.allowOutsideClick = arguments[0].allowOutsideClick !== undefined ? arguments[0].allowOutsideClick : defaultParams.allowOutsideClick;\n+            params.allowEscapeKey = arguments[0].allowEscapeKey !== undefined ? arguments[0].allowEscapeKey : defaultParams.allowEscapeKey;\n+            params.showConfirmButton = arguments[0].showConfirmButton !== undefined ? arguments[0].showConfirmButton : defaultParams.showConfirmButton;\n+            params.showCancelButton = arguments[0].showCancelButton !== undefined ? arguments[0].showCancelButton : defaultParams.showCancelButton;\n+            params.preConfirm = arguments[0].preConfirm || defaultParams.preConfirm;\n+            params.timer = parseInt(arguments[0].timer, 10) || defaultParams.timer;\n+            params.width = parseInt(arguments[0].width, 10) || defaultParams.width;\n+            params.padding = parseInt(arguments[0].padding, 10) || defaultParams.padding;\n+            params.background = arguments[0].background !== undefined ? arguments[0].background : defaultParams.background;\n+\n+            params.confirmButtonText = arguments[0].confirmButtonText || defaultParams.confirmButtonText;\n+            params.confirmButtonColor = arguments[0].confirmButtonColor || defaultParams.confirmButtonColor;\n+            params.confirmButtonClass = arguments[0].confirmButtonClass || params.confirmButtonClass;\n+            params.cancelButtonText = arguments[0].cancelButtonText || defaultParams.cancelButtonText;\n+            params.cancelButtonColor = arguments[0].cancelButtonColor || defaultParams.cancelButtonColor;\n+            params.cancelButtonClass = arguments[0].cancelButtonClass || params.cancelButtonClass;\n+            params.buttonsStyling = arguments[0].buttonsStyling !== undefined ? arguments[0].buttonsStyling : defaultParams.buttonsStyling;\n+            params.reverseButtons = arguments[0].reverseButtons !== undefined ? arguments[0].reverseButtons : defaultParams.reverseButtons;","path":"src/sweetalert2.js","position":1217,"original_position":1217,"commit_id":"2ae0a65d2a14215cd91dc45e70e0e5781102a65b","original_commit_id":"2ae0a65d2a14215cd91dc45e70e0e5781102a65b","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Line is too long.","created_at":"2016-05-26T17:09:41Z","updated_at":"2016-05-26T17:09:41Z","html_url":"https://github.com/limonte/sweetalert2/pull/142#discussion_r64783256","pull_request_url":"https://api.github.com/repos/limonte/sweetalert2/pulls/142","_links":{"self":{"href":"https://api.github.com/repos/limonte/sweetalert2/pulls/comments/64783256"},"html":{"href":"https://github.com/limonte/sweetalert2/pull/142#discussion_r64783256"},"pull_request":{"href":"https://api.github.com/repos/limonte/sweetalert2/pulls/142"}}},"pull_request":{"url":"https://api.github.com/repos/limonte/sweetalert2/pulls/142","id":71587423,"html_url":"https://github.com/limonte/sweetalert2/pull/142","diff_url":"https://github.com/limonte/sweetalert2/pull/142.diff","patch_url":"https://github.com/limonte/sweetalert2/pull/142.patch","issue_url":"https://api.github.com/repos/limonte/sweetalert2/issues/142","number":142,"state":"open","locked":false,"title":"IOS Fix","user":{"login":"yeomann","id":5970751,"avatar_url":"https://avatars.githubusercontent.com/u/5970751?v=3","gravatar_id":"","url":"https://api.github.com/users/yeomann","html_url":"https://github.com/yeomann","followers_url":"https://api.github.com/users/yeomann/followers","following_url":"https://api.github.com/users/yeomann/following{/other_user}","gists_url":"https://api.github.com/users/yeomann/gists{/gist_id}","starred_url":"https://api.github.com/users/yeomann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeomann/subscriptions","organizations_url":"https://api.github.com/users/yeomann/orgs","repos_url":"https://api.github.com/users/yeomann/repos","events_url":"https://api.github.com/users/yeomann/events{/privacy}","received_events_url":"https://api.github.com/users/yeomann/received_events","type":"User","site_admin":false},"body":"Fix is under sweetAlert.init function, according to my sublime starting from 1180 line number to 1223 line number.\r\nAlso browserSync added in gulpfile for easier cross platform testing.","created_at":"2016-05-26T16:41:50Z","updated_at":"2016-05-26T17:09:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4366568fa4a7607d225467f16e9d2cd2a36e2192","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/limonte/sweetalert2/pulls/142/commits","review_comments_url":"https://api.github.com/repos/limonte/sweetalert2/pulls/142/comments","review_comment_url":"https://api.github.com/repos/limonte/sweetalert2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/limonte/sweetalert2/issues/142/comments","statuses_url":"https://api.github.com/repos/limonte/sweetalert2/statuses/2ae0a65d2a14215cd91dc45e70e0e5781102a65b","head":{"label":"yeomann:master","ref":"master","sha":"2ae0a65d2a14215cd91dc45e70e0e5781102a65b","user":{"login":"yeomann","id":5970751,"avatar_url":"https://avatars.githubusercontent.com/u/5970751?v=3","gravatar_id":"","url":"https://api.github.com/users/yeomann","html_url":"https://github.com/yeomann","followers_url":"https://api.github.com/users/yeomann/followers","following_url":"https://api.github.com/users/yeomann/following{/other_user}","gists_url":"https://api.github.com/users/yeomann/gists{/gist_id}","starred_url":"https://api.github.com/users/yeomann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeomann/subscriptions","organizations_url":"https://api.github.com/users/yeomann/orgs","repos_url":"https://api.github.com/users/yeomann/repos","events_url":"https://api.github.com/users/yeomann/events{/privacy}","received_events_url":"https://api.github.com/users/yeomann/received_events","type":"User","site_admin":false},"repo":{"id":59766311,"name":"sweetalert2","full_name":"yeomann/sweetalert2","owner":{"login":"yeomann","id":5970751,"avatar_url":"https://avatars.githubusercontent.com/u/5970751?v=3","gravatar_id":"","url":"https://api.github.com/users/yeomann","html_url":"https://github.com/yeomann","followers_url":"https://api.github.com/users/yeomann/followers","following_url":"https://api.github.com/users/yeomann/following{/other_user}","gists_url":"https://api.github.com/users/yeomann/gists{/gist_id}","starred_url":"https://api.github.com/users/yeomann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeomann/subscriptions","organizations_url":"https://api.github.com/users/yeomann/orgs","repos_url":"https://api.github.com/users/yeomann/repos","events_url":"https://api.github.com/users/yeomann/events{/privacy}","received_events_url":"https://api.github.com/users/yeomann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yeomann/sweetalert2","description":"Supported fork of t4t5/sweetalert","fork":true,"url":"https://api.github.com/repos/yeomann/sweetalert2","forks_url":"https://api.github.com/repos/yeomann/sweetalert2/forks","keys_url":"https://api.github.com/repos/yeomann/sweetalert2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yeomann/sweetalert2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yeomann/sweetalert2/teams","hooks_url":"https://api.github.com/repos/yeomann/sweetalert2/hooks","issue_events_url":"https://api.github.com/repos/yeomann/sweetalert2/issues/events{/number}","events_url":"https://api.github.com/repos/yeomann/sweetalert2/events","assignees_url":"https://api.github.com/repos/yeomann/sweetalert2/assignees{/user}","branches_url":"https://api.github.com/repos/yeomann/sweetalert2/branches{/branch}","tags_url":"https://api.github.com/repos/yeomann/sweetalert2/tags","blobs_url":"https://api.github.com/repos/yeomann/sweetalert2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yeomann/sweetalert2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yeomann/sweetalert2/git/refs{/sha}","trees_url":"https://api.github.com/repos/yeomann/sweetalert2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yeomann/sweetalert2/statuses/{sha}","languages_url":"https://api.github.com/repos/yeomann/sweetalert2/languages","stargazers_url":"https://api.github.com/repos/yeomann/sweetalert2/stargazers","contributors_url":"https://api.github.com/repos/yeomann/sweetalert2/contributors","subscribers_url":"https://api.github.com/repos/yeomann/sweetalert2/subscribers","subscription_url":"https://api.github.com/repos/yeomann/sweetalert2/subscription","commits_url":"https://api.github.com/repos/yeomann/sweetalert2/commits{/sha}","git_commits_url":"https://api.github.com/repos/yeomann/sweetalert2/git/commits{/sha}","comments_url":"https://api.github.com/repos/yeomann/sweetalert2/comments{/number}","issue_comment_url":"https://api.github.com/repos/yeomann/sweetalert2/issues/comments{/number}","contents_url":"https://api.github.com/repos/yeomann/sweetalert2/contents/{+path}","compare_url":"https://api.github.com/repos/yeomann/sweetalert2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yeomann/sweetalert2/merges","archive_url":"https://api.github.com/repos/yeomann/sweetalert2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yeomann/sweetalert2/downloads","issues_url":"https://api.github.com/repos/yeomann/sweetalert2/issues{/number}","pulls_url":"https://api.github.com/repos/yeomann/sweetalert2/pulls{/number}","milestones_url":"https://api.github.com/repos/yeomann/sweetalert2/milestones{/number}","notifications_url":"https://api.github.com/repos/yeomann/sweetalert2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yeomann/sweetalert2/labels{/name}","releases_url":"https://api.github.com/repos/yeomann/sweetalert2/releases{/id}","deployments_url":"https://api.github.com/repos/yeomann/sweetalert2/deployments","created_at":"2016-05-26T16:32:17Z","updated_at":"2016-05-26T16:32:19Z","pushed_at":"2016-05-26T17:09:28Z","git_url":"git://github.com/yeomann/sweetalert2.git","ssh_url":"git@github.com:yeomann/sweetalert2.git","clone_url":"https://github.com/yeomann/sweetalert2.git","svn_url":"https://github.com/yeomann/sweetalert2","homepage":"https://limonte.github.io/sweetalert2/","size":1426,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"limonte:master","ref":"master","sha":"971f6818c05edc7a27278546bd5cc6ba930daebd","user":{"login":"limonte","id":6059356,"avatar_url":"https://avatars.githubusercontent.com/u/6059356?v=3","gravatar_id":"","url":"https://api.github.com/users/limonte","html_url":"https://github.com/limonte","followers_url":"https://api.github.com/users/limonte/followers","following_url":"https://api.github.com/users/limonte/following{/other_user}","gists_url":"https://api.github.com/users/limonte/gists{/gist_id}","starred_url":"https://api.github.com/users/limonte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limonte/subscriptions","organizations_url":"https://api.github.com/users/limonte/orgs","repos_url":"https://api.github.com/users/limonte/repos","events_url":"https://api.github.com/users/limonte/events{/privacy}","received_events_url":"https://api.github.com/users/limonte/received_events","type":"User","site_admin":false},"repo":{"id":28748255,"name":"sweetalert2","full_name":"limonte/sweetalert2","owner":{"login":"limonte","id":6059356,"avatar_url":"https://avatars.githubusercontent.com/u/6059356?v=3","gravatar_id":"","url":"https://api.github.com/users/limonte","html_url":"https://github.com/limonte","followers_url":"https://api.github.com/users/limonte/followers","following_url":"https://api.github.com/users/limonte/following{/other_user}","gists_url":"https://api.github.com/users/limonte/gists{/gist_id}","starred_url":"https://api.github.com/users/limonte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limonte/subscriptions","organizations_url":"https://api.github.com/users/limonte/orgs","repos_url":"https://api.github.com/users/limonte/repos","events_url":"https://api.github.com/users/limonte/events{/privacy}","received_events_url":"https://api.github.com/users/limonte/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/limonte/sweetalert2","description":"Supported fork of t4t5/sweetalert","fork":true,"url":"https://api.github.com/repos/limonte/sweetalert2","forks_url":"https://api.github.com/repos/limonte/sweetalert2/forks","keys_url":"https://api.github.com/repos/limonte/sweetalert2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/limonte/sweetalert2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/limonte/sweetalert2/teams","hooks_url":"https://api.github.com/repos/limonte/sweetalert2/hooks","issue_events_url":"https://api.github.com/repos/limonte/sweetalert2/issues/events{/number}","events_url":"https://api.github.com/repos/limonte/sweetalert2/events","assignees_url":"https://api.github.com/repos/limonte/sweetalert2/assignees{/user}","branches_url":"https://api.github.com/repos/limonte/sweetalert2/branches{/branch}","tags_url":"https://api.github.com/repos/limonte/sweetalert2/tags","blobs_url":"https://api.github.com/repos/limonte/sweetalert2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/limonte/sweetalert2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/limonte/sweetalert2/git/refs{/sha}","trees_url":"https://api.github.com/repos/limonte/sweetalert2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/limonte/sweetalert2/statuses/{sha}","languages_url":"https://api.github.com/repos/limonte/sweetalert2/languages","stargazers_url":"https://api.github.com/repos/limonte/sweetalert2/stargazers","contributors_url":"https://api.github.com/repos/limonte/sweetalert2/contributors","subscribers_url":"https://api.github.com/repos/limonte/sweetalert2/subscribers","subscription_url":"https://api.github.com/repos/limonte/sweetalert2/subscription","commits_url":"https://api.github.com/repos/limonte/sweetalert2/commits{/sha}","git_commits_url":"https://api.github.com/repos/limonte/sweetalert2/git/commits{/sha}","comments_url":"https://api.github.com/repos/limonte/sweetalert2/comments{/number}","issue_comment_url":"https://api.github.com/repos/limonte/sweetalert2/issues/comments{/number}","contents_url":"https://api.github.com/repos/limonte/sweetalert2/contents/{+path}","compare_url":"https://api.github.com/repos/limonte/sweetalert2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/limonte/sweetalert2/merges","archive_url":"https://api.github.com/repos/limonte/sweetalert2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/limonte/sweetalert2/downloads","issues_url":"https://api.github.com/repos/limonte/sweetalert2/issues{/number}","pulls_url":"https://api.github.com/repos/limonte/sweetalert2/pulls{/number}","milestones_url":"https://api.github.com/repos/limonte/sweetalert2/milestones{/number}","notifications_url":"https://api.github.com/repos/limonte/sweetalert2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/limonte/sweetalert2/labels{/name}","releases_url":"https://api.github.com/repos/limonte/sweetalert2/releases{/id}","deployments_url":"https://api.github.com/repos/limonte/sweetalert2/deployments","created_at":"2015-01-03T16:15:52Z","updated_at":"2016-05-26T00:23:30Z","pushed_at":"2016-05-26T17:09:29Z","git_url":"git://github.com/limonte/sweetalert2.git","ssh_url":"git@github.com:limonte/sweetalert2.git","clone_url":"https://github.com/limonte/sweetalert2.git","svn_url":"https://github.com/limonte/sweetalert2","homepage":"https://limonte.github.io/sweetalert2/","size":1418,"stargazers_count":391,"watchers_count":391,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":87,"mirror_url":null,"open_issues_count":4,"forks":87,"open_issues":4,"watchers":391,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/limonte/sweetalert2/pulls/142"},"html":{"href":"https://github.com/limonte/sweetalert2/pull/142"},"issue":{"href":"https://api.github.com/repos/limonte/sweetalert2/issues/142"},"comments":{"href":"https://api.github.com/repos/limonte/sweetalert2/issues/142/comments"},"review_comments":{"href":"https://api.github.com/repos/limonte/sweetalert2/pulls/142/comments"},"review_comment":{"href":"https://api.github.com/repos/limonte/sweetalert2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/limonte/sweetalert2/pulls/142/commits"},"statuses":{"href":"https://api.github.com/repos/limonte/sweetalert2/statuses/2ae0a65d2a14215cd91dc45e70e0e5781102a65b"}}}}
{"actor":{"display_login":"houndci-bot"}}