Created
December 9, 2012 11:09
-
-
Save hezi/4244298 to your computer and use it in GitHub Desktop.
partial GIPSuperWebViewInit.js
This file contains hidden or 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
. . . | |
navigator.googleInternal = { | |
iframe_: undefined, | |
isInitialized: false, | |
init: function() { | |
if (this.isInitialized) { | |
return; | |
} | |
this.iframe_ = document.createElement('iframe'); | |
var cssText = 'position:absolute;top:-5000px;height:2px;width:2px;'; | |
this.iframe_.style.cssText = cssText; | |
this.iframe_.src = 'about:blank'; | |
document.body.appendChild(this.iframe_); | |
this.isInitialized = true; | |
}, | |
dispatch: function(object, method, opt_args) { | |
var urlWithoutHash = window.location.href.split('#')[0]; | |
var requestUrl = urlWithoutHash + | |
'#googleapp/api/' + object + '/' + method + | |
(opt_args ? '/?' + this.serialize_(opt_args) : ''); | |
var oldHash = window.location.hash; | |
var newHash = 'googleapp/api/' + object + '/' + method + | |
(opt_args ? '/?' + this.serialize_(opt_args) : ''); | |
this.init(); | |
this.iframe_.contentWindow.location.hash = newHash; | |
// Setting the hash to an empty string will cause the page to jump to | |
// the top of the iframe, which is the top of the window. We instead set | |
// it to a dummy value to prevent any jumping form occuring. | |
this.iframe_.contentWindow.location.hash = 'null'; | |
}, | |
. . . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment