reCAPTCHA を Cappuccino アプリに統合していますが、reCAPTCHA 入力テキスト フィールドのこの奇妙な入力機能以外はすべて機能しています。「qwrszcv」などのいくつかのキーのみが機能しているように見えますが、他のほとんどのキーは正常に機能します。働かないでください。
マップキット コードの一部を借りて reCAPTCHA スクリプト ファイルを head に挿入し、reCAPTCHA div を作成したカスタム CPView クラスに挿入しました。
ここに私のコンストラクタコードがあります:
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if (self != nil)
{
var DOMScriptElement = document.createElement("script");
DOMScriptElement.src = "http://www.google.com/recaptcha/api/js/recaptcha_ajax.js";
DOMScriptElement.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(DOMScriptElement);
needsInitialization = YES;
console.log(self);
}
return self;
}
そして私の初期化コード:
- (id)initializeRecaptcha
{
if (needsInitialization)
{
DOMRecaptchaElement = document.createElement("div");
DOMRecaptchaElement.id = "recaptcha_div_id";
var style = DOMRecaptchaElement.style,
bounds = [self bounds],
width = CGRectGetWidth(bounds),
height = CGRectGetHeight(bounds);
style.overflow = "hidden";
style.position = "absolute";
style.visibility = "visible";
style.zIndex = 0;
style.left = "0px";
style.top = "0px";
style.width = width + "px";
style.height = height + "px";
_DOMElement.appendChild(DOMRecaptchaElement);
window.Recaptcha.create("my-recaptcha-key",
"recaptcha_div_id",
{
theme: "clean",
callback: window.Recaptcha.focus_response_field
}
);
needsInitialization = NO;
}
else
{
window.Recaptcha.reload();
}
}
カプチーノがイベントを伝播する方法と関係があると思いますが、私の人生では、この入力を機能させる方法を理解できません.