Last active
July 26, 2019 09:03
-
-
Save severak/8b335b5f6a994637fc71683c4f97d612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function confirmAsync(mgs, cbk) { | |
// asychronní confirm - kdybyste se divili, co to je za prasárnu: | |
// Chrome potlačuje zobrazování confirmu když můžou zablokovat hlavní thread (nebo dělá něco podobného) | |
setTimeout(function () { | |
if (confirm(mgs)) { | |
cbk(); | |
} | |
}, 100); | |
return false; | |
} | |
function confirmSubmit(mgs, buttonName) { | |
// asychronní confirm - kdybyste se divili, co to je za prasárnu: | |
// Chrome potlačuje zobrazování confirmu když můžou zablokovat hlavní thread (nebo dělá něco podobného) | |
setTimeout(function () { | |
if (confirm(mgs)) { | |
if (buttonName) { | |
var hidden = document.createElement('input'); | |
hidden.name=buttonName; | |
hidden.type='hidden'; | |
hidden.value='OK'; | |
document.getElementById('form').appendChild(hidden); | |
} | |
document.getElementById('form').submit();; | |
} | |
}, 100); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment