Skip to content

Instantly share code, notes, and snippets.

@qgustavor
Last active June 27, 2016 09:12
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 qgustavor/14737d413a6d24dbeb0a4424bf2464cc to your computer and use it in GitHub Desktop.
Save qgustavor/14737d413a6d24dbeb0a4424bf2464cc to your computer and use it in GitHub Desktop.
Restore extra column which got removed in the last Google Keep update
// ==UserScript==
// @name Fix Google Keep columns
// @namespace üsersçrìpts@blio.tk
// @include https://keep.google.com/*
// @version 1.2
// @grant none
// @run-at document-start
// ==/UserScript==
var originalGetter = Object.getOwnPropertyDescriptor(Element.prototype, 'clientWidth').get;
Object.defineProperty(document.documentElement, 'clientWidth', {
configurable: true,
enumerable: true,
get: function (){
// 256 is the space for the extra collumn
// which got removed in last update
return originalGetter.call(document.documentElement) + (
// Only add the extra space if the function which called
// was the one which handles columns (may break on update):
Error().stack.indexOf('prototype.init') === -1 ? 0 : 256
);
}
});
@qgustavor
Copy link
Author

By the way the update was too sudden that I don't remember if it removed one or two columns. It adds space for just one column as seems two don't fit with the sidebar opened.

@OsakaWebbie
Copy link

It mystifies me that Keep doesn't just use the entire window area when the menu is hidden, but they didn't ask my opinion...

This is probably a dumb question, but how do I get my browser to include your little script? I normally use Firefox, if that matters.

@qgustavor
Copy link
Author

@OsakaWebbie You can use Greasemonkey.

@OsakaWebbie
Copy link

Thanks, that worked. Now I'd like to ask about the other thing that you did for someone on Reddit: A command to hide the menu on Keep startup. It looks like you shared such code as a comment and then deleted it. I think it would be a good companion to the gist here.

@qgustavor
Copy link
Author

This user script breaks the centering of popup notes. I thought Google would fix this issue before I posted it, but seems they still not fixed this. For me it's better having out of center notes than losing that extra column.

@OsakaWebbie Many of my gists are public, that one is published here.

@qgustavor
Copy link
Author

"This user script breaks the centering of popup notes.": Fixed in 1.2

@oluc
Copy link

oluc commented Jun 27, 2016

I was looking for this. Thanks !

There seems to be a glitch:
when loading keep.google.com, it gets 4 columns.
Then if I adjust the width of the browser,
starting from a narrow width, and growing,
the number of columns is :
1,
then 2,
then 3, (so far so good)
then back to 2 (for a long way) (seems like a bug),
then back to 3 columns,
and it never reaches 4 columns even at full width (seems like a bug)

(I installed it together with your hide-google-keep-sidebar.user.js)

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