nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

index.js (606B)


      1 import alertify from 'alertify.js';
      2 import './style.css';
      3 
      4 function notify(message, onOk) {
      5     alertify.alert(message, onOk);
      6 }
      7 
      8 function query(message, value) {
      9     function removeFocusFromInput() {
     10         const activeElement = document.activeElement;
     11         if (activeElement?.tagName === 'INPUT') {
     12             activeElement.blur();
     13         }
     14     }
     15 
     16     const result = window.prompt(message, value);
     17     // There is a bug in Chrome on Android: after closing the prompt, it sets focus to last active input element
     18     setTimeout(removeFocusFromInput, 0);
     19     return result;
     20 }
     21 
     22 export {notify, query};