-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
119 lines (102 loc) · 5.17 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Long S Converter</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="header-container">
<h1 class="title">Long S Converter </h1><h3 class="credit">by <a href="https://github.com/travisgk">TravisGK</a></h3>
</div>
<!-- loads scripts traditionally, no modules required. -->
<script src="js-long-s/germanlists.js"></script>
<script src="js-long-s/splitstring.js"></script>
<script src="js-long-s/simpleconversions.js"></script>
<script src="js-long-s/germanconversion.js"></script>
<script src="js-long-s/long-s.js"></script>
<div class="bubble-container">
<div class="flex-container">
<label for="langOption">Language:</label>
<select id="langOption" required>
<option value="en" selected>English</option>
<option value="fr">Français</option>
<option value="de">Deutsch</option>
<option value="es">Español</option>
<option value="it">Italiano</option>
</select>
<button id="convert-button" onclick="runConversion()">Convert</button>
<script type="text/javascript">
function runConversion() {
let text = document.getElementById("inputText").value;
const langOption = document.getElementById("langOption").value;
let keepUnknownS = false;
document.getElementById("outputTextbox").innerText = convertText(
text, langOption, keepUnknownS
);
}
// Attach the copyToClipboard function to the button's click event
document.getElementById("convert-button").addEventListener("click", runConversion);
</script>
</div>
<div class="ui-container">
<textarea id="inputText" placeholder="Enter your text here." cols=105></textarea>
<div id="outputText">
<div id="outputTextbox"></div>
<div style="text-align: right;">
<button id="copy-button">
<span style="font-size: .875em; margin-right: .125em; position: relative; top: -.25em; left: -.125em">
📄<span style="position: absolute; top: .25em; left: .25em">📄</span>
</span>
</button>
</div>
</div>
</div>
<div style="position: relative;">
<div id="notification">Copied to clipboard!</div>
</div>
<br>
<br>
</div>
<script type="text/javascript">
let notificationTimeout; // stores timeout ID.
// Function to show the notification
function showNotification() {
const notification = document.getElementById("notification");
// Clear any existing timeout to avoid conflicts
clearTimeout(notificationTimeout);
// Reset styles to prepare for showing the notification
notification.style.display = "block"; // Show the notification
notification.style.opacity = "1"; // Reset opacity for new notification
// Fade out the notification after 5 seconds
notificationTimeout = setTimeout(() => {
notification.style.opacity = "0"; // Start fading
}, 2000); // Wait for 5 seconds before starting to fade
// Remove the notification from the DOM after fading out
notificationTimeout = setTimeout(() => {
notification.style.display = "none"; // Hide the notification completely
notification.style.opacity = "1"; // Reset opacity for future uses
}, 3000); // Total time until it's completely hidden
}
// Function to copy text to clipboard
function copyToClipboard() {
const outputText = document.getElementById("outputTextbox").innerText; // Get the text from the div
navigator.clipboard.writeText(outputText) // Copy the text to clipboard
.then(() => {
console.log("Text copied to clipboard!");
showNotification();
})
.catch(err => {
console.error("Error copying text: ", err);
});
}
// Attach the copyToClipboard function to the button's click event
document.getElementById("copy-button").addEventListener("click", copyToClipboard);
</script>
<div class="bubble-container">
<p>This tool accurately inserts the historical long S character ( ſ ) into text based on language-specific spelling conventions. The long S was commonly used in various European languages from the Medieval times up to the early 20th century.</p>
<p style="margin-top: 1em;">English, French, German, Spanish and Italian are supported.</p>
</div>
</body>
</html>