|
@@ -8,57 +8,6 @@ layout: default
|
|
// Enter JavaScript-land!
|
|
// Enter JavaScript-land!
|
|
// First, some functions, followed by initialization commands
|
|
// First, some functions, followed by initialization commands
|
|
|
|
|
|
- // Begin BUILDER functions
|
|
|
|
- // source: https://www.codecanal.com/html5-drag-and-copy/
|
|
|
|
- function allowDrop(ev) {
|
|
|
|
- ev.preventDefault();
|
|
|
|
- }
|
|
|
|
- function drag(ev) {
|
|
|
|
- ev.dataTransfer.setData("text", ev.target.id);
|
|
|
|
- }
|
|
|
|
- function drop(ev) {
|
|
|
|
- ev.preventDefault();
|
|
|
|
- var target = ev.target;
|
|
|
|
- // Prevents dropping into text field
|
|
|
|
- if (target.id == "drag-directions") {
|
|
|
|
- target = target.parentElement;
|
|
|
|
- }
|
|
|
|
- // Set up transfer
|
|
|
|
- var data = ev.dataTransfer.getData("text");
|
|
|
|
- // Iff module is from the menu clone it
|
|
|
|
- var module = document.getElementById(data);
|
|
|
|
- if (module.parentElement.id == "module-menu") {
|
|
|
|
- module = module.cloneNode(true);
|
|
|
|
- // Add a corresponding text field
|
|
|
|
- var name = module.innerHTML.replace(/(<([^>]+)>)/ig,'');
|
|
|
|
- var query = "Explain how the " + name + " module works.";
|
|
|
|
- addField(query);
|
|
|
|
- }
|
|
|
|
- // append name
|
|
|
|
- module.id += "-dropped";
|
|
|
|
- // display the deletion button
|
|
|
|
- module.children[2].style.display = "inline";
|
|
|
|
- // pop it in!
|
|
|
|
- target.appendChild(module);
|
|
|
|
- // be sure the dummy text is gone
|
|
|
|
- document.getElementById("drag-directions").style.display = "none";
|
|
|
|
- // Send field contents to console to aid in database stuff
|
|
|
|
- console.log(document.getElementById("module-input"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Adds a new question field
|
|
|
|
- function addField(content) {
|
|
|
|
- // if input is null, add an empty field to the list
|
|
|
|
- // include a field removal button
|
|
|
|
- var destination = document.getElementById("builder-field");
|
|
|
|
- if (content == null) { content = ""; }
|
|
|
|
- var output = '\n<div><a onclick="this.parentNode.remove()" id="delete-module"><img src="{% link assets/tabler_icons/x.svg %}" align="right"/></a>';
|
|
|
|
- output += '<span class="question">' + content + '</span>';
|
|
|
|
- output += '<p contenteditable="true" class="editable output" id="custom-field"></p></div>\n';
|
|
|
|
- destination.innerHTML += output;
|
|
|
|
- }
|
|
|
|
- // end BUILDER functions
|
|
|
|
-
|
|
|
|
// toggleVisible(id)
|
|
// toggleVisible(id)
|
|
// Toggles the visibility of a given element by given ID
|
|
// Toggles the visibility of a given element by given ID
|
|
function toggleVisible(id) {
|
|
function toggleVisible(id) {
|
|
@@ -378,47 +327,6 @@ layout: default
|
|
|
|
|
|
<span class="question">What is the community’s name?</span>
|
|
<span class="question">What is the community’s name?</span>
|
|
<h1 contenteditable="true" class="editable output" id="communityname">{{ page.community-name }}</h1>
|
|
<h1 contenteditable="true" class="editable output" id="communityname">{{ page.community-name }}</h1>
|
|
-
|
|
|
|
- <p class="question"><strong>RuleBuilder</strong></p>
|
|
|
|
-
|
|
|
|
- <!-- BUILDER -->
|
|
|
|
- <div ondrop="drop(event)" ondragover="allowDrop(event)"
|
|
|
|
- class="modulebox" id="module-input">
|
|
|
|
- <span class="question" id="drag-directions">
|
|
|
|
- Drag modules from the icon at right</span>
|
|
|
|
- <div class="button">
|
|
|
|
- <img src="{% link assets/tabler_icons/tool.svg %}" title="Modules" />
|
|
|
|
- <div class="tooltiptext" id="module-menu">
|
|
|
|
- <!-- Customizable module -->
|
|
|
|
- <span class="module" id="module-custom"
|
|
|
|
- draggable="true" ondragstart="drag(event)">
|
|
|
|
- <input contenteditable="true" placeholder="Custom..." />
|
|
|
|
- <img src="{% link assets/tabler_icons/bulb.svg %}"
|
|
|
|
- draggable="false" />
|
|
|
|
- <a onclick="this.parentNode.remove()" id="delete-module"
|
|
|
|
- style="display:none">
|
|
|
|
- <img src="{% link assets/tabler_icons/x.svg %}" /></a>
|
|
|
|
- </span>
|
|
|
|
- <!-- Load preset modules from _data/modules.csv -->
|
|
|
|
- {% for module in site.data.modules %}
|
|
|
|
- <span class="module fixed" id="module-{{ module.id }}"
|
|
|
|
- draggable="true" ondragstart="drag(event)">
|
|
|
|
- <span>{{ module.name }}</span>
|
|
|
|
- <a target="_blank" href="{{ module.url }}">
|
|
|
|
- <img src="{% link assets/tabler_icons/link.svg %}"
|
|
|
|
- draggable="false" /></a>
|
|
|
|
- <a onclick="this.parentNode.remove()" id="delete-module"
|
|
|
|
- style="display:none">
|
|
|
|
- <img src="{% link assets/tabler_icons/x.svg %}" /></a>
|
|
|
|
- </span>
|
|
|
|
- {% endfor %}
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div id="builder-field">
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <p class="question"><strong>RuleWriter</strong></p>
|
|
|
|
|
|
|
|
<!-- SECTION S1: BASICS -->
|
|
<!-- SECTION S1: BASICS -->
|
|
<h2 id="header-s1" class="header">
|
|
<h2 id="header-s1" class="header">
|