preview of code generated

easier to copy generated code now
This commit is contained in:
Chuck Dries 2017-03-20 20:21:30 -07:00
parent dd8629daa7
commit 2eb744b341

View File

@ -7,16 +7,23 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Robotic Chuck</title> <title>Robotic Chuck</title>
<style> <style>
code { body{
margin: auto;
max-width: 800px;
}
code, #output {
padding: 5px; padding: 5px;
background: #eee; background: #eee;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 3px; border-radius: 3px;
display: inline-block; display: inline-block;
} }
input { input {
width: 100em; width: 90%;
max-width: 800px;
} }
</style> </style>
</head> </head>
@ -38,32 +45,41 @@
tstring = tstring + formatter.join(""); tstring = tstring + formatter.join("");
tstring = tstring + "</div>" tstring = tstring + "</div>"
outBox.innerText = tstring; outBox.innerText = tstring;
outBox.style.minHeight = (formatter.length + 9) + "em";
document.getElementById("preview").innerHTML = tstring;
} }
</script> </script>
<p></p> <p></p>
Title of box: <input type="text" id="titleIn" placeholder="Investigating Hope: The Series"><br /> Title of box: <input type="text" id="titleIn" placeholder="Investigating Hope: The Series"><br /> Description text:
Description text: <input type="text" id="description" placeholder="This article is one in a series of investigative pieces about a complaint filed with ASU regarding accusations against on-campus ministry Hope Church."><br /> <input
type="text" id="description" placeholder="This article is one in a series of investigative pieces about a complaint filed with ASU regarding accusations against on-campus ministry Hope Church."><br />
<p>Enter the links to generate according to this format:</p> <p>Enter the links to generate according to this format:</p>
<pre><code class="json">[ <pre><code class="json">[
{ {
"headline": "A beautiful headline!", "headline": "A Beautiful Headline!",
"url": "this-is-a-sample-url" "url": "this-is-a-sample-url"
}, },
{
"headline": "A Second Beautiful Headline!",
"url": "second-sample-url"
},
{ {
"headline": "Yet Another Headline", "headline": "Yet Another Headline",
"url": "yet-another-url" "url": "yet-another-url"
} }
] ]
</code></pre> </code></pre>
<textarea name="input" id="in" cols="90" rows="30"></textarea> <p>This format is known as JSON, it's an internet standard that's supposed to be easy for humans and computers to read. Note how commas are used to separate multiple items but are never used after the last item in a set. This is important, it will not work if you include a trailing comma where there should not be one.</p>
<h2><a href="#" onclick="generate()">click to generate</a></h2> <textarea name="input" id="in" cols="100" rows="30"></textarea>
<h2><a href="#output" onclick="generate()" placeholder="Please be careful, this will not work if you format the JSON incorrectly">click to generate</a></h2>
<p>Paste the following code into a safeembed</p> <p>Paste the following code into a safeembed</p>
<pre><code id="output"> <textarea id="output" cols="100" readonly style=""></textarea>
</code></pre>
<p><em> Don't forget:</em> For each page you embed on, add the following bit of code just before the <code>&lt;/h4&gt;</code> at the end of the line on the line that corresponds to the current page. <p><em> Don't forget:</em> For each page you embed on, add the following bit of code just before the <code>&lt;/h4&gt;</code> at the end of the line on the line that corresponds to the current page.
<pre><code>&lt;span class="here"&gt;(You are here)&lt;/span&gt; <pre><code>&lt;span class="here"&gt;(You are here)&lt;/span&gt;</pre></code>
</pre></code> <p>The code generated will look roughly like this:</P>
<div id="preview" style="max-width: 800px;"></div>
<p>Gryphon overrides certain styles by default, so make sure to test on your article.</p>
</body> </body>