-
Notifications
You must be signed in to change notification settings - Fork 0
/
editor.html
243 lines (191 loc) · 9.6 KB
/
editor.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html>
<head>
<title>Machine Translator - A Translator for NITS</title>
<link rel="shortcut icon" href="images/abinash.png">
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<link href="https://cdn.quilljs.com/1.3.6/quill.bubble.css" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<style type="text/css">
.upload{
box-shadow: 10px 14px 8px 0
rgba(0, 0, 0, 0.2), 0 6px 20px 0
rgba(0, 0, 0, 0.19);
border: 2px solid #F86251;
padding: 4px;
border-radius: 8px;
height: 180px;
width: 280px;
opacity: 0.8;
}
.upload:hover{
background-color: #F86251;
opacity: 2
}
</style>
</head>
<body style="background-color: #f5f5dc">
<nav class="navbar navbar-expand-md navbar-dark "style="background-color: #F86251">
<!-- <div class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Left</a>
</li>
<li class="nav-item">
<a class="nav-link" href="//codeply.com">Codeply</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
</ul>
</div> -->
<div class="mx-auto order-0">
<a class="navbar-brand mx-auto" href="index.html">Machine Translator</a>
</div>
<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="editor2.html">Editor 2</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="editor.html">Editor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About</a>
</li>
<!-- </li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li> -->
</ul>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".dual-collapse2">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
<!-- for english writing div -->
<div id="before-div" class="offset-1 col-md-10" style="font-family: courier;margin-top: 30px;">
<div class="row">
<div class="col-md-10">
<h3 style="text-align: left;" >Write/Paste text below:</h3></div>
<div style="margin:auto 20px 4px auto ">
<a href="help.html" class="btn btn-primary">Help</a>
</div>
</div>
<form id="english-form">
<div style="background-color: white;" id="toolbar"></div>
<div style="height: 460px;width: 100%;background-color: white;" id="editor"></div>
<div style="margin-top: 12px;">
<input type="submit" id="before" onclick="savetextfileenglish()" value="Translate" class="btn btn-success btn-block"></input>
</div>
</form>
</div>
<!-- for hindi div -->
<div id="after-div" class="offset-1 col-md-10" style="margin-top: 40px;">
<h3>Translated Text: </h3>
<p style="background-color: white;border-radius: 8px;padding: 10px 10px 10px 10px" id="hindi-text">Start writing your text above.....</p>
</div>
<!-- for uploading file from ML-Model and display to hindi div-->
<!-- <input type="file" id="fileToLoad">
<button onclick="loadFileAsText()">Load Selected File</button> -->
<!-- Initial footer section -->
<div style="margin-top: 180px;margin-bottom: 0px;font-family: courier">
<hr class="bold" style="border-color: red; color: red; margin: 0px 118px 0px 118px">
<p style="text-align: center;">Developed for <b><a href="https://www.nits.ac.in" style="text-decoration: none; color: black">National Institute of Technology Silchar</a></b></p>
</div>
<!-- footer section ends -->
</body>
<!-- code for grab a file -->
<!-- Include the Quill library -->
<!-- Initialize Quill editor -->
<script>
var toolbarOptions = [
['bold','italic', 'underline' ,'strike'],
['blockquote', 'code-block'],
[ {'header': [1,2,3,4,5,6, false] } ],
[ {'list': 'ordered'},{'list':'bullet'} ],
[ {'script':'sub'},{'script': 'super'} ],
[ {'indent': '-1'},{'indent': '+1'} ],
[ {'direction': 'rtl'} ],
[ {'size':['small',false,'large','huge'] } ],
['link','image','video','formula'],
[ {'color': [] }, {'background':[] } ],
[ {'font': [] } ],
[ {'align': [] } ]
];
var quill = new Quill('#editor', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow',
placeholder: 'Start typing here and scroll down to see the translated result.'
});
</script>
<script>
$(document).ready(function(){
$("#english-form").submit(function(e){
var content = quill.root.innerHTML;// we can use .container and .root both
$("#hindi-text").html(content);
return false;
});
});
</script>
<!-- save file into text file -->
<script type="text/javascript">
function savetextfileenglish(){
var content = quill.root.innerHTML;
/*//content return html format then .replace change content format to simple text*/
var textToSave = content.replace(/<(?:.|\n)*?>/gm, '');
//Blob used to save input file from internet
var textToSaveAsBlob = new Blob([textToSave], {type:"text/plain"});
var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
var fileNameToSaveAs = 'english-'+ Math.floor(Math.random() * (+1 + +10)) + 1;
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
downloadLink.href = textToSaveAsURL;
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
downloadLink.click();
}
function destroyClickedElement(event)
{
document.body.removeChild(event.target);
}
/* load a file a display it in hindi div*/
/*<input type="file" id="fileToLoad">
<button onclick="loadFileAsText()">Load Selected File</button>
*/
/*function loadFileAsText()
{
var fileToLoad = document.getElementById("fileToLoad").files[0];//load files
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var textFromFileLoaded = fileLoadedEvent.target.result;
document.getElementById("hindi-text").value = textFromFileLoaded;
};
fileReader.readAsText(fileToLoad, "UTF-8");
}*/
</script>
<!-- scripts jquery and other by bootstrap -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</html>