Last active
August 29, 2015 14:13
-
-
Save akhoury/5972bcb66eca3aaca9fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// won't work, im dumb, I just realized that it's a cross-domain frame, initially I thought the frame-content is being written by the js script | |
var gc2r = (function() { | |
var hostPageStyle = '' | |
+ '@media screen and (max-width: 350px) {' | |
+ ' div.goog-bubble-content.gc-reset {' | |
+ ' width: auto !important;' | |
+ ' }' | |
+ ' div.goog-bubble-content.gc-reset, ' | |
+ ' div.goog-bubble-content.gc-reset iframe, ' | |
+ ' td.pls-contentWrap.gc-reset {' | |
+ ' width: 100% !important;' | |
+ ' }' | |
+ ' div.goog-bubble-content.gc-reset iframe {' | |
+ ' position: absolute;' | |
+ ' left: 0 !important;' | |
+ ' right: 0 !important;' | |
+ ' width: 100% !important!;' | |
+ ' }' | |
+ '}'; | |
var inMainFrameStyle = '' | |
+ ' .rc-anchor-item {' | |
+ ' float: right;' | |
+ ' }' | |
+ ' .rc-anchor.rc-anchor-standard {' | |
+ ' width: initial;' | |
+ ' }' | |
+ ' .rc-anchor-item .rc-anchor-logo {' | |
+ ' margin-right: 10px;' | |
+ ' }' | |
+ ' .rc-anchor-checkbox-label {' | |
+ ' width: auto;' | |
+ ' }'; | |
return function(targetId) { | |
var container = targetId ? (document.getElementById(targetId) || {}).firstChild : | |
(document.querySelectorAll('iframe[src*="google.com/recaptcha/api2"]')[0] || {}).parentNode; | |
if (!container) return console.log('Google ReCaptcha 2 container not found in the DOM'); | |
var iframe = container.querySelector('iframe'); | |
container.style.position = 'relative'; | |
container.style.width = '100%'; | |
iframe.style.position = 'absolute'; | |
iframe.style.left = 0; | |
iframe.style.top = 0; | |
iframe.style.bottom = 0; | |
iframe.style.right = 0; | |
iframe.style.margin = 'auto'; | |
iframe.style.width = '100%'; | |
var s = document.createElement('style'); | |
s.innerHTML = hostPageStyle; | |
document.body.appendChild(s); | |
var doc = iframe.contentDocument; | |
var win = iframe.contentWindow; | |
doc.open(); | |
doc.write(response); | |
doc.close('<style>' + inMainFrameStyle + '</style>'); | |
}; | |
})(); | |
gc2_responsive(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment