Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Commit a5f62ab

Browse files
committed
Merge pull request #21 from B-Translator/display-disqus-comments
Display Disqus comments. Fixes issue #5.
2 parents c01b644 + 6a9755b commit a5f62ab

File tree

6 files changed

+47
-0
lines changed

6 files changed

+47
-0
lines changed

html/_html/disqus.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div data-role="collapsible" data-inset="false" data-content-theme="false" data-mini="true" data-collapsed-icon="carat-l" data-expanded-icon="carat-d" data-iconpos="right">
2+
<h4>Disqus</h4>
3+
<div id="disqus_thread" class="disqus-wrap disqus-active"></div>
4+
</div>

html/_html/head.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
<link rel="stylesheet" href="css/app.css">
2929
<script src="js/config.js"></script>
3030
<script src="js/user.js"></script>
31+
<script src="js/disqus.js"></script>
3132
<script src="js/app.js"></script>

html/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ <h1>Fjalori ICT</h1>
3131

3232
{% include _html/translation_details.html %}
3333

34+
{% include _html/disqus.html %}
35+
3436
</div><!-- /content -->
3537

3638
<!-- messages -->

index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<link rel="stylesheet" href="css/app.css">
3232
<script src="js/config.js"></script>
3333
<script src="js/user.js"></script>
34+
<script src="js/disqus.js"></script>
3435
<script src="js/app.js"></script>
3536

3637
</head>
@@ -153,6 +154,12 @@ <h4>Voters ({{nr}})</h4>
153154
</script>
154155

155156

157+
<div data-role="collapsible" data-inset="false" data-content-theme="false" data-mini="true" data-collapsed-icon="carat-l" data-expanded-icon="carat-d" data-iconpos="right">
158+
<h4>Disqus</h4>
159+
<div id="disqus_thread" class="disqus-wrap disqus-active"></div>
160+
</div>
161+
162+
156163
</div><!-- /content -->
157164

158165
<!-- messages -->

js/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,29 @@ var $app = (function () {
264264
// Sending a new translation to the server.
265265
$('#new-translation-form').on('submit', send_new_translation);
266266
$('#send-new-translation').on('click', send_new_translation);
267+
268+
// Get the disqus comments for this term.
269+
reload_disqus(sguid, term);
267270
});
268271
};
272+
273+
var reload_disqus = function (sguid, term) {
274+
//var term = $('#search-term')[0].value;
275+
//var sguid = $('#new-translation').data('sguid');
276+
if ($('.disqus-wrap').length == 1) {
277+
$('.disqus-inactive').addClass('disqus-active').removeClass('disqus-inactive').attr('id','disqus_thread');
278+
}
279+
if (typeof(DISQUS) !== 'undefined'){
280+
DISQUS.reset({
281+
reload: true,
282+
config: function () {
283+
this.page.identifier = 'translations/sq/' + sguid;
284+
this.page.url = 'http://fjalori.fs.al/#' + term;
285+
this.page.title = term;
286+
}
287+
});
288+
}
289+
};
269290

270291
/**
271292
* When a translation from the list is clicked, display

js/disqus.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
$(document).ready(function () {
3+
var disqus_shortname = 'l10n-sq';
4+
5+
if (typeof(DISQUS) == 'undefined'){
6+
(function() {
7+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
8+
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
9+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
10+
})();
11+
}
12+
});

0 commit comments

Comments
 (0)