1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

e-ajax data-confirm option added.

This commit is contained in:
Cameron
2018-11-21 15:36:26 -08:00
parent 5247af0098
commit af629e0a2b

View File

@@ -148,7 +148,9 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
// Old way - href='myscript.php#id-to-target. // Old way - href='myscript.php#id-to-target.
href: $element.attr("href"), href: $element.attr("href"),
// Wait for final event. Useful for keyUp, keyDown... etc. // Wait for final event. Useful for keyUp, keyDown... etc.
wait: $element.attr('data-event-wait') wait: $element.attr('data-event-wait'),
// Optional confirmation message - requires user input before proceeding.
confirm: $element.attr('data-confirm'),
}; };
// If this is a navigation controller, e.g. pager. // If this is a navigation controller, e.g. pager.
@@ -539,6 +541,17 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
$element.after($loadingImage); $element.after($loadingImage);
} }
if(options.confirm != null)
{
answer = confirm(options.confirm);
if(answer === false)
{
return null;
}
}
// Old way - href='myscript.php#id-to-target. // Old way - href='myscript.php#id-to-target.
if(options.target == null || options.url == null) if(options.target == null || options.url == null)
{ {