forked from bhavinjawade/Web-Poster-Maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
991 lines (908 loc) · 45.5 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
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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
<!DOCTYPE html>
<html id = "fullpage">
<head>
<title>Wittyfeed Enhance</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="
https://fonts.googleapis.com/css?family=Noto+Sans|Padauk|Concert+One|Hind|Josefin+Sans|Raleway|Nunito+Sans|Oswald|Poppins|Anton|Roboto|Lato|Montserrat|Baloo|Muli" rel="stylesheet">
<link href=" http://fonts.webtoolhub.com/font-n17979-kruti-dev-010.aspx" rel="stylesheet">
<link href=" https://www.dafont.com/stanberry.font" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
<link rel="stylesheet" href="fonts.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js" integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script type="text/javascript" src="js/html2canvas.js"></script>
<script type="text/javascript" src="js/jquery.plugin.html2canvas.js"></script>
<style>
.slidecontainer {
width: 100%;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
</style>
<style>
body{
margin:0 !important;
}
#target{
margin:0 !important;
z-index: 0;
float:left;
padding: 0 !important;
box-shadow: 0px 2px 8px #c2c2c2;
}
#myarea{
outline : 0;
border:none;
background-color: transparent;
}
.textbox{
background-color: transparent;
font-size: 25px;
border:none;
outline: none;
}
.rightside{
width: 48%;
padding-right: 8%;
}
.colors,.bkcolors,.shcolors{
width: 26px;
height: 26px;
border: none;
padding:8px;
}
#myRange{
margin-left: 1%;
margin-top: 1%;
display: inline-block;
width: 93% !important;
}
.sliders{
margin-left: 1%;
margin-top: 1%;
display: inline-block;
width: 93% !important;
}
.colorpalet{
margin-left: 0%;
margin-top: 15px !important;
width: fit-content;
/* display: inline; */
padding-top: 0%;
}
.colorbox{
padding-left: 5px;
margin-left: 24px;
}
.container{
padding-bottom: 17px;
background-color: #f7f7f7;
box-shadow: 0px 2px 8px #c2c2c2;
}
.dropdown{
margin-top: 13px;
font-size: 17px;
border-radius: 5px;
background-color: #dddddd;
border: none;
padding: 8px;
}
.htu{
background-color: #f7f7f7;
padding: 11px;
border-radius: 5px;
left: 1%;
top: 80% !important;
float: left;
position: absolute;
box-shadow: 0px 2px 8px #c2c2c2;
}
.mainholder{
height: 100%;
padding: 2%;
}
.controllers{
padding-left: 15px;
}
.savebtn{
background-color: #008cff;
color: white;
}
#target{
width: 605px;
height: 605px;
position: relative;
margin-top: 3% !important;
margin-left: 11% !important;
}
@font-face {
font-family: Kruti;
src: url(kruti.ttf);
}
@font-face {
font-family: Stanberry;
src: url(Stanberry.ttf);
}
.br-0{
border-radius : 0px !important;
}
.w-100{
width: 100%;
height:100%;
}
.p-0{
border: 1px solid #9c2424;
background-color: brown;
color: white;
font-weight: 500;
border: 1px solid #4f4f4f;
background-color: #646464;
font-size: 1.2vw;
}
.p-0:hover{
border: 1px solid #9c2424;
background-color: white;
color: black;
font-weight: 5004caf50;
border: 1px solid #4f4f4f;
}
.p-0:focus{
outline:none !important;
border:none !important;
box-shadow:none !important;
}
.no-hvr:hover{
border: 1px solid #9c2424;
background-color: #9c2424 !important;
color: white !important;
font-weight: 500;
border: 1px solid #4f4f4f;
background-color: #4f4f4f !important;
}
.no-hvr{
border: 1px solid #9c2424;
background-color: #9c2424 !important;
color: white !important;
font-weight: 500;
border: 1px solid #4f4f4f;
background-color: #4f4f4f !important;
}
.h-add{
}
.fl{
float:left;
}
body{
overflow:hidden;
}
.controlbox{
opacity:0.9;
padding: 0;
box-shadow: 0px 2px 10px black;
transition:1s;
}
.controlbox:hover{
opacity:1;
box-shadow: 0px 2px 10px black;
}
.themearrow{
position: absolute;
top: 2%;
left: 2%;
font-size: 29px;
color: #5f5959;
}
.icons{
margin-left: 11px;
font-size: 20px;
}
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: #d8d5d5;
opacity: 1; /* Firefox */
}
#image-holder{
display: block;
position: fixed;
top: 0px;
left: 0px;
z-index: 1000;
width: 100%;
height: 100%;
background-color: #2d2d2de8;
text-align: center;
}
#showimage{
margin-top: 2%;
}
#closeholder{
color: white;
position: absolute;
float: right;
right: 0;
top: 0;
font-weight: 800;
font-size: 37px;
font-family: Muli;
padding: 1%;
padding-right: 2%;
background-color: #00000063;
padding-left: 2%;
margin: 1%;
border-radius: 3px;
cursor: pointer;
}
</style>
</head>
<body onload="fontsizeadder(this);" onresize="fontsizeadder(this);" style = "background-image: url('images/background.png');display:none;">
<div class = "container-fluid">
<div class = "row">
<div class = "col-md-8">
<div id = "image-holder" style = "display:none; position:fixed;
top: 0;
left: 0;z-index:1000;
width:100%;
height:100%;">
<p onclick = "closeholder()" id = "closeholder" style="font-color:white;">X</p>
<img id = "showimage" src = ""/>
</div>
<form method="POST" enctype="multipart/form-data" action="save.php" id="myForm">
<input type="hidden" name="img_val" id="img_val" value="" />
</form>
<div id="target">
<div id = "main_bg" style = "z-index: 0;position: absolute;height: 100%;width:100%;"></div>
</div>
</div>
<div class = "col-md-4 controlbox">
<!--<p class = "htu" style = "margin-left: 14px;margin-top: 0;margin-top: 4px;"> Double click on an element to add properties on it <br>
Double click and drag to move to element<br> Keep elements in the box to have them in picture <br>
throw them outside the box to discard them</p>-->
<div class = "controllers" style = "display: block-inline;">
<div class = "row h-add">
<div class = "col-md-6 p-0">
<button class = "btn p-0 br-0 w-100" style = "border:none;" onclick="location.reload();">NEW POSTER<i class="fa fa-file-image-o icons" aria-hidden="true"></i></button>
</div>
<div class = "col-md-6 p-0">
<label class = "savebtn btn p-0 br-0 w-100" style = "border:none;padding-top: 11px !important;">
SAVE POSTER<i class="fa fa-floppy-o icons" aria-hidden="true"></i><input hidden type="submit" value="Save Image" onclick="capture();" style ="" />
</label>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-6 p-0">
<label class = "btn p-0 br-0 w-100" style = "border:none;margin: 0px;padding-top: 11px !important;">UPLOAD IMAGE<i class="fa fa-upload icons" aria-hidden="true"></i><input type='file' onchange ="addimage(this);" hidden/></label>
</div>
<div class = "col-md-6 p-0">
<button class = "btn p-0 br-0 w-100" style = "border:none;" onclick = "addtext();" >ADD TEXT<i class="fa fa-font icons" aria-hidden="true"></i></button>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-6 p-0">
<select class = "btn p-0 br-0 w-100" style = "border:none; text-align-last: center;" id = "frames" class = "dropdown fontholder" name="fonts" onchange = "addframes(this);">
<option value="images/selectshape">SELECT FRAMES</option>
<option value="images/innervoice">innervoice</option>
<option value="images/wittyfeed">wittyfeed dark</option>
<option value="images/wittyfeed_white">wittyfeed light</option>
<option value="images/indiakapulse">India Ka Pulse</option>
<option value="images/swbh">Sochne Wali Baat hai</option>
<option value="images/natkhat">Natkhat Chutkule</option>
<option value="images/gyanchand">Gyanchand</option>
<option value="images/innervoice_img">Innervoice with Image</option>
<option value="images/breakthesilence">Break The Silence</option>
</select>
</div>
<div class = "col-md-6 p-0">
<select class = "btn p-0 br-0 w-100" style = "border:none; text-align-last: center;" id = "frames" class = "dropdown fontholder" name="fonts" onchange = "changeRatio(this);">
<option value="1">SELECT ASPECT RATIO</option>
<option value="1">Standard</option>
<option value="2">4:3</option>
<option value="3">16:9</option>
</select>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-4 p-0 no-hvr">
<center style = "margin-top: 9%;">TEXT COLOR</center>
</div>
<div class = "col-md-8 p-0">
<div class = "col-md-2 p-0 w-100 fl" style = "border-left: none;border-top:none; border-bottom:none;">
<button class = "colors btn p-0 br-0 w-100" style = "border:none;background-color: #ffffff"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "colors btn p-0 br-0 w-100" style = "border:none;background-color: #046fc2"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "colors btn p-0 br-0 w-100" style = "border:none;background-color: #ffba01"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "colors btn p-0 br-0 w-100" style = "border:none;background-color: #000000"></button>
</div>
<div class = "col-md-4 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<input class = "btn p-0 br-0 w-100 textcolors" style = "border:none;" placeholder = "#000000"/>
</div>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-4 p-0 no-hvr">
<center style = "margin-top: 0%;">BACKGROUND COLOR</center>
</div>
<div class = "col-md-8 p-0">
<div class = "col-md-2 p-0 w-100 fl" style = "border-left: none;border-top:none; border-bottom:none;">
<button class = "bkcolors btn p-0 br-0 w-100" style = "border:none;background-color: #ffffff"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "bkcolors btn p-0 br-0 w-100" style = "border:none;background-color: #046fc2"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "bkcolors btn p-0 br-0 w-100" style = "border:none;background-color: #ffba01"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "bkcolors btn p-0 br-0 w-100" style = "border:none;background-color: #000000"></button>
</div>
<div class = "col-md-4 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<input class = "btn p-0 br-0 w-100" style = "border:none;" placeholder = "#000000"/>
</div>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-4 p-0 ">
<button class = "btn p-0 br-0 w-100" style = "border:none;" onclick = "scale(event)">RESIZE<i class="fa fa-expand icons" aria-hidden="true"></i></button>
</div>
<div class = "col-md-8 p-0">
<input disabled class = "p-0 br-0 w-100 btn sliders" type="range" min="1" max="100" value="100" id="myRange">
</div>
</div>
<div class = "row h-add">
<div class = "col-md-4 p-0">
<button class = "btn p-0 br-0 w-100" style = "border:none;" onclick = "fontsize(event);">FONTSIZE<i class="fa fa-text-height icons" aria-hidden="true"></i></button>
</div>
<div class = "col-md-8 p-0">
<input disabled class = "btn p-0 br-0 w-100 sliders" type="range" min="0" max="150" value="0" id="fontsize">
</div>
</div>
<div class = "row h-add">
<div class = "col-md-4 p-0">
<button onclick = "opacity(event)" class = "btn p-0 br-0 w-100" style = "border:none;">TRANSPARENCY</button>
</div>
<div class = "col-md-8 p-0">
<input disabled class = "btn p-0 br-0 w-100 sliders" type="range" min="0" max="10" value="10" id="opac">
</div>
</div>
<div class = "row h-add">
<div class = "col-md-12 p-0">
<select onchange = "fontfamily(this);" class = "btn p-0 br-0 w-100" style = "border:none; text-align-last: center;" name="fonts" onchange = "fontfamily(this);">
<option value="Select Font">SELECT FONT</option>
<option value="arial">Arial</option>
<option value="Roboto">Roboto</option>
<option value="Hind">Hindi</option>
<option value="Raleway">Raleway</option>
<option value="Josefin sans">Josefin</option>
<option value="Concert One">Concert One</option>
<option value="Montserrat">Montserrat</option>
<option value="Baloo">Baloo</option>
<option value="Muli">Muli</option>
<option value="Kruti">Kruti Dev 010</option>
<option value="Stanberry">Stanberry</option>
</select>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-1 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 bold" style = "border:none;"><b>B</b></button>
</div>
<div class = "col-md-1 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 italic" style = "border:none;"><i>I</i></button>
</div>
<div class = "col-md-1 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 underline" style = "border:none;"><u>U</u></button>
</div>
<div class = "col-md-1 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 leftalign" style = "border:none;"><i class="fa fa-align-left" aria-hidden="true"></i></button>
</div>
<div class = "col-md-1 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 rightalign" style = "border:none;"><i class="fa fa-align-right" aria-hidden="true"></i></button>
</div>
<div class = "col-md-1 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 centeralign" style = "border:none;"><i class="fa fa-align-center" aria-hidden="true"></i></button>
</div>
<div class = "col-md-1 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 justifyalign" style = "border:none;"><i class="fa fa-align-justify" aria-hidden="true"></i></button>
</div>
<div class = "col-md-5 p-0 w-100 fl">
<button class = "btn p-0 br-0 w-100 centerwhole" style = "border:none;">CENTER</button>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-12 p-0">
<select class = "btn p-0 br-0 w-100" style = "border:none; text-align-last: center;" id = "shapes" name="fonts" onchange = "addshape(this);">
<option value="selectshape">SELECT SHAPE</option>
<option value="images/wittylogo">wittyfeed logo</option>
<option value="images/wittyfeed_india_logo">wittyfeed india logo</option>
<option value="images/innervoicelogo">Innervoice logo</option>
<option value="images/ivlogo">iv logo</option>
<option value="images/wflogo">wf logo</option>
<option value="Color Layer">TINT</option>
<option value="images/quotes">Quotes</option>
<option value="square">square</option>
<option value="rectangle">rectangle</option>
<option value="line">line</option>
</select>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-4 p-0 no-hvr">
<center style = "margin-top: 9%;" style = "border:none;">SHAPE COLOR</center>
</div>
<div class = "col-md-8 p-0">
<div class = "col-md-2 p-0 w-100 fl" style = "border-left: none;border-top:none; border-bottom:none;">
<button class = "shcolors btn p-0 br-0 w-100" style = "border:none;background-color: #ffffff"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "shcolors btn p-0 br-0 w-100" style = "border:none;background-color: #046fc2"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "shcolors btn p-0 br-0 w-100" style = "border:none;background-color: #ffba01"></button>
</div>
<div class = "col-md-2 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<button class = "shcolors btn p-0 br-0 w-100" style = "border:none;background-color: #000000"></button>
</div>
<div class = "col-md-4 p-0 w-100 fl" style = "border-top:none; border-bottom:none;">
<input class = "btn p-0 br-0 w-100" style = "border:none; font-color: white" placeholder = "#000000"/>
</div>
</div>
</div>
<div class = "row h-add">
<div class = "col-md-6 p-0">
<button onclick = "picheja();" class = "btn p-0 br-0 w-100" style = "border:none;"><i class="fa fa-chevron-down" style = "margin-right: 11px;font-size: 20px;" aria-hidden="true"></i>SEND BACK</button>
</div>
<div class = "col-md-6 p-0">
<button onclick = "aageaa();" class = "btn p-0 br-0 w-100" style = "border:none;">BRING FRONT<i class="fa fa-chevron-up icons" aria-hidden="true"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//////////////////////////////////////////////////ONLOAD FontSIZE adder/////////////////////////////////////////
function fontsizeadder(elem){
var browserHeight = window.innerHeight;
var rowHeight = browserHeight / 13;
console.log(rowHeight);
var elementArray = document.getElementsByClassName("h-add");
console.log(elementArray);
for (var i = 0; i < elementArray.length; ++i)
elementArray[i].style.height = rowHeight + "px";
document.getElementsByTagName("BODY")[0].style.display = "block";
/* var value = "";
for(var i = 1 ; i <= 55; i++){
document.getElementById('fontsizer').innerHTML = value + "<option value="+i+">"+i+"</option>";
value = value + "<option value="+i+">"+i+"</option>";
}
*/
}
universallayerindex = 0;
textlayerindex = 0;
imagelayerindex = 0;
selectedid = 0;
function picheja(){
if(document.getElementById(selectedid).style.zIndex >= 1)
document.getElementById(selectedid).style.zIndex = parseInt(document.getElementById(selectedid).style.zIndex) - 1;
}
function aageaa(){
document.getElementById(selectedid).style.zIndex = parseInt(document.getElementById(selectedid).style.zIndex) + 1;
}
////////////////////////////////////////////////////////////////COLORS TEXT ALIGNMENT///////////////////////////////////////////////////////
$(document).ready(function() {
$('.colors').click(function() {
color = this.style.backgroundColor;
document.execCommand("ForeColor", false, color);
});
});
$(document).ready(function() {
$('.clr').click(function() {
color = document.getElementById("textcolorbox").value;
document.execCommand("ForeColor", false, color);
});
});
$(document).ready(function() {
$('.bold').click(function() {
document.execCommand("bold");
});
});
$(document).ready(function() {
$('.italic').click(function() {
document.execCommand("italic");
});
});
$(document).ready(function() {
$('.centerwhole').click(function() {
console.log("hellobhai");
var elem = document.getElementById(selectedid);
console.log(elem);
x = elem.offsetWidth;
y = elem.offsetHeight;
X = (605-x)/2;
Y = (605-y)/2;
console.log(x,y,X,Y);
elem.style.left = X + "px";
elem.style.top = Y + "px";
});
});
$(document).ready(function() {
$('.underline').click(function() {
document.execCommand("underline");
});
});
$(document).ready(function() {
$('.leftalign').click(function() {
document.execCommand('justifyLeft');
});
});
function setbgcolor(color){
document.getElementById("main_bg").style.backgroundColor = color;
}
$(document).ready(function() {
$('.centeralign').click(function() {
document.execCommand('justifyCenter');
});
});
$(document).ready(function() {
$('.rightalign').click(function() {
document.execCommand('justifyRight');
});
});
$(document).ready(function() {
$('.justifyalign').click(function() {
document.execCommand('justifyFull');
});
});
$(document).ready(function() {
$('.bkcolors').click(function() {
color = this.style.backgroundColor;
document.getElementById("main_bg").style.backgroundColor = color;
console.log(color);
});
});
$(document).ready(function() {
$('.trybk').click(function() {
color = document.getElementById("bkcolorbox").value;;
document.getElementById("main_bg").style.backgroundColor = color;
console.log(color);
});
});
$(document).ready(function() {
$('.shcolors').click(function() {
color = this.style.backgroundColor;
//console.log("id_"+selectedid);
document.getElementById(selectedid).style.backgroundColor = color;
console.log(color);
});
});
//////////////////////////////////////////////////////////////////SCALE/////////////////////////////////////////////////////////
function scale(event){
document.getElementById("myRange").disabled = false;
document.getElementById("myRange").value = 50;
var elem = document.getElementById(selectedid);
console.log(selectedid);
slider = document.getElementById("myRange");
//console.log(elem.id);
event = document.getElementById("shapes");
slider.oninput = function() {
if(elem.tagName == "IMG")
{
elem.style.width = document.getElementById("myRange").value + "%";
//elem.style.height = document.getElementById("myRange").value + "%";
console.log(elem.tagName);
}
if(elem.tagName == "DIV")
{
console.log(elem.tagName + elem.value);
if(event.value == "circle" || elem.value == "square")
{
elem.style.width = document.getElementById("myRange").value + "%";
console.log(elem.offsetWidth);
elem.style.height = elem.offsetWidth;
}
if(event.value == "line"){
elem.style.width = document.getElementById("myRange").value + "%";
}
if(event.value == "rectangle")
{
elem.style.width = document.getElementById("myRange").value + "%";
console.log(elem.offsetWidth);
}
}
}
}
////////////////////////////////////////////////////////////////////OPACITY/////////////////////////////////////////////////////////
function opacity(event){
document.getElementById("opac").disabled = false;
document.getElementById("opac").value = 10;
var elem = document.getElementById(selectedid);
console.log(selectedid);
slider = document.getElementById("opac");
slider.oninput = function() {
elem.style.opacity = document.getElementById("opac").value / 10;
}
}
//////////////////////////////////////////////////////////////FONT FAMILY///////////////////////////////////////////////////////////
function fontfamily(eleme){
console.log(eleme);
var elem = document.getElementById(selectedid);
console.log(selectedid);
elem.style.fontFamily = eleme.value;
}
////////////////////////////////////////////////////////////////ADD SHAPE/////////////////////////////////////////////////////////////
function addshape(elem){
value = document.getElementById("target").innerHTML;
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
console.log(document.getElementById("id_"+i).tagName);
if(document.getElementById("id_"+i).tagName == "TEXTAREA")
{
strings.push(document.getElementById("id_"+i).value);
console.log("hello");
}
}
}
if(elem.value == "square")
{console.log(elem.value);document.getElementById("target").innerHTML = value + "" + '<div src = "" id = "id_'+universallayerindex+'" onclick = "dragElement(this);" style = " height: 50px; width: 50px; z-index : '+universallayerindex+';overflow : hidden; background-color: black; position : absolute;max-width: 500px;max-height: 500px;"/>';}
else if(elem.value == "rectangle")
{console.log(elem.value);document.getElementById("target").innerHTML = value + "" + '<div src = "" id = "id_'+universallayerindex+'" onclick = "dragElement(this);" style = " height: 50px; width: 100px; z-index : '+universallayerindex+';overflow : hidden; background-color: red; position : absolute;max-width: 500px;max-height: 500px;"/>';}
else if(elem.value == "circle")
{console.log(elem.value);document.getElementById("target").innerHTML = value + "" + '<div src = "" id = "id_'+universallayerindex+'" onclick = "dragElement(this);" style = " border-radius: 50%; height: 50px; width: 50px; z-index : '+universallayerindex+';overflow : hidden; background-color: red; position : absolute;max-width: 500px;max-height: 500px;"/>';}
else if(elem.value == "line")
{console.log(elem.value);document.getElementById("target").innerHTML = value + "" + '<div src = "" id = "id_'+universallayerindex+'" onclick = "dragElement(this);" style = " height: 5px; width: 100px; z-index : '+universallayerindex+';overflow : hidden; background-color: red; position : absolute;max-width: 500px;max-height: 500px;"/>';}
else if(elem.value == "Color Layer")
{selectedid = universallayerindex;console.log(elem.value);document.getElementById("target").innerHTML = value + "" + '<div src = "" id = "id_'+universallayerindex+'" onclick = "dragElement(this);" style = "opacity:0.6;height: 100%; width: 100%; z-index : '+universallayerindex+';overflow : hidden; background-color: black; position : absolute;"/>';}
else
document.getElementById("target").innerHTML = value + "" + '<img onclick = "dragElement(this);" src = "'+elem.value+'.png" id = "id_'+universallayerindex+'" style = "width: 100%; z-index : '+universallayerindex+';position : absolute;"/>';
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
if(document.getElementById("id_"+i).tagName == "TEXTAREA")
document.getElementById("id_"+i).value = strings[i];
}
}
universallayerindex = universallayerindex + 1;
}
//////////////////////////////////////////////////////////////ADD FRAME////////////////////////////////////////////////////////////////
function addframes(elem){
value = document.getElementById("target").innerHTML;
strings = [];
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
console.log(document.getElementById("id_"+i).className);
if(document.getElementById("id_"+i).className == "textbox")
strings.push(document.getElementById("id_"+i).value);
}}
if(elem.value != 'images/gyanchand'){//not gyanchand add frame
document.getElementById("target").innerHTML = value + "" + '<img src = "'+elem.value+'.png" id = "id_'+universallayerindex+'" style = " height: 100%; width: 100%; z-index : '+universallayerindex+';position : absolute;"/>';
value = value + '<img src = "'+elem.value+'.png" id = "id_'+universallayerindex+'" style = " height: 100%; width: 100%; z-index : '+universallayerindex+';position : absolute;"/>';
universallayerindex++;
}
if(elem.value == 'images/innervoice'){//done
addtext("Muli","white");
}
if(elem.value == 'images/swbh'){//done
addtext("Stanberry","black");
}
if(elem.value == 'images/natkhat'){//done
addtext("kruti","black","800");
}
if(elem.value == 'images/wittyfeed_white'){//done
addtext("Montserrat","black");
}
if(elem.value == 'images/wittyfeed'){//done
addtext("Montserrat","white");
}
if(elem.value == 'images/indiakapulse'){//done
addtext("Raleway","black");
}
if(elem.value == 'images/gyanchand'){
document.getElementById("target").innerHTML = value + "" + '<img src = "'+elem.value+'.png" id = "id_'+universallayerindex+'" style = " height: 100%; width: 100%; z-index : 100;position : absolute;"/>';
value = value + "" + '<img src = "'+elem.value+'.png" id = "id_'+universallayerindex+'" style = " height: 100%; width: 100%; z-index : 100;position : absolute;"/>';
universallayerindex++
document.getElementById("target").innerHTML = value + "" + '<div class = "textbox" type = "text" onclick = "dragElement(this);" id = id_'+universallayerindex+' style = "font-family: baloo;z-index : 100; color: black; position : absolute; top: 50%; left: 29%;" contenteditable>पाठ दर्ज करें</div>';
universallayerindex++;
}
if(elem.value == 'images/quoteoftheday'){
document.getElementById("target").innerHTML = value + "" + '<img src = "'+elem.value+'.png" id = "id_'+universallayerindex+'" style = " height: 100%; width: 100%; z-index : 100;position : absolute;"/>';
value = value + "" + '<img src = "'+elem.value+'.png" id = "id_'+universallayerindex+'" style = " height: 100%; width: 100%; z-index : 100;position : absolute;"/>';
universallayerindex++
document.getElementById("target").innerHTML = value + "" + '<div class = "textbox" type = "text" onclick = "dragElement(this);" id = id_'+universallayerindex+' style = "font-family: Muli;z-index : 100; color: white; font-weight: bold; position : absolute; top: 50%; left: 29%;" contenteditable>Enter Your Text</div>';
universallayerindex++;
}
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
if(document.getElementById("id_"+i).className == "textbox")
document.getElementById("id_"+i).value = strings[i];
}}
}
//////////////////////////////////////////////////////FONT SIZE///////////////////////////////////////////////////
function fontsize(event){
document.getElementById("fontsize").disabled = false;
document.getElementById("fontsize").value = 0;
var elem = document.getElementById(selectedid);
console.log("fontsize change on : " + selectedid);
console.log(elem);
slider = document.getElementById("fontsize");
slider.oninput = function() {
elem.style.fontSize = document.getElementById("fontsize").value + "px";
}
}
////////////////////////////////////////////////////////////////READ URL////////////////////////////////////////////////////////
function readURL(input) {
console.log("inside read url");
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
document.getElementById('id_'+(universallayerindex - 1)).src = e.target.result;
}
reader.readAsDataURL(input.files[0]);
}
imagelayerindex = imagelayerindex + 1;
universallayerindex = universallayerindex + 1;
}
var z = 0;
///////////////////////////////////////////////////////////ADD IMAGE////////////////////////////////////////////////////////
function addimage(input){
console.log("Image adder");
value = document.getElementById("target").innerHTML;
strings = [];
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
//console.log(document.getElementById("id_"+i).className);
if(document.getElementById("id_"+i).className == "textbox")
strings.push(document.getElementById("id_"+i).value);
}}
document.getElementById("target").innerHTML = value + "" + '<img src = "" id = "id_'+universallayerindex+'" onclick = "dragElement(this);" style = " max-width:100%; max-height:100%;z-index : '+universallayerindex+';overflow : hidden; position : absolute;"/>';
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
if(document.getElementById("id_"+i).className == "textbox")
document.getElementById("id_"+i).value = strings[i];
}}
readURL(input);
}
var textindex = 0;
///////////////////////////////////////////////////////////ADD TEXT/////////////////////////////////////////////////////
function addtext(font = "arial",color = "gray",weight = "500"){
value = document.getElementById("target").innerHTML;
strings = [];
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
console.log(i + " " +document.getElementById("id_"+i).className);
if(document.getElementById("id_"+i).className == "textbox")
strings.push(document.getElementById("id_"+i).value);
}}
document.getElementById("target").innerHTML = value + "" + '<div class = "textbox" type = "text" onclick = "dragElement(this);" id = id_'+universallayerindex+' style = "font-family: '+font+';z-index : '+universallayerindex+'; color: '+color+'; position : absolute; top: 42%; left: 34%; font-weight: '+weight+'" contenteditable>Put your text here</div>';
if(textlayerindex != 0){
for (i = 0; i < universallayerindex; i++) {
if(document.getElementById("id_"+i).className == "textbox")
document.getElementById("id_"+i).value = strings[i];
}}
textlayerindex++;
universallayerindex = universallayerindex + 1;
}
////////////////////////////////////////////////////////////////DRAG ELEMENT///////////////////////////////////////////////////
function dragElement(elmnt) {
selectedid = elmnt.id;
console.log(elmnt.id + "this is selected");
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
if (document.getElementById(elmnt.id + "header")) {
/* if present, the header is where you move the DIV from:*/
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
} else {
/* otherwise, move the DIV from anywhere inside the DIV:*/
elmnt.onmousedown = dragMouseDown;
}
function showCoords(event) {
var x = event.clientX;
var y = event.clientY;
return x,y;
}
function dragMouseDown(e) {
e = e || window.event;
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// call a function whenever the cursor moves:
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
/* stop moving when mouse button is released:*/
document.onmouseup = null;
document.onmousemove = null;
}
}
///////////////////////////////////////////////////////////////CAPTURE FINAL IMAGE///////////////////////////////////////////
function capture() {
document.getElementById('fullpage').style.zoom = 3;
$('#target').html2canvas({
onrendered: function (canvas) {
//Set hidden field's value to image data (base-64 string)
$('#img_val').val(canvas.toDataURL("image/jpeg",1.0));
console.log(canvas.toDataURL("image/png",1.0));
//Submit the form manually
document.getElementById("showimage").src = canvas.toDataURL("image/png",1.0);
document.getElementById("image-holder").style.display = "block";
//document.getElementById("myForm").submit();
}
});
document.getElementById('fullpage').style.zoom = 1;
}
///////////////////////////////////////////////////CLOSE HOLDER///////////////////////////////////////////////////////////////
function closeholder(){
document.getElementById("image-holder").style.display = "none";
}
///////////////////////////////////////////////////Ratio Change///////////////////////////////////////////////////////////////
function changeRatio(input){
if (input.value==="1"){
document.getElementById('target').style.height = "605px";
}
else if(input.value==="2"){
document.getElementById('target').style.height = "454px";
}
else if (input.value==="3"){
document.getElementById('target').style.height = "339px";
}
}
</script>
<style type="text/css">
#target {
border: 1px solid #CCC;
padding: 5px;
margin: 5px;
}
h2, h3 {
color: #003d5d;
}
#more {
font-family: Verdana;
color: purple;
background-color: #d8da3d;
}
</style>
</div>
</body>
</html>