NOVATER Studio — Royal faces for your wrist. ![]()
![]()
Nice!
btw, you may want to add your Facer profile URL to your community profile, that way we’ll find you…
Hi Tom, I made this little bookmarklet to quickly find a forum member’s Facer gallery. Just click it while browsing a forum thread, and it shows the gallery links for the members who participated. Thought it might be useful for others too![]()
It’s still a bit buggy, and you’ll need to refresh the page before using it in a different thread, but it does the job for now.
bookmarklet (cut and paste code below in the url space of a bookmark):
javascript:(() => { ‘use strict’; const host = ‘community.facer.io’; const panelId = ‘facer-gallery-finder-panel’; const oldPanel = document.getElementById(panelId); if (oldPanel) { oldPanel.remove(); return; } if (location.hostname !== host) { alert(‘Please open a page on community.facer.io first.’); return; } const validUsername = value => typeof value === ‘string’ && /[1]{1,80}$/.test(value); const authors = new Map(); const topicMatch = location.pathname.match(/^/t/(?:[^/]+/)?(\d+)(?:/|$)/); const profileMatch = location.pathname.match(/^/u/([^/?#]+)/); function addAuthor(username, displayName = ‘’) { if (!validUsername(username)) return; if (!authors.has(username)) { authors.set(username, {username, displayName: displayName || ‘’}); } else if (displayName && !authors.get(username).displayName) { authors.get(username).displayName = displayName; } } function fromElement(element) { const value = element.getAttribute(‘data-user-card’); if (validUsername(value)) return value; const href = element.getAttribute(‘href’) || ‘’; const match = href.match(/(?:^|/)u/([^/?#]+)/i); if (!match) return ‘’; try { return decodeURIComponent(match[1]); } catch () { return match[1]; } } function addLoadedAuthors() { if (profileMatch) { try { addAuthor(decodeURIComponent(profileMatch[1])); } catch () { addAuthor(profileMatch[1]); } return; } const posts = document.querySelectorAll(‘.topic-post, article[data-post-id], .crawler-post’); posts.forEach(post => { const names = post.querySelectorAll( ‘.topic-meta-data [data-user-card], .topic-meta-data a[href*=“/u/”], ’ + ‘.names [data-user-card], .names a[href*=“/u/”], ’ + ‘.crawler-post-meta a[href*=“/u/”]’ ); names.forEach(element => addAuthor(fromElement(element))); }); if (authors.size === 0) { document.querySelectorAll(‘a[data-user-card], a[href^=“/u/”]’) .forEach(element => addAuthor(fromElement(element))); } } const panel = document.createElement(‘section’); panel.id = panelId; panel.setAttribute(‘aria-label’, ‘Facer Gallery Finder’); Object.assign(panel.style, { position: ‘fixed’, zIndex: ‘2147483647’, top: ‘18px’, right: ‘18px’, width: ‘370px’, maxWidth: ‘calc(100vw - 36px)’, maxHeight: ‘88vh’, display: ‘flex’, flexDirection: ‘column’, boxSizing: ‘border-box’, padding: ‘16px’, border: ‘1px solid #454d59’, borderRadius: ‘12px’, background: ‘#15191e’, color: ‘#f5f6f8’, fontFamily: ‘Arial, sans-serif’, fontSize: ‘13px’, lineHeight: ‘1.5’, boxShadow: ‘0 12px 45px rgba(0,0,0,.48)’ }); const heading = document.createElement(‘div’); Object.assign(heading.style, {display: ‘flex’, alignItems: ‘center’, justifyContent: ‘space-between’, gap: ‘10px’}); const title = document.createElement(‘strong’); title.textContent = ‘Facer Gallery Finder’; title.style.fontSize = ‘16px’; const close = document.createElement(‘button’); close.type = ‘button’; close.textContent = ‘×’; Object.assign(close.style, {color:’#fff’,background:‘#313941’,border:‘1px solid #505965’,borderRadius:‘7px’,cursor:‘pointer’,fontSize:‘20px’,padding:‘1px 9px’}); close.addEventListener(‘click’, () => panel.remove()); heading.append(title, close); panel.append(heading); const description = document.createElement(‘p’); description.textContent = ‘Finding forum participants…’; description.style.margin = ‘11px 0 8px’; panel.append(description); const filter = document.createElement(‘input’); filter.type = ‘search’; filter.placeholder = ‘Filter participants…’; filter.setAttribute(‘aria-label’, ‘Filter participants’); Object.assign(filter.style, {boxSizing:‘border-box’,width:‘100%’,padding:‘9px’,border:‘1px solid #56606d’,borderRadius:‘7px’,background:‘#252c34’,color:‘#fff’,marginBottom:‘9px’}); panel.append(filter); const list = document.createElement(‘div’); Object.assign(list.style, {minHeight:‘20px’,maxHeight:‘48vh’,overflowY:‘auto’,paddingRight:‘3px’}); panel.append(list); const status = document.createElement(‘div’); status.setAttribute(‘aria-live’, ‘polite’); Object.assign(status.style, {marginTop:‘10px’,color:‘#b9c5d0’,overflowWrap:‘anywhere’}); function setStatus(message, isError = false) { status.textContent = message; status.style.color = isError ? ‘#ffaca8’ : ‘#b9c5d0’; } async function openGallery(username) { const tab = window.open(‘about:blank’, ‘_blank’); setStatus(‘Looking up the Facer account for @’ + username + ‘…’); try { const response = await fetch(‘/u/’ + encodeURIComponent(username) + ‘.json’, { credentials: ‘same-origin’, headers: {Accept: ‘application/json’} }); if (!response.ok) throw new Error(‘Profile request failed (HTTP ’ + response.status + ‘).’); const data = await response.json(); const id = data?.user?.custom_fields?.facer_id; if (typeof id !== ‘string’ || !/[2]+$/.test(id)) { throw new Error(‘No linked Facer gallery was found for @’ + username + ‘.’); } const galleryUrl = ‘Thousands of FREE watch faces for Apple Watch, Samsung Galaxy Watch, OnePlus, Xiaomi, RTOS, VEE Wear, and more - Facer’ + encodeURIComponent(id); status.replaceChildren(); status.style.color = ‘#b9c5d0’; const link = document.createElement(‘a’); link.href = galleryUrl; link.target = ‘_blank’; link.rel = ‘noopener noreferrer’; link.textContent = ‘Open gallery for @’ + username; link.style.color = ‘#8ac7ff’; status.append(‘Gallery found. ‘, link); if (tab && !tab.closed) tab.location.replace(galleryUrl); } catch (error) { if (tab && !tab.closed) tab.close(); setStatus(error?.message || ‘Unable to find the gallery.’, true); } } function renderAuthors() { const query = filter.value.trim().toLowerCase(); const matches = Array.from(authors.values()).filter(a => a.username.toLowerCase().includes(query) || a.displayName.toLowerCase().includes(query) ); list.replaceChildren(); for (const author of matches) { const button = document.createElement(‘button’); button.type = ‘button’; const label = author.displayName && author.displayName.toLowerCase() !== author.username.toLowerCase() ? author.displayName + ’ (@’ + author.username + ‘)’ : ‘@’ + author.username; button.textContent = label; Object.assign(button.style, {display:‘block’,width:‘100%’,textAlign:‘left’,boxSizing:‘border-box’,margin:‘4px 0’,padding:‘8px 10px’,borderRadius:‘7px’,background:’#2a3139’,color:‘#fff’,border:‘1px solid #46505b’,cursor:‘pointer’,overflowWrap:‘anywhere’}); button.addEventListener(‘click’, () => openGallery(author.username)); list.append(button); } if (!matches.length) { const empty = document.createElement(‘div’); empty.textContent = authors.size ? ‘No participants match your filter.’ : ‘No participants found yet.’; empty.style.color = ‘#adb9c3’; list.append(empty); } } filter.addEventListener(‘input’, renderAuthors); const form = document.createElement(‘form’); Object.assign(form.style, {display:‘flex’,gap:‘7px’,marginTop:‘12px’}); const input = document.createElement(‘input’); input.type = ‘text’; input.placeholder = ‘Forum username’; input.setAttribute(‘aria-label’, ‘Forum username’); Object.assign(input.style, {width:‘100%’,minWidth:‘0’,flex:‘1’,boxSizing:‘border-box’,padding:‘8px’,borderRadius:‘6px’,border:‘1px solid #56606d’,background:‘#252c34’,color:‘#fff’,fontSize:‘13px’}); const submit = document.createElement(‘button’); submit.type = ‘submit’; submit.textContent = ‘Find’; Object.assign(submit.style, {background:‘#33475e’,color:‘#fff’,border:‘1px solid #55799c’,borderRadius:‘6px’,padding:‘8px 12px’,cursor:‘pointer’}); form.append(input, submit); form.addEventListener(‘submit’, event => { event.preventDefault(); const username = input.value.trim().replace(/^@/, ‘’); if (!validUsername(username)) { setStatus(‘Please enter a valid forum username.’, true); return; } openGallery(username); }); panel.append(form, status); document.body.append(panel); async function getJSON(url) { const response = await fetch(url, {credentials: ‘same-origin’, headers: {Accept: ‘application/json’}}); if (!response.ok) throw new Error(‘Discourse API error (HTTP ’ + response.status + ‘).’); return response.json(); } async function loadTopic() { if (!topicMatch) { addLoadedAuthors(); description.textContent = authors.size ? authors.size + ’ forum user’ + (authors.size === 1 ? ‘’ : ‘s’) + ’ found on this page.’ : ‘No forum users detected. Enter a username below.’; renderAuthors(); return; } const topicId = topicMatch[1]; try { const topic = await getJSON(‘/t/’ + topicId + ‘.json?print=true’); const postStream = topic?.post_stream; if (!postStream || !Array.isArray(postStream.posts)) { throw new Error(‘Topic data did not contain posts.’); } const seen = new Set(); function addPosts(posts) { for (const post of posts) { if (typeof post?.id === ‘number’) seen.add(post.id); addAuthor(post?.username, typeof post?.name === ‘string’ ? post.name : ‘’); } } addPosts(postStream.posts); const stream = Array.isArray(postStream.stream) ? postStream.stream : ; const missing = stream.filter(id => Number.isInteger(id) && !seen.has(id)); renderAuthors(); description.textContent = authors.size + ’ participants found so far…‘; for (let offset = 0; offset < missing.length; offset += 20) { if (!panel.isConnected) return; const chunk = missing.slice(offset, offset + 20); const parameters = new URLSearchParams(); chunk.forEach(id => parameters.append(‘post_ids’, String(id))); const more = await getJSON(’/t/’ + topicId + ‘/posts.json?’ + parameters.toString()); if (!Array.isArray(more?.post_stream?.posts)) { throw new Error(‘Unable to read an additional batch of posts.’); } addPosts(more.post_stream.posts); renderAuthors(); description.textContent = authors.size + ’ participants found so far…‘; setStatus(‘Reading topic posts: ’ + Math.min(stream.length, seen.size) + ’ of ’ + stream.length + ‘.’); } description.textContent = authors.size + ’ participant’ + (authors.size === 1 ? ‘’ : ‘s’) + ’ found in this topic. Select one to open their gallery:’; renderAuthors(); setStatus(‘Complete. Only accounts with a linked Facer ID have a gallery URL.’); } catch (error) { addLoadedAuthors(); renderAuthors(); description.textContent = authors.size ? authors.size + ’ currently visible participant’ + (authors.size === 1 ? ‘’ : ‘s’) + ’ found.’ : ‘Unable to list topic participants. Enter a username below.’; setStatus(‘Full topic scan unavailable: ’ + (error?.message || ‘Unknown error’) + ’ Some participants may be missing.’, true); } } addLoadedAuthors(); renderAuthors(); if (topicMatch) { description.textContent = ‘Scanning the full topic for participants…’; setStatus(‘Loading topic data…’); } loadTopic(); })();
Had anyone besides me submitted a ticket for profile links? We really need this.
Nice! good stuff!
Yes, I asked Adam in this thread in August: New forum look and feel? - #10 by ed.ludwig
