r/ModSupport • • 12d ago

Admin Replied Rearranging post flairs on device

I'm trying to rearrange the order for the post flairs for our sub using my phone, but it's not an option for the app and using the website version just highlights the text when I try to hold or touch the 6 dot drag icon next to the flair options.

7 Upvotes

9 comments sorted by

2

u/Slow-Maximum-101 Reddit Admin: Community 11d ago

Hi u/BrotherDeus Unfortunately, this isn’t currently available on the app or the mobile web versions.

1

u/BrotherDeus 11d ago

Okay, thanks

2

u/Littux 10d ago edited 10d ago

Try this bookmarklet:

javascript:(async()=>{try{await (async()=>{if(!r.config.modhash)throw new Error("must be run on old reddit");const subredditMatch=location.pathname.match(/^/r/([^/]%2B)(?:/|$)/i);if(!subredditMatch)throw new Error("Open a subreddit page before running this bookmarklet.");const subreddit=subredditMatch[1];const panel=document.createElement("section");panel.id="reorder-flair-panel";panel.setAttribute("role","dialog");panel.setAttribute("aria-modal","true");panel.setAttribute("aria-labelledby","reorder-flair-title");panel.innerHTML=`%0A<style>%0A%09%23reorder-flair-panel {%0A%09%09position: fixed;%0A%09%09z-index: 2147483647;%0A%09%09top: 24px;%0A%09%09right: 24px;%0A%09%09width: min(420px, calc(100vw - 48px));%0A%09%09max-height: calc(100vh - 48px);%0A%09%09overflow: auto;%0A%09%09box-sizing: border-box;%0A%09%09padding: 16px;%0A%09%09border: 1px solid %23888;%0A%09%09border-radius: 6px;%0A%09%09background: %23fff;%0A%09%09color: %23222;%0A%09%09box-shadow: 0 4px 20px %230005;%0A%09%09font: 14px/1.4 sans-serif;%0A%09}%0A%09%23reorder-flair-panel * { box-sizing: border-box; }%0A%09%23reorder-flair-panel header {%0A%09%09display: flex;%0A%09%09align-items: center;%0A%09%09justify-content: space-between;%0A%09%09gap: 12px;%0A%09}%0A%09%23reorder-flair-panel h2 { margin: 0; font-size: 18px; }%0A%09%23reorder-flair-panel button {%0A%09%09padding: 5px 9px;%0A%09%09border: 1px solid %23aaa;%0A%09%09border-radius: 4px;%0A%09%09background: %23f7f7f7;%0A%09%09color: inherit;%0A%09%09cursor: pointer;%0A%09%09font: inherit;%0A%09}%0A%09%23reorder-flair-panel button:disabled { cursor: default; opacity: .45; }%0A%09%23reorder-flair-panel ul {%0A%09%09display: grid;%0A%09%09gap: 6px;%0A%09%09margin: 14px 0;%0A%09%09padding: 0;%0A%09%09list-style: none;%0A%09}%0A%09%23reorder-flair-panel li {%0A%09%09display: flex;%0A%09%09align-items: center;%0A%09%09justify-content: space-between;%0A%09%09gap: 8px;%0A%09%09min-height: 34px;%0A%09%09padding: 4px 6px 4px 10px;%0A%09%09border: 1px solid %23ddd;%0A%09%09border-radius: 4px;%0A%09}%0A%09%23reorder-flair-panel .flair-text {%0A%09%09min-width: 0;%0A%09%09overflow-wrap: anywhere;%0A%09}%0A%09%23reorder-flair-panel .flair-controls { display: flex; gap: 4px; }%0A%09%23reorder-flair-panel %23reorder-flair-status { min-height: 1.4em; }%0A</style>%0A<header>%0A%09<h2 id="reorder-flair-title">Reorder link flairs</h2>%0A%09<button type="button" id="reorder-flair-close" aria-label="Close">Close</button>%0A</header>%0A<ul id="reorder-flair-list"></ul>%0A<p id="reorder-flair-status" role="status">Loading flair templates…</p>%0A<button type="button" id="reorder-flair-save" disabled>Save order</button>`;document.getElementById("reorder-flair-panel")?.remove();document.body.appendChild(panel);const list=panel.querySelector("%23reorder-flair-list");const status=panel.querySelector("%23reorder-flair-status");const saveButton=panel.querySelector("%23reorder-flair-save");panel.querySelector("%23reorder-flair-close").addEventListener("click",()=>panel.remove());let flairs=[];let saving=false;const render=()=>{list.replaceChildren();flairs.forEach((flair,index)=>{const row=document.createElement("li");const text=document.createElement("span");text.className="flair-text";text.textContent=flair.text;const controls=document.createElement("span");controls.className="flair-controls";[{label:"Move flair up",icon:"↑",offset:-1},{label:"Move flair down",icon:"↓",offset:1}].forEach(({label,icon,offset})=>{const button=document.createElement("button");button.type="button";button.textContent=icon;button.setAttribute("aria-label",label);button.disabled=saving||index%2Boffset<0||index%2Boffset>=flairs.length;button.addEventListener("click",()=>{const[movedFlair]=flairs.splice(index,1);flairs.splice(index%2Boffset,0,movedFlair);status.textContent="Unsaved changes.";render()});controls.appendChild(button)});row.append(text,controls);list.appendChild(row)});saveButton.disabled=saving||flairs.length===0};try{const response=await fetch(`/r/${subreddit}/api/link_flair.json?raw_json=1`,{headers:{Accept:"application/json"}});if(!response.ok)throw new Error(`Failed to load flair templates (${response.status}).`);const data=await response.json();const templates=Array.isArray(data)?data:null;if(!Array.isArray(templates))throw new Error("The flair template response was not a list.");flairs=templates.map(template=>({id:template.id,text:String(template.text??"")}));if(flairs.some(flair=>typeof flair.id!=="string"||!flair.id)){throw new Error("A flair template is missing its template ID.")}status.textContent=flairs.length?"":"No link flair templates found.";render()}catch(error){status.textContent=`Failed to load flair templates: ${error.message}`;return}saveButton.addEventListener("click",async()=>{const modhash=window.r.config.modhash;saving=true;status.textContent="Saving order…";render();try{const response=await fetch(`/api/v1/${subreddit}/flair_template_order/LINK_FLAIR?raw_json=1`,{method:"PATCH",headers:{"Content-Type":"application/json","x-modhash":modhash},body:JSON.stringify(flairs.map(flair=>flair.id))});const responseText=await response.text();if(!response.ok){throw new Error(`Request failed (${response.status}): ${responseText||response.statusText}`)}if(responseText){const result=JSON.parse(responseText);const errors=result.errors??result.data?.errors;if(Array.isArray(errors)&&errors.length){throw new Error(`Reddit rejected the order: ${JSON.stringify(errors)}`)}}status.textContent="Order saved."}catch(error){status.textContent=`Failed to save order: ${error.message}`}finally{saving=false;render()}})})();}catch(e){console.error("Bookmarklet failed:", e.message);alert("Bookmarklet failed: " %2B e.message)}})();

To use the bookmark, bookmark this page and go to Bookmarks > Mobile Bookmarks (on chrome, may differ for others) and click on the newly created bookmark. Edit it and change the title to "Reorder flair". Change the URL to the code above. Save it and go to the subreddit where you want to reorder the flairs on old reddit (old.reddit.com/r/subreddit). Enter "Reorder flair" on the address bar and you should see a bookmark suggestion on the bottom. Click on it and a pop-up for reordering the flairs should show up

1

u/BrotherDeus 10d ago

Thanks, I'll try it later

2

u/Littux 5d ago

Any update?

2

u/BrotherDeus 5d ago

I'm really sorry, I actually just used a desktop to reorder the flairs and completely forgot about this!

1

u/RareEtherealLight 5h ago

Indeed it isn't but the Web doesn't work either at the moment for some reason?

2

u/RareEtherealLight 5h ago

Hey OP, I'm currently having the same problem as you. In theory this function should be possible in the Web Version by dragging the 6 dots but it isn't working for me either, so I'm lost with you. The function definitely isn't available on the Mobile App.

I'm going to keep searching and have saved this post so if I manage it, I will give you a shout. My next try is old reddit 😉🤞🏻

1

u/BrotherDeus 5h ago

Thank you!