Skip to content

Commit

Permalink
Add '(link)' text to readme window, so users can easily share a link …
Browse files Browse the repository at this point in the history
…to the readme
  • Loading branch information
gfwilliams committed May 22, 2024
1 parent d805466 commit 1b613f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ function showReadme(event, appid) {
let markedOptions = { baseUrl : appPath };
function show(contents) {
if (!contents) return;
showPrompt(app.name + " Documentation", marked(contents, markedOptions), {ok: true}, false).catch(() => {});
let footerText = `<a href="${window.location.origin+window.location.pathname+"?id="+appid+"&readme"}">(Link)</a>`;
showPrompt(app.name + " Documentation", marked(contents, markedOptions), {ok: true, footer: footerText}, false).catch(() => {});
}
httpGet(appPath+app.readme).then(show).catch(()=>show("Failed to load README."));
}
Expand Down
5 changes: 3 additions & 2 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ function showPrompt(title, text, buttons, shouldEscapeHtml) {
${(shouldEscapeHtml) ? escapeHtml(text).replace(/\n/g,'<br/>') : text}
</div>
</div>
${Object.keys(buttons).length ? `<div class="modal-footer">
${Object.keys(buttons).length ? `
<div class="modal-footer">
${buttons.yes?'<button class="btn btn-primary" isyes="1">Yes</button>':''}
${buttons.no?'<button class="btn" isyes="0">No</button>':''}
${buttons.ok?'<button class="btn" isyes="1">Ok</button>':''}
${buttons.footer?`<span style="float:left">${buttons.footer}<span>`:""}
</div>
</div>`:``}
`:``}
</div>
</div>`);
document.body.append(modal);
Expand Down

0 comments on commit 1b613f4

Please sign in to comment.