Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed Jul 3, 2021
1 parent 438defe commit 10e6027
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/source/tweak/replace.html.pug
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ block script
| let box = document.createElement('span'),
| color = source.value;
| box.className = 'color-box';
| box.dataset.color = color;
| box.value = color; // Hacky :(
| box.style.backgroundColor = color;
| source.parentNode.insertBefore(box, source);
| source.type = 'hidden';
| const picker = new CP(box);
| picker.on('change', function(r, g, b, a) {
| let color = this.color(r, g, b, a);
| source.value = color;
| this.source.dataset.color = color;
| this.source.value = color; // Hacky :(
| this.source.style.backgroundColor = color;
| });
| }
Expand All @@ -43,4 +43,4 @@ block script
block content
main
p Replace text input with hidden input.
p: input(type='text')
p: input(type='text' value='#f00')
6 changes: 3 additions & 3 deletions tweak/replace.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
<body>
<main>
<p>Replace text input with hidden input.</p>
<p><input type="text"></p>
<p><input type="text" value="#f00"></p>
</main>
<script src="../index.min.js"></script>
<script>
function replaceWithColorBox(source) {
let box = document.createElement('span'),
color = source.value;
box.className = 'color-box';
box.dataset.color = color;
box.value = color; // Hacky :(
box.style.backgroundColor = color;
source.parentNode.insertBefore(box, source);
source.type = 'hidden';
const picker = new CP(box);
picker.on('change', function(r, g, b, a) {
let color = this.color(r, g, b, a);
source.value = color;
this.source.dataset.color = color;
this.source.value = color; // Hacky :(
this.source.style.backgroundColor = color;
});
}
Expand Down

0 comments on commit 10e6027

Please sign in to comment.