forked from extern/easydiffusion
Add a 'What's New?' tab as a core plugin, which fetches the contents of CHANGES.md from the app's release branch
This commit is contained in:
parent
f7ec9f2073
commit
18d9d2602a
@ -1,8 +1,6 @@
|
||||
# Change history
|
||||
|
||||
Please add all changes that have a noticeable impact on users (including plugin
|
||||
developers) to this change list
|
||||
# What's new?
|
||||
|
||||
# 2.4.5
|
||||
* Add checkbox for "Open browser on startup"
|
||||
* Add a directory for core plugins that ship with Stable Diffusion UI by default
|
||||
* Add a "What's New?" tab as a core plugin, which fetches the contents of CHANGES.md from the app's release branch
|
@ -14,6 +14,7 @@
|
||||
<link rel="stylesheet" href="/media/css/drawingboard.min.css">
|
||||
<script src="/media/js/jquery-3.6.1.min.js"></script>
|
||||
<script src="/media/js/drawingboard.min.js"></script>
|
||||
<script src="/media/js/marked.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
@ -333,7 +334,7 @@
|
||||
<script src="media/js/inpainting-editor.js?v=1"></script>
|
||||
<script src="media/js/image-modifiers.js?v=6"></script>
|
||||
<script src="media/js/auto-save.js?v=8"></script>
|
||||
<script src="media/js/main.js?v=22.1"></script>
|
||||
<script src="media/js/main.js?v=23"></script>
|
||||
<script src="media/js/themes.js?v=4"></script>
|
||||
<script src="media/js/dnd.js?v=9"></script>
|
||||
<script>
|
||||
|
@ -1284,7 +1284,7 @@ document.querySelectorAll('.popup').forEach(popup => {
|
||||
})
|
||||
|
||||
var tabElements = [];
|
||||
document.querySelectorAll(".tab").forEach(tab => {
|
||||
function linkTabContents(tab) {
|
||||
var name = tab.id.replace("tab-", "");
|
||||
var content = document.getElementById(`tab-content-${name}`)
|
||||
tabElements.push({
|
||||
@ -1305,7 +1305,9 @@ document.querySelectorAll(".tab").forEach(tab => {
|
||||
content.classList.toggle("active")
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
document.querySelectorAll(".tab").forEach(linkTabContents)
|
||||
|
||||
window.addEventListener("beforeunload", function(e) {
|
||||
const msg = "Unsaved pictures will be lost!";
|
||||
|
6
ui/media/js/marked.min.js
vendored
Normal file
6
ui/media/js/marked.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
47
ui/plugins/ui/release-notes.plugin.js
Normal file
47
ui/plugins/ui/release-notes.plugin.js
Normal file
@ -0,0 +1,47 @@
|
||||
(function() {
|
||||
document.querySelector('#tab-container').insertAdjacentHTML('beforeend', `
|
||||
<span id="tab-news" class="tab">
|
||||
<span><i class="fa fa-bolt icon"></i> What's new?</span>
|
||||
</span>
|
||||
`)
|
||||
|
||||
document.querySelector('#tab-content-wrapper').insertAdjacentHTML('beforeend', `
|
||||
<div id="tab-content-news" class="tab-content">
|
||||
<div id="news" class="tab-content-inner">
|
||||
Loading..
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
|
||||
document.querySelector('body').insertAdjacentHTML('beforeend', `
|
||||
<style>
|
||||
#tab-content-news .tab-content-inner {
|
||||
max-width: 100%;
|
||||
text-align: left;
|
||||
padding: 10pt;
|
||||
}
|
||||
</style>
|
||||
`)
|
||||
|
||||
linkTabContents(document.querySelector('#tab-news'))
|
||||
|
||||
let markedScript = document.createElement('script')
|
||||
markedScript.src = '/media/js/marked.min.js'
|
||||
|
||||
markedScript.onload = async function() {
|
||||
let appConfig = await fetch('/get/app_config')
|
||||
appConfig = await res.json()
|
||||
|
||||
let updateBranch = appConfig.update_branch || 'main'
|
||||
|
||||
let news = document.querySelector('#news')
|
||||
let releaseNotes = await fetch(`https://raw.githubusercontent.com/cmdr2/stable-diffusion-ui/${updateBranch}/CHANGES.md`)
|
||||
if (releaseNotes.status != 200) {
|
||||
return
|
||||
}
|
||||
releaseNotes = await releaseNotes.text()
|
||||
news.innerHTML = marked.parse(releaseNotes)
|
||||
}
|
||||
|
||||
document.querySelector('body').appendChild(markedScript)
|
||||
})()
|
Loading…
Reference in New Issue
Block a user