-
-
Save Kreijstal/f00af4e11a925ff935bf20d7a529cb9e to your computer and use it in GitHub Desktop.
//>implying whoever reads it can understand this | |
//Minified code from Rainb Essentials. | |
var genParser=function(e,t,n){function r(e,t){var n,r,i,a;return e?e instanceof RegExp?(i=new RegExp,i.compile("^(?:"+e.source+")",(e.multiline?"m":"")+(e.eturnignoreCase?"i":"")),n=i.exec(o.substr(s)),r=n&&n[0],null===r?null:(s+=r.length,r)):"string"==typeof e?e===o.substr(s,e.length)?(s+=e.length,e):null:(r=e.type,a=c[r],n=a(e,t),a?n:null):null}function i(e){return o=e,s=0,a.unknown(r(u))}var o,s,a=t,u={type:"type",is:n},c={expression:function(e){var t,n,i,o,s,a,u,c,l,p,f,h,d,g={type:"alternate",contains:[e.contains]},b={type:"alternate",contains:[]},y={type:"alternate",contains:[]},m=[],v=[];if(c=e.operators){for(t=0,i=c.length;i>t;t++)for(n=0,o=c[t].tokens.length;o>n;n++)a=c[t].tokens[n],e.whiteSpaceIgnore?"string"==typeof a?b.contains.push(new RegExp("\\s*(?:"+a.replace(/([-+\\?.!$^&*(){}[\]])/g,"\\$1")+")\\s*")):a instanceof RegExp?b.contains.push(new RegExp("\\s*(?:"+a.source+")\\s*",(a.multiline?"m":"")+(a.ignoreCase?"i":""))):b.contains.push({type:"tyArray",contains:[/\s*/,a,/\s*/]}):b.contains.push(a);g.contains[1]=b}if(c=e.delimeters){for(t=0,i=c.length;i>t;t++)for(n=0,o=c[t].length;o>n;n++)a=c[t][n],e.whiteSpaceIgnore?"string"==typeof a?y.contains.push(new RegExp("s*(?:"+a+")s*")):a instanceof RegExp?y.contains.push(new RegExp("s*(?:"+a.source+")s*",(a.multiline?"m":"")+(a.ignoreCase?"i":""))):y.contains.push({type:"tyArray",contains:[/\s*/,a,/\s*/]}):y.contains.push(a);g.contains[2]=y}for(;u=r(g,s={});)if(s._matched===g.contains[0])m.push(u);else if(s._matched===b){if(-1===(n=b.contains.indexOf(s.props._matched)))throw new Error("props.props._matched not found at oper.contains, This is impossible.. or is it?");for(t=0,i=(c=e.operators).length,d=0;i>t;t++)if((d+=c[t].tokens.length)>n){l=c[t].precedence,p=c[t].rightAssociative;break}for(;(o=v.length)&&(!p&&l===v[o-1][1]||l<v[o-1][1]);)for(h=m.pop(),f=m.pop(),m.length||f||console.warn("NOT ENOUGH TERMS"),a=v.pop(),t=0,i=(c=e.operators).length,d=0;i>t;t++)if((d+=c[t].tokens.length)>a[2]){m.push({operation:c[t].tokens[a[2]-(d-c[t].tokens.length)],op:a[0],arguments:[f,h],name:"operator"});break}v.push([u,l,n])}else if(s._match!==y)throw Error("This is impossible! It has matched an unknown value..???");for(;o=v.length;)for(h=m.pop(),f=m.pop(),m.length||f||console.warn("NOT ENOUGH TERMS"),a=v.pop(),t=0,i=(c=e.operators).length,d=0;i>t;t++)if((d+=c[t].tokens.length)>a[2]){m.push({operation:c[t].tokens[a[2]-(d-c[t].tokens.length)],op:a[0],arguments:[f,h],name:"operator"});break}if(m.length<1)return null;if(1!==m.length)throw new Error("Operators and expressions mismatch!!");return m[0]},type:function(t){var n,i,o={},s=r(e[t.is],o);if(null===s)return null;i={type:(n=e[t.is])&&(n.delimiting?"list":n.type||("string"==typeof n||n instanceof RegExp?"String":void 0)),name:t.is,content:s};for(var a in o)o.hasOwnProperty(a)&&!i[a]&&(i[a]=o[a]);return i},repeat:function(e,t){var n,i,o,a,u,c=[],l=s,p=e.delimiting,f=0,a=p&&e.multipleDelimeters;i=e.contains,t.props=[];do{if(n=r(p&&1&f?p:i,u={}),!a&&p&&1&f){if(f++,null!==n)continue;break}f++,null!==n&&(c.push(n),t.props.push(u))}while(null!==n&&f!==e.to);return o=c.length,!e.optional&&0==o||!isNaN(a=e.from)&&a>o?(s=l,null):(p&&!a&&(t.delimeter=p),c)},tyArray:function(e,t){var n,i,o=[],a=s,u=e.optional||[];t.props=[];for(var c,l=0,p=e.contains.length;p>l;l++){if(c=e.contains[l],n=r(c,i={}),null===n&&u.indexOf(l)<0)return s=a,null;null!==n&&t.props.push(i),o.push(n)}return o},alternate:function(e,t){for(var n,i,o=null,s={},a=0,u=e.contains.length;u>a;a++)if(i=e.contains[a],n=r(i,s),null!==n){o=n,t.props=s,t._matched=i;break}return o}};return i},CssSelectorParser=genParser({"type selector":/\*|(?:[\w_]|\\x?[a-f0-9]{2,6}\s?|\\[\S\s])(?:[^\\\s#.>&+~:,="'[\]\)]|\\x?[a-f0-9]{2,6}\s?|\\[\S\s])*/i,attributeValue:{type:"alternate",contains:[/"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'/i,{type:"type",is:"type selector"}]},"pseudo-class":{type:"alternate",contains:[{type:"tyArray",contains:[":not",{type:"tyArray",contains:["(",{type:"type",is:"selectorArray"},")"]}]},{type:"tyArray",contains:[/::?(?:[\w_]|\\x?[a-f0-9]{2,6}\s?|\\[\S\s])(?:[^\\\s#.>&+~:,(]|\\x?[a-f0-9]{2,6}\s?|\\[\S\s])*/,{type:"tyArray",contains:["(",/(?:[^)\\]|\\[\S\s])*/,")"]}],optional:[1]}]},operator:/\s*(?:\$=|\^=|~=|\|=|\*=|=)\s*/,"attribute selector":{type:"tyArray",contains:["[",{type:"tyArray",contains:[{type:"type",is:"type selector"},{type:"type",is:"operator"},{type:"type",is:"attributeValue"}],optional:[1,2]},"]"]},"ID selector":{type:"tyArray",contains:["#",{type:"type",is:"type selector"}]},"class selector":{type:"tyArray",contains:[".",{type:"type",is:"type selector"}]},"simple selector":{type:"repeat",contains:{type:"alternate",contains:[{type:"type",is:"type selector"},{type:"type",is:"class selector"},{type:"type",is:"ID selector"},{type:"type",is:"attribute selector"},{type:"type",is:"pseudo-class"}]}},selector:{type:"expression",contains:{type:"type",is:"simple selector"},whiteSpaceIgnore:!0,rightAssociative:!0,operators:[{precedence:1,tokens:[">","&","+","~",/\s/]}]},selectorArray:{type:"repeat",delimiting:/\s*,\s*/,contains:{type:"type",is:"selector"}}},{unknown:function(e){return e.name?this[e.name](e):e},selectorArray:function(e){for(var t={name:"selector group",list:[]},n=0,r=e.content.length;r>n;n++)t.list.push(this.unknown(e.content[n]));return t},selector:function(e){return this.unknown(e.content)},"simple selector":function(e){var t,n,r={};r["class"]=[],r.attributes=[],r.pseudoClass=[];for(var i,o=0,s=e.content.length;s>o;o++)switch(i=e.content[o],i.name){case"type selector":r.tagName||(r.tagname=this.unescape(i.content));break;case"class selector":r["class"].push(this.unescape(i.content[1].content));break;case"ID selector":r.ID||(r.ID=this.unescape(i.content[1].content));break;case"attribute selector":t={attributeName:this.unescape(i.content[1][0].content)},(n=i.content[1][1])&&(t.operator=n.content,t.attributeValue=this.unescape(i.content[1][2].content)),r.attributes.push(t);break;case"pseudo-class":r.pseudoClass.push({"class":this.unescape(i.content[0]),value:i.content[1]&&this.unknown(i.content[1][1])})}return r},operator:function(e){var t=this.unknown(e.arguments[1]);return t.parent=this.unknown(e.arguments[0]),t.parentRelationship=e.op,t},unescape:function(e){var t,n,r=[{search:/\\([0-9A-fa-f]{1,6} ?)/g,replace:{f:"hexadecimal","for":1}},{search:/\\(.)/g,replace:{"for":1}}],i=e;'"'!=e[0]&&"'"!=e[0]||e[0]!==e[e.length-1]||(i=e.substring(1,e.length-1));for(var o=0;o<r.length;o++)void 0===(n=r[o].replace.f)?t="$"+r[o].replace["for"]:"hexadecimal"==n&&(t=function(e){return String.fromCharCode(parseInt(arguments[r[o].replace["for"]],16))}),i=i.replace(r[o].search,t);return i}},"selectorArray");$Rainb={d:document.documentElement},$Rainb.id=function(e){return document.getElementById(e)},$Rainb.ready=function(e){var t;return"loading"!==document.readyState?void e():(t=function(){return $Rainb.off(document,"DOMContentLoaded",t),e()},$Rainb.on(document,"DOMContentLoaded",t))},$Rainb.formData=function(e){var t,n,r;if(e instanceof HTMLFormElement)return new FormData(e);t=new FormData;for(n in e)r=e[n],r&&("object"==typeof r&&"newName"in r?t.append(n,r,r.newName):t.append(n,r));return t},$Rainb.extend=function(e,t){var n,r;for(n in t)r=t[n],e[n]=r},$Rainb.deepCompare=function(){function e(t,n){var o;if(isNaN(t)&&isNaN(n)&&"number"==typeof t&&"number"==typeof n)return!0;if(t===n)return!0;if("function"==typeof t&&"function"==typeof n||t instanceof Date&&n instanceof Date||t instanceof RegExp&&n instanceof RegExp||t instanceof String&&n instanceof String||t instanceof Number&&n instanceof Number)return t.toString()===n.toString();if(!(t instanceof Object&&n instanceof Object))return!1;if(t.isPrototypeOf(n)||n.isPrototypeOf(t))return!1;if(t.constructor!==n.constructor)return!1;if(t.prototype!==n.prototype)return!1;if(r.indexOf(t)>-1||i.indexOf(n)>-1)return!1;for(o in n){if(n.hasOwnProperty(o)!==t.hasOwnProperty(o))return!1;if(typeof n[o]!=typeof t[o])return!1}for(o in t){if(n.hasOwnProperty(o)!==t.hasOwnProperty(o))return!1;if(typeof n[o]!=typeof t[o])return!1;switch(typeof t[o]){case"object":case"function":if(r.push(t),i.push(n),!e(t[o],n[o]))return!1;r.pop(),i.pop();break;default:if(t[o]!==n[o])return!1}}return!0}var t,n,r,i;if(arguments.length<1)return!0;for(t=1,n=arguments.length;n>t;t++)if(r=[],i=[],!e(arguments[0],arguments[t]))return!1;return!0},$Rainb.on=function(e,t,n){var r,i,o,s;for(s=t.split(" "),i=0,o=s.length;o>i;i++)r=s[i],e.addEventListener(r,n,!1)},$Rainb.off=function(e,t,n){var r,i,o,s;for(s=t.split(" "),i=0,o=s.length;o>i;i++)r=s[i],e.removeEventListener(r,n,!1)},$Rainb.el=function(e,t,n,r){var i,o=e instanceof Element?e:document.createElement(e);for(var s in t)if("style"!=s)if("__properties"!=s)o.setAttribute(s,t[s]);else for(a in t[s])o[a]=t[s][a];else for(var a in t[s])o.style[a]=t[s][a];if(n&&(i=n.length))for(var u,c=0;i>c;c++)u=n[c],u.length&&"string"==typeof u?o.appendChild(document.createTextNode(u)):o.appendChild(u);if(r&&(i=r.length))for(var u,c=0;i>c;c++)u=r[c],$Rainb.on(o,u.lstng,u.cb);return o},$Rainb.HTTP=function(){var e={};return function(t,n,i,o){function s(){if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof window.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP.4.0")}catch(e){try{return new ActiveXObject("MSXML2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}}}function a(e,t){var n;for(n in e)e.hasOwnProperty(n)&&t.call(e,n,e[n])}n=n||{},n.method=n.method||"GET";var u=s(),c=!0;return u?($Rainb.extend(u,n.opts),$Rainb.extend(u.upload,n.upCallbacks),u.open(n.method,t,!n.sync),n.whenModified&&(t in e&&u.setRequestHeader("If-Modified-Since",e[t]),$Rainb.on(r,"load",function(){return e[t]=r.getResponseHeader("Last-Modified")})),a(o,function(e,t){u.setRequestHeader(e,t)}),u.onreadystatechange=function(){u.readyState==u.DONE&&c&&(c=!1,i(u))},u.onloadend=function(){c&&(c=!1,i(u))},u.send(n.post),u):null}}(),$Rainb.hasClass=function(e,t){return e.classList&&e.classList.contains(t)},$Rainb.rm=function(e){return e&&e.parentNode.removeChild(e)},$Rainb.tn=function(e){return document.createTextNode(e)},$Rainb.add=function(e,t){return e.appendChild($Rainb.nodes(t))},$Rainb.nodes=function(e){var t,n,r,i;if(!(e instanceof Array))return e;for(t=d.createDocumentFragment(),r=0,i=e.length;i>r;r++)n=e[r],t.appendChild(n);return t},$Rainb.prepend=function(e,t){return e.insertBefore($Rainb.nodes(t),e.firstChild)},$Rainb.bubbleFind=function(e,t){for(;null!==e;){if($Rainb.isElement(e,t))return e;e=e.parentNode}},$Rainb.nodes=function(e){var t,n,r,i;if(!(e instanceof Array))return e;for(t=document.createDocumentFragment(),r=0,i=e.length;i>r;r++)n=e[r],t.appendChild(n);return t},$Rainb.after=function(e,t){return e.parentNode.insertBefore($Rainb.nodes(t),e.nextSibling)},$Rainb.before=function(e,t){return e.parentNode.insertBefore($Rainb.nodes(t),e)},$Rainb.replace=function(e,t){return e.parentNode.replaceChild($Rainb.nodes(t),e)},$Rainb.ins=function(e,t,n){var r=e.scrollTop,i=0;n=n||"";var o=e.selectionStart||"0"==e.selectionStart?"ff":document.selection?"ie":!1;if("ie"==o){e.focus();var s=document.selection.createRange();s.moveStart("character",-e.value.length),i=s.text.length}else"ff"==o&&(i=e.selectionStart);var a=e.value.substring(0,i),u=e.value.substring(i,e.selectionEnd),c=e.value.substring(e.selectionEnd,e.value.length);if(e.value=a+t+u+n+c,i=i+t.length+u.length+n.length,"ie"==o){e.focus();var s=document.selection.createRange();s.moveStart("character",-e.value.length),s.moveStart("character",i),s.moveEnd("character",0),s.select()}else"ff"==o&&(e.selectionStart=i,e.selectionEnd=i,e.focus());e.scrollTop=r},$Rainb.alast=function(e){return e[e.length-1]},$Rainb.till=function(){function e(r){if(t.length)for(var i=0,o=t.length;o>i;i++)$Rainb.isElement(t[i].selector,r.target)&&t[i].cb(r.target);else $Rainb.off(document,"DOMNodeInserted",e),n=!1}var t=[],n=!1;return function(r,i,o){o=o||window;var s;(s=document.querySelector(r))?i(s):(t.push({selector:r,cb:i}),n||($Rainb.on(document,"DOMNodeInserted",e),n=!0))}}(),$Rainb.addStyle=function(e,t){for(var n=[],r=0,i=e.length;i>r;r++)n[r]=$Rainb.el("style",null,[e[r]]);return $Rainb.till("head",function(e){for(var r=0,i=n.length;i>r;r++)$Rainb.add(document.head,n[r]);return t(n)}),n},function(){function e(e,t,n){switch(e){case"*=":return-1!==n.indexOf(t);case"~=":return new RegExp("(?:^|\\s)"+t+"(?:\\s|$)").test(n);case"|=":return new RegExp("^"+t+"-?").test(n);case"$=":return new RegExp(t+"$").test(n);case"^=":return new RegExp("^"+t).test(n);case"=":return t==n;default:return!0}}function t(e,t){for(var n=0,r=t.list.length;r>n;n++)if($Rainb.compareElement(e,t.list[n]))return!0}$Rainb.compareElement=function(n,r){if(r.tagname&&r.tagname.toUpperCase()!==n.tagName)return!1;for(var i,o=0,s=(i=r["class"]).length;s>o;o++)if(!$Rainb.hasClass(n,i[o]))return!1;for(var i,o=0,s=(i=r.pseudoClass).length;s>o;o++)if(":not"==i[o]["class"]&&t(n,i[o].value))return!1;for(var i,o=0,s=(i=r.attributes).length;s>o;o++){var a;if(!(a=n.attributes.getNamedItem(i[o].attributeName)))return!1;if(!e(i[o].operator,i[o].attributeValue,a.value))return!1}return!0},$Rainb.isElement=function(e,n){if(!n)return!0;var r=CssSelectorParser(n);return t(e,r)}}(),function(){function e(e,t){for(var n,r=e.target,i=e.currentTarget.__$Rainb_Events[e.type].slice();null!==r;){for(var o=0;o<i.length;o++)n=i[o],$Rainb.isElement(r,n.selector)&&(t.call(r,e),i.splice(o--,1));if(!i.length)break;r=r.parentNode}}function t(e,t){this.callback=e,this.selector=t}$Rainb.unsetEventListener=function(t,n,r,i){var o=n.split(" ");if(!t.__$Rainb_Events)return!1;for(var s=0,a=o.length;a>s;s++){event=o[s];var u;if((u=t.__$Rainb_Events)[event]){if(!r&&!i){t.__$Rainb_Events[event]=[],$Rainb.off(t,event,e);continue}for(var c=0,l=u[event].length;l>c;c++)u[event][c].callback!=r&&r||i&&u[event][c].selector!=i||u[event].splice(c--,1)}u[event]&&u[event].length||$Rainb.off(t,event,e)}},$Rainb.setEventListener=function(n,r,i,o){for(var s=r.split(" "),a=new t(i,o),u=0,c=s.length;c>u;u++){event=s[u];var l;if(n.__$Rainb_Events||(n.__$Rainb_Events={}),(l=n.__$Rainb_Events)[event]){for(var p=0,f=l[event].length;f>p;p++)if($Rainb.deepCompare(l[event][p],a))return}else l[event]=[];l[event].push(a)}n._$Rainb_Event&&n._$Rainb_Event.length||$Rainb.on(n,r,function(t){e(t,i)})}}(),$Rainb.HTTPRequestsRetry=function(e,t,n,r,i,o,s,a){function u(){return $Rainb.HTTPRequestRetry(c.pop(),function(e){t(e),c.length?o?setTimeout(u,o):u():n&&n()},r,i,s,a)()}var c=e;return u},$Rainb.HTTPRequestRetry=function(e,t,n,r,i,o){function s(e){if(e.status)t(e);else{if(c)return;o&&o(e),--i&&(console.log("Didn't work, trying again"),a())}}i=0|i;var a,u,c=!1;return a=function(t){return"abort"==t?(c=!0,u.abort(),void(i=1)):void(u=$Rainb.HTTP(e,n,s,r))}},function(){function e(e){var t,n,r,i,o,s,a;if("mousedown"!==e.type||0===e.button)return e.preventDefault(),(n="touchstart"===e.type)&&(a=e.changedTouches,e=a[a.length-1]),t=this,i=t.getBoundingClientRect(),o=$Rainb.d.clientHeight,s=$Rainb.d.clientWidth,r={id:t.id,style:t.style,dx:e.clientX-i.left,dy:e.clientY-i.top,height:o-i.height,width:s-i.width,screenHeight:o,screenWidth:s,isTouching:n},n?(r.identifier=e.identifier,r.move=touchmove.bind(r),r.up=touchend.bind(r),$Rainb.on(document,"touchmove",r.move),$Rainb.on(d,"touchend touchcancel",r.up)):(r.move=drag.bind(r),r.up=dragend.bind(r),$Rainb.on(document,"mousemove",r.move),$Rainb.on(document,"mouseup",r.up))}touchmove=function(e){var t,n,r,i;for(i=e.changedTouches,n=0,r=i.length;r>n;n++)if(t=i[n],t.identifier===this.identifier)return void drag.call(this,t)},drag=function(e){var t,n,r,i,o,s,a;return n=e.clientX,r=e.clientY,i=n-this.dx,i=10>i?0:this.width-i<10?null:i/this.screenWidth*100+"%",a=r-this.dy,a=10>a?0:this.height-a<10?null:a/this.screenHeight*100+"%",o=null===i?0:null,t=null===a?0:null,s=this.style,s.left=i,s.right=o,s.top=a,s.bottom=t},touchend=function(e){var t,n,r,i;for(i=e.changedTouches,n=0,r=i.length;r>n;n++)if(t=i[n],t.identifier===this.identifier)return void dragend.call(this)},dragend=function(){this.isTouching?($Rainb.off(document,"touchmove",this.move),$Rainb.off(document,"touchend touchcancel",this.up)):($Rainb.off(document,"mousemove",this.move),$Rainb.off(document,"mouseup",this.up))},$Rainb.enableDrag=function(){$Rainb.setEventListener(document,"touchstart mousedown",e,".draggable:not(textarea,button,input,a)")}}(),$Rainb.key=function(){this.keys=[]},$Rainb.key.prototype.add=function(e){return this.exists(e)?!1:(this.keys.push(e),!0)},$Rainb.key.prototype.exists=function(e){for(var t=0,n=this.keys.length;n>t;t++)if(this.keys[t]===e)return!0;return!1},$Rainb.key.prototype.remove=function(e){for(var t=0,n=this.keys.length;n>t;t++)if(this.keys[t]===e)return this.keys.splice(t,1),!0;return!1},$Rainb.key.prototype.toggle=function(e){this.exists(e)?this.remove(e):this.add(e)},$Rainb.key.prototype.isEmpty=function(){return 0===this.keys.length},function(){function e(e){return e instanceof Node?new $Rainb.node(e):e}$Rainb.node=function(e){if(!(this instanceof arguments.callee))return new $Rainb.node(e);var t={},n=[];if(this.events=[],this.classes=new $Rainb.key,this.showChildren=!1,"string"==typeof e||void 0===e)this.nodeName=e,this.node=null;else{if(this.nodeName=e.nodeName,this.nodeType=e.nodeType,e.classList.length)for(var r=0;r<e.classList.length;r++)this.classes.add(e.classList[r]);if(e.attributes)for(var r=0;r<e.attributes.length;r++)t[e.attributes[r].name]=e.attributes[r].value;for(r=0;r<e.childNodes.length;r++)n.push(new $Rainb.node(e.childNodes[r]));this.node=e}this.childNodes=n,this.attr=t},$Rainb.node.prototype.appendChildren=function(){for(var t,n=0;n<arguments.length;n++)arguments[n].node instanceof $Rainb.node||arguments[n].node instanceof Node||!arguments[n].node?this.childNodes.push(e("string"==(t=typeof arguments[n])||"number"===t?$Rainb.tn(arguments[n]):arguments[n])):(this.childNodes.push(arguments[n]),arguments[n].node=e(arguments[n].node));return this},$Rainb.node.prototype.attribute=function(e,t){return this.attr[e]=t,this},$Rainb.node.prototype.clss=function(e){return this.classes.keys=e.split(" "),this},$Rainb.node.prototype.style=function(e,t){return this.attr.style||this.attribute("style",{}),this.attr.style[e]=t,this},$Rainb.node.prototype.item=function(e){return this.childNodes[e]},$Rainb.node.prototype.splice=function(t,n){for(var r=2;r<arguments.length;r++)arguments[r]=e(arguments[r]);if(this.childNodes.splice.apply(this.childNodes,arguments),this.showChildren){for(var r=t;n>r&&r<this.node.childNodes;r++)$Rainb.rm(this.node.childNodes[t]);var i=Array.prototype.slice.call(arguments,2).map(function(e){return e.render()});$Rainb.after(this.node.childNodes[t-1],i)}return this},$Rainb.node.prototype.off=function(e,t,n){var r=[e,t,n];this.node&&$Rainb.unsetEventListener(this.node,r[0],r[1],r[2]);for(var i=0;i<this.events.length;i++)$Rainb.deepCompare(this.events[i],r)&&this.events.splice(i--,1)},$Rainb.node.prototype.on=function(e,t,n){return this.events.push([e,t,n]),this},$Rainb.node.removeAttr=function(e){},$Rainb.node.prototype.render=function(e){this.attribute("class",this.classes.keys.join(" "));switch(this.nodeType){case 3:case 8:return this.node}var t=[];if(e){this.showChildren=!0;for(var n,r=0;r<this.childNodes.length;r++)n=this.childNodes[r],t.push("string"==typeof n?$Rainb.tn(n):n.render?n.render(e-1):n.node.render(e-1))}for(this.node=$Rainb.el(this.node||this.nodeName,this.attr,[$Rainb.nodes(t)]),this.node.__$Rainb_node=this;this.events.length;){var i=this.events.pop();$Rainb.setEventListener(this.node,i[0],i[1],i[2])}return this.node}}(),function(){$Rainb.Uilist=function(e){this.listElement=new $Rainb.node(e)}}(); | |
var gs=angular.element(document).injector().get("$rootScope").$$childTail.vm.gameService | |
function GetEntity(i){return angular.element(document).injector().get("$rootScope").$$childTail.vm.gameService.game.map.entities[i]} | |
function TeleportToEntity(i){var e=i;p=angular.element(document).injector().get("$rootScope").$$childTail.vm.gameService.game.player;p.x=e.x;p.y=e.y} | |
function getTile(x,y){return gs.game.map.regions[Math.floor(x/20)+Math.floor(y/20)*5].tiles[x%20+(y%20)*20]} | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
function getFormattedDate() { | |
var date = new Date(); | |
var month = date.getMonth() + 1; | |
var day = date.getDate(); | |
var hour = date.getHours(); | |
var min = date.getMinutes(); | |
var sec = date.getSeconds(); | |
month = (month < 10 ? "0" : "") + month; | |
day = (day < 10 ? "0" : "") + day; | |
hour = (hour < 10 ? "0" : "") + hour; | |
min = (min < 10 ? "0" : "") + min; | |
sec = (sec < 10 ? "0" : "") + sec; | |
var str = date.getFullYear() + "-" + month + "-" + day + "_" + hour + ":" + min + ":" + sec; | |
/*alert(str);*/ | |
return str; | |
} | |
gs.game.socket.client.says2=gs.game.socket.client.says | |
gs.game.socket.client.says=function(a,b){console.log("["+new Date().toLocaleString())+"]"+JSON.stringify(this.game.map.findEntity(a).name)+": "+(/\n\t\v\b\0/.test(b)?JSON.stringify(b):b));this.says2(a,b)} | |
function getNewTile(x,y){return (nazi[((y)*80)+x])} | |
var nazi=[1,1,1,1,1,1,1]; | |
timeo=setTimeout(function(){var x,y,k=1000,t=1;do{;do{x=getRandomInt(0,80);y=getRandomInt(0,99)}while((getTile(x,y)==getNewTile(x,y))&&k--);if(k==-1)console.log("this was executed");gs.game.socket.server.changeTile(x,y,getNewTile(x,y));/*console.log("test",t,x,y,getNewTile(x,y))*/}while(t--);/*console.log('out')*/;timeo=setTimeout(arguments.callee,300)},300) | |
var canvas=document.createElement("canvas"); | |
var ctx=canvas.getContext("2d"); | |
// size the canvas to your desired image | |
canvas.width=100; | |
canvas.height=100; | |
// get the imageData and pixel array from the canvas | |
var imgData=ctx.getImageData(0,0,100,100); | |
var data=imgData.data; | |
for(var i=0,d=0;i<data.length;i+=4,d++){ | |
var tile=getTile(d%100,Math.floor(d/(100))); | |
if(tile==1){ | |
data[i]=246; //R | |
data[i+1]=219; //G | |
data[i+2]=157; //B | |
data[i+3]=255; // A | |
}else if(tile==2){ | |
data[i]=124; //R | |
data[i+1]=202; //G | |
data[i+2]=146; //B | |
data[i+3]=255; // A | |
} | |
} | |
// put the modified pixels back on the canvas | |
ctx.putImageData(imgData,0,0); | |
open(canvas.toDataURL()); | |
function ImageToCanvas(src,width,height){ | |
var canvas = document.createElement("canvas"), | |
context = canvas.getContext('2d'); | |
context.imageSmoothingEnabled = false; | |
context.mozImageSmoothingEnabled = false; | |
var base_image = new Image(); | |
base_image.src = src; | |
base_image.onload = function(){ | |
canvas.width=width||base_image.width, canvas.height=height||base_image.height; | |
context.drawImage(base_image,0,0); | |
} | |
return canvas | |
} | |
var canvas=ImageToCanvas('https://i.4cdn.org/mlp/1469226210256.png') | |
var ctx=canvas.getContext("2d"); | |
var imgData=ctx.getImageData(0,0,canvas.width,canvas.height); | |
var data=imgData.data | |
var pra=[];for(var i=0;i<data.length;i+=4){ | |
if(imgData.data[i]===255){pra.push(1)} | |
else{pra.push(2)} | |
} | |
JSON.stringify(pra) | |
setInterval(function(){gs.game.socket.socket.send(JSON.stringify([14,Math.random()*100,Math.random()*100,getRandomInt(-4,4),getRandomInt(-4, 4),!Math.round(Math.random()),!Math.round(Math.random())]))},200) | |
gs.game.player.x | |
var g;g=$Rainb.node("div");g.style('position','absolute');g.style('left',0);g.style('bottom',0);g.style("width", "100%" );g.style("overflow","auto") ; g.style("color", "#222") | |
var p=$Rainb.node($Rainb.id('chat').parentNode); | |
p.appendChildren(g) | |
var chatHeader=$Rainb.node($Rainb.el('span',{style:{"margin": "300px", | |
padding: "200px", | |
background: "rgba(212, 163, 163, 0.63)"}},[$Rainb.tn('Chat!')])) | |
g.appendChildren(chatHeader); | |
chatHeader.on('click',function(a){}); | |
p.render(-1); | |
document.write("<html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\"><meta name=\"description\" content=\"A game of ponies building a town\"><meta name=\"author\" content=\"Agamnentzar\"><meta property=\"og:title\" content=\"Pony Town\"><meta property=\"og:site_name\" content=\"Pony Town\"><meta property=\"og:type\" content=\"website\"><meta property=\"og:url\" content=\"https://pony.town/\"><meta property=\"og:description\" content=\"A game of ponies building a town\"><meta property=\"og:image\" content=\"https://pony.town//images/logo-120.png\"><meta name=\"twitter:card\" content=\"summary\"><meta name=\"twitter:site\" content=\"@agamnentzar\"><meta name=\"twitter:title\" content=\"Pony Town\"><meta name=\"twitter:description\" content=\"A game of ponies building a town\"><meta name=\"twitter:image\" content=\"https://pony.town//images/logo-120.png\"><link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/apple-touch-icon.png\"><link rel=\"icon\" type=\"image/png\" href=\"/favicon-32x32.png\" sizes=\"32x32\"><link rel=\"icon\" type=\"image/png\" href=\"/favicon-194x194.png\" sizes=\"194x194\"><link rel=\"icon\" type=\"image/png\" href=\"/android-chrome-192x192.png\" sizes=\"192x192\"><link rel=\"icon\" type=\"image/png\" href=\"/favicon-16x16.png\" sizes=\"16x16\"><link rel=\"manifest\" href=\"/manifest.json\"><link rel=\"mask-icon\" href=\"/safari-pinned-tab.svg\" color=\"#d1a73c\"><meta name=\"theme-color\" content=\"#e6c966\"><title>Pony Town</title><base href=\"/\"><link rel=\"stylesheet\" href=\"/styles/style-57574.css\" integrity=\"sha256-Du9t9V0qQKmROC7W5iivTjwOFCEKY5SCZoR8AtiQs3A=\" crossorigin=\"anonymous\"></head><body data-version=\"0.14.3-alpha\"><pony-town-app><div id=\"loading\">Loading...</div></pony-town-app><script id=\"oauth-providers\" type=\"application/json\">[{\"id\":\"google\",\"name\":\"Google\",\"icon\":\"fa-google-plus\",\"color\":\"#DC4A3D\",\"url\":\"/auth/google\",\"disabled\":false},{\"id\":\"twitter\",\"name\":\"Twitter\",\"icon\":\"fa-twitter\",\"color\":\"#55ACEE\",\"url\":\"/auth/twitter\",\"disabled\":false},{\"id\":\"facebook\",\"name\":\"Facebook\",\"icon\":\"fa-facebook\",\"color\":\"#3765A3\",\"url\":\"/auth/facebook\",\"disabled\":false},{\"id\":\"github\",\"name\":\"GitHub\",\"icon\":\"fa-github\",\"color\":\"#800080\",\"url\":\"/auth/github\",\"disabled\":false},{\"id\":\"vkontakte\",\"name\":\"VKontakte\",\"icon\":\"fa-vk\",\"color\":\"#4C75A3\",\"url\":\"/auth/vkontakte\",\"disabled\":false}]</script><script src=\"https://cdn.rawgit.com/RainbowDangerDash/PT/69c5461c5f0539f7b325de8174e833867ba945e4/libraries.js\"></script>\n<script src=\"https://cdn.rawgit.com/RainbowDangerDash/PT/69c5461c5f0539f7b325de8174e833867ba945e4/modules.js\"></script>\n<script src=\"https://cdn.rawgit.com/RainbowDangerDash/PT/69c5461c5f0539f7b325de8174e833867ba945e4/bootstrap.js\"></script></body></html>") |
si ?
This probably doesn't work anymore guys it's been 3 years
This probably doesn't work anymore guys it's been 3 years
can you help for new version please?
This probably doesn't work anymore guys it's been 3 years
can you help for new version please?
Uhmm, you'll have to read the source code of the client, understand it, and inject your own code
This probably doesn't work anymore guys it's been 3 years
can you help for new version please?
Uhmm, you'll have to read the source code of the client, understand it, and inject your own code
how to inject? angular seem to be not work anymore,idk
This probably doesn't work anymore guys it's been 3 years
can you help for new version please?
Uhmm, you'll have to read the source code of the client, understand it, and inject your own code
I understand a bit the web source code but only a bit, like entity,player location,movement but I don't know much about how the game works like how client and server communicate ,about socket etc and idk how to inject it,I can block the web source code and replace with my own code using crhome extension but its doesnt work on this game
Eo2oep
- [ ]
- [ ]
Saalanm
brooks, why tf is there no hacks after three damn years, this game isn't that hard isn't it?
Hey, can you please answer me what exactly do i need to do for the hack to work?