This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This function hides Disqus if thread is closed and no comments were posted. | |
* It is better to place this function in HEAD. | |
* | |
* IMPORTANT: Please note, that this example uses internal APIs that might change in future. | |
* We will not provide any prior announcement before changing or removing any internal APIs. | |
*/ | |
var disqus_callback = function () { | |
if (DISQUS.jsonData.thread.closed && DISQUS.jsonData.thread.total_posts === 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_unicode(f): | |
if isinstance(f, dict): | |
for k, v in f.iteritems(): | |
f[str(k)] = to_unicode(v) | |
elif isinstance(f, (list, tuple)): | |
f = [to_unicode(f) for f in f] | |
elif isinstance(f, str): | |
f = f.decode('utf-8') | |
else: | |
f = unicode(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Comments count code example</title> | |
<!-- | |
Note: Disqus uses custom data- attributes to specify thread identifiers. | |
Those attributes are part of the HTML5 specs and already supported by all browsers. | |
For more information, see: | |
* http://ejohn.org/blog/html-5-data-attributes/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var disqus_config = function () { | |
var config = this; // Access to the config object | |
/* | |
All currently supported events: | |
* preData — fires just before we request for initial data | |
* preInit - fires after we get initial data but before we load any dependencies | |
* onInit - fires when all dependencies are resolved but before dtpl template is rendered | |
* afterRender - fires when template is rendered but before we show it | |
* onReady - everything is done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You will need to locate a block with name "postbox_login_options_horizontal". | |
There, you will see that we create an unordered list (UL) with login buttons as | |
its items. | |
You will want to put your buttons just after the FOR loop (i.e. immediately | |
after the closing { /for }). Just make sure that your LI tag has class | |
"dsq-login-button". | |
<ul class="dsq-login-buttons"> | |
{ for option in loginOptions } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ block commentMessage :cls } | |
<div class="{= cls }" id="dsq-comment-message-{= comment.id }"> | |
{ if comment.killed } | |
<em>{ "Comment removed." }</em> | |
{ elif !comment.approved } | |
<em>{ "This comment was flagged for review." }</em> | |
{ else } | |
{= comment.message } | |
{ if comment.last_modified_by == 'moderator' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ block editArea } | |
<div class="dsq-textarea-wrapper"> | |
<textarea class="dsq-edit-textarea" id="dsq-edit-textarea-{= comment.id }">{= comment.message }</textarea> | |
</div> | |
<div class="dsq-save-edit"> | |
<button type="button" | |
onclick="DISQUS.dtpl.actions.fire('comments.edit.send', {= comment.id }, this);">{ "Save edit" }</button> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outer() { | |
var a = true; | |
function inner() { | |
// Does compiler keep a reference to outer for this function? | |
} | |
} | |
outer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>DISQUS JavaScript Tests</title> | |
<!-- Hiro files --> | |
<link rel="stylesheet" href="css/tests/hiro.css"> | |
<script src="js/tests/ender.js"></script> | |
<script src="js/tests/hiro.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe id="hey"></iframe> | |
<script> | |
var hey = document.getElementById("hey"); | |
alert(document.querySelector); | |
hey.contentWindow.document.write('<html><scr' + 'ipt>alert(document.querySelector);</scr' + 'ipt></html>'); | |
hey.contentWindow.document.close(); | |
</script> |
OlderNewer