Adding parsePlot() function
This commit is contained in:
parent
ca97387d15
commit
20b97c9352
41
index.html
41
index.html
@ -1099,13 +1099,48 @@ let myCustomLogin = function () {
|
|||||||
</div>
|
</div>
|
||||||
</section>`;
|
</section>`;
|
||||||
|
|
||||||
|
|
||||||
|
function parsePlot(plottext){
|
||||||
|
|
||||||
|
var tstring = plottext.replace(/\s+/g, " ");
|
||||||
|
tstring = tstring.split(") -> (");
|
||||||
|
if(tstring.length > 0){
|
||||||
|
if(tstring[0][0]=="("){
|
||||||
|
tstring[0] = tstring[0].slice(1)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tstring[-1][-1]==")"){
|
||||||
|
tstring[0] = tstring[0].slice(0,-1)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return 'error';
|
||||||
|
}
|
||||||
|
return tstring;
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('sectionplotdiv').innerHTML = sectionPlotUI;
|
document.getElementById('sectionplotdiv').innerHTML = sectionPlotUI;
|
||||||
const section_plot_btn = document.getElementById('section_plot_btn');
|
const section_plot_btn = document.getElementById('section_plot_btn');
|
||||||
section_plot_btn.onclick = function () {
|
section_plot_btn.onclick = function () {
|
||||||
let section_plot_value = document.getElementById('section_plot_txt').value;
|
let section_plot_value = document.getElementById('section_plot_txt').value;
|
||||||
console.log(section_plot_value);
|
//console.log(section_plot_value);
|
||||||
// plot func here
|
// plot func here
|
||||||
hidePopup('section_plot_modal')
|
var splitSections = parsePlot(section_plot_value);
|
||||||
|
console.log(splitSections);
|
||||||
|
if(splitSections != 'error'){
|
||||||
|
cloudArticleApp.addSections(splitSections);
|
||||||
|
hidePopup('section_plot_modal');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showMessage('Plot diagram entered is in wrong format')
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1275,7 +1310,7 @@ let myCustomLogin = function () {
|
|||||||
<line x1="32" x2="32" y2="64"/>
|
<line x1="32" x2="32" y2="64"/>
|
||||||
<line x1="64" y1="32" y2="32"/>
|
<line x1="64" y1="32" y2="32"/>
|
||||||
</svg>
|
</svg>
|
||||||
Add Plot Diagram
|
Add Sections from Plot Diagram
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user