<div id="disqus_thread">
</div>
<script type="text/javascript">
var disqus_shortname = 'umigarrett';
var disqus_identifier =title; // "title" is a variable provided by fancybox; it's the name of the image
alert( disqus_identifier );
var disqus_url = window.location.href+'/'+title;
window.disqus_no_style = true;
var disqus_container_id = 'disqus_thread';
var disqus_title = 'Photo '+title;
var disqus_message = title;
oldDsq = document.getElementById('disqusCommentScript');
if(oldDsq) {
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).removeChild(oldDsq);
}
var dsq = document.createElement('script');
dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://umigarrett.disqus.com/embed.js';
dsq.id = 'disqusCommentScript';
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(dsq);
</script>
<div id="disqus_thread">
</div>
<script type="text/javascript">
if( typeof DISQUS != 'undefined' ) {
DISQUS.reload({
reload: true,
config: function () {
this.page.identifier = title; // "title" is a variable provided by fancybox; it's the name of the image
this.page.url = window.location.href;
}
});
}
oldDsq = document.getElementById('disqusCommentScript');
if(oldDsq) { // remove old instance of the disqus script if it's still around
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).removeChild(oldDsq);
}
var disqus_shortname = 'umigarrett'; // start filling up identifier info
var disqus_identifier =title;
var disqus_url = window.location.href+'/'+title;
window.disqus_no_style = true;
var disqus_container_id = 'disqus_thread';
var disqus_title = 'Photo '+title;
var disqus_message = title;
var dsq = document.createElement('script');
dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://umigarrett.disqus.com/embed.js';
dsq.id = 'disqusCommentScript';
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(dsq);
</script>
App.DisqusView = Em.View.extend({
template: function( model ){
window.disqus_shortname = 'cancernomograms';
window.disqus_no_style = true;
window.disqus_identifier = 'nomogram_' + model.get('id');
window.disqus_url = 'http://'+document.domain+'/#!/'+model.get('slug');
return '';
},
didInsertElement: function(){
Ember.run.scheduleOnce('afterRender', this, this.renderComments);
},
renderComments: function(){
console.log( window.disqus_identifier, window.disqus_url );
if (w.DISQUS) {
w.DISQUS.reset({
reload: true,
config: function () {
this.page.identifier = window.disqus_identifier;
this.page.url = window.disqus_url;
}
});
} else {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + window.disqus_shortname + '.disqus.com/embed.js';
$('head').append(dsq);
}
}
});window.disqus_url = 'http://'+document.domain+'/'+model.get('slug');
--
You received this message because you are subscribed to the Google Groups "Disqus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to disqus-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
<a href="#" onclick="refresh_Disqus_1()">Refresh Comments in Spanish</a> <!-- With above button you trigger the dynamic load of your 1st location, or you bind it with the page load event or any other event -->
<div id="disqus_container_1"> <!-- into this first container we will re-injekt the '<div id="disqus_thread"></div>' when we switch back to our first thread --> <!-- and delete the '<div id="disqus_thread"></div>' at the 2nd location where we injekted --> </div>...
...
<a href="#" onclick="refresh_Disqus_2()">Refresh Comments in English</a> <!-- With above button you trigger the dynamic load of your 2nd location, or you bind it with the page load event or any other event -->
<div id="disqus_container_2"> <!-- into this container we will injekt the '<div id="disqus_thread"></div>' which tells DISQUS where to place the widget now --> <!-- and delete the '<div id="disqus_thread"></div>' at our first location <div id="disqus_container_1"> --> </div>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
// define your variables globally (outside function - because that's what messes up ...) :
var disqus_shortname = 'your_shortname_1';var disqus_identifier = 'your_identifier_1';var disqus_url = 'http://www.example.html/page_1.html';var disqus_title = 'Your Title_1';var disqus_language = 'en'; // declare a function that will load the DISQUS widget:
function loadDisqus() { (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();};
// define your DISQUS parameters dynamically (ex. _1 and _2 ):
// important: injekt (and delete at other location of your site) '<div id="disqus_thread"></div>'
function set_Disqus_2() { $("#disqus_container_1").html(""); // deleting on first location $("#disqus_container_2").html('<div id="disqus_thread"></div>'); // injecting on different location on same DOM
disqus_shortname = 'your_shortname_2'; disqus_identifier = 'your_identifier_2'; disqus_url = 'http://www.example.html/page_2.html'; disqus_title = 'Your Title_2'; disqus_language = 'es';};
// likewise you can switch back to your first div container with second function and reload first thread:
function set_Disqus_1() { $("#disqus_container_2").html(""); // deleting from second location $("#disqus_container_1").html('<div id="disqus_thread"></div>'); // injecting back again to first location on same DOM
disqus_shortname = 'your_shortname_1'; disqus_identifier = 'your_identifier_1'; disqus_url = 'http://www.example.html/page_1.html'; disqus_title = 'Your Title_1'; disqus_language = 'en';};
// declare your two functions to switch back and forth from location and thread _1 to _2:
function refresh_Disqus_1() // Click event of Reload Button _1{ set_Disqus_1(); loadDisqus()};
function refresh_Disqus_2() // Click event of Reload Button _2{ set_Disqus_2(); loadDisqus()};