Last active
May 18, 2021 23:03
-
-
Save arasmussen/6ba9a16354cdddc95b8e3deaf2fa395a to your computer and use it in GitHub Desktop.
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
componentDidMount() { | |
initializeCannyChangelog(); | |
} | |
function initializeCannyChangelog() { | |
// Load Canny SDK | |
!function(w,d,i,s){function l(){if(!d.getElementById(i)){var f=d.getElementsByTagName(s)[0],e=d.createElement(s);e.type="text/javascript",e.async=!0,e.src="https://canny.io/sdk.js",f.parentNode.insertBefore(e,f)}}if("function"!=typeof w.Canny){var c=function(){c.q.push(arguments)};c.q=[],w.Canny=c,"complete"===d.readyState?l():w.attachEvent?w.attachEvent("onload",l):w.addEventListener("load",l,!1)}}(window,document,"canny-jssdk","script"); | |
// Find changelog button | |
const spanTags = document.getElementsByTagName('span'); | |
const changelogButtons = spanTags.filter((spanTag) => { | |
return spanTag.textContent === 'Latest Changes'; | |
}); | |
if (changelogButtons.length !== 1) { | |
return; | |
} | |
const changelogButton = changelogButtons[0]; | |
// Initialize changelog | |
Canny('initChangelog', { | |
appID: 'YOUR_APP_ID', | |
position: 'bottom', | |
align: 'left', | |
}, changelogButton); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment