Skip to content

Instantly share code, notes, and snippets.

@gazambuja
Created November 18, 2019 12:34
Show Gist options
  • Select an option

  • Save gazambuja/c50acb629614d484201c2ea922de6691 to your computer and use it in GitHub Desktop.

Select an option

Save gazambuja/c50acb629614d484201c2ea922de6691 to your computer and use it in GitHub Desktop.
//Enable two page view in google docs
var newWidth = document.getElementsByClassName('kix-zoomdocumentplugin-outer')[0].style.width.replace('px','') *2 +10 +'px';
document.getElementsByClassName("kix-paginateddocumentplugin")[0].style.width = newWidth;
var pages = document.getElementsByClassName("kix-page");
for (var i = 0; i < pages.length; i++) {
if(i==0) {
pages[0].parentNode.width = newWidth;
}
pages[i].style.float = "left";
}
@chicalicia512
Copy link
Copy Markdown

Hi! I found this code from https://www.youtube.com/watch?v=v7EOc4Nm8Po
I tried it and I am getting the following error message:
VM3051:2 Uncaught TypeError: Cannot read properties of undefined (reading 'style')
at :2:82

Any help is appreciated!

@NoSubstitute
Copy link
Copy Markdown

NoSubstitute commented Mar 3, 2022

Yeah, this doesn't seem to work anymore.
Others have done similar things, but the Docs code seems to have changed.
Broken: https://github.com/ryanpcmcquen/side_by_side_gdocs

From what I understand it is likely that you are referring to elements that don't exist anymore. That have been renamed or removed.
https://bobbyhadz.com/blog/javascript-cannot-read-property-style-of-undefined

@samsong
Copy link
Copy Markdown

samsong commented Mar 12, 2022

confirm does not work. can someone find the new element name for: kix-zoomdocumentplugin-outer

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