Compare commits
10 Commits
8a3c8879b7
...
55730a8642
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55730a8642 | ||
|
|
c8e51c8344 | ||
|
|
bf5d5ec510 | ||
|
|
271c543579 | ||
|
|
fba92592aa | ||
|
|
e68489717a | ||
|
|
57c4369849 | ||
|
|
fb4c302ddd | ||
|
|
ce9a39c76e | ||
|
|
c750cfbbc3 |
15
css/main.css
15
css/main.css
@ -320,11 +320,11 @@ ul {
|
||||
}
|
||||
|
||||
.observe-empty-state:empty {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.observe-empty-state:not(:empty) + .empty-state {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.icon {
|
||||
@ -987,6 +987,15 @@ sm-copy {
|
||||
padding: 1.5rem 0 1rem 0;
|
||||
background-color: rgba(var(--background-color), 1);
|
||||
}
|
||||
#preview_page h1,
|
||||
#preview_page h2,
|
||||
#preview_page h3,
|
||||
#preview_page h4,
|
||||
#preview_page h5,
|
||||
#preview_page h6 {
|
||||
font-weight: 400;
|
||||
font-family: "Calistoga", cursive;
|
||||
}
|
||||
#preview_page h3 {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
@ -1002,7 +1011,7 @@ sm-copy {
|
||||
}
|
||||
|
||||
#preview__body {
|
||||
padding-bottom: 1.5rem;
|
||||
padding: 1.5rem 0;
|
||||
}
|
||||
|
||||
.preview-group:not(:last-of-type) {
|
||||
|
||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -313,11 +313,11 @@ ul {
|
||||
}
|
||||
|
||||
.observe-empty-state:empty {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.observe-empty-state:not(:empty) + .empty-state {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.icon {
|
||||
@ -933,6 +933,15 @@ sm-copy {
|
||||
padding: 1.5rem 0 1rem 0;
|
||||
background-color: rgba(var(--background-color), 1);
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: 400;
|
||||
font-family: "Calistoga", cursive;
|
||||
}
|
||||
h3 {
|
||||
margin-bottom: 1rem;
|
||||
&:not(:first-of-type) {
|
||||
@ -948,7 +957,7 @@ sm-copy {
|
||||
}
|
||||
}
|
||||
#preview__body {
|
||||
padding-bottom: 1.5rem;
|
||||
padding: 1.5rem 0;
|
||||
}
|
||||
|
||||
.preview-group {
|
||||
|
||||
92
index.html
92
index.html
@ -11,7 +11,7 @@
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap"
|
||||
href="https://fonts.googleapis.com/css2?family=Calistoga&family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap"
|
||||
rel="stylesheet">
|
||||
<script src="purify.min.js" defer></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6" defer></script>
|
||||
@ -1004,6 +1004,7 @@
|
||||
hidePopup()
|
||||
render.article(params.articleID)
|
||||
}
|
||||
hideVersionHistory()
|
||||
window.history.replaceState('', '', `#/home?articleID=${params.articleID}`)
|
||||
getRef('preview__body').innerHTML = ''
|
||||
targetPage = 'main_page'
|
||||
@ -1306,9 +1307,9 @@
|
||||
}
|
||||
|
||||
function getReadingTime(content) {
|
||||
const wpm = 225;
|
||||
const wpm = 250;
|
||||
const words = content.trim().split(/\s+/).length;
|
||||
return Math.ceil(words / wpm);
|
||||
return Math.floor(words / wpm);
|
||||
}
|
||||
|
||||
|
||||
@ -1335,7 +1336,7 @@
|
||||
section.lastElementChild.remove()
|
||||
section.replaceWith(...section.childNodes)
|
||||
})
|
||||
return DOMPurify.sanitize(exportContent.innerHTML)
|
||||
return DOMPurify.sanitize(exportContent.innerHTML, { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
|
||||
}
|
||||
|
||||
function exportSelection() {
|
||||
@ -1389,11 +1390,11 @@
|
||||
contributors.forEach(id => allContributors.add(id))
|
||||
});
|
||||
if (floGlobals.appObjects[pagesData.params.articleID]?.preview?.id) {
|
||||
floGlobals.appObjects[pagesData.params.articleID].preview.content = DOMPurify.sanitize(getRef('preview__body').innerHTML)
|
||||
floGlobals.appObjects[pagesData.params.articleID].preview.content = DOMPurify.sanitize(getRef('preview__body').innerHTML, { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
|
||||
} else {
|
||||
floGlobals.appObjects[pagesData.params.articleID].preview = {
|
||||
uid: floCrypto.randString(16, true),
|
||||
content: DOMPurify.sanitize(getRef('preview__body').innerHTML),
|
||||
content: DOMPurify.sanitize(getRef('preview__body').innerHTML, { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] }),
|
||||
contributors: [...allContributors]
|
||||
}
|
||||
}
|
||||
@ -1483,9 +1484,12 @@
|
||||
currentElement.remove()
|
||||
}
|
||||
})
|
||||
|
||||
let activeEntry
|
||||
getRef('article_wrapper').addEventListener("focusin", e => {
|
||||
if (e.target.closest('.content__area')) {
|
||||
const target = e.target.closest('.content__area')
|
||||
activeEntry = target.closest('.content-card')
|
||||
document.addEventListener('selectionchange', detectFormatting)
|
||||
if (target.childNodes[0] === undefined) {
|
||||
target.innerHTML = `<p><br/></p>`
|
||||
@ -1508,6 +1512,7 @@
|
||||
if (!e.relatedTarget?.closest('#text_toolbar')) {
|
||||
getRef('text_toolbar').classList.add('hide-completely')
|
||||
childObserver.disconnect()
|
||||
activeEntry = undefined
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1527,6 +1532,7 @@
|
||||
document.execCommand("defaultParagraphSeparator", false, "p");
|
||||
function formatDoc(sCmd, sValue) {
|
||||
document.execCommand(sCmd, false, sValue);
|
||||
checkEntry()
|
||||
}
|
||||
function incScore(value) {
|
||||
let currentScore = parseFloat(getRef('update_score_field').value)
|
||||
@ -1543,7 +1549,7 @@
|
||||
}
|
||||
function updateScore() {
|
||||
const newScore = parseFloat(getRef('update_score_field').value)
|
||||
updateGenData(floGlobals.versionHistory.currentEntry, { score: newScore })
|
||||
updateGenData(floGlobals.versionHistory.currentEntry, { tag: newScore })
|
||||
document.querySelectorAll(`[data-vector-clock="${floGlobals.versionHistory.currentEntry}"] .content__score`).forEach(scoreElem => scoreElem.textContent = newScore)
|
||||
document.querySelectorAll(`[data-vector-clock="${floGlobals.versionHistory.currentEntry}"] .content__score`).forEach(scoreElem => newScore > 0 ? scoreElem.parentNode.classList.add('score-button--filled') : scoreElem.parentNode.classList.remove('score-button--filled'))
|
||||
floCloudAPI.tagApplicationData(floGlobals.versionHistory.currentEntry, newScore).then(res => {
|
||||
@ -1649,7 +1655,7 @@
|
||||
if (!floGlobals.isSubAdmin) {
|
||||
clone.querySelector('.content__area').setAttribute('contentEditable', true)
|
||||
}
|
||||
clone.querySelector('.content__area').innerHTML = DOMPurify.sanitize(html)
|
||||
clone.querySelector('.content__area').innerHTML = DOMPurify.sanitize(html, { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
|
||||
let noOfContributors = 0
|
||||
let latestContributor
|
||||
for (const contributor in contributors) {
|
||||
@ -1669,15 +1675,21 @@
|
||||
clone.querySelector('.entry__author').textContent = editor
|
||||
if (oldText !== '') {
|
||||
const frag = document.createDocumentFragment()
|
||||
Diff.diffChars(oldText, plainText).forEach((part) => {
|
||||
const type = part.added ? 'added' :
|
||||
part.removed ? 'removed' : '';
|
||||
frag.append(
|
||||
createElement('span', {
|
||||
textContent: part.value,
|
||||
className: type
|
||||
})
|
||||
);
|
||||
Diff.diffWords(oldText, plainText).forEach((part) => {
|
||||
if (part.hasOwnProperty('added') || part.hasOwnProperty('removed')) {
|
||||
const type = part.added ? 'added' :
|
||||
part.removed ? 'removed' : '';
|
||||
frag.append(
|
||||
createElement('span', {
|
||||
textContent: part.value,
|
||||
className: type
|
||||
})
|
||||
);
|
||||
} else {
|
||||
frag.append(
|
||||
document.createTextNode(part.value)
|
||||
)
|
||||
}
|
||||
});
|
||||
clone.querySelector('.entry__changes').append(frag)
|
||||
} else {
|
||||
@ -1755,7 +1767,9 @@
|
||||
iterations: []
|
||||
}
|
||||
}
|
||||
floGlobals.currentArticle.sections[section].uniqueEntries.add(origin)
|
||||
if (floGlobals.currentArticle.sections[section]) {
|
||||
floGlobals.currentArticle.sections[section].uniqueEntries.add(origin)
|
||||
}
|
||||
floGlobals.currentArticle.uniqueEntries[origin]['iterations'].push(generalData[key].vectorClock)
|
||||
}
|
||||
for (const sectionID in floGlobals.currentArticle.sections) {
|
||||
@ -1790,14 +1804,14 @@
|
||||
}
|
||||
|
||||
const checkEntry = debounce(e => {
|
||||
const contentCard = e.target.closest('.content-card')
|
||||
const contentCard = activeEntry
|
||||
const contentArea = contentCard.querySelector('.content__area')
|
||||
const uid = contentCard.dataset.uid
|
||||
const isUniqueEntry = contentArea.dataset.type === 'origin'
|
||||
if (contentArea.textContent.trim() === '') {
|
||||
if (contentArea.innerText.trim() === '') {
|
||||
contentCard.querySelector('.submit-entry').classList.add('hide-completely')
|
||||
} else {
|
||||
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'] })
|
||||
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
|
||||
const hash = Crypto.SHA256(cleanHTML)
|
||||
let previousHash
|
||||
if (!isUniqueEntry) {
|
||||
@ -1830,7 +1844,7 @@
|
||||
contentArea.firstChild.remove()
|
||||
contentArea.prepend(p)
|
||||
}
|
||||
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'] })
|
||||
const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
|
||||
const hash = Crypto.SHA256(cleanHTML)
|
||||
let previousVersion, previousHash
|
||||
if (!isUniqueEntry) {
|
||||
@ -1988,7 +2002,7 @@
|
||||
selectedContent.delete(contentID)
|
||||
} else {
|
||||
const sectionID = contentCard.closest('.article-section').dataset.sectionId
|
||||
const content = DOMPurify.sanitize(contentCard.querySelector('.content__area').innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'] })
|
||||
const content = DOMPurify.sanitize(contentCard.querySelector('.content__area').innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'], ADD_ATTR: ['target'] })
|
||||
.replace(/b>/gi, 'strong>').replace(/i>/gi, 'em>')
|
||||
const contributors = Object.keys(getIterationDetails(contentID).contributors)
|
||||
selectedContent.set(contentID, { content, sectionID, contributors })
|
||||
@ -12068,7 +12082,7 @@
|
||||
margin: 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
font-family: "Inter", sans-serif
|
||||
font-family: "Roboto", sans-serif
|
||||
}
|
||||
|
||||
:root {
|
||||
@ -12126,6 +12140,16 @@
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: 400;
|
||||
font-family: "Calistoga", cursive;
|
||||
}
|
||||
|
||||
sm-copy {
|
||||
font-size: 0.9rem;
|
||||
--button-border-radius: 0.5rem;
|
||||
@ -12345,6 +12369,7 @@
|
||||
}
|
||||
|
||||
.logo {
|
||||
color: inherit;
|
||||
display: grid;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
@ -12391,7 +12416,6 @@
|
||||
}
|
||||
|
||||
article p {
|
||||
font-family: "noto serif", serif;
|
||||
line-height: 1.8;
|
||||
font-size: 1rem
|
||||
}
|
||||
@ -12577,22 +12601,20 @@
|
||||
</style>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400..700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap"
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Calistoga&family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap"
|
||||
rel="stylesheet">
|
||||
</template>
|
||||
<template id="body_template">
|
||||
<header id="main_header">
|
||||
<div class="logo">
|
||||
<svg class="main-logo" width="23" height="22" viewBox="0 0 23 22" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M15 0.749881C10.9026 2.35002 8 6.33604 8 11C8 15.664 10.9026 19.65 15 21.2501C13.7603 21.7343 12.4112 22 11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0C12.4112 0 13.7603 0.26573 15 0.749881Z" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M14 16.591C16.2349 15.7182 17.8182 13.544 17.8182 11C17.8182 8.45602 16.2349 6.28183 14 5.40903C14.6762 5.14494 15.4121 5 16.1818 5C19.4955 5 22.1818 7.68629 22.1818 11C22.1818 14.3137 19.4955 17 16.1818 17C15.4121 17 14.6762 16.8551 14 16.591Z" />
|
||||
<a href="https://ranchimall.github.io/rmtimes/" class="logo">
|
||||
<svg class="main-logo" viewBox="0 0 27.25 32">
|
||||
<title>RanchiMall</title>
|
||||
<path
|
||||
d="M27.14,30.86c-.74-2.48-3-4.36-8.25-6.94a20,20,0,0,1-4.2-2.49,6,6,0,0,1-1.25-1.67,4,4,0,0,1,0-2.26c.37-1.08.79-1.57,3.89-4.55a11.66,11.66,0,0,0,3.34-4.67,6.54,6.54,0,0,0,.05-2.82C20,3.6,18.58,2,16.16.49c-.89-.56-1.29-.64-1.3-.24a3,3,0,0,1-.3.72l-.3.55L13.42.94C13,.62,12.4.26,12.19.15c-.4-.2-.73-.18-.72.05a9.39,9.39,0,0,1-.61,1.33s-.14,0-.27-.13C8.76.09,8-.27,8,.23A11.73,11.73,0,0,1,6.76,2.6C4.81,5.87,2.83,7.49.77,7.49c-.89,0-.88,0-.61,1,.22.85.33.92,1.09.69A5.29,5.29,0,0,0,3,8.33c.23-.17.45-.29.49-.26a2,2,0,0,1,.22.63A1.31,1.31,0,0,0,4,9.34a5.62,5.62,0,0,0,2.27-.87L7,8l.13.55c.19.74.32.82,1,.65a7.06,7.06,0,0,0,3.46-2.47l.6-.71-.06.64c-.17,1.63-1.3,3.42-3.39,5.42L6.73,14c-3.21,3.06-3,5.59.6,8a46.77,46.77,0,0,0,4.6,2.41c.28.13,1,.52,1.59.87,3.31,2,4.95,3.92,4.95,5.93a2.49,2.49,0,0,0,.07.77h0c.09.09,0,.1.9-.14a2.61,2.61,0,0,0,.83-.32,3.69,3.69,0,0,0-.55-1.83A11.14,11.14,0,0,0,17,26.81a35.7,35.7,0,0,0-5.1-2.91C9.37,22.64,8.38,22,7.52,21.17a3.53,3.53,0,0,1-1.18-2.48c0-1.38.71-2.58,2.5-4.23,2.84-2.6,3.92-3.91,4.67-5.65a3.64,3.64,0,0,0,.42-2A3.37,3.37,0,0,0,13.61,5l-.32-.74.29-.48c.17-.27.37-.63.46-.8l.15-.3.44.64a5.92,5.92,0,0,1,1,2.81,5.86,5.86,0,0,1-.42,1.94c0,.12-.12.3-.15.4a9.49,9.49,0,0,1-.67,1.1,28,28,0,0,1-4,4.29C8.62,15.49,8.05,16.44,8,17.78a3.28,3.28,0,0,0,1.11,2.76c.95,1,2.07,1.74,5.25,3.32,3.64,1.82,5.22,2.9,6.41,4.38A4.78,4.78,0,0,1,21.94,31a3.21,3.21,0,0,0,.14.92,1.06,1.06,0,0,0,.43-.05l.83-.22.46-.12-.06-.46c-.21-1.53-1.62-3.25-3.94-4.8a37.57,37.57,0,0,0-5.22-2.82A13.36,13.36,0,0,1,11,21.19a3.36,3.36,0,0,1-.8-4.19c.41-.85.83-1.31,3.77-4.15,2.39-2.31,3.43-4.13,3.43-6a5.85,5.85,0,0,0-2.08-4.29c-.23-.21-.44-.43-.65-.65A2.5,2.5,0,0,1,15.27.69a10.6,10.6,0,0,1,2.91,2.78A4.16,4.16,0,0,1,19,6.16a4.91,4.91,0,0,1-.87,3c-.71,1.22-1.26,1.82-4.27,4.67a9.47,9.47,0,0,0-2.07,2.6,2.76,2.76,0,0,0-.33,1.54,2.76,2.76,0,0,0,.29,1.47c.57,1.21,2.23,2.55,4.65,3.73a32.41,32.41,0,0,1,5.82,3.24c2.16,1.6,3.2,3.16,3.2,4.8a1.94,1.94,0,0,0,.09.76,4.54,4.54,0,0,0,1.66-.4C27.29,31.42,27.29,31.37,27.14,30.86ZM6.1,7h0a3.77,3.77,0,0,1-1.46.45L4,7.51l.68-.83a25.09,25.09,0,0,0,3-4.82A12,12,0,0,1,8.28.76c.11-.12.77.32,1.53,1l.63.58-.57.84A10.34,10.34,0,0,1,6.1,7Zm5.71-1.78A9.77,9.77,0,0,1,9.24,7.18h0a5.25,5.25,0,0,1-1.17.28l-.58,0,.65-.78a21.29,21.29,0,0,0,2.1-3.12c.22-.41.42-.76.44-.79s.5.43.9,1.24L12,5ZM13.41,3a2.84,2.84,0,0,1-.45.64,11,11,0,0,1-.9-.91l-.84-.9.19-.45c.34-.79.39-.8,1-.31A9.4,9.4,0,0,1,13.8,2.33q-.18.34-.39.69Z" />
|
||||
</svg>
|
||||
<h4>RanchiMall Times</h4>
|
||||
</div>
|
||||
</a>
|
||||
<theme-toggle></theme-toggle>
|
||||
<button id="user_button" class="hide-completely" onclick="showPopup('user_popup')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" height="24px" viewBox="0 0 24 24" width="24px"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user