From 8037ffdcc02f9be0bf41049ece1739d105e887a5 Mon Sep 17 00:00:00 2001 From: atom-box Date: Wed, 8 Sep 2021 20:08:26 -0500 Subject: [PATCH] Make content block with inputs for slider range and text box input. --- data/quiltContent.mjs | 22 ++++++++++++++++++---- helpers/quilt/repeatFront.mjs | 16 ++++++++++++++++ helpers/quiltMain.js | 10 ++++++++++ quilt.html | 4 ++-- 4 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 helpers/quilt/repeatFront.mjs diff --git a/data/quiltContent.mjs b/data/quiltContent.mjs index 44b9dcd..689e180 100644 --- a/data/quiltContent.mjs +++ b/data/quiltContent.mjs @@ -65,17 +65,31 @@ let articles = [ { backgroundColor: '#493', textColor: '#ddf', - title: 'API', - question: 'Get info from a live external A.P.I. hub', + title: 'Repeat Front', + question: 'Given a string and an int n, return a string made of the first n characters of the string, followed by the first n-1 characters of the string, and so on. You may assume that n is between 0 and the length of the string, inclusive (i.e. n >= 0 and n <= str.length()).
Source: Stanford CodingBat', strategy: 'null', form: '

Placeholder

', - linkToCodeRepo: 'https://github.com/atom-box/codingBatJS/blob/master/textSimilarity.html', + linkToCodeRepo: 'https://codingbat.com/prob/p128796', testElement: '

dogfish - dogfish - dogfish - dogfish

', inputs: [], predictedOutputs: [], answerHtml: ` -

Coming soon...

+
+
+ Letters in first bite:
1 + 6 + +
Enter 7 or more letters: + + + + +
Total Seeds:
+ +
+
+ `, }, diff --git a/helpers/quilt/repeatFront.mjs b/helpers/quilt/repeatFront.mjs new file mode 100644 index 0000000..4bcbd04 --- /dev/null +++ b/helpers/quilt/repeatFront.mjs @@ -0,0 +1,16 @@ +const repeatFront = (a, b) => { + return a + b; +} + + + + +// repeatFront.js +// const price = document.querySelector('#price'); +// const output = document.querySelector('.price-output'); + +// output.textContent = price.value; + +// price.addEventListener('input', function() { +// output.textContent = price.value; +// }); \ No newline at end of file diff --git a/helpers/quiltMain.js b/helpers/quiltMain.js index f8cb3e6..44ec932 100644 --- a/helpers/quiltMain.js +++ b/helpers/quiltMain.js @@ -41,4 +41,14 @@ articles.forEach(element => { // document.getElementById('articlesAnchor').innerHTML = 'glow'; document.getElementById('articlesAnchor').outerHTML = divs; + +// repeatFront.js +const price = document.querySelector('#price'); +const output = document.querySelector('.price-output'); + +output.textContent = price.value; + +price.addEventListener('input', function() { + output.textContent = price.value; +}); }); diff --git a/quilt.html b/quilt.html index bee84f6..e8a85e8 100644 --- a/quilt.html +++ b/quilt.html @@ -174,9 +174,9 @@

Making things work in Madison, Wisconsin: - + - +