Merge pull request #2549 from brentj73/master

Added typing for recaptcha.js
This commit is contained in:
Masahiro Wakame
2014-07-25 15:06:46 +09:00
3 changed files with 92 additions and 0 deletions
+1
View File
@@ -279,6 +279,7 @@ All definitions files include a header with the author and editors, so at some p
* [Q-io](https://github.com/kriskowal/q-io) (by [Bart van der Schoor](https://github.com/Bartvds))
* [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei))
* [Raven.js](https://github.com/getsentry/raven-js) (by [Santi Albo](https://github.com/santialbo))
* [Recaptcha.js](https://www.google.com/recaptcha) (by [Brent Jenkins](https://github.com/brentj73))
* [Rickshaw](http://code.shutterstock.com/rickshaw/) (by [Blake Niemyjski](https://github.com/niemyjski))
* [Riot.js](https://github.com/moot/riotjs) (by [vvakame](https://github.com/vvakame))
* [Restify](https://github.com/mcavage/node-restify) (by [Bret Little](https://github.com/blittle))
+52
View File
@@ -0,0 +1,52 @@
/// <reference path="recaptcha.d.ts"/>
var recaptchaOptions: RecaptchaOptions = {
theme : 'custom',
custom_theme_widget: 'recaptcha_widget'
};
var recaptchaOptions: RecaptchaOptions = {
custom_translations: { instructions_visual: "This is my text:" }
};
var recaptchaOptions: RecaptchaOptions = {
custom_translations: {
instructions_visual: "Scrivi le due parole:",
instructions_audio: "Trascrivi ci\u00f2 che senti:",
play_again: "Riascolta la traccia audio",
cant_hear_this: "Scarica la traccia in formato MP3",
visual_challenge: "Modalit\u00e0 visiva",
audio_challenge: "Modalit\u00e0 auditiva",
refresh_btn: "Chiedi due nuove parole",
help_btn: "Aiuto",
incorrect_try_again: "Scorretto. Riprova.",
},
lang: 'it',
theme: 'red'
};
var recaptchaOptions: RecaptchaOptions = {
theme : 'white',
tabindex : 2
};
Recaptcha.create("public_key_a",
"element_id_a",
{
theme: "red",
callback: Recaptcha.focus_response_field
}
);
Recaptcha.create("public_key_b",
"element_id_b",
recaptchaOptions
);
Recaptcha.switch_type("audio");
Recaptcha.get_challenge();
Recaptcha.get_response();
Recaptcha.reload();
Recaptcha.showhelp();
Recaptcha.focus_response_field();
Recaptcha.destroy();
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for Google Recaptcha
// Project: https://www.google.com/recaptcha
// Definitions by: Brent Jenkins <https://github.com/brentj73>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class Recaptcha {
constructor();
static reload(): void;
static switch_type(newtype: string): void;
static showhelp(): void;
static get_challenge(): string;
static get_response(): string;
static focus_response_field(): void;
static create(public_key: string, element: string, options: RecaptchaOptions): void;
static destroy(): void;
}
interface RecaptchaOptions {
tabindex?: number;
theme?: string;
callback?: Function;
lang?: string;
custom_theme_widget?: string;
custom_translations?: CustomTranslations;
}
interface CustomTranslations {
visual_challenge?: string;
audio_challenge?: string;
refresh_btn?: string;
instructions_visual?: string;
instructions_audio?: string;
help_btn?: string;
play_again?: string;
cant_hear_this?: string;
incorrect_try_again?: string;
image_alt_text?: string;
privacy_and_terms?: string;
}