Skip to content

Commit

Permalink
remove exchange button
Browse files Browse the repository at this point in the history
  • Loading branch information
duynlk committed Dec 9, 2023
1 parent 7d6b580 commit c38ffd3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
Binary file modified capture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 21 additions & 10 deletions custom/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,28 @@ $(document).ready(function(){
}
});

// click button remake
$("#btn-remake").click(function(){
// change input-lyric
$("#input-lyric").on("input", function(){
var input = $("#input-lyric").val();
if(input != "") {
var output = handleRemakeLyric(input);
var output = handleRemakeLyric(input);

setTimeout(function(){
$("#output-lyric").val(output);
}, 200);
setTimeout(function(){
$("#output-lyric").val(output);
}, 200);
});

toastr.success('Remake done');
}else{
toastr.error('Input is null');
// scroll input-lyric
$("#input-lyric").on("scroll", function(){
if($("#sync-chk").is(":checked")){
syncScroll();
}
});

// click sync checkbox
$("#sync-chk").click(function(){
syncScroll();
});

function handleRemakeLyric(input) {
var lines = input.split('\n');
var realLength = lines.length;
Expand Down Expand Up @@ -114,4 +120,9 @@ $(document).ready(function(){
}
return strVal.substring(0, strVal.length - 1);
}

function syncScroll() {
var scrollPos = $("#input-lyric").scrollTop();
$("#output-lyric").scrollTop(scrollPos);
}
});
6 changes: 2 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ <h5 class="title is-5 mt-4">
</div>

<div class="column is-1">
<button id="btn-remake" class="button is-info mb-3">
<i class="fa-solid fa-arrows-rotate"></i>
</button>
<button id="btn-copy" class="button is-success mb-3">
<i class="fa-regular fa-copy"></i>
</button><br>
Expand All @@ -41,6 +38,7 @@ <h5 class="title is-5 mt-4">
<button id="btn-clear-output" class="button is-danger mb-5">
<i class="fa-solid fa-delete-left" style="transform: rotate(180deg);"></i>
</button>
<input id="sync-chk" type="checkbox" checked> Sync
</div>

<div class="column is-5">
Expand All @@ -50,7 +48,7 @@ <h5 class="title is-5 mt-4">

<!-- footer -->
<div>
<small>&copy; 2023 by DuyNLK</small>
<small>&copy; 2023 by <b>DuyNLK</b></small>
</div>
</div>
</body>
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Make the smooth lyrics for website https://vangson.info

#### Button List:

![arrows-rotate](img/arrows-rotate.svg) - Action to remake
1. ![acopy](img/copy.svg) - Copy output to clipboard

![acopy](img/copy.svg) - Copy output to clipboard
2. ![delete-left](img/delete-left.svg) - Empty input/output

![delete-left](img/delete-left.svg) - Empty input/output
3. "Sync" checkbox: Sync scroll position of input/output

![capture](capture.png)

0 comments on commit c38ffd3

Please sign in to comment.