Last active
November 22, 2018 09:00
-
-
Save primozcigler/7e0aa9f6330b177c3a06 to your computer and use it in GitHub Desktop.
Trello changelog in console
This file contains hidden or 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
(function() { | |
'use strict'; | |
var changelog = []; | |
var date = new Date(); | |
var padLeft = function ( str ) { | |
var pad = '00'; | |
return pad.substring(0, pad.length - str.length) + str; | |
}; | |
// opening <pre> | |
changelog.push( '<pre>' ); | |
// ver + date | |
changelog.push( $$( '.js-title-helper' )[0].textContent + ' (' + date.getFullYear() + '-' + padLeft( "" + ( 1 + date.getMonth() ) ) + '-' + padLeft( "" + date.getDate() ) + ')' ); | |
// changes from checklist | |
Array.prototype.map.call( $$('.checklist .checklist-item-state-complete .checklist-item-details-text'), function( $elm ) { | |
changelog.push( $elm.textContent ); | |
} ); | |
// closing </pre> | |
changelog.push( '</pre>' ); | |
changelog.push( '' ); | |
copy( | |
changelog | |
.map( function( line ) { | |
return line.trim(); | |
} ) | |
.join( '\n' ) | |
); | |
return 'Changelog copied to clipboard!'; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment