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