mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Added typing for recaptcha.js
This commit is contained in:
@@ -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();
|
||||
Vendored
+39
@@ -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: any);
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user