Created
September 6, 2022 16:06
-
-
Save tjmcewan/a48e61d7284b37d085b8098449b6ab40 to your computer and use it in GitHub Desktop.
Bookmarklet to copy EasyRetro cards to your clipboard as markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
!(() => document.querySelectorAll('.easy-card-list').length < 1 | |
? window.alert('EasyRetro board columns not found') | |
: (() => { | |
/* show all the comments first */ | |
document.querySelectorAll('[aria-label="New comment"]').forEach(el => el.click()); | |
navigator.clipboard.writeText( | |
[...document.querySelectorAll('.easy-card-list')] | |
/* for each column: get column header */ | |
.map(l => [`# ${l.querySelector('.column-header').textContent.trim()}\n`] | |
.concat([...l.querySelectorAll('.easy-card')] | |
/* for each card: get likes, text, comments */ | |
.map(c => '- ' | |
.concat(c.querySelector('.easy-badge-votes').textContent.trim() === '0' ? '' : `[+${c.querySelector('.easy-badge-votes').textContent.trim()}] `) | |
.concat(c.querySelector('.easy-card-main').textContent.trim().replaceAll('\n---\n', ' || ')) | |
.concat([...c.querySelectorAll('.easy-comment-text')].map(m => '\n - ' + m.textContent.trim()).join('')) | |
) | |
).join('\n') | |
).join('\n\n\n') | |
).then(() => { | |
/* if copy to clipboard was a success, hide the comments again */ | |
document.querySelectorAll('[aria-label="New comment"]').forEach(el => el.click()); | |
window.alert('Markdown copied to clipboard'); | |
}, e => console.error(e) || window.alert('Hm, something went wrong')) | |
})() | |
)(); | |
void (0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:!(()=>document.querySelectorAll('.easy-card-list').length<1?window.alert('EasyRetro board columns not found'):(()=>{document.querySelectorAll('[aria-label="New comment"]').forEach(el=>el.click());navigator.clipboard.writeText([...document.querySelectorAll('.easy-card-list')].map(l=>[`# ${l.querySelector('.column-header').textContent.trim()}\n`].concat([...l.querySelectorAll('.easy-card')].map(c=>'- '.concat(c.querySelector('.easy-badge-votes').textContent.trim()==='0'?'':`[+${c.querySelector('.easy-badge-votes').textContent.trim()}] `).concat(c.querySelector('.easy-card-main').textContent.trim().replaceAll('\n---\n',' || ')).concat([...c.querySelectorAll('.easy-comment-text')].map(m=>'\n - '+m.textContent.trim()).join('')))).join('\n')).join('\n\n\n')).then(()=>{document.querySelectorAll('[aria-label="New comment"]').forEach(el=>el.click());window.alert('Markdown copied to clipboard');},e=>console.error(e)||window.alert('Hm, something went wrong'))})())();void(0); |
formatted column-clearer:
javascript: !(
() => confirm('Clear ALL columns?')
&& [...document.querySelectorAll('.easy-card-list')].forEach(col => {
col.querySelector('[aria-label=%22Open%20column%20menu%22]').click();
col.querySelector('[aria-label=%22Clear%20column%22]').click();
document.querySelector('#swal2-checkbox').checked=true;
document.querySelector('button.swal2-confirm').click();
})
)();
void (0);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, clear all columns with confirmation: