admin管理员组文章数量:1419905
I want to re size the text from the captcha to be easier to see, with Greasemonkey.
How can I do it?
For example, I have this captcha:
<div id="recaptcha_image" style="width: 300px; height: 57px; ">
<img style="display:block;" height="57" width="300" src="">
</div>
I want to change the height="57"
and the width="300"
from the second line (from the image style) to 85 and 450 respectively.
Changing it into the inspect works correctly, but how can I do to do it always with Greasemonkey?
I want to re size the text from the captcha to be easier to see, with Greasemonkey.
How can I do it?
For example, I have this captcha:
<div id="recaptcha_image" style="width: 300px; height: 57px; ">
<img style="display:block;" height="57" width="300" src="http://www.google./recaptcha/api/image?c=03AHJ_VuuqeICMpU36GlHCSchBzERwiDzTH4A1RHobtEpbbSK5lWC47EVkgeuF_ause8bnYTHGhjRr_GFiVMh9e4sZFXIBlv4-vcY7WXNjtBHhVmIl2Z5tqK_CY5hRZjtr-MWDUrBOr7mQE0ZqfU8XeeUeXLM5cxcwEQ">
</div>
I want to change the height="57"
and the width="300"
from the second line (from the image style) to 85 and 450 respectively.
Changing it into the inspect works correctly, but how can I do to do it always with Greasemonkey?
Share Improve this question edited Jul 22, 2010 at 10:33 Brock Adams 93.7k23 gold badges241 silver badges305 bronze badges asked Jul 21, 2010 at 17:37 Bruno 'Shady'Bruno 'Shady' 4,51615 gold badges57 silver badges75 bronze badges 4- you cannot use document.getElementById('reaptcha_image').style.height="85px"; ?? – mplungjan Commented Jul 21, 2010 at 17:39
-
note if you copied and pasted what mplungjan wrote it won't work it should be
document.getElementById('recaptcha_image').style.height="85px";
The c was missing in the recapta part of the name. – qw3n Commented Jul 21, 2010 at 18:07 - this mand only enlarge the box of the captcha, and not the text itself – Bruno 'Shady' Commented Jul 21, 2010 at 20:17
-
1
Use
document.getElementById('recaptcha_image').firstChild.style.height="85px";
to change the size of the image (recaptcha "text") itself. Also, as recaptcha's are in an iframe, if you are accessing it from the parent frame you will need to userecaptchIframe.document.getElementById('recaptcha_image').firstChild.style.height="85px";
whererecaptchIframe
is the iframe of the recaptcha. – Adam Commented Jul 21, 2010 at 23:17
3 Answers
Reset to default 2These userContent.css
entries might work:
div#recaptcha_image,
div#recaptcha_image > img {
width: 450px !important;
height: 85px !important;
}
Since this is Greasemonkey, I'm going to assume you're using a reasonably up-to-date version of Firefox. In which case, you might be able to use querySelector:
var query = document.querySelector("#recaptcha_image > img");
if (query) {
query.style.width = "450px !important";
query.style.height = "85px !important";
}
If that doesn't work, you can try setting the img's attributes instead:
var query = document.querySelector("#recaptcha_image > img");
if (query) {
query.setAttribute("width", "450");
query.setAttribute("height", "85");
}
If that doesn't work, you can try setting both the box and the img:
var element = document.getElementById("recaptcha_image");
if (element) {
element.style.width = "450px !important";
element.style.height = "85px !important";
}
var query = element.querySelector("img");
if (query) {
query.setAttribute("width", "450");
query.setAttribute("height", "85");
}
Do:
var img = document.evaluate("//div[@id='recaptcha_image']/img", document, null, 9, null).singleNodeValue;
img.setAttribute('width', '85');
img.setAttribute('height', '450');
If the recaptcha is in an iframe, then @include the iframe's url, and not the parent's url, but note that this'll probably change the size of recaptcha's on every site, so you may want to check that window.top.location
for window.top is the desired location.
本文标签: javascriptHow can I resize the recaptcha in GreasemonkeyStack Overflow
版权声明:本文标题:javascript - How can I resize the recaptcha in Greasemonkey? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745308323a2652782.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论