|
@@ -16,7 +16,7 @@ layout: default
|
|
|
color: gray;
|
|
|
}
|
|
|
|
|
|
-/* TOOLTIP
|
|
|
+/* Tooltip for Modules
|
|
|
https://www.w3schools.com/css/tryit.asp?filename=trycss_tooltip_right
|
|
|
This could bear substantial improvement. */
|
|
|
.button {
|
|
@@ -70,7 +70,7 @@ These are the major functional buttons*/
|
|
|
/* icons are from https://github.com/tabler/tabler-icons */
|
|
|
margin: 0 5px 0 0;
|
|
|
}
|
|
|
-/* Various IDs */
|
|
|
+/* VARIOUS IDs */
|
|
|
#rulebox {
|
|
|
border: 1px solid lightgray;
|
|
|
padding: 20px;
|
|
@@ -142,7 +142,9 @@ These are the major functional buttons*/
|
|
|
editableFields[i].contentEditable = "false";
|
|
|
editableFields[i].style.borderStyle = "none";
|
|
|
// Remove empty fields entirely
|
|
|
- if (editableFields[i].innerHTML === "") {
|
|
|
+ var content = editableFields[i].innerHTML;
|
|
|
+ content = content.replace(/(<([^>]+)>)/ig,''); // strips stray tags
|
|
|
+ if (content === "") {
|
|
|
editableFields[i].style.display = "none";
|
|
|
}
|
|
|
}
|
|
@@ -153,8 +155,9 @@ These are the major functional buttons*/
|
|
|
var sectionQuestions = sections[i].getElementsByClassName("editable");
|
|
|
var blanks = 0;
|
|
|
for (var x = 0; x < sectionQuestions.length; x++) {
|
|
|
- console.log(sectionQuestions[x].innerHTML);
|
|
|
- if (sectionQuestions[x].innerHTML == "") { blanks++; }
|
|
|
+ var content = sectionQuestions[x].innerHTML;
|
|
|
+ content = content.replace(/(<([^>]+)>)/ig,''); // strips stray tags
|
|
|
+ if (content == "") { blanks++; }
|
|
|
if (blanks == sectionQuestions.length) {
|
|
|
var headerID = "header-s" + (i + 1);
|
|
|
document.getElementById(headerID).style.display = "none";
|
|
@@ -211,10 +214,13 @@ These are the major functional buttons*/
|
|
|
// Produces Markdown rendition of Rule
|
|
|
function textOutput() {
|
|
|
var filename = 'CommunityRule.txt';
|
|
|
- var content = '# CommunityRule: ' + document.getElementById('communityname').innerHTML + '\n\n';
|
|
|
+ var content = '# document.getElementById('communityname').innerHTML + '\n\n';
|
|
|
+ content = content.replace(/(<([^>]+)>)/ig,''); // strips stray tags
|
|
|
var elements = document.getElementsByClassName('output');
|
|
|
for (var i = 1; i < elements.length; i++) {
|
|
|
- if (elements[i].innerHTML != "") {
|
|
|
+ var thisBit = elements[i].innerHTML;
|
|
|
+ thisBit = thisBit.replace(/(<([^>]+)>)/ig,''); // strips stray tags
|
|
|
+ if (thisBit != "") {
|
|
|
if (elements[i].classList.contains("subhead")) {
|
|
|
content += '## ';
|
|
|
}
|
|
@@ -222,7 +228,6 @@ These are the major functional buttons*/
|
|
|
}
|
|
|
}
|
|
|
content += document.getElementById('attributionMD').innerHTML;
|
|
|
- content = content.replace(/(<([^>]+)>)/ig,''); // strips stray tags
|
|
|
// Starting here, see https://stackoverflow.com/a/33542499
|
|
|
var blob = new Blob([content], {type: 'text/plain'});
|
|
|
if(window.navigator.msSaveOrOpenBlob) {
|
|
@@ -235,7 +240,7 @@ These are the major functional buttons*/
|
|
|
document.body.appendChild(elem);
|
|
|
elem.click();
|
|
|
document.body.removeChild(elem);
|
|
|
- URL.revokeObjectURL();
|
|
|
+ URL.revokeObjectURL(); // This needs an arg but I can't figure out what
|
|
|
}
|
|
|
var myFile = new Blob([fileContent], {type: 'text/plain'});
|
|
|
window.URL = window.URL || window.webkitURL; document.getElementById('download').setAttribute('href',window.URL.createObjectURL(myFile));
|