/*
* ~~~~~~~~~~~~~
*
* sphinx.websupport utilties for all documentation.
*
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
(function($) {
return this.each(function() {
var textarea = this;
$(textarea)
.focus(function() {
}, 500);
})
.blur(function() {
});
});
};
var lineCount = 0;
});
};
})(jQuery);
(function($) {
function init() {
initEvents();
}
function initEvents() {
});
handleVote($(this));
});
});
});
handleReSort($(this));
});
});
});
});
});
});
});
});
}
/**
* Set comp, which is a comparator function used for sorting and
* inserting comments into the list.
*/
function setComparator() {
// If the first three letters are "asc", sort in ascending order
// and remove the prefix.
comp = function(a, b) { return a[i] - b[i]; };
} else {
// Otherwise sort in descending order.
}
// Reset link styles and format the selected sort option.
}
/**
* Create a comp function. If the user has preferences stored in
* the sortBy cookie, use those, otherwise use the default.
*/
function initComparator() {
// If the sortBy cookie is set, use that instead.
if (start != -1) {
if (end == -1) {
}
}
}
}
/**
* Show a comment div.
*/
});
});
}
/**
* Hide a comment div.
*/
});
}
/**
* Perform an ajax request to get comments for a node
* and insert the comments into the comments tree.
*/
$.ajax({
type: 'GET',
var speed = 100;
$('#cf' + id)
.find('textarea[name="proposal"]')
} else {
// If there are comments, sort them and put them in the list.
}
},
showError('Oops, there was a problem retrieving the comments.');
},
dataType: 'json'
});
}
/**
* Add a comment via ajax and insert the comment into the comment tree.
*/
if (text == '') {
showError('Please enter a comment.');
return;
}
// Disable the form that is being submitted.
// Send the comment to the server.
$.ajax({
type: "POST",
dataType: 'json',
data: {
},
// Reset the form.
if (node_id) {
}
.val('')
.removeAttr('disabled');
}
if (node_id) {
// if this was a "root" comment, remove the commenting box
// (the user can get it back by reopening the comment popup)
}
},
showError('Oops, there was a problem adding the comment.');
}
});
}
/**
* Recursively append comments to the main comment list and children
* lists, creating the comment tree.
*/
var div = createCommentDiv(this);
// To avoid stagnating data, don't store the comments children in data.
this.children = null;
});
}
/**
* After adding a new comment, it must be inserted in the correct
* location in the comment tree.
*/
// To avoid stagnating data, don't store the comments children in data.
// Determine where in the parents children list to insert this comment.
.parent()
return;
}
}
// If we get here, this comment rates lower than all the others,
// or it is the only comment in the list.
}
$.ajax({
type: 'POST',
},
showError('Oops, there was a problem accepting the comment.');
}
});
}
$.ajax({
type: 'POST',
if (data == 'delete') {
// Moderator mode: remove the comment and all children immediately
});
return;
}
// User mode: only mark the comment as deleted
.find('span.user-id:first')
.find('div.comment-text:first')
.remove();
},
showError('Oops, there was a problem deleting the comment.');
}
});
}
}
}
}
}
}
/** Handle when the user clicks on a sort by link. */
if (classes[i] != 'sort-option') {
}
}
var expiration = new Date();
});
}
/**
* Function to process a vote when a user clicks an arrow.
*/
showError("You'll need to login to vote.");
return;
}
if (!id) {
// Didn't click on one of the voting arrows.
return;
}
// If it is an unvote, the new vote value is 0,
// Otherwise it's 1 for an upvote, or -1 for a downvote.
var value = 0;
}
// The data to be sent to the server.
var d = {
};
// Swap the vote and unvote links.
.show();
// The div the comment is displayed in.
// If this is not an unvote, and the other vote arrow has
// already been pressed, unpress it.
}
// Update the comments rating in the local data.
// Change the rating text.
// Send the vote information to the server.
$.ajax({
type: "POST",
data: d,
showError('Oops, there was a problem casting that vote.');
}
});
}
/**
* Open a reply form used to reply to an existing comment.
*/
// Swap out the reply link for the hide link
// Add the reply li to the children ul.
$('#cl' + id)
// Setup the submit handler for the reply form.
closeReply(id);
})
.find('input[type=button]')
.click(function() {
closeReply(id);
});
});
}
/**
* Close the reply form opened with openReply.
*/
// Remove the reply div from the DOM.
$(this).remove();
});
// Swap out the hide link for the reply link
}
/**
* Recursively sort a tree of comments using the comp comparator.
*/
});
return comments;
}
/**
* Get the children comments from a ul. If recursive is true,
* recursively include childrens' children.
*/
var children = [];
.each(function() {
if (recursive)
});
return children;
}
/** Create a div to display a comment in. */
return $('<div class="moderate">Thank you! Your comment will show up '
+ 'once it is has been approved by a moderator.</div>');
}
// Prettify the comment rating.
// Make a class (for displaying not yet moderated comments differently)
// Create a div for this comment.
// If the user has voted on this comment, highlight the correct arrow.
}
if (comment.proposal_diff)
}
return div;
}
/**
* A simple template renderer. Placeholders such as <%id%> are replaced
* by context['id'] with items being escaped. Placeholders such as <#id#>
* are not escaped.
*/
});
}
});
}
/** Flash an error message briefly. */
.appendTo('body')
.fadeIn("slow")
.delay(2000)
.fadeOut("slow");
}
/** Add a link the user uses to open the comments popup. */
return this.each(function() {
$(this)
.append(
href: '#',
})
alt: 'comment',
}))
})
)
.append(
href: '#',
'class': 'sphinx-comment-close hidden',
})
alt: 'close',
title: 'close'
}))
})
);
});
};
var opts = {
processVoteURL: '/_process_vote',
addCommentURL: '/_add_comment',
getCommentsURL: '/_get_comments',
acceptCommentURL: '/_accept_comment',
deleteCommentURL: '/_delete_comment',
commentImage: '/static/_static/comment.png',
closeCommentImage: '/static/_static/comment-close.png',
loadingImage: '/static/_static/ajax-loader.gif',
commentBrightImage: '/static/_static/comment-bright.png',
upArrowPressed: '/static/_static/up-pressed.png',
downArrowPressed: '/static/_static/down-pressed.png',
voting: false,
moderator: false
};
if (typeof COMMENT_OPTIONS != "undefined") {
}
<div class="sphinx-comments" id="sc<%id%>">\
<p class="sort-options">\
Sort by:\
<a href="#" class="sort-option byrating">best rated</a>\
<a href="#" class="sort-option byascage">newest</a>\
<a href="#" class="sort-option byage">oldest</a>\
</p>\
<div class="comment-header">Comments</div>\
<div class="comment-loading" id="cn<%id%>">\
loading comments... <img src="<%loadingImage%>" alt="" /></div>\
<ul id="cl<%id%>" class="comment-ul"></ul>\
<div id="ca<%id%>">\
<p class="add-a-comment">Add a comment\
(<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\
<div class="comment-markup-box" id="mb<%id%>">\
reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \
<tt>``code``</tt>, \
code blocks: <tt>::</tt> and an indented block after blank line</div>\
<form method="post" id="cf<%id%>" class="comment-form" action="">\
<textarea name="comment" cols="80"></textarea>\
<p class="propose-button">\
<a href="#" id="pc<%id%>" class="show-propose-change">\
Propose a change ▹\
</a>\
<a href="#" id="hc<%id%>" class="hide-propose-change">\
Propose a change ▿\
</a>\
</p>\
<textarea name="proposal" id="pt<%id%>" cols="80"\
spellcheck="false"></textarea>\
<input type="submit" value="Add comment" />\
<input type="hidden" name="node" value="<%id%>" />\
<input type="hidden" name="parent" value="" />\
</form>\
</div>\
</div>';
<div id="cd<%id%>" class="sphinx-comment<%css_class%>">\
<div class="vote">\
<div class="arrow">\
<a href="#" id="uv<%id%>" class="vote" title="vote up">\
<img src="<%upArrow%>" />\
</a>\
<a href="#" id="uu<%id%>" class="un vote" title="vote up">\
<img src="<%upArrowPressed%>" />\
</a>\
</div>\
<div class="arrow">\
<a href="#" id="dv<%id%>" class="vote" title="vote down">\
<img src="<%downArrow%>" id="da<%id%>" />\
</a>\
<a href="#" id="du<%id%>" class="un vote" title="vote down">\
<img src="<%downArrowPressed%>" />\
</a>\
</div>\
</div>\
<div class="comment-content">\
<p class="tagline comment">\
<span class="user-id"><%username%></span>\
<span class="rating"><%pretty_rating%></span>\
<span class="delta"><%time.delta%></span>\
</p>\
<div class="comment-text comment"><#text#></div>\
<p class="comment-opts comment">\
<a href="#" class="reply hidden" id="rl<%id%>">reply ▹</a>\
<a href="#" class="close-reply" id="cr<%id%>">reply ▿</a>\
<a href="#" id="sp<%id%>" class="show-proposal">proposal ▹</a>\
<a href="#" id="hp<%id%>" class="hide-proposal">proposal ▿</a>\
<a href="#" id="dc<%id%>" class="delete-comment hidden">delete</a>\
<span id="cm<%id%>" class="moderation hidden">\
<a href="#" id="ac<%id%>" class="accept-comment">accept</a>\
</span>\
</p>\
<pre class="proposal" id="pr<%id%>">\
<#proposal_diff#>\
</pre>\
<ul class="comment-children" id="cl<%id%>"></ul>\
</div>\
<div class="clearleft"></div>\
</div>\
</div>';
<li>\
<div class="reply-div" id="rd<%id%>">\
<form id="rf<%id%>">\
<textarea name="comment" cols="80"></textarea>\
<input type="submit" value="Add reply" />\
<input type="button" value="Cancel" />\
<input type="hidden" name="parent" value="<%id%>" />\
<input type="hidden" name="node" value="" />\
</form>\
</div>\
</li>';
init();
});
})(jQuery);
// add comment anchors for all paragraphs that are commentable
$('.sphinx-has-comment').comment();
// highlight search words in search results
$("div.context").each(function() {
var params = $.getQueryParameters();
var result = $(this);
});
});
// directly open comment window if requested
}
});