Merge pull request #907 from jonegerton/jquery.are-you-sure

Add typings for jQuery.areYouSure
This commit is contained in:
Boris Yankov
2013-08-26 10:23:57 -07:00
3 changed files with 50 additions and 0 deletions

View File

@@ -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/))

View File

@@ -0,0 +1,18 @@
// Type definitions for jquery.are-you-sure.js
// Project: https://github.com/codedance/jquery.AreYouSure
// Definitions by: Jon Egerton <https://github.com/jonegerton>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jquery.are-you-sure.d.ts"/>
//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");}
})

View File

@@ -0,0 +1,31 @@
// Type definitions for jquery.are-you-sure.js
// Project: https://github.com/codedance/jquery.AreYouSure
// Definitions by: Jon Egerton <https://github.com/jonegerton>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/**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;
}