Skip to content

Commit 3c529de

Browse files
committed
Always add Disqus. Code formatting.
1 parent dfa55c6 commit 3c529de

File tree

2 files changed

+53
-47
lines changed

2 files changed

+53
-47
lines changed

js/graphgist.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ function GraphGist($) {
8686
initSocial(initAndGetHeading());
8787
share();
8888
}
89+
window.setTimeout(function () {
90+
initDisqus($content);
91+
}, 5 * 1000);
8992
var version = postProcessPage();
9093
var consoleUrl = CONSOLE_VERSIONS[version in CONSOLE_VERSIONS ? version : DEFAULT_VERSION];
9194
CypherConsole({'url': consoleUrl}, function (conslr) {
@@ -262,7 +265,7 @@ function GraphGist($) {
262265
'init': 'none',
263266
'query': query || 'none',
264267
'message': 'none',
265-
'viz' : 'none',
268+
'viz': 'none',
266269
'no_root': true
267270
}, success, error);
268271

js/social.js

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
function initDisqus($content) {
2+
if ($('#disqus_thread').length > 0) {
3+
return;
4+
}
25
$content.append('<div id="disqus_thread"></div>');
36
var disqus_shortname = 'graphgist';
47

@@ -30,58 +33,58 @@ function share() {
3033
}
3134

3235
function initSocial(heading) {
33-
(function () {
34-
var po = document.createElement('script');
35-
po.type = 'text/javascript';
36-
po.async = true;
37-
po.src = 'https://apis.google.com/js/platform.js';
38-
var s = document.getElementsByTagName('script')[0];
39-
s.parentNode.insertBefore(po, s);
40-
})();
36+
(function () {
37+
var po = document.createElement('script');
38+
po.type = 'text/javascript';
39+
po.async = true;
40+
po.src = 'https://apis.google.com/js/platform.js';
41+
var s = document.getElementsByTagName('script')[0];
42+
s.parentNode.insertBefore(po, s);
43+
})();
44+
45+
!function (d, s, id) {
46+
var js, fjs = d.getElementsByTagName(s)[0];
47+
if (!d.getElementById(id)) {
48+
js = d.createElement(s);
49+
js.id = id;
50+
js.src = "https://platform.twitter.com/widgets.js";
51+
fjs.parentNode.insertBefore(js, fjs);
52+
}
53+
}(document, "script", "twitter-wjs");
4154

42-
!function (d, s, id) {
43-
var js, fjs = d.getElementsByTagName(s)[0];
44-
if (!d.getElementById(id)) {
55+
(function (d, s, id) {
56+
var js, fjs = d.getElementsByTagName(s)[0];
57+
if (d.getElementById(id)) return;
4558
js = d.createElement(s);
4659
js.id = id;
47-
js.src = "https://platform.twitter.com/widgets.js";
60+
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=442180952526716";
4861
fjs.parentNode.insertBefore(js, fjs);
49-
}
50-
}(document, "script", "twitter-wjs");
51-
52-
(function (d, s, id) {
53-
var js, fjs = d.getElementsByTagName(s)[0];
54-
if (d.getElementById(id)) return;
55-
js = d.createElement(s);
56-
js.id = id;
57-
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=442180952526716";
58-
fjs.parentNode.insertBefore(js, fjs);
59-
}(document, 'script', 'facebook-jssdk'));
62+
}(document, 'script', 'facebook-jssdk'));
6063

61-
var location = window.location.href;
62-
var index = location.indexOf('#');
63-
if ( index !== -1) {
64-
location = location.substr(0, index);
65-
}
66-
var uniqueId = window.location.search;
67-
if (typeof uniqueId === 'undefined' || (!uniqueId) || uniqueId === '?') {
68-
uniqueId = 'graphgist-home';
69-
}
70-
PDRTJS_settings_7478426 = {
71-
"id" : "7478426",
72-
"unique_id" : uniqueId,
73-
"title" : heading,
74-
"permalink" : location
75-
};
64+
var location = window.location.href;
65+
var index = location.indexOf('#');
66+
if (index !== -1) {
67+
location = location.substr(0, index);
68+
}
69+
var uniqueId = window.location.search;
70+
if (typeof uniqueId === 'undefined' || (!uniqueId) || uniqueId === '?') {
71+
uniqueId = 'graphgist-home';
72+
}
73+
PDRTJS_settings_7478426 = {
74+
"id": "7478426",
75+
"unique_id": uniqueId,
76+
"title": heading,
77+
"permalink": location
78+
};
7679

77-
(function (d, s, id) {
78-
var js, fjs = d.getElementsByTagName(s)[0];
79-
if (d.getElementById(id)) return;
80-
js = d.createElement(s);
81-
js.id = id;
82-
js.src = "http://i0.poll.fm/js/rating/rating.js";
83-
fjs.parentNode.insertBefore(js, fjs);
84-
}(document, 'script', 'polldaddy-rating'));
80+
(function (d, s, id) {
81+
var js, fjs = d.getElementsByTagName(s)[0];
82+
if (d.getElementById(id)) return;
83+
js = d.createElement(s);
84+
js.id = id;
85+
js.src = "http://i0.poll.fm/js/rating/rating.js";
86+
fjs.parentNode.insertBefore(js, fjs);
87+
}(document, 'script', 'polldaddy-rating'));
8588

8689
}
8790

0 commit comments

Comments
 (0)