diff --git a/capture.png b/capture.png index 02b035c..c843fac 100644 Binary files a/capture.png and b/capture.png differ diff --git a/custom/script.js b/custom/script.js index 7c35aac..61047f0 100644 --- a/custom/script.js +++ b/custom/script.js @@ -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; @@ -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); + } }); \ No newline at end of file diff --git a/index.html b/index.html index 59640cb..669305a 100644 --- a/index.html +++ b/index.html @@ -29,9 +29,6 @@
-
@@ -41,6 +38,7 @@
+ Sync
@@ -50,7 +48,7 @@
- © 2023 by DuyNLK + © 2023 by DuyNLK
diff --git a/readme.md b/readme.md index 813a539..4dea11b 100644 --- a/readme.md +++ b/readme.md @@ -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)