-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.html
494 lines (424 loc) · 19.9 KB
/
docs.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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<!DOCTYPE html>
<html>
<head>
<title>
Aswin's Writer
</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.min.js"></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<!-- Popper JS -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<!--fonts for those missing-->
<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=Palette+Mosaic&display=swap" rel="stylesheet">
<!--icon kit-->
<script src="https://kit.fontawesome.com/3e2a93553e.js" crossorigin="anonymous"></script>
<style>
textarea{
width:100%;
height: 250px;;
}
h2{
background-color:yellow;
font-size:50px;
}
body{
background-color: palegreen;
}
div{
background-color: white;
}
#loader {
position: absolute;
left: 50%;
top: 50%;
z-index: 1;
width: 130px;
height: 130px;
margin: -76px 0 0 -76px;
#myDiv {
display: none;
}
#loading {
position: absolute;
left: 50%;
top: 50%;
z-index: 1;
text-align: center;
color:green;
background-color:yellow;
top: calc(50% - 30px);
left: calc(50% - 45px);
text-align: center;
font-weight:bold;
}
p{
font-size:25px;
}
</style>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body onload="myFunction()" style="margin:0;">
<script>
//this will bold the text
function showTextinBold()
{
document.getElementById("result").style.fontWeight = "bold";
}
//this will underline the text
function showTextinUnderline()
{
document.getElementById('result').style.textDecoration = "underline";
}
//this will change the font color
function showTextinRed()
{ let colorDropdown=document.getElementById('colors').value;
document.getElementById('result').style.color = colorDropdown;
}
//this will change the font face or family of the text
function showTextinFonts()
{ let fontfamilyDropdown=document.getElementById('fonts').value;
document.getElementById('result').style.fontFamily = fontfamilyDropdown;
}
//this will change the font size of the text
function showTextinsizes()
{ let fontsizeDropdown=document.getElementById('sizes').value;
document.getElementById('result').style.fontSize= fontsizeDropdown;
}
//this will cross out the text
function showTextinStrike()
{ document.getElementById('result').style.textDecoration = "line-through";
}
// this will show what you have wrote in the textarea but without formating
function showTextforResult()
{
let textToChange = document.getElementById('textToUse').value;
let resultDivElement =document.getElementById('result');
resultDivElement.innerHTML = textToChange ;
}
// this will make the text like a heading
function showTextforHeading()
{
let textToChange = document.getElementById('textToUse').value;
let resultDivElement =document.getElementById('result');
resultDivElement.innerHTML = "<h1>" + textToChange +"</h1>";
}
//this will make the text slanted or italic
function showTextforItalic()
{
document.getElementById('result').style.fontStyle="italic";
}
//this will change the background color of the text
function showTextforHighlight()
{
document.getElementById('result').style.backgroundColor="yellow";
}
//this will print the result that is in the div section by opening a new window
function print() {
var printWindow = window.open('','PrintWindow', 'width=400,height=200');
html2canvas(document.getElementById('result')).then(function (canvas) {
var doc = printWindow.document;
var img = doc.createElement('img');
img.src = canvas.toDataURL('image/png');
doc.body.appendChild(img);
setTimeout(function () {
printWindow.print();
printWindow.close();
}, 0);
});
}
function showresultinnew() {
var printWindow = window.open('','PrintWindow', 'width=400,height=200');
html2canvas(document.getElementById('result')).then(function (canvas) {
var doc = printWindow.document;
var img = doc.createElement('img');
img.src = canvas.toDataURL('image/png');
doc.body.appendChild(img);
setTimeout(function () {
}, 0);
});
}
var myVar;
function myFunction() {
myVar = setTimeout(showPage, 3000);
document.getElementById('formating').style.display="none";
document.getElementById('export').style.display="none";
var getinfo = localStorage.getItem("Name");
document.getElementById("signin").innerHTML ="Hello "+ getinfo +"!";
}
function showPage() {
document.getElementById("loader").style.display = "none";
document.getElementById("loading").style.display="none";
}
//this saves contents of the showPage
//used html to canvas and js to pdf
function savetopdf(){
var HTML_Width = $(".result").width();
var HTML_Height = $(".result").height();
var top_left_margin = 5;
var PDF_Width = HTML_Width + (top_left_margin * 2);
var PDF_Height = (PDF_Width * 1.5) + (top_left_margin * 2);
var canvas_image_width = HTML_Width;
var canvas_image_height = HTML_Height;
var totalPDFPages = Math.ceil(HTML_Height / PDF_Height) - 1;
html2canvas($(".result")[0]).then(function (canvas) {
var imgData = canvas.toDataURL("image/jpeg", 1.0);
var pdf = new jsPDF('p', 'pt', [PDF_Width, PDF_Height]);
pdf.addImage(imgData, 'JPG', top_left_margin, top_left_margin, canvas_image_width, canvas_image_height);
for (var i = 1; i <= totalPDFPages; i++) {
pdf.addPage(PDF_Width, PDF_Height);
pdf.addImage(imgData, 'JPG', top_left_margin, -(PDF_Height*i)+(top_left_margin*4),canvas_image_width,canvas_image_height);
}
pdf.save("aswinwriter.pdf");
});
}
//this creates loading animations
$(document).ready(function(){
$("#loadformat").click(function(){
$("#formating")
.toggle(2000);
});
});
$(document).ready(function(){
$("#loadexport").click(function(){
$("#export")
.toggle(2000);
});
});
function saveonline(){
if(document.getElementById('signin').innerHTML== "Hello null!"){
document.getElementById('fornonmembers').className = "modal fade show";
document.getElementById('fornonmembers').style.display="block";
}else{
var docname=document.getElementById('docname').value;
var contents= document.getElementById('forsaveuse').innerHTML;
localStorage.setItem(docname,contents)
var textarea= document.getElementById('textToUse').value;
var savename = docname + "txt";
localStorage.setItem(savename,textarea)
}
}
function retrieve(){
var docnametoretrieve = document.getElementById('retrievename').value;
var x = localStorage.getItem(docnametoretrieve);
document.getElementById('forsaveuse').innerHTML = x;
var z= localStorage.getItem(docnametoretrieve+"txt");
var textarea= document.getElementById('textToUse').value = z;
document.getElementById('docname').value = docnametoretrieve;
}
function addimage(){
var textarea = document.getElementById('textToUse').value;
var media= document.getElementById('mediasrc').value;
var imageadding = "<img src='"+media+"' width='400px' height='500px'>"
var newtextarea= textarea + imageadding;
document.getElementById('textToUse').value=newtextarea;
document.getElementById('mediasrc').value="";
}
function addvideo(){
var textarea = document.getElementById('textToUse').value;
var media= document.getElementById('mediasrc').value;
var videoadding= "<video width='500px' height='400px' controls><source src='"+media+"'></video>"
var newtextarea= textarea + videoadding;
document.getElementById('textToUse').value=newtextarea;
document.getElementById('mediasrc').value="";
}
</script>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<!-- Brand/logo -->
<a class="navbar-brand" href="#">Aswin's Writer</a>
<!-- Links -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://docs.aswinapps.com/writerdocs.html">Documentation</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="modal" data-target="#help" href="#">Help</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.aswinapps.com">Back to Home</a>
</li>
</ul>
</nav>
<span class="spinner-border text-success" id="loader"></span>
<p style="text-align:right;" id="signin"> Not Logged In</p>
<input type="text" class="form-control" id="docname" placeholder="Document Name">
<!-- this section defines the basic functions-->
<button type="button" id="loadformat"class="btn btn-primary">View Formating Options</button>
<div id="formating" class="bg-light">
<button type = "button" style="font-weight: bold; background-color: white; margin-top: 8px;
padding: 14px;" id ="bold" onclick="showTextinBold()"><i class="fa-solid fa-bold"></i></button>
<button type="button" id="und" style="text-decoration: underline ;background-color:white; margin-top: 8px;
padding: 14px;"onclick="showTextinUnderline()"><i class="fa-solid fa-underline"></i></button>
<button type="button" id="strike" style="background-color: white; margin-top: 8px;
padding: 14px;" onclick="showTextinStrike()">
<i class="fa-solid fa-strikethrough"></i></button>
<button type="button" id="ita" style=" background-color: white; margin-top: 8px;
padding: 14px;"onclick="showTextforItalic()"><i class="fa-solid fa-italic"></i></button>
<button type="button" value = "Highlight" id="mark" style="background-color:white; margin-top: 8px;
padding: 14px;"onclick="showTextforHighlight()"><i class="fa-solid fa-highlighter"></i></button>
<button type="button" id="heading" style="background-color: white;margin-top: 8px;
padding: 14px;"onclick="showTextforHeading()"><i class="fa-solid fa-heading"></i></button>
<div id="moreformat">
<form>
<!-- this will change the font face... this is the dropdown menu-->
<select id="fonts" name="fonts" onchange=" showTextinFonts()" style="margin-top: 5px;
padding: 14px;">
<option value="Arial" >Arial</option>
<option value="Comic Sans MS">Comic Sans MS</option>
<option value="Georgia" >Times New Roman</option>
<option value="Georgia">Georgia</option>
<option value="Courier New">Courier New</option>
<option value="Palette Mosaic">Brush Script MT</option>
<option value="Tahoma ">Tahoma </option>
<option value="Courier New">Courier New</option>
<option value="Garamond ">Garamond </option>
<option value="Copperplate">Copperplate</option>
<option value="Impact ">Impact </option>
<option value="American Typewriter">American Typewriter</option>
<option value="cursive">Bradley Hand</option>
<option value="select" selected >Select a Font Face</option>
</select>
<!-- this will change the font size...this is the dropdown menu-->
<select id = "sizes" name="sizes " onchange="showTextinsizes()" style="margin-top: 5px;
padding: 14px;">
<option value="12pt">12</option>
<option value="24pt">24</option>
<option value="36pt">36</option>
<option value="48pt">48</option>
<option value="56pt">56</option>
<option value="72pt">72</option>
<option value="select" selected>Select a Font Size</option>
</select>
<!-- this will change the font color... this is the dropdown menu-->
<label for="color"></label>
<select id="colors" name="colors" onchange="showTextinRed(this.options)" style="margin-top: 8px;
margin-right: 90px;
padding: 14px;">
<option value="black">Black</option>
<option value="gray">Gray</option>
<option value="white" >White</option>
<option value="yellow">Yellow</option>
<option value="orange">Orange</option>
<option value="red">Red</option>
<option value="purple">Purple</option>
<option value="pink">Pink</option>
<option value="green">Green</option>
<option value="lime">Lime</option>
<option value="palegreen">Pale Green</option>
<option value="blue">Blue</option>
<option value="#ADD8E6">Light Blue</option>
<option value="00008B">Dark Blue</option>
<option value="indigo">Indigo</option>
<option value="#0d98ba">Blue Green</option>
<option value="select" selected>Select a Font Color</option>
</select>
</form>
</div>
</div>
<button type="button" id="loadexport" class="btn btn-primary">Export</button>
<div id="export">
<button type="button" value="Show Result" id="pararesulting1" style="background-color: white;margin-top: 8px; padding: 14px;" onclick="showresultinnew()">Show Result</button>
<button type="button" value="Print" ID="PT" style="background-color: white; margin-top: 8px;
padding: 14px;" onclick="print()"><i class="fa-solid fa-print"></i></button>
<button type="btn" style="background-color: white; margin-top: 8px;
padding: 14px;" onclick="savetopdf()"> <i class="fa-solid fa-download"></i></button>
</div>
<button type="btn" class="btn btn-primary" data-toggle="collapse" data-target="#media"><i class="fa-solid fa-plus-minus"></i>Add Media</button>
<button type="btn" class="btn btn-success" onclick="saveonline()"><i class="fa-solid fa-floppy-disk"></i>Save Document Online</button>
<button type="btn" class="btn btn-warning" data-toggle="modal" data-target="#retrieves"><span class="material-icons">
file_open
</span>Retrieve Saved Document</button>
<div class="modal" id="help" style="background:transparent;">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Help</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<ol>
<li>To start you would remove all text and write youe own.</li>
<li>To Format text you would click the formatting button, you could bold, italics, and more. You could change font face, size, and color.</li>
<li>To add media, create an url for the media and then copy and paste the url. Choose whether it is a image or a video.</li>
<li>To save online, you would sign in or up. Write the document name and press on save.</li>
<li>To retrieve, just press retrieve document and write the document name.</li>
</ol>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<br>
<div id="media" class="collapse">
<h4>Add Media</h4>
<input type="text" id="mediasrc" class="form-control" placeholder="Source of the media(image/video)"><br><Small><i class="fa-solid fa-circle-info"></i>We don't support custom files yet. Get a url for the image/video and add the source.</Small>
<button type="btn" class="btn btn-success" onclick="addimage()">Add Image</button><button type="btn" class="btn btn-success" onclick="addvideo()">Add Video</button>
</div>
<!-- this is the spot where they need to enter the text-->
<textarea id="textToUse" onkeyup="showTextforResult()">
Welcome to Aswin's Writer. This is completely free. You can start typing here. Just Press show result or any of the buttons to try it.To go to the next line just write <br>, the break symbol in HTML.
</textarea>
<br/><!-- this is where you will see the result after click on any of the formatting buttons/ dropdown menus-->
<b> The Document:</b>
<div id="forsaveuse">
<div id="result" class="result">
</div>
</div>
<!-- Button to Open the Modal -->
<!-- The Modal -->
<div class="modal" id="retrieves">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Enter document name to retrieve document.</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<input type="text" id="retrievename" class="form-control">
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal" onclick="retrieve()">Done.</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="fornonmembers">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Option is available for members only</h4>
<button type="button" class="close" onclick="document.getElementById('fornonmembers').style.display=null;">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
We're sorry, but this option is available for memebers only. <br>
Have an account? Visit the <a href="https://goodapps.w3spaces.com">Main Page<i class="material-icons"></i></a> to log in.<br>
Don't have an account? Visit the <a href="https://goodapps.w3spaces.com">Main Page<i class="material-icons"></i></a> to sign up.It is completely free.
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" onclick="document.getElementById('fornonmembers').style.display=null;">Close</button>
</div>
</div>
</div>
</div>
</body>
</html>