Our World of Text: Difference between revisions
m →Users |
m →Anons |
||
| Line 27: | Line 27: | ||
The Anonway script was inspired by a similar Anonway made by user freebsd-craze where he would manually forward messages sent my anons in another chat to global. | The Anonway script was inspired by a similar Anonway made by user freebsd-craze where he would manually forward messages sent my anons in another chat to global. | ||
''Open the Collapsible for the script.''<div class="mw-collapsible mw-collapsed" data-expandtext="Open Collapsible" data-collapsetext="Close Collapsible"> | ''Open the Collapsible for the script.''<ref>Script can also be found here: https://ourworldoftext.com/anonsagain</ref><div class="mw-collapsible mw-collapsed" data-expandtext="Open Collapsible" data-collapsetext="Close Collapsible"> | ||
<pre>/*DON'T RUN ON THE SAME WORLD UNLESS YOU WANT SEVERAL POSTS AT ONCE! INSTRUCTIONS: CREATE ACCOUNT, GO TO ANY WORLD, OPEN LOCAL CHAT, OPEN CONSOLE, PASTE THE CODE AND RUN. LOCAL CHAT HAS TO ALREADY BE OPEN ON LAUNCH. LEAVE BROWSER OPEN IN THE BACKGROUND, KEEP THE PAGE ACTIVE*/(()=>{"use strict";let t=!1,e=-1/0,n=null;const a=[],i=new Map,c=t=>new Promise(e=>setTimeout(e,t));function r(t){return String(t??"").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u202A-\u202E\u2066-\u2069]/g,"").slice(0,1e4).trim()}function o(t){return[...document.querySelectorAll(t)].find(t=>{const e=getComputedStyle(t);return t.isConnected&&t.getClientRects().length>0&&"none"!==e.display&&"hidden"!==e.visibility})||null}function l(t,e=2e3){return new Promise(n=>{const a=performance.now()+e;!function e(){const i=o(t);i?.classList.contains("chat_tab_selected")?n(!0):performance.now()>=a?n(!1):setTimeout(e,25)}()})}async function s(t,e){const n=o(t);if(!n)throw new Error(e);if(!n.classList.contains("chat_tab_selected")){if(n.click(),!await l(t))throw new Error(e);await c(100)}}async function u(t){const e=o("#chat_page_tab");if(!o("#chat_global_tab")||!e)throw new Error("Could not find the Global and Local chat tabs.");try{await s("#chat_global_tab","Global tab unable to be selected"),api_chat_send(t.text,{nick:t.nick})}finally{e.isConnected&&(e.click(),await l("#chat_page_tab")||console.error("Local chat unable to be selected"))}}async function d(t){await s("#chat_page_tab","Local chat tab unable to be selected"),api_chat_send(`/tell ${t} NO USERS ALLOWED!`)}function f(n){return a.length>=50?(console.warn("Relay queue is full"),!1):(a.push(n),async function(){if(!t){t=!0;try{for(;a.length;){const t=a.shift(),n=e+1e3-performance.now();n>0&&await c(n),e=performance.now();try{"tell"===t.type?await d(t.id):await u(t)}catch(t){console.error("Error:",t)}}}finally{t=!1}}}(),!0)}w.on("chat",function(t){const e=function(t){return{id:String(t?.id??""),location:t?.location??"",nickname:r(t?.nickname??""),realUsername:String(t?.realUsername??t?.dataObj?.realUsername??"").trim(),text:t?.message??t?.dataObj?.message??""}}(t);if("page"!==e.location)return;const a=r(e.text);if(!a)return;if(/^\/tell\b/i.test(a)||"NO USERS & GUESTS ALLOWED!"===a)return;if(e.realUsername){if(/^NAG/i.test(e.realUsername))return;if(!/^\d+$/.test(e.id))return;const t=i.get(e.id)??-1/0;return void(Date.now()-t>=6e4&&f({type:"tell",id:e.id})&&i.set(e.id,Date.now()))}if(!/^\d+$/.test(e.id))return;const c=e.nickname?`${e.nickname} (${e.id})`:e.id,o=a.slice(0,400);n?.id===e.id&&n?.text===o||(n={id:e.id,text:o},f({type:"relay",nick:c,text:o}))})})();</pre></div> | <pre>/*DON'T RUN ON THE SAME WORLD UNLESS YOU WANT SEVERAL POSTS AT ONCE! INSTRUCTIONS: CREATE ACCOUNT, GO TO ANY WORLD, OPEN LOCAL CHAT, OPEN CONSOLE, PASTE THE CODE AND RUN. LOCAL CHAT HAS TO ALREADY BE OPEN ON LAUNCH. LEAVE BROWSER OPEN IN THE BACKGROUND, KEEP THE PAGE ACTIVE*/(()=>{"use strict";let t=!1,e=-1/0,n=null;const a=[],i=new Map,c=t=>new Promise(e=>setTimeout(e,t));function r(t){return String(t??"").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u202A-\u202E\u2066-\u2069]/g,"").slice(0,1e4).trim()}function o(t){return[...document.querySelectorAll(t)].find(t=>{const e=getComputedStyle(t);return t.isConnected&&t.getClientRects().length>0&&"none"!==e.display&&"hidden"!==e.visibility})||null}function l(t,e=2e3){return new Promise(n=>{const a=performance.now()+e;!function e(){const i=o(t);i?.classList.contains("chat_tab_selected")?n(!0):performance.now()>=a?n(!1):setTimeout(e,25)}()})}async function s(t,e){const n=o(t);if(!n)throw new Error(e);if(!n.classList.contains("chat_tab_selected")){if(n.click(),!await l(t))throw new Error(e);await c(100)}}async function u(t){const e=o("#chat_page_tab");if(!o("#chat_global_tab")||!e)throw new Error("Could not find the Global and Local chat tabs.");try{await s("#chat_global_tab","Global tab unable to be selected"),api_chat_send(t.text,{nick:t.nick})}finally{e.isConnected&&(e.click(),await l("#chat_page_tab")||console.error("Local chat unable to be selected"))}}async function d(t){await s("#chat_page_tab","Local chat tab unable to be selected"),api_chat_send(`/tell ${t} NO USERS ALLOWED!`)}function f(n){return a.length>=50?(console.warn("Relay queue is full"),!1):(a.push(n),async function(){if(!t){t=!0;try{for(;a.length;){const t=a.shift(),n=e+1e3-performance.now();n>0&&await c(n),e=performance.now();try{"tell"===t.type?await d(t.id):await u(t)}catch(t){console.error("Error:",t)}}}finally{t=!1}}}(),!0)}w.on("chat",function(t){const e=function(t){return{id:String(t?.id??""),location:t?.location??"",nickname:r(t?.nickname??""),realUsername:String(t?.realUsername??t?.dataObj?.realUsername??"").trim(),text:t?.message??t?.dataObj?.message??""}}(t);if("page"!==e.location)return;const a=r(e.text);if(!a)return;if(/^\/tell\b/i.test(a)||"NO USERS & GUESTS ALLOWED!"===a)return;if(e.realUsername){if(/^NAG/i.test(e.realUsername))return;if(!/^\d+$/.test(e.id))return;const t=i.get(e.id)??-1/0;return void(Date.now()-t>=6e4&&f({type:"tell",id:e.id})&&i.set(e.id,Date.now()))}if(!/^\d+$/.test(e.id))return;const c=e.nickname?`${e.nickname} (${e.id})`:e.id,o=a.slice(0,400);n?.id===e.id&&n?.text===o||(n={id:e.id,text:o},f({type:"relay",nick:c,text:o}))})})();</pre></div> | ||