src/build/html/_static/websupport.min.js
changeset 0 d153941bb745
equal deleted inserted replaced
-1:000000000000 0:d153941bb745
       
     1 !function(e){e.fn.autogrow=function(){return this.each(function(){var t=this;e.fn.autogrow.resize(t),e(t).focus(function(){t.interval=setInterval(function(){e.fn.autogrow.resize(t)},500)}).blur(function(){clearInterval(t.interval)})})},e.fn.autogrow.resize=function(t){var n=parseInt(e(t).css("line-height"),10),a=t.value.split("\n"),i=t.cols,o=0;e.each(a,function(){o+=Math.ceil(this.length/i)||1});var s=n*(o+1);e(t).css("height",s)}}(jQuery),function(e){function t(){n(),o()}function n(){e(document).on("click","a.comment-close",function(t){t.preventDefault(),c(e(this).attr("id").substring(2))}),e(document).on("click","a.vote",function(t){t.preventDefault(),y(e(this))}),e(document).on("click","a.reply",function(t){t.preventDefault(),x(e(this).attr("id").substring(2))}),e(document).on("click","a.close-reply",function(t){t.preventDefault(),k(e(this).attr("id").substring(2))}),e(document).on("click","a.sort-option",function(t){t.preventDefault(),b(e(this))}),e(document).on("click","a.show-proposal",function(t){t.preventDefault(),f(e(this).attr("id").substring(2))}),e(document).on("click","a.hide-proposal",function(t){t.preventDefault(),h(e(this).attr("id").substring(2))}),e(document).on("click","a.show-propose-change",function(t){t.preventDefault(),v(e(this).attr("id").substring(2))}),e(document).on("click","a.hide-propose-change",function(t){t.preventDefault(),g(e(this).attr("id").substring(2))}),e(document).on("click","a.accept-comment",function(t){t.preventDefault(),u(e(this).attr("id").substring(2))}),e(document).on("click","a.delete-comment",function(t){t.preventDefault(),p(e(this).attr("id").substring(2))}),e(document).on("click","a.comment-markup",function(t){t.preventDefault(),w(e(this).attr("id").substring(2))})}function a(){if("asc"==U.substring(0,3)){var t=U.substring(3);T=function(e,n){return e[t]-n[t]}}else T=function(e,t){return t[U]-e[U]};e("a.sel").attr("href","#").removeClass("sel"),e("a.by"+U).removeAttr("href").addClass("sel")}function o(){if(U="rating",document.cookie.length>0){var e=document.cookie.indexOf("sortBy=");if(-1!=e){e+=7;var t=document.cookie.indexOf(";",e);-1==t&&(t=document.cookie.length,U=unescape(document.cookie.substring(e,t)))}}a()}function s(t){e("#ao"+t).hide(),e("#ah"+t).show();var n=e.extend({id:t},I),a=e(C(E,n)).hide();a.find('textarea[name="proposal"]').hide(),a.find("a.by"+U).addClass("sel");var i=a.find("#cf"+t);i.submit(function(e){e.preventDefault(),d(i)}),e("#s"+t).after(a),a.slideDown("fast",function(){r(t)})}function c(t){e("#ah"+t).hide(),e("#ao"+t).show();var n=e("#sc"+t);n.slideUp("fast",function(){n.remove()})}function r(t){e.ajax({type:"GET",url:I.getCommentsURL,data:{node:t},success:function(n,a,i){var o=e("#cl"+t),s=100;if(e("#cf"+t).find('textarea[name="proposal"]').data("source",n.source),0===n.comments.length)o.html("<li>No comments yet.</li>"),o.data("empty",!0);else{var c=_(n.comments);s=100*n.comments.length,l(c,o),o.data("empty",!1)}e("#cn"+t).slideUp(s+200),o.slideDown(s)},error:function(e,t,n){O("Oops, there was a problem retrieving the comments.")},dataType:"json"})}function d(t){var n=t.find('input[name="node"]').val(),a=t.find('input[name="parent"]').val(),i=t.find('textarea[name="comment"]').val(),o=t.find('textarea[name="proposal"]').val();""!=i?(t.find("textarea,input").attr("disabled","disabled"),e.ajax({type:"POST",url:I.addCommentURL,dataType:"json",data:{node:n,parent:a,text:i,proposal:o},success:function(i,o,s){n&&g(n),t.find("textarea").val("").add(t.find("input")).removeAttr("disabled");var c=e("#cl"+(n||a));c.data("empty")&&(e(c).empty(),c.data("empty",!1)),m(i.comment),e("#ao"+n).find("img").attr({src:I.commentBrightImage}),n&&e("#ca"+n).slideUp()},error:function(e,n,a){t.find("textarea,input").removeAttr("disabled"),O("Oops, there was a problem adding the comment.")}})):O("Please enter a comment.")}function l(t,n){e.each(t,function(){var t=A(this);n.append(e(document.createElement("li")).html(t)),l(this.children,t.find("ul.comment-children")),this.children=null,t.data("comment",this)})}function m(t){var n=A(t);t.children=null,n.data("comment",t);var a=e("#cl"+(t.node||t.parent)),o=D(a),s=e(document.createElement("li"));for(s.hide(),i=0;i<o.length;i++)if(T(t,o[i])<=0)return e("#cd"+o[i].id).parent().before(s.html(n)),void s.slideDown("fast");a.append(s.html(n)),s.slideDown("fast")}function u(t){e.ajax({type:"POST",url:I.acceptCommentURL,data:{id:t},success:function(n,a,i){e("#cm"+t).fadeOut("fast"),e("#cd"+t).removeClass("moderate")},error:function(e,t,n){O("Oops, there was a problem accepting the comment.")}})}function p(t){e.ajax({type:"POST",url:I.deleteCommentURL,data:{id:t},success:function(n,a,i){var o=e("#cd"+t);if("delete"!=n){o.find("span.user-id:first").text("[deleted]").end().find("div.comment-text:first").text("[deleted]").end().find("#cm"+t+", #dc"+t+", #ac"+t+", #rc"+t+", #sp"+t+", #hp"+t+", #cr"+t+", #rl"+t).remove();var s=o.data("comment");s.username="[deleted]",s.text="[deleted]",o.data("comment",s)}else o.slideUp("fast",function(){o.remove()})},error:function(e,t,n){O("Oops, there was a problem deleting the comment.")}})}function f(t){e("#sp"+t).hide(),e("#hp"+t).show(),e("#pr"+t).slideDown("fast")}function h(t){e("#hp"+t).hide(),e("#sp"+t).show(),e("#pr"+t).slideUp("fast")}function v(t){e("#pc"+t).hide(),e("#hc"+t).show();var n=e("#pt"+t);n.val(n.data("source")),e.fn.autogrow.resize(n[0]),n.slideDown("fast")}function g(t){e("#hc"+t).hide(),e("#pc"+t).show();var n=e("#pt"+t);n.val("").removeAttr("disabled"),n.slideUp("fast")}function w(t){e("#mb"+t).toggle()}function b(t){for(var n=t.attr("class").split(/\s+/),i=0;i<n.length;i++)"sort-option"!=n[i]&&(U=n[i].substring(2));a();var o=new Date;o.setDate(o.getDate()+365),document.cookie="sortBy="+escape(U)+";expires="+o.toUTCString(),e("ul.comment-ul").each(function(t,n){var a=D(e(n),!0);l(a=_(a),e(n).empty())})}function y(t){if(I.voting){var n=t.attr("id");if(n){var a=0;"u"!=n.charAt(1)&&(a="u"==n.charAt(0)?1:-1);var i={comment_id:n.substring(2),value:a};t.hide(),e("#"+n.charAt(0)+("u"==n.charAt(1)?"v":"u")+i.comment_id).show();var o=e("div#cd"+i.comment_id),s=o.data("comment");0!==i.value&&s.vote===-1*i.value&&(e("#"+(1==i.value?"d":"u")+"u"+i.comment_id).hide(),e("#"+(1==i.value?"d":"u")+"v"+i.comment_id).show()),s.rating+=0===s.vote?i.value:i.value-s.vote,s.vote=i.value,o.data("comment",s),o.find(".rating:first").text(s.rating+" point"+(1==s.rating?"":"s")),e.ajax({type:"POST",url:I.processVoteURL,data:i,error:function(e,t,n){O("Oops, there was a problem casting that vote.")}})}}else O("You'll need to login to vote.")}function x(t){e("#rl"+t).hide(),e("#cr"+t).show();var n=e(C(j,{id:t})).hide();e("#cl"+t).prepend(n).find("#rf"+t).submit(function(n){n.preventDefault(),d(e("#rf"+t)),k(t)}).find("input[type=button]").click(function(){k(t)}),n.slideDown("fast",function(){e("#rf"+t).find("textarea").focus()})}function k(t){e("#rd"+t).slideUp("fast",function(){e(this).remove()}),e("#cr"+t).hide(),e("#rl"+t).show()}function _(t){return t.sort(T),e.each(t,function(){this.children=_(this.children)}),t}function D(t,n){var a=[];return t.children().children("[id^='cd']").each(function(){var t=e(this).data("comment");n&&(t.children=D(e(this).find("#cl"+t.id),!0)),a.push(t)}),a}function A(t){if(!t.displayed&&!I.moderator)return e('<div class="moderate">Thank you!  Your comment will show up once it is has been approved by a moderator.</div>');t.pretty_rating=t.rating+" point"+(1==t.rating?"":"s"),t.css_class=t.displayed?"":" moderate";var n=e.extend({},I,t),a=e(C(P,n));if(t.vote){var i=1==t.vote?"u":"d";a.find("#"+i+"v"+t.id).hide(),a.find("#"+i+"u"+t.id).show()}return(I.moderator||"[deleted]"!=t.text)&&(a.find("a.reply").show(),t.proposal_diff&&a.find("#sp"+t.id).show(),I.moderator&&!t.displayed&&a.find("#cm"+t.id).show(),(I.moderator||I.username==t.username)&&a.find("#dc"+t.id).show()),a}function C(t,n){function a(t,a){var o=n;return e.each(t.split("."),function(){o=o[this]}),a?i.text(o||"").html():o}var i=e(document.createElement("div"));return t.replace(/<([%#])([\w\.]*)\1>/g,function(){return a(arguments[2],"%"==arguments[1])})}function O(t){e(document.createElement("div")).attr({class:"popup-error"}).append(e(document.createElement("div")).attr({class:"error-message"}).text(t)).appendTo("body").fadeIn("slow").delay(2e3).fadeOut("slow")}var T,U;e.fn.comment=function(){return this.each(function(){var t=e(this).attr("id").substring(1),n=COMMENT_METADATA[t],a=n+" comment"+(1==n?"":"s"),i=n>0?I.commentBrightImage:I.commentImage,o=0==n?" nocomment":"";e(this).append(e(document.createElement("a")).attr({href:"#",class:"sphinx-comment-open"+o,id:"ao"+t}).append(e(document.createElement("img")).attr({src:i,alt:"comment",title:a})).click(function(t){t.preventDefault(),s(e(this).attr("id").substring(2))})).append(e(document.createElement("a")).attr({href:"#",class:"sphinx-comment-close hidden",id:"ah"+t}).append(e(document.createElement("img")).attr({src:I.closeCommentImage,alt:"close",title:"close"})).click(function(t){t.preventDefault(),c(e(this).attr("id").substring(2))}))})};var I={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",upArrow:"/static/_static/up.png",downArrow:"/static/_static/down.png",upArrowPressed:"/static/_static/up-pressed.png",downArrowPressed:"/static/_static/down-pressed.png",voting:!1,moderator:!1};"undefined"!=typeof COMMENT_OPTIONS&&(I=jQuery.extend(I,COMMENT_OPTIONS));var E='    <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>,         <code>``code``</code>,         code blocks: <code>::</code> 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 &#9657;          </a>          <a href="#" id="hc<%id%>" class="hide-propose-change">            Propose a change &#9663;          </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>',P='    <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 &#9657;</a>          <a href="#" class="close-reply" id="cr<%id%>">reply &#9663;</a>          <a href="#" id="sp<%id%>" class="show-proposal">proposal &#9657;</a>          <a href="#" id="hp<%id%>" class="hide-proposal">proposal &#9663;</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>',j='    <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>';e(document).ready(function(){t()})}(jQuery),$(document).ready(function(){$(".sphinx-has-comment").comment(),$("div.context").each(function(){var e=$.getQueryParameters(),t=e.q?e.q[0].split(/\s+/):[],n=$(this);$.each(t,function(){n.highlightText(this.toLowerCase(),"highlighted")})});var e=document.location.hash;"#comment-"==e.substring(0,9)&&($("#ao"+e.substring(9)).click(),document.location.hash="#s"+e.substring(9))});