diff --git a/README.md b/README.md index 8e8694da37..f4015d3695 100755 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ List of Definitions * [jQuery](http://jquery.com/) (from TypeScript samples) * [jQuery Mobile](http://jquerymobile.com) (by [Boris Yankov](https://github.com/borisyankov)) * [jQuery UI](http://jqueryui.com/) (by [Boris Yankov](https://github.com/borisyankov)) +* [jQuery.areYouSure](https://github.com/codedance/jquery.AreYouSure) (by [Jon Egerton](https://github.com/jonegerton)) * [jQuery.autosize](http://www.jacklmoore.com/autosize/) (by [Jack Moore](http://www.jacklmoore.com/)) * [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos)) * [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/)) diff --git a/jquery.are-you-sure/jquery.are-you-sure-tests.ts b/jquery.are-you-sure/jquery.are-you-sure-tests.ts new file mode 100644 index 0000000000..6f8691e05d --- /dev/null +++ b/jquery.are-you-sure/jquery.are-you-sure-tests.ts @@ -0,0 +1,18 @@ +// Type definitions for jquery.are-you-sure.js +// Project: https://github.com/codedance/jquery.AreYouSure +// Definitions by: Jon Egerton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +//Use defaults +$("test").areYouSure(); + +//Use all settings +$("test").areYouSure({ + message: "Oops - sure you wanna leave?", + dirtyClass: "soiled", + fieldSelector: "input[type='text']", + change: function () { alert("changed");} +}) \ No newline at end of file diff --git a/jquery.are-you-sure/jquery.are-you-sure.d.ts b/jquery.are-you-sure/jquery.are-you-sure.d.ts new file mode 100644 index 0000000000..62cc39c2c8 --- /dev/null +++ b/jquery.are-you-sure/jquery.are-you-sure.d.ts @@ -0,0 +1,31 @@ +// Type definitions for jquery.are-you-sure.js +// Project: https://github.com/codedance/jquery.AreYouSure +// Definitions by: Jon Egerton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/**Options available to control dirty form checking*/ +interface AreYouSureOptions { + + /**Message to show when attempting to quit a dirty form without saving*/ + message?: string; + + /**Class to assign to the form when dirty*/ + dirtyClass?: string; + + /**Callback when form is found to be dirty - allows control of submit/reset buttons etc*/ + change?: Function; + + /**Jquery selector to use to find input elements*/ + fieldSelector?: string; +} + +interface AreYouSure { + (): JQuery; + (options: AreYouSureOptions): JQuery; +} + +interface JQuery { + areYouSure: AreYouSure; +} \ No newline at end of file