/*! * You are currently viewing the Ripple JavaScript source code. * Just so you know: if you want to see the source of the Ripple Frontend * (Hanayo), you can do so at https://github.com/osuYozora/hanayo * Un-minified version of this file as a whole is not available, however * its dependencies (jquery, timeago, semantic...) are open source, and ripple's * custom JS is available at /static/ripple.js. */ /*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */ function closeClosestMessage(){$(this).closest(".message").fadeOut(300,function(){$(this).remove()})}function showMessage(e,t){var n=$('
");n.find(".close.icon").click(closeClosestMessage),$("#messages-container").append(n),n.slideDown(300)}function api(e,t,n,i,o){"function"==typeof t&&(n=t,t=null),"boolean"==typeof i&&(o=i,i=void 0);var r="An error occurred while contacting the Ripple API. Please report this to a Ripple developer.";$.ajax({method:o?"POST":"GET",dataType:"json",url:hanayoConf.baseAPI+"/api/v1/"+e,data:o?JSON.stringify(t):t,contentType:o?"application/json; charset=utf-8":"",success:function(e){if(200!=e.code){if(e.code>=400&&e.code<500&&"function"==typeof i)return void i(e);console.warn(e),showMessage("error",r)}n(e)},error:function(e,t,n){return e.status>=400&&e.status<500&&"function"==typeof i?void i(e.responseJSON):(console.warn(e,t,n),void showMessage("error",r))}})}function escapeHTML(e){return String(e).replace(/[&<>"'\/]/g,function(e){return entityMap[e]})}function setupSimplepag(e){var t=$(".simplepag");t.find(".left.floated .item").click(function(){return!$(this).hasClass("disabled")&&(page--,void e())}),t.find(".right.floated .item").click(function(){return!$(this).hasClass("disabled")&&(page++,void e())})}function disableSimplepagButtons(e){var t=$(".simplepag");page<=1?t.find(".left.floated .item").addClass("disabled"):t.find(".left.floated .item").removeClass("disabled"),e?t.find(".right.floated .item").addClass("disabled"):t.find(".right.floated .item").removeClass("disabled")}function addCommas(e){e+="",x=e.split("."),x1=x[0],x2=x.length>1?"."+x[1]:"";for(var t=/(\d+)(\d{3})/;t.test(x1);)x1=x1.replace(t,"$1,$2");return x1+x2}function getScoreMods(e,t){var n=[];return 512==(512&e)&&(e&=-65),16384==(16384&e)&&(e&=-33),modsString.forEach(function(t,i){var o=1<0&&n.push(t)}),n.length>0?(t?"":"+ ")+n.join(", "):t?T("None"):""}function timeFormat(e){var t=Math.floor(e/3600);e%=3600;var n=Math.floor(e/60),i=e%60,o="";return t>0?(o+=t+":",n<10&&(o+="0"),o+=n+":"):o+=n+":",i<10&&(o+="0"),o+=i}function query(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^]*)|&|#|$)"),i=n.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function formToObject(e){var t=e.find("input, textarea, select"),n={};return t.each(function(e,t){if(t=$(t),void 0!==t.attr("name")){var i,o=t.attr("name").split(".");switch(t.attr("type")){case"checkbox":i=t.is(":checked");break;default:switch(t.data("cast")){case"int":i=+t.val();break;default:i=t.val()}}n=modifyObjectDynamically(n,o,i)}}),n}function modifyObjectDynamically(e,t,n){return 1===t.length?e[t[0]]=n:t.length>1&&("object"!=typeof e[t[0]]&&(e[t[0]]={}),e[t[0]]=modifyObjectDynamically(e[t[0]],t.slice(1),n)),e}function T(e,t){return"undefined"!=typeof t&&"undefined"!=typeof t.count&&$.inArray(hanayoConf.language,langWhitelist)===-1&&1!==t.count&&(e=keyPlurals[e]),i18next.t(e,t)}function privilegesToString(e){var t=[];return apiPrivileges.forEach(function(n,i){0!=(e&1<0&&t-1 in e)}function o(e,t,n){return he.isFunction(t)?he.grep(e,function(e,i){return!!t.call(e,i,e)!==n}):t.nodeType?he.grep(e,function(e){return e===t!==n}):"string"!=typeof t?he.grep(e,function(e){return ae.call(t,e)>-1!==n}):Te.test(t)?he.filter(t,e,n):(t=he.filter(t,e),he.grep(e,function(e){return ae.call(t,e)>-1!==n&&1===e.nodeType}))}function r(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function a(e){var t={};return he.each(e.match(De)||[],function(e,n){t[n]=!0}),t}function s(e){return e}function l(e){throw e}function c(e,t,n){var i;try{e&&he.isFunction(i=e.promise)?i.call(e).done(t).fail(n):e&&he.isFunction(i=e.then)?i.call(e,t,n):t.call(void 0,e)}catch(e){n.call(void 0,e)}}function u(){te.removeEventListener("DOMContentLoaded",u),e.removeEventListener("load",u),he.ready()}function d(){this.expando=he.expando+d.uid++}function f(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Me.test(e)?JSON.parse(e):e)}function p(e,t,n){var i;if(void 0===n&&1===e.nodeType)if(i="data-"+t.replace(Ie,"-$&").toLowerCase(),n=e.getAttribute(i),"string"==typeof n){try{n=f(n)}catch(e){}Ne.set(e,t,n)}else n=void 0;return n}function h(e,t,n,i){var o,r=1,a=20,s=i?function(){return i.cur()}:function(){return he.css(e,t,"")},l=s(),c=n&&n[3]||(he.cssNumber[t]?"":"px"),u=(he.cssNumber[t]||"px"!==c&&+l)&&$e.exec(he.css(e,t));if(u&&u[3]!==c){c=c||u[3],n=n||[],u=+l||1;do r=r||".5",u/=r,he.style(e,t,u+c);while(r!==(r=s()/l)&&1!==r&&--a)}return n&&(u=+u||+l||0,o=n[1]?u+(n[1]+1)*n[2]:+n[2],i&&(i.unit=c,i.start=u,i.end=o)),o}function g(e){var t,n=e.ownerDocument,i=e.nodeName,o=We[i];return o?o:(t=n.body.appendChild(n.createElement(i)),o=he.css(t,"display"),t.parentNode.removeChild(t),"none"===o&&(o="block"),We[i]=o,o)}function m(e,t){for(var n,i,o=[],r=0,a=e.length;r-1)o&&o.push(r);else if(c=he.contains(r.ownerDocument,r),a=v(d.appendChild(r),"script"),c&&b(a),n)for(u=0;r=a[u++];)Ke.test(r.type||"")&&n.push(r);return d}function x(){return!0}function w(){return!1}function C(){try{return te.activeElement}catch(e){}}function k(e,t,n,i,o,r){var a,s;if("object"==typeof t){"string"!=typeof n&&(i=i||n,n=void 0);for(s in t)k(e,s,n,i,t[s],r);return e}if(null==i&&null==o?(o=n,i=n=void 0):null==o&&("string"==typeof n?(o=i,i=void 0):(o=i,i=n,n=void 0)),o===!1)o=w;else if(!o)return e;return 1===r&&(a=o,o=function(e){return he().off(e),a.apply(this,arguments)},o.guid=a.guid||(a.guid=he.guid++)),e.each(function(){he.event.add(this,t,o,i,n)})}function T(e,t){return he.nodeName(e,"table")&&he.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e:e}function S(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function A(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function E(e,t){var n,i,o,r,a,s,l,c;if(1===t.nodeType){if(qe.hasData(e)&&(r=qe.access(e),a=qe.set(t,r),c=r.events)){delete a.handle,a.events={};for(o in c)for(n=0,i=c[o].length;n1&&"string"==typeof h&&!fe.checkClone&&nt.test(h))return e.each(function(n){var r=e.eq(n);g&&(t[0]=h.call(this,n,r.html())),R(r,t,i,o)});if(f&&(r=y(t,e[0].ownerDocument,!1,e,o),a=r.firstChild,1===r.childNodes.length&&(r=a),a||o)){for(s=he.map(v(r,"script"),S),l=s.length;d