Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: js/main.js

Issue 8689009: share-page: Initial implementation (Closed)
Left Patch Set: Created Oct. 24, 2012, 3:17 p.m.
Right Patch Set: Created Oct. 25, 2012, 1:19 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « index.html ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 (function() 1 (function()
2 { 2 {
3 function initFacebook() 3 function initFacebook()
4 { 4 {
5 (function(d, s, id) { 5 (function(d, s, id) {
6 var js, fjs = d.getElementsByTagName(s)[0]; 6 var js, fjs = d.getElementsByTagName(s)[0];
7 if (d.getElementById(id)) return; 7 if (d.getElementById(id)) return;
8 js = d.createElement(s); js.id = id; 8 js = d.createElement(s); js.id = id;
9 js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; 9 js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
10 fjs.parentNode.insertBefore(js, fjs); 10 fjs.parentNode.insertBefore(js, fjs);
11 }(document, 'script', 'facebook-jssdk')); 11 }(document, 'script', 'facebook-jssdk'));
12 } 12 }
13 13
14 function initTwitter() 14 function initTwitter()
15 { 15 {
16 !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementBy Id(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js ";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); 16 !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementBy Id(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js ";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
17 } 17 }
18 18
19 function initGooglePlus() 19 function initGooglePlus()
20 { 20 {
21 var po = document.createElement('script'); po.type = 'text/javascript'; po.a sync = true; 21 var po = document.createElement('script'); po.type = 'text/javascript'; po.a sync = true;
22 po.src = 'https://apis.google.com/js/plusone.js'; 22 po.src = 'https://apis.google.com/js/plusone.js';
23 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefor e(po, s); 23 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefor e(po, s);
24 } 24 }
Wladimir Palant 2012/10/25 07:24:34 I guess that the ugly initialization code is provi
25 25
26 initFacebook(); 26 function sendDimensions()
27 initTwitter(); 27 {
28 initGooglePlus(); 28 if (window.parent === window)
29 return;
30
31 var dimensions = {
32 width: document.body.offsetWidth,
33 height: document.body.offsetHeight
34 };
35 window.parent.postMessage(dimensions, "*");
36 }
37
38 window.addEventListener("DOMContentLoaded", function()
39 {
40 initFacebook();
41 initTwitter();
42 initGooglePlus();
43 sendDimensions();
44 }, false);
29 })(); 45 })();
LEFTRIGHT
« index.html ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld