diff --git a/src/js/render.js b/src/js/render.js
index fa15333..8c7f573 100644
--- a/src/js/render.js
+++ b/src/js/render.js
@@ -36,7 +36,21 @@ export function renderDictionaryDetails() {
export function renderName() {
const dictionaryName = removeTags(window.currentDictionary.name) + ' ' + removeTags(window.currentDictionary.specification);
- document.getElementById('dictionaryName').innerHTML = dictionaryName;
+ const name = document.getElementById('dictionaryName');
+ name.innerHTML = dictionaryName;
+ const isPublic = hasToken() && window.currentDictionary.settings.isPublic;
+ if (isPublic && !document.getElementById('dictionaryShare')) {
+ const shareLink = document.createElement('a');
+ shareLink.id = 'dictionaryShare';
+ shareLink.classList.add('button');
+ shareLink.style.float = 'right';
+ shareLink.href = window.location.pathname.match(new RegExp(window.currentDictionary.externalID + '$')) ? window.location.pathname
+ : window.location.pathname.substring(0, window.location.pathname.indexOf(window.currentDictionary.externalID)) + window.currentDictionary.externalID;
+ shareLink.target = '_blank';
+ shareLink.title = 'Public Link to Dictionary';
+ shareLink.innerHTML = '➦';
+ name.parentElement.insertBefore(shareLink, name);
+ }
}
export function renderDescription() {
@@ -179,10 +193,10 @@ export function renderWords() {
${word.name}${homonymnNumber > 0 ? ' ' + homonymnNumber.toString() + '' : ''}
${word.pronunciation}
${word.partOfSpeech}
+ ${isPublic ? `➦` : ''}
Options
Edit
- ${isPublic ? `
Share` : ''}
Delete
diff --git a/src/js/view/render.js b/src/js/view/render.js
index 6c1b86e..2d8ed15 100644
--- a/src/js/view/render.js
+++ b/src/js/view/render.js
@@ -26,6 +26,9 @@ export function renderDictionaryDetails() {
export function renderName() {
const dictionaryName = removeTags(window.currentDictionary.name) + ' ' + removeTags(window.currentDictionary.specification);
document.getElementById('dictionaryName').innerHTML = dictionaryName;
+ const shareLink = window.location.pathname.match(new RegExp(window.currentDictionary.externalID + '$')) ? window.location.pathname
+ : window.location.pathname.substring(0, window.location.pathname.indexOf(window.currentDictionary.externalID)) + window.currentDictionary.externalID;
+ document.getElementById('dictionaryShare').href = shareLink;
}
export function renderDescription() {
@@ -145,11 +148,13 @@ export function renderWords() {
details: detailsMarkdown,
wordId: originalWord.wordId,
});
+ const shareLink = window.location.pathname + (window.location.pathname.match(new RegExp(word.wordId + '$')) ? '' : '/' + word.wordId);
wordsHTML += `
${word.name}
${word.pronunciation}
${word.partOfSpeech}
+ ➦
- ${word.definition}
diff --git a/src/scss/Account/_structure.scss b/src/scss/Account/_structure.scss
index e54f47f..2009354 100644
--- a/src/scss/Account/_structure.scss
+++ b/src/scss/Account/_structure.scss
@@ -13,4 +13,10 @@
}
}
}
+}
+
+.share-link {
+ margin-left: $general-padding !important;
+ line-height: 16px !important;
+ padding: 1px 3px 3px !important;
}
\ No newline at end of file
diff --git a/view.html b/view.html
index ae2b342..b0300ed 100644
--- a/view.html
+++ b/view.html
@@ -109,7 +109,9 @@
- Dictionary Name
+ ➦
+ {{dict_name}}
+ Created by {{public_name}}