Skip to content

Instantly share code, notes, and snippets.

@makotom
Created July 21, 2011 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makotom/1096454 to your computer and use it in GitHub Desktop.
Save makotom/1096454 to your computer and use it in GitHub Desktop.
UserJS for Opera to fix blank-pages problem in Google+
(function(){
// if(location.toString().match(/^https?:\/\/[^\/.]+\.google\.com\//)){ // It does affect all Google pages?
if(location.toString().match(/^https?:\/\/plus\.google\.com\//)){
history.replaceStateOriginal = history.replaceState;
history.replaceState = function(state, title, url){
if(url !== location.toString() && url !== location.pathname){
if(!state){
location.href = url;
}else{
history.replaceStateOriginal(state, title, url);
}
}
};
}
})();
@XP1
Copy link

XP1 commented Jul 21, 2011

Going to add a more descriptive description? In what way, how does this make Google+ usable in Opera?

@makotom
Copy link
Author

makotom commented Jul 21, 2011

By the default, in Opera, nothing will be shown if you accessed Google+ with URLs having particular GET queries. This UserJS tries to fix it.

@XP1
Copy link

XP1 commented Jul 21, 2011

@makotom, interesting. Is this why when you go to the main stream (Google+ homepage), Opera will sometimes try to load the stream forever, thus the white space where the stream is?

@makotom
Copy link
Author

makotom commented Jul 21, 2011

@XP1
Yes :)

@XP1
Copy link

XP1 commented Jul 22, 2011

@makotom, would you like to look at my code for my Google+ Injector User JS and then try it out?

Google uses unnecessary, server-side browser sniffing to send Opera a crippled webpage, missing CSS, HTML, and JavaScript, which, in effect, do not include web toolbar buttons and advanced feedback features.

That is why I created a User JS and extension for Google+ that will inject the missing HTML, CSS, and JavaScript so that the web toolbar notification and share buttons will work correctly.

I posted about it here in the My Opera forums:
http://my.opera.com/community/forums/findpost.pl?id=9922772


Google+ Injector:
https://github.com/XP1/Google--for-Opera/

For the User JS, click on the file and then click "raw".
For the extension, click "Downloads" and then install "googlePlusInjector-1.03.oex".

If you use the User JS, "User JavaScript on HTTPS" must be enabled, and you will get an HTTPS warning for each browsing session.
opera:config#User%20JavaScript%20on%20HTTPS or opera:config#UserPrefs|UserJavaScriptonHTTPS

If you use the extension, "User JavaScript on HTTPS" does not have to be enabled, so you will not get an HTTPS warning for each browsing session. However, for extensions, "Allow interaction with secure pages" must be enabled.

Known issues:
Webpages, like "https://plus.google.com/photos/" and "https://plus.google.com/circles/", do not have the notification and share text, so there is no way to get the the notification and share text for non-English languages. For these webpages, they will always show as "Notifications" and "Share", unless you edit the User JS.


Also, try out my Google +1 Button extension. My extension will let you +1 a webpage even if it lacks +1 buttons.
https://github.com/XP1/Google--1-Button-extension-for-Opera/
Click "Downloads" and then install "googlePlusOneButton-1.01.oex".


I'm interested if you have any comments about the code or how it can be improved. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment