Last active
December 12, 2018 21:15
-
-
Save phette23/b4c9da75cc08ebd43b4c244266991f3d to your computer and use it in GitHub Desktop.
format a support ticket for reporting a broken link in Summon (paste into dev tools)
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
// support ticket text, to be copied to clipboard later | |
var text = 'The link to this article\n\n' | |
// angular doc with metadata details | |
var doc = angular.element('.documentSummary').scope().document | |
var authors = doc.authors.reduce((text, author, idx, arr) => { | |
text += author.fullname | |
// it's _not_ the last author in the list | |
if (arr.length - idx != 1) { | |
text += ', ' | |
} | |
// there's more than one author and this is the penultimate author | |
if (arr.length > 1 && arr.length - idx === 2) { | |
text += '& ' | |
} | |
return text | |
}, '') | |
// citation | |
text += `"${doc.full_title}" by ${authors}. _${doc.publication_title}_, ${doc.publication_date}.\n\n` | |
text += `fails to resolve correctly.\n\nSummon bookmark:\n${'https://cca.summon.serialssolutions.com/#!/search?bookMark=' + doc.bookmark}\n\nOpenURL:\n${doc.open_url}` | |
prompt("Copy to clipboard with CMD+C", text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment