Skip to content

Commit

Permalink
Merge pull request #26 from RainbowJM/Tapan
Browse files Browse the repository at this point in the history
Tapan
  • Loading branch information
RainbowJM authored Apr 14, 2023
2 parents 6e3de90 + 2e068a9 commit 37f5446
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
30 changes: 30 additions & 0 deletions public/scripts/keyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// var textarea = document.getElementById("input-text");
// textarea.addEventListener("click", openKeyboard);


// function openKeyboard() {
// $('input-text').keyboard();
// }

var textarea = document.getElementById("#input-text");

textarea.addEventListener("click", function() {
openKeyboard();
});

function openKeyboard() {
// Create an instance of the Google IME API
var ime = new google.ime.InputMethodEditor();

// Call the activate() method to activate the On-Screen Keyboard
ime.activate(["transliteration"], function() {
ime.setLanguage("en");
ime.setOnStateChangeHandler(function(isOn) {
if (isOn) {
// The On-Screen Keyboard is now active
} else {
// The On-Screen Keyboard is no longer active
}
});
});
}
2 changes: 1 addition & 1 deletion public/scripts/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ const preview = document.querySelector(".preview");

input.addEventListener("input", () => {
preview.innerText = input.value;
});
});
17 changes: 17 additions & 0 deletions views/generate-poems.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<head>
<%- include('./partials/head'); %>
<script src="https://inputtools.google.com/js/ime.js"></script>
</head>

<body id="generate">
Expand Down Expand Up @@ -38,8 +39,24 @@
<%- include('./partials/background-decoration'); %>


<!-- <script>
var ime;
function onApiLoad() {
ime = new google.inputmethod.InputMethodManager();
}
function openKeyboard() {
ime.showInputView(document.getElementById('myTextarea'));
}
var textarea = document.getElementById("myTextarea");
textarea.addEventListener("click", function() {
openKeyboard();
});
</script> -->

<script src="./scripts/preview.js"></script>
<script src="./scripts/keyboard.js"></script>


</body>

Expand Down
2 changes: 1 addition & 1 deletion views/partials/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Commissioner:wght@300;400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Commissioner:wght@300;400;500;700&display=swap" rel="stylesheet">

0 comments on commit 37f5446

Please sign in to comment.