Skip to content

Commit 1b613f4

Browse files
committed
Add '(link)' text to readme window, so users can easily share a link to the readme
1 parent d805466 commit 1b613f4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

js/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ function showReadme(event, appid) {
205205
let markedOptions = { baseUrl : appPath };
206206
function show(contents) {
207207
if (!contents) return;
208-
showPrompt(app.name + " Documentation", marked(contents, markedOptions), {ok: true}, false).catch(() => {});
208+
let footerText = `<a href="${window.location.origin+window.location.pathname+"?id="+appid+"&readme"}">(Link)</a>`;
209+
showPrompt(app.name + " Documentation", marked(contents, markedOptions), {ok: true, footer: footerText}, false).catch(() => {});
209210
}
210211
httpGet(appPath+app.readme).then(show).catch(()=>show("Failed to load README."));
211212
}

js/ui.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ function showPrompt(title, text, buttons, shouldEscapeHtml) {
117117
${(shouldEscapeHtml) ? escapeHtml(text).replace(/\n/g,'<br/>') : text}
118118
</div>
119119
</div>
120-
${Object.keys(buttons).length ? `<div class="modal-footer">
120+
${Object.keys(buttons).length ? `
121121
<div class="modal-footer">
122122
${buttons.yes?'<button class="btn btn-primary" isyes="1">Yes</button>':''}
123123
${buttons.no?'<button class="btn" isyes="0">No</button>':''}
124124
${buttons.ok?'<button class="btn" isyes="1">Ok</button>':''}
125+
${buttons.footer?`<span style="float:left">${buttons.footer}<span>`:""}
125126
</div>
126-
</div>`:``}
127+
`:``}
127128
</div>
128129
</div>`);
129130
document.body.append(modal);

0 commit comments

Comments
 (0)