John Hjelmstad / Jonathan Beri - same deal as sign in button... let's incorporate it...
Originally shared by Gerwin Sturm
As you might have noticed I invested quite some time in Polymer recently. What I like about web components is that they make a lot of things a lot easier, except...
Normally adding a +1 button (or any other Google+ plugin) to a website is just about the easiest thing you can do.
1. Take the code snippet from the docs, e.g. https://
2. Paste it in your code at the appropriate place.
3. Done.
Unfortunately the gapi JS library doesn't like to work with the Shadow DOM. Even if you pass in a direct reference to an element inside of your element it won't work.
The (https://realm dom.
Since there are a lot more widgets to choose from, I took this idea and started by creating a generic element that takes `type` and `data` as attributes to render the appropriate plugin, using the same idea as the hangout-button.
So for the default +1 button you could just use
Or for a profile badge you would use
<google-plugin type='person' data='{"href": "https://
From there I started to create specific elements, that have the relevant attributes for each plugin.
For now there are only two but others are easy to add:
(the profile attribute will be used to build the href attribute needed by the profile widget)
The plugins still aren't really happy inside of the shadow dom, displaying some errors in the console, and not all interaction seems to be working correctly.
I have some other ideas I will test to improve this, but maybe the gapi team will eventually support Shadow DOM properly ;)
For now these elements work better than not working at all :)
Source code: https://
Docs: http://
Demo: http://