Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4133173
ext.confirmEdit.fancyCaptcha.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ext.confirmEdit.fancyCaptcha.js
View Options
/* eslint-disable no-jquery/no-global-selector */
$
(
document
).
on
(
'click'
,
'.fancycaptcha-reload'
,
function
()
{
const
$this
=
$
(
this
),
$root
=
$this
.
closest
(
'.fancycaptcha-captcha-container'
),
$captchaImage
=
$root
.
find
(
'.fancycaptcha-image'
);
$this
.
addClass
(
'fancycaptcha-reload-loading'
);
// AJAX request to get captcha index key
new
mw
.
Api
().
post
(
{
action
:
'fancycaptchareload'
}
).
done
(
(
data
)
=>
{
const
captchaIndex
=
data
.
fancycaptchareload
.
index
;
let
imgSrc
;
if
(
typeof
captchaIndex
===
'string'
)
{
// replace index key with a new one for captcha image
imgSrc
=
$captchaImage
.
attr
(
'src'
).
replace
(
/(wpCaptchaId=)\w+/
,
'$1'
+
captchaIndex
);
$captchaImage
.
attr
(
'src'
,
imgSrc
);
// replace index key with a new one for hidden tag
$
(
'#mw-input-captchaId'
).
val
(
captchaIndex
);
$
(
'#mw-input-captchaWord'
).
val
(
''
).
trigger
(
'focus'
);
// now do the same with a selector that works for pre-1.27 login forms
$root
.
find
(
'[name="wpCaptchaId"]'
).
val
(
captchaIndex
);
$root
.
find
(
'[name="wpCaptchaWord"]'
).
val
(
''
).
trigger
(
'focus'
);
// and make it accessible for other tools, e.g. VisualEditor
$captchaImage
.
data
(
'captchaId'
,
captchaIndex
);
}
}
)
.
always
(
()
=>
{
$this
.
removeClass
(
'fancycaptcha-reload-loading'
);
}
);
return
false
;
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 11:59 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c3/74/3a101767818390ba0da86dc8e5cf
Default Alt Text
ext.confirmEdit.fancyCaptcha.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment