Added plot define feature
This commit is contained in:
parent
afde9d4a1c
commit
b9f40c3a74
@ -3882,7 +3882,6 @@ smTextarea.innerHTML = `
|
|||||||
--border-radius: 0.3rem;
|
--border-radius: 0.3rem;
|
||||||
--background: rgba(var(--text-color), 0.06);
|
--background: rgba(var(--text-color), 0.06);
|
||||||
--padding: initial;
|
--padding: initial;
|
||||||
--max-height: 8rem;
|
|
||||||
}
|
}
|
||||||
:host([variant="outlined"]) .textarea {
|
:host([variant="outlined"]) .textarea {
|
||||||
box-shadow: 0 0 0 0.1rem rgba(var(--text-color), 0.4) inset;
|
box-shadow: 0 0 0 0.1rem rgba(var(--text-color), 0.4) inset;
|
||||||
@ -3897,7 +3896,7 @@ smTextarea.innerHTML = `
|
|||||||
overflow: hidden auto;
|
overflow: hidden auto;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
max-height: var(--max-height);
|
max-height: var(--max-height, auto);
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
padding: var(--padding);
|
padding: var(--padding);
|
||||||
@ -3909,6 +3908,7 @@ textarea{
|
|||||||
min-width: 1em;
|
min-width: 1em;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
font-size: inherit;
|
||||||
resize: none;
|
resize: none;
|
||||||
grid-area: 2/1;
|
grid-area: 2/1;
|
||||||
justify-self: stretch;
|
justify-self: stretch;
|
||||||
|
|||||||
@ -1170,6 +1170,14 @@ sm-copy {
|
|||||||
right: auto;
|
right: auto;
|
||||||
bottom: auto;
|
bottom: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#create_article_popup {
|
||||||
|
--width: 28rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#user_popup {
|
||||||
|
--width: 25rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (any-hover: hover) {
|
@media (any-hover: hover) {
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1097,6 +1097,12 @@ sm-copy {
|
|||||||
right: auto;
|
right: auto;
|
||||||
bottom: auto;
|
bottom: auto;
|
||||||
}
|
}
|
||||||
|
#create_article_popup {
|
||||||
|
--width: 28rem;
|
||||||
|
}
|
||||||
|
#user_popup {
|
||||||
|
--width: 25rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (any-hover: hover) {
|
@media (any-hover: hover) {
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
|||||||
115
index.html
115
index.html
@ -443,10 +443,13 @@
|
|||||||
</sm-checkbox>
|
</sm-checkbox>
|
||||||
<div class="grid gap-1">
|
<div class="grid gap-1">
|
||||||
<div class="grid gap-0-5">
|
<div class="grid gap-0-5">
|
||||||
<h4>Define sections (optional)</h4>
|
<h4>Define plot (optional)</h4>
|
||||||
<p>Create and name sections by writing title of each section separated by a comma (,)</p>
|
<p>Create and name sections by writing section title encapsulated in '()' and each separated by a
|
||||||
|
'->'.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<sm-textarea id="get_section_titles" rows="4" placeholder="section title 1, section title 2, ...">
|
<sm-textarea id="get_section_titles" rows="8"
|
||||||
|
placeholder="(Name, place, time, context) -> (Name, place, time, context) ...">
|
||||||
</sm-textarea>
|
</sm-textarea>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="grid gap-1">
|
<!-- <div class="grid gap-1">
|
||||||
@ -734,23 +737,6 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limits the rate of function execution
|
|
||||||
function throttle(func, delay) {
|
|
||||||
// If setTimeout is already scheduled, no need to do anything
|
|
||||||
if (timerId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Schedule a setTimeout after delay seconds
|
|
||||||
timerId = setTimeout(function () {
|
|
||||||
func();
|
|
||||||
|
|
||||||
// Once setTimeout function execution is finished, timerId = undefined so that in
|
|
||||||
// the next scroll event function execution can be scheduled by the setTimeout
|
|
||||||
timerId = undefined;
|
|
||||||
}, delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
let zIndex = 10
|
let zIndex = 10
|
||||||
// function required for popups or modals to appear
|
// function required for popups or modals to appear
|
||||||
function showPopup(popupId, pinned) {
|
function showPopup(popupId, pinned) {
|
||||||
@ -1189,10 +1175,10 @@
|
|||||||
if (floGlobals.isSubAdmin) {
|
if (floGlobals.isSubAdmin) {
|
||||||
const title = getRef('get_article_title').value.trim()
|
const title = getRef('get_article_title').value.trim()
|
||||||
const setDefault = getRef('set_default_checkbox').checked
|
const setDefault = getRef('set_default_checkbox').checked
|
||||||
const sectionTitles = getRef('get_section_titles').value.trim()
|
const sectionTitles = parsePlot(getRef('get_section_titles').value.trim())
|
||||||
let sections = []
|
let sections = []
|
||||||
if (sectionTitles !== '') {
|
if (sectionTitles) {
|
||||||
sections = sectionTitles.split(',').map(title => {
|
sections = sectionTitles.map(title => {
|
||||||
return {
|
return {
|
||||||
id: floCrypto.randString(16, true),
|
id: floCrypto.randString(16, true),
|
||||||
title: title.trim(),
|
title: title.trim(),
|
||||||
@ -1228,6 +1214,36 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parsePlot(plottext) {
|
||||||
|
let tstring = plottext.trim().replace(/\s+/g, " ") // collapse all whitespace to single whitespace
|
||||||
|
tstring = tstring.replace(/\)\s*\->\s*\(/g, ")->(");
|
||||||
|
|
||||||
|
tstring = tstring.split(")->("); // split string based on the delimiter
|
||||||
|
|
||||||
|
if (tstring.length > 0) {
|
||||||
|
if (tstring[0].trim()[0] == "(") {
|
||||||
|
tstring[0] = tstring[0].trim().slice(1)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let lastobj = tstring[tstring.length - 1];
|
||||||
|
let lastobjlen = lastobj.length;
|
||||||
|
|
||||||
|
if (lastobj.trim()[lastobjlen - 1] == ")") {
|
||||||
|
tstring[tstring.length - 1] = lastobj.trim().slice(0, lastobjlen - 1)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return tstring;
|
||||||
|
}
|
||||||
|
|
||||||
function setDefaultArticle() {
|
function setDefaultArticle() {
|
||||||
if (floGlobals.isSubAdmin) {
|
if (floGlobals.isSubAdmin) {
|
||||||
getConfirmation('Set as default article?').then(res => {
|
getConfirmation('Set as default article?').then(res => {
|
||||||
@ -1585,21 +1601,22 @@
|
|||||||
bodyTemplate.querySelector('#reading_time').textContent = `${readingTime} min read`
|
bodyTemplate.querySelector('#reading_time').textContent = `${readingTime} min read`
|
||||||
let bodyAttributes = ''
|
let bodyAttributes = ''
|
||||||
let extraScripts = ''
|
let extraScripts = ''
|
||||||
if (floGlobals.isSubAdmin) {
|
// if (floGlobals.isSubAdmin) {
|
||||||
bodyAttributes = `data-article-id="${floGlobals.currentArticle.id}" onload="onLoadStartUp()"`
|
// bodyAttributes = `data-article-id="${floGlobals.currentArticle.id}" onload="onLoadStartUp()"`
|
||||||
// copy script already present in this file instead of storing a duplicate
|
// // copy script already present in this file instead of storing a duplicate
|
||||||
extraScripts = `
|
// extraScripts = `
|
||||||
${getRef('voting_enabled').innerHTML}
|
// ${getRef('voting_enabled').innerHTML}
|
||||||
<script>
|
// <script>
|
||||||
${getRef('init_lib').innerHTML}
|
// ${getRef('init_lib').innerHTML}
|
||||||
${getRef('floCrypto').innerHTML}
|
// ${getRef('floCrypto').innerHTML}
|
||||||
${getRef('floBlockchainAPI').innerHTML}
|
// ${getRef('floBlockchainAPI').innerHTML}
|
||||||
${getRef('compactIDB').innerHTML}
|
// ${getRef('compactIDB').innerHTML}
|
||||||
${getRef('floCloudAPI').innerHTML}
|
// ${getRef('floCloudAPI').innerHTML}
|
||||||
${getRef('floDapps').innerHTML}
|
// ${getRef('floDapps').innerHTML}
|
||||||
<\/script>
|
// <\/script>
|
||||||
`
|
// `
|
||||||
} else {
|
// }
|
||||||
|
if (!isSubAdmin) {
|
||||||
bodyTemplate.querySelector('header button').remove()
|
bodyTemplate.querySelector('header button').remove()
|
||||||
}
|
}
|
||||||
const bodyHTML = createElement('div')
|
const bodyHTML = createElement('div')
|
||||||
@ -1680,8 +1697,8 @@
|
|||||||
readTime,
|
readTime,
|
||||||
contributors: [...allContributors],
|
contributors: [...allContributors],
|
||||||
}, 'publishing_requests', {
|
}, 'publishing_requests', {
|
||||||
application: 'Test_RM_Times',
|
application: 'RM_Times',
|
||||||
receiverID: 'FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf'
|
receiverID: 'FF5pewfsJxyrCvg8a2C8VXefeyVvKvQxmF'
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
@ -12910,7 +12927,7 @@
|
|||||||
FLO: ['https://livenet.flocha.in/', 'https://flosight.duckdns.org/'],
|
FLO: ['https://livenet.flocha.in/', 'https://flosight.duckdns.org/'],
|
||||||
FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/']
|
FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/']
|
||||||
},
|
},
|
||||||
adminID: "FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf",
|
adminID: "FF5pewfsJxyrCvg8a2C8VXefeyVvKvQxmF",
|
||||||
sendAmt: 0.001,
|
sendAmt: 0.001,
|
||||||
fee: 0.0005,
|
fee: 0.0005,
|
||||||
|
|
||||||
@ -12920,7 +12937,7 @@
|
|||||||
|
|
||||||
//for cloud apps
|
//for cloud apps
|
||||||
subAdmins: [],
|
subAdmins: [],
|
||||||
application: "Test_RM_Times",
|
application: "RM_Times",
|
||||||
appObjects: {},
|
appObjects: {},
|
||||||
generalData: {},
|
generalData: {},
|
||||||
lastVC: {}
|
lastVC: {}
|
||||||
@ -13088,18 +13105,18 @@
|
|||||||
duration: 150,
|
duration: 150,
|
||||||
ease: 'easing',
|
ease: 'easing',
|
||||||
}
|
}
|
||||||
floGlobals.appObjects.articles[articleID].votes += voteCount
|
floGlobals.appObjects.rmTimes.articles[articleID].votes += voteCount
|
||||||
getRef('like_count').animate(slideOutUp, animOptions)
|
getRef('like_count').animate(slideOutUp, animOptions)
|
||||||
.onfinish = (e) => {
|
.onfinish = (e) => {
|
||||||
e.target.cancel()
|
e.target.cancel()
|
||||||
}
|
}
|
||||||
const tempCount = document.createElement('div')
|
const tempCount = document.createElement('div')
|
||||||
tempCount.classList.add('temp-count')
|
tempCount.classList.add('temp-count')
|
||||||
tempCount.textContent = floGlobals.appObjects.articles[articleID].votes
|
tempCount.textContent = floGlobals.appObjects.rmTimes.articles[articleID].votes
|
||||||
getRef('like_count').after(tempCount)
|
getRef('like_count').after(tempCount)
|
||||||
tempCount.animate(slideInUp, animOptions)
|
tempCount.animate(slideInUp, animOptions)
|
||||||
.onfinish = () => {
|
.onfinish = () => {
|
||||||
getRef('like_count').textContent = floGlobals.appObjects.articles[articleID].votes
|
getRef('like_count').textContent = floGlobals.appObjects.rmTimes.articles[articleID].votes
|
||||||
tempCount.remove()
|
tempCount.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13234,15 +13251,15 @@
|
|||||||
//floDapps.setAppObjectStores({sampleObs1:{}, sampleObs2:{options{autoIncrement:true, keyPath:'SampleKey'}, Indexes:{sampleIndex:{}}}})
|
//floDapps.setAppObjectStores({sampleObs1:{}, sampleObs2:{options{autoIncrement:true, keyPath:'SampleKey'}, Indexes:{sampleIndex:{}}}})
|
||||||
let firstLoad = true
|
let firstLoad = true
|
||||||
floDapps.setMidStartup(() => new Promise(async (resolve, reject) => {
|
floDapps.setMidStartup(() => new Promise(async (resolve, reject) => {
|
||||||
await floCloudAPI.requestObjectData('articles')
|
await floCloudAPI.requestObjectData('rmTimes')
|
||||||
await floCloudAPI.requestGeneralData(`article_${currentArticleID}_votes`, {
|
await floCloudAPI.requestGeneralData(`article_${currentArticleID}_votes`, {
|
||||||
lowerVectorClock: floGlobals.appObjects.articles[currentArticleID].lastCountedVC + 1,
|
lowerVectorClock: floGlobals.appObjects.rmTimes.articles[currentArticleID].lastCountedVC + 1,
|
||||||
callback: (allVotes, e) => {
|
callback: (allVotes, e) => {
|
||||||
if (firstLoad) {
|
if (firstLoad) {
|
||||||
for (const vote in allVotes) {
|
for (const vote in allVotes) {
|
||||||
floGlobals.appObjects.articles[currentArticleID].votes += allVotes[vote].message.voteCount || 1
|
floGlobals.appObjects.rmTimes.articles[currentArticleID].votes += allVotes[vote].message.voteCount || 1
|
||||||
}
|
}
|
||||||
getRef('like_count').textContent = floGlobals.appObjects.articles[currentArticleID].votes
|
getRef('like_count').textContent = floGlobals.appObjects.rmTimes.articles[currentArticleID].votes
|
||||||
} else {
|
} else {
|
||||||
for (const msg in allVotes) {
|
for (const msg in allVotes) {
|
||||||
animateLikeCount(allVotes[msg].message.voteCount, currentArticleID)
|
animateLikeCount(allVotes[msg].message.voteCount, currentArticleID)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user