// ==UserScript== // @name wplace-tile-dump // @version 0.0.1 // @description A small script to dump tiles // @match *://wplace.live/* // @grant GM_addStyle // ==/UserScript== (function(){"use strict";var D,v,t_,S,n_,r_,o_,i_,O,z,G,C={},l_=[],C_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,M=Array.isArray;function x(_,e){for(var t in e)_[t]=e[t];return _}function V(_){_&&_.parentNode&&_.parentNode.removeChild(_)}function $(_,e,t){var n,i,o,u={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:u[o]=e[o];if(arguments.length>2&&(u.children=arguments.length>3?D.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(o in _.defaultProps)u[o]===void 0&&(u[o]=_.defaultProps[o]);return A(_,u,n,i,null)}function A(_,e,t,n,i){var o={type:_,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++t_,__i:-1,__u:0};return i==null&&v.vnode!=null&&v.vnode(o),o}function L(_){return _.children}function F(_,e){this.props=_,this.context=e}function E(_,e){if(e==null)return _.__?E(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?E(_):null}function u_(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return u_(_)}}function s_(_){(!_.__d&&(_.__d=!0)&&S.push(_)&&!W.__r++||n_!=v.debounceRendering)&&((n_=v.debounceRendering)||r_)(W)}function W(){for(var _,e,t,n,i,o,u,s=1;S.length;)S.length>s&&S.sort(o_),_=S.shift(),s=S.length,_.__d&&(t=void 0,i=(n=(e=_).__v).__e,o=[],u=[],e.__P&&((t=x({},n)).__v=n.__v+1,v.vnode&&v.vnode(t),J(e.__P,t,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??E(n),!!(32&n.__u),u),t.__v=n.__v,t.__.__k[t.__i]=t,h_(o,t,u),t.__e!=i&&u_(t)));W.__r=0}function c_(_,e,t,n,i,o,u,s,f,l,a){var r,p,c,y,w,b,h=n&&n.__k||l_,d=e.length;for(f=T_(t,e,h,f,d),r=0;r0?A(u.type,u.props,u.key,u.ref?u.ref:null,u.__v):u).__=_,u.__b=_.__b+1,s=null,(l=u.__i=N_(u,t,f,r))!=-1&&(r--,(s=t[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>a?p--:if?p--:p++,u.__u|=4))):_.__k[o]=null;if(r)for(o=0;o(a?1:0)){for(i=t-1,o=t+1;i>=0||o=0?i--:o++])!=null&&(2&l.__u)==0&&s==l.key&&f==l.type)return u}return-1}function f_(_,e,t){e[0]=="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||C_.test(e)?t:t+"px"}function R(_,e,t,n,i){var o,u;_:if(e=="style")if(typeof t=="string")_.style.cssText=t;else{if(typeof n=="string"&&(_.style.cssText=n=""),n)for(e in n)t&&e in t||f_(_.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||f_(_.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(i_,"$1")),u=e.toLowerCase(),e=u in _||e=="onFocusOut"||e=="onFocusIn"?u.slice(2):e.slice(2),_.l||(_.l={}),_.l[e+o]=t,t?n?t.u=n.u:(t.u=O,_.addEventListener(e,o?G:z,o)):_.removeEventListener(e,o?G:z,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in _)try{_[e]=t??"";break _}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?_.removeAttribute(e):_.setAttribute(e,e=="popover"&&t==1?"":t))}}function p_(_){return function(e){if(this.l){var t=this.l[e.type+_];if(e.t==null)e.t=O++;else if(e.t0?_:M(_)?_.map(d_):x({},_)}function U_(_,e,t,n,i,o,u,s,f){var l,a,r,p,c,y,w,b=t.props,h=e.props,d=e.type;if(d=="svg"?i="http://www.w3.org/2000/svg":d=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l=t.__.length&&t.__.push({}),t.__[_]}function A_(_){return Y=1,L_(E_,_)}function L_(_,e,t){var n=H_(I++,2);if(n.t=_,!n.__c&&(n.__=[E_(void 0,e),function(s){var f=n.__N?n.__N[0]:n.__[0],l=n.t(f,s);f!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=m,!m.__f)){var i=function(s,f,l){if(!n.__c.__H)return!0;var a=n.__c.__H.__.filter(function(p){return!!p.__c});if(a.every(function(p){return!p.__N}))return!o||o.call(this,s,f,l);var r=n.__c.props!==s;return a.forEach(function(p){if(p.__N){var c=p.__[0];p.__=p.__N,p.__N=void 0,c!==p.__[0]&&(r=!0)}}),o&&o.call(this,s,f,l)||r};m.__f=!0;var o=m.shouldComponentUpdate,u=m.componentWillUpdate;m.componentWillUpdate=function(s,f,l){if(this.__e){var a=o;o=void 0,i(s,f,l),o=a}u&&u.call(this,s,f,l)},m.shouldComponentUpdate=i}return n.__N||n.__}function F_(_,e){var t=H_(I++,3);!g.__s&&I_(t.__H,e)&&(t.__=_,t.u=e,m.__H.__h.push(t))}function W_(){for(var _;_=g_.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(j),_.__H.__h.forEach(Z),_.__H.__h=[]}catch(e){_.__H.__h=[],g.__e(e,_.__v)}}g.__b=function(_){m=null,y_&&y_(_)},g.__=function(_,e){_&&e.__k&&e.__k.__m&&(_.__m=e.__k.__m),$_&&$_(_,e)},g.__r=function(_){b_&&b_(_),I=0;var e=(m=_.__c).__H;e&&(X===m?(e.__h=[],m.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(j),e.__h.forEach(Z),e.__h=[],I=0)),X=m},g.diffed=function(_){w_&&w_(_);var e=_.__c;e&&e.__H&&(e.__H.__h.length&&(g_.push(e)!==1&&m_===g.requestAnimationFrame||((m_=g.requestAnimationFrame)||R_)(W_)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),X=m=null},g.__c=function(_,e){e.some(function(t){try{t.__h.forEach(j),t.__h=t.__h.filter(function(n){return!n.__||Z(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],g.__e(n,t.__v)}}),k_&&k_(_,e)},g.unmount=function(_){x_&&x_(_);var e,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{j(n)}catch(i){e=i}}),t.__H=void 0,e&&g.__e(e,t.__v))};var S_=typeof requestAnimationFrame=="function";function R_(_){var e,t=function(){clearTimeout(n),S_&&cancelAnimationFrame(e),setTimeout(_)},n=setTimeout(t,35);S_&&(e=requestAnimationFrame(t))}function j(_){var e=m,t=_.__c;typeof t=="function"&&(_.__c=void 0,t()),m=e}function Z(_){var e=m;_.__c=_.__(),m=e}function I_(_,e){return!_||_.length!==e.length||e.some(function(t,n){return t!==_[n]})}function E_(_,e){return typeof e=="function"?e(_):e}const j_="_tile-dump_1gawa_1",q_="_title_1gawa_12",B_="_tile-list_1gawa_17",O_="_tile_1gawa_1",z_=`._tile-dump_1gawa_1 { background-color: white; position: absolute; top: 0; left: 0; width: 600px; height: 600px; padding: 10px; } ._title_1gawa_12 { font-weight: bold; text-align: center; } ._tile-list_1gawa_17 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; } ._tile_1gawa_1 { border: 2px solid white; &:hover { border: 2px solid blue; } } `,G_=/\/files\/s0\/tiles\/(\d+)\/(\d+)\.png/;GM_addStyle(z_);function V_({image:_}){return $("a",{href:_,download:!0,target:"_blank"},$("img",{class:O_,src:_}))}function J_(){const[_,e]=A_(new Set);function t(n){if(n?.data?.source!=="blue-marble"||!n?.data?.endpoint)return;const i=new URL(n.data.endpoint);i.origin==="https://backend.wplace.live"&&i.pathname.match(G_)&&(_.add(n.data.endpoint),e(new Set(_)))}return F_(()=>(window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}),[]),$("div",{class:j_},$("h2",{class:q_},"Tiles"),$("div",{class:B_},[..._].map(n=>$(V_,{image:n}))))}let __=document.createElement("div");__=document.body.appendChild(__),M_($(J_,null),document.body,__)})();