{"id":33,"date":"2026-08-13T12:52:59","date_gmt":"2026-08-13T12:52:59","guid":{"rendered":"https:\/\/www.relayed.net\/?page_id=33"},"modified":"2026-08-13T12:52:59","modified_gmt":"2026-08-13T12:52:59","slug":"swapper","status":"publish","type":"page","link":"https:\/\/www.relayed.net\/?page_id=33","title":{"rendered":"Swapper"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u00a0\n <div class=\"pmsw-wrap\" data-pmsw id=\"pmsw_b07626dd-d4ea-406c-b868-534a286e90ec\">\n  <div class=\"pmsw-sec\">\n   <div class=\"pmsw-title\">Swap + \/ -<\/div>\n\n   <textarea\n    class=\"pmsw-in\"\n    rows=\"2\"\n    placeholder=\"Paste here...\"\n   ><\/textarea>\n\n   <div class=\"pmsw-actions\">\n    <button type=\"button\" class=\"pmsw-btn\" data-pmsw-swap>Swap<\/button>\n    <button type=\"button\" class=\"pmsw-btn pmsw-btn2\" data-pmsw-clear>Clear<\/button>\n\n    <div class=\"pmsw-hit\" data-pmsw-hit>\n     Swaps: <span data-pmsw-hitn>45<\/span>\n    <\/div>\n   <\/div>\n\n   <pre class=\"pmsw-out\" data-pmsw-out><\/pre>\n  <\/div>\n <\/div>\n\n <style>\n .pmsw-wrap{max-width:980px;border:1px solid #e3e5e8;border-radius:12px;padding:14px;margin:16px 0}\n .pmsw-sec{padding:6px 0}\n .pmsw-title{font-size:14px;font-weight:700;margin-bottom:8px}\n .pmsw-in{width:100%;padding:5px;border:1px solid #cfd4da;border-radius:10px;box-sizing:border-box;background:#131313;color:#FFFFFF}\n .pmsw-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;align-items:center}\n .pmsw-btn{appearance:none;border:1px solid #cfd4da;background:#111;color:#fff;padding:8px 12px;border-radius:10px;cursor:pointer;font-size:13px}\n .pmsw-btn2{background:#fff;color:#111}\n .pmsw-hit{margin-left:auto;font-size:12px;opacity:.85;white-space:nowrap}\n .pmsw-out{margin-top:12px;white-space:pre-wrap;word-break:break-word;padding:10px;border:1px dashed #cfd4da;border-radius:10px;min-height:44px}\n\n @media (max-width:720px){\n  .pmsw-hit{margin-left:0}\n }\n <\/style>\n\n <script>\n (function(){\n  const root = document.getElementById(\"pmsw_b07626dd-d4ea-406c-b868-534a286e90ec\");\n  if(!root) return;\n\n  const ajaxUrl = \"https:\\\/\\\/www.relayed.net\\\/wp-admin\\\/admin-ajax.php\";\n\n  const inp = root.querySelector('.pmsw-in');\n  const out = root.querySelector('[data-pmsw-out]');\n  const btnSwap = root.querySelector('[data-pmsw-swap]');\n  const btnClear = root.querySelector('[data-pmsw-clear]');\n  const hitN = root.querySelector('[data-pmsw-hitn]');\n\n  function swapPlusMinus(s){\n   return String(s)\n    .replace(\/\\+\/g,'__P__')\n    .replace(\/-\/g,'+')\n    .replace(\/__P__\/g,'-');\n  }\n\n  async function copyText(t){\n   t=String(t||'');\n   if(!t) return false;\n\n   try{\n    if(navigator.clipboard && window.isSecureContext){\n     await navigator.clipboard.writeText(t);\n     return true;\n    }\n   }catch(e){}\n\n   try{\n    var ta=document.createElement('textarea');\n    ta.value=t;\n    ta.setAttribute('readonly','');\n    ta.style.position='fixed';\n    ta.style.left='0';\n    ta.style.top='0';\n    ta.style.opacity='0';\n\n    document.body.appendChild(ta);\n    ta.focus();\n    ta.select();\n    ta.setSelectionRange(0, ta.value.length);\n\n    var ok=document.execCommand('copy');\n    document.body.removeChild(ta);\n\n    return !!ok;\n   }catch(e){\n    return false;\n   }\n  }\n\n  function bumpHit(){\n   fetch(ajaxUrl,{\n    method:'POST',    headers:{     'Content-Type':'application\/x-www-form-urlencoded; charset=UTF-8'    },    body:'action=pmsw_hit'   })\n   .then(r=>r.json())\n   .then(j=>{    if(j&&j.success&&j.data&&typeof j.data.hits!=='undefined'){     hitN.textContent=String(j.data.hits);    }\n   })\n   .catch(()=>{});\n  }\n\n  function toast(msg){\n   var t=root.querySelector('[data-pmsw-toast]');\n\n   if(!t){\n    t=document.createElement('div');\n    t.setAttribute('data-pmsw-toast','');\n\n    t.style.position='fixed';\n    t.style.right='16px';\n    t.style.bottom='16px';\n    t.style.zIndex='99999';\n    t.style.background='#111';\n    t.style.color='#fff';\n    t.style.padding='10px 12px';\n    t.style.borderRadius='10px';\n    t.style.fontSize='25px';\n    t.style.boxShadow='0 8px 24px rgba(0,0,0,.18)';\n    t.style.opacity='0';\n    t.style.transform='translateY(6px)';\n    t.style.transition='opacity .18s ease, transform .18s ease';\n\n    document.body.appendChild(t);\n   }\n\n   t.textContent=msg;\n   clearTimeout(t.__tm);\n   requestAnimationFrame(()=>{    t.style.opacity='1';    t.style.transform='translateY(0)';   });\n   t.__tm=setTimeout(()=>{    t.style.opacity='0';    t.style.transform='translateY(6px)';   },1200);  }\n  btnSwap.addEventListener('click', async function(){\n   const v=inp.value||'';   const res=swapPlusMinus(v);\n\n   out.textContent=res;\n   bumpHit();\n\n   const ok=await copyText(res);\n\n   if(ok) toast('Copied to clipboard');   else toast('Copy failed');  });\n\n  btnClear.addEventListener('click', function(){   inp.value='';   out.textContent='';   inp.focus();  });\n\n })();\n <\/script>\n\n <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-33","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.relayed.net\/index.php?rest_route=\/wp\/v2\/pages\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.relayed.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.relayed.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.relayed.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.relayed.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":1,"href":"https:\/\/www.relayed.net\/index.php?rest_route=\/wp\/v2\/pages\/33\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/www.relayed.net\/index.php?rest_route=\/wp\/v2\/pages\/33\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/www.relayed.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}