@innovastudio/contentbuilder 1.0.87 → 1.0.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1484 @@
1
+ /*
2
+ Buttons Plugin
3
+ */
4
+
5
+ (function () {
6
+ if(typeof _cb === 'undefined') return;
7
+
8
+ var html = '<div class="is-modal buttonbuilder">' +
9
+ '<div class="is-modal-content" style="width:505px;height:620px;position: relative;display: flex;flex-direction: column;align-items: center;padding: 0px;">' +
10
+ '<div class="is-modal-bar is-draggable" style="background:'+_cb.styleTabsBackground+';position: absolute;top: 0;left: 0;width: 100%;z-index:1;line-height:32px;height:32px;">' + _cb.out('Button Editor') +
11
+ '<div class="is-modal-close" style="z-index:1;width:32px;height:32px;position:absolute;top:0px;right:0px;box-sizing:border-box;padding:0;line-height:32px;font-size: 12px;text-align:center;cursor:pointer;">&#10005;</div>' +
12
+ '</div>' +
13
+ '<iframe data-width="1440" style="width:100%;height:100%;max-width:1440px;border:none;border-top:32px solid transparent;margin:0;box-sizing:border-box;" src="about:blank"></iframe>' +
14
+ '</div>' +
15
+ '</div>';
16
+
17
+ _cb.addHtml(html);
18
+
19
+ var html_button = '<button title="' + _cb.out('Edit Button') + '" data-title="' + _cb.out('Edit Button') + '" class="button-builder" style="display:none;"><svg class="is-icon-flex" style="width:12px;height:12px;"><use xlink:href="#ion-android-create"></use></svg></button>';
20
+
21
+ var linkTool = document.querySelector('#divLinkTool');
22
+ if(!linkTool) return; // in case builder is destroyed
23
+
24
+ linkTool.insertAdjacentHTML('afterBegin', html_button); //add button to existing #divLinkTool
25
+
26
+ var buttonEdit = linkTool.querySelector('.button-builder');
27
+
28
+ //Extend onContentClick
29
+ var oldget = _cb.opts.onContentClick;
30
+ _cb.opts.onContentClick = function (e) {
31
+
32
+ let elm = e.target;
33
+
34
+ let isButton;
35
+ if(elm.className) {
36
+ if(elm.className.indexOf('inline-block')>-1) {
37
+ isButton=true;
38
+ }
39
+ }
40
+
41
+ if((elm.tagName.toLowerCase() === 'a' && isButton)) {
42
+ buttonEdit.style.display = 'block';
43
+ } else {
44
+ buttonEdit.style.display = 'none';
45
+ }
46
+
47
+ if(oldget) {
48
+ var ret = oldget.apply(this, arguments);
49
+ return ret;
50
+ }
51
+ };
52
+
53
+ buttonEdit.addEventListener('click', function(){
54
+
55
+ var modal = document.querySelector('.is-modal.buttonbuilder');
56
+ _cb.showModal(modal);
57
+
58
+ _cb.saveForUndo(true); // checkLater = true
59
+
60
+ var btnClose = modal.querySelector('.is-modal-close');
61
+ btnClose.addEventListener('click', function(e){
62
+ _cb.hideModal(modal);
63
+ });
64
+
65
+ // Update style
66
+ modal.querySelector('.is-modal-bar').style.background = _cb.styleTabsBackground;
67
+
68
+ iframe = modal.querySelector('iframe');
69
+ doc = iframe.contentWindow.document;
70
+ doc.open();
71
+ doc.write(getHTML());
72
+ doc.close();
73
+ });
74
+
75
+ function getHTML() {
76
+
77
+ var pluginPath = _cb.opts.pluginPath + 'plugins/buttons/';
78
+
79
+ const html = `
80
+ <!DOCTYPE HTML>
81
+ <html>
82
+ <head>
83
+ <meta charset="utf-8">
84
+ <title></title>
85
+ <style>
86
+ body {
87
+ color: ${_cb.styleModalColor};
88
+ margin:0;
89
+ overflow-x:hidden;overflow-y:auto;
90
+ font-family:sans-serif;
91
+ font-size:13px;
92
+ letter-spacing:1px;
93
+ font-weight:300;
94
+ }
95
+ .flex-col { display:flex;flex-direction:column }
96
+ .flex-row { display:flex;flex-direction:row }
97
+ .flex-wrap { flex-flow:wrap }
98
+
99
+ .container > div {
100
+ text-align:center;
101
+ font-size:24px;c
102
+ ursor:pointer;margin: 0;
103
+ display:inline-block;
104
+ float:left;
105
+ width:25%;
106
+ height:80px;
107
+ line-height:80px;
108
+ border:#eee 1px solid;
109
+ box-sizing:border-box;
110
+ }
111
+ .clearfix:before, .clearfix:after {content: " ";display: table;}
112
+ .clearfix:after {clear: both;}
113
+ .clearfix {*zoom: 1;}
114
+
115
+ .inptext {
116
+ width:90%;
117
+ font-size:17px;
118
+ letter-spacing:1px;
119
+ border:none;
120
+ padding:10px;
121
+ border:rgba(127, 127, 127, 0.32) 1px solid;
122
+ }
123
+ button {
124
+ width: auto;
125
+ height: 40px;
126
+ line-height: 1;
127
+ display: inline-block;
128
+ box-sizing: border-box;
129
+ margin: 0;
130
+ padding: 0 9px;
131
+ cursor: pointer;
132
+ background-color: ${_cb.styleButtonClassicBackground};
133
+ color: ${_cb.styleButtonClassicColor};
134
+ border: 1px solid transparent;
135
+ font-family: sans-serif;
136
+ letter-spacing: 1px;
137
+ font-size: 11px;
138
+ font-weight: normal;
139
+ text-transform: uppercase;
140
+ text-align: center;
141
+ position: relative;
142
+ border-radius: 0;
143
+ transition: all ease 0.3s
144
+ }
145
+ .inptext:focus {outline:none}
146
+ button:focus {outline:none;}
147
+
148
+ button.classic-primary {
149
+ display: inline-block;
150
+ width: auto;
151
+ height: 50px;
152
+ padding-left: 10px;
153
+ padding-right: 10px;
154
+ min-width: 135px;
155
+ background-color: ${_cb.styleButtonClassicBackground};
156
+ }
157
+ button.classic-secondary {
158
+ display: inline-block;
159
+ width: auto;
160
+ height: 50px;
161
+ padding-left: 10px;
162
+ padding-right: 10px;
163
+ background: transparent;
164
+ }
165
+ select {
166
+ font-size: 14px;
167
+ letter-spacing: 1px;
168
+ height: 50px;
169
+ line-height: 1.7;
170
+ color: #454545;
171
+ border-radius: 0;
172
+ border: none;
173
+ background-color: #eee;
174
+ width: auto;
175
+ display: inline-block;
176
+ background-image: none;
177
+ -webkit-appearance: menulist;
178
+ -moz-appearance: menulist;
179
+ appearance: menulist;
180
+ padding: 0 5px;
181
+ }
182
+ select:focus {outline:none}
183
+
184
+ /*
185
+ Tabs
186
+ */
187
+ .is-tabs.simple {
188
+ white-space:nowrap;
189
+ padding:20px;padding-bottom:5px;padding-top: 10px;
190
+ box-sizing:border-box;
191
+ font-family: sans-serif;
192
+ font-size: 11px;
193
+ text-transform: uppercase;
194
+ letter-spacing: 2px;
195
+ background: ${_cb.styleTabsBackground};
196
+ }
197
+ .is-tabs.simple a {
198
+ display: inline-block;
199
+ float:left;
200
+ padding: 3px 0 0 1px;
201
+ color: ${_cb.styleTabItemColor};
202
+ border-bottom: transparent 1px solid;
203
+
204
+ margin: 0 16px 16px 0;
205
+ text-decoration: none;
206
+ transition: box-shadow ease 0.3s;
207
+ }
208
+ .is-tabs.simple a:hover {
209
+
210
+ }
211
+ .is-tabs.simple a.active {
212
+ background: transparent;
213
+ box-shadow: none;
214
+ cursor:default;
215
+ border-bottom: ${_cb.styleTabItemBorderBottomActive};
216
+ }
217
+ .is-tab-content.simple {display:none;padding:20px;}
218
+
219
+ /* Overide */
220
+ .is-tabs.simple {border-bottom:${_cb.styleSeparatorColor} 1px solid;padding-bottom:15px;}
221
+ .is-tabs.simple a {margin: 0 16px 0 0;line-height:1.5}
222
+ .is-tab-content {
223
+ border:none;
224
+ padding:20px;
225
+ box-sizing:border-box;
226
+ display:none;
227
+ height: 100%;
228
+ position: absolute;
229
+ width: 100%;
230
+ box-sizing: border-box;
231
+ border-top: 50px solid transparent;
232
+ top: 0px;
233
+ }
234
+
235
+
236
+ .is-button-remove {
237
+ position: absolute;
238
+ top: 0px;
239
+ right: 0px;
240
+ width: 20px;
241
+ height: 20px;
242
+ background: rgba(95, 94, 94, 0.26);
243
+ color: #fff;
244
+ line-height: 20px;
245
+ text-align: center;
246
+ font-size: 12px;
247
+ cursor: pointer;
248
+ display:none;
249
+ }
250
+ #divMyButtonList {
251
+ height: 100%;
252
+ width: 100%;
253
+ position: absolute;
254
+ top: 0;
255
+ left: 0;
256
+ padding: 20px;
257
+ border-top: transparent 90px solid;
258
+ box-sizing: border-box;
259
+ overflow: hidden;
260
+ overflow-y: auto;
261
+ }
262
+ #divMyButtonList a {position:relative}
263
+ #divMyButtonList a.active .is-button-remove {display:block;}
264
+ #divButtonTemplates {
265
+ height: 100%;
266
+ width: 100%;
267
+ position: absolute;
268
+ top: 0;
269
+ left: 0;
270
+ padding: 20px;
271
+ box-sizing: border-box;
272
+ overflow: hidden;
273
+ overflow-y: auto;
274
+ opacity: 0.95;
275
+ }
276
+
277
+ /* Templates */
278
+ #divMyButtonList > a, #divButtonTemplates > a {
279
+ margin: 0px 13px 15px 0;
280
+ padding: 10px 50px;
281
+ font-size: 1rem;
282
+ line-height: 2rem;
283
+ border-radius: 0;
284
+ letter-spacing: 3px;
285
+ display: inline-block;
286
+ font-weight: normal;
287
+ text-align: center;
288
+ text-decoration: none;
289
+ cursor: pointer;
290
+ background-image: none;
291
+ border: 1px solid transparent;
292
+ white-space: nowrap;
293
+ -webkit-transition: all 0.16s ease;
294
+ transition: all 0.16s ease;
295
+ text-decoration:none;
296
+ color: #000;
297
+ }
298
+
299
+ button.is-btn-color {
300
+ width: 50px;
301
+ height: 50px;
302
+ padding: 0;
303
+ background: ${_cb.styleButtonPickColorBackground};
304
+ // border: rgba(0,0,0,0.09) 1px solid;
305
+ border: ${_cb.styleButtonPickColorBorder};
306
+ }
307
+
308
+ .colored .is-tabs.simple {border-bottom:transparent 1px solid;}
309
+
310
+ select {
311
+ background: ${_cb.styleSelectBackground};
312
+ color: ${_cb.styleSelectColor};
313
+ }
314
+
315
+ /* Scrollbar for modal */
316
+
317
+ .dark * {
318
+ scrollbar-width: thin;
319
+ scrollbar-color: rgba(255, 255, 255, 0.3) auto;
320
+ }
321
+ .dark *::-webkit-scrollbar {
322
+ width: 12px;
323
+ }
324
+ .dark *::-webkit-scrollbar-track {
325
+ background: transparent;
326
+ }
327
+ .dark *::-webkit-scrollbar-thumb {
328
+ background-color:rgba(255, 255, 255, 0.3);
329
+ }
330
+
331
+ .colored-dark * {
332
+ scrollbar-width: thin;
333
+ scrollbar-color: rgb(100, 100, 100) auto;
334
+ }
335
+ .colored-dark *::-webkit-scrollbar {
336
+ width: 12px;
337
+ }
338
+ .colored-dark *::-webkit-scrollbar-track {
339
+ background: transparent;
340
+ }
341
+ .colored-dark *::-webkit-scrollbar-thumb {
342
+ background-color:rgb(100, 100, 100);
343
+ }
344
+
345
+ .colored * {
346
+ scrollbar-width: thin;
347
+ scrollbar-color: rgba(0, 0, 0, 0.4) auto;
348
+ }
349
+ .colored *::-webkit-scrollbar {
350
+ width: 12px;
351
+ }
352
+ .colored *::-webkit-scrollbar-track {
353
+ background: transparent;
354
+ }
355
+ .colored *::-webkit-scrollbar-thumb {
356
+ background-color: rgba(0, 0, 0, 0.4);
357
+ }
358
+
359
+ .light * {
360
+ scrollbar-width: thin;
361
+ scrollbar-color: rgba(0, 0, 0, 0.4) auto;
362
+ }
363
+ .light *::-webkit-scrollbar {
364
+ width: 12px;
365
+ }
366
+ .light *::-webkit-scrollbar-track {
367
+ background: transparent;
368
+ }
369
+ .light *::-webkit-scrollbar-thumb {
370
+ background-color: rgba(0, 0, 0, 0.4);
371
+ }
372
+ </style>
373
+ </head>
374
+ <body${_cb.styleDark?' class="dark"':''}${_cb.styleColored?' class="colored"':''}${_cb.styleColoredDark?' class="colored-dark"':''}${_cb.styleLight?' class="light"':''}>
375
+
376
+ <svg width="0" height="0" style="position:absolute;display:none;">
377
+ <defs>
378
+ <symbol viewBox="0 0 512 512" id="ion-ios-close-empty"><path d="M340.2 160l-84.4 84.3-84-83.9-11.8 11.8 84 83.8-84 83.9 11.8 11.7 84-83.8 84.4 84.2 11.8-11.7-84.4-84.3 84.4-84.2z"></path></symbol>
379
+ <symbol viewBox="0 0 512 512" id="ion-contrast"><path d="M256 32C132.3 32 32 132.3 32 256s100.3 224 224 224 224-100.3 224-224S379.7 32 256 32zm135.8 359.8C355.5 428 307 448 256 448V64c51 0 99.5 20 135.8 56.2C428 156.5 448 204.7 448 256c0 51.3-20 99.5-56.2 135.8z"></path></symbol>
380
+ </defs>
381
+ </svg>
382
+
383
+ <div class="is-tabs simple clearfix" data-group="button" style="position: absolute;top: 0;height: 51px;width: 100%;z-index: 1;">
384
+ <a title="${_cb.out('Default')}" href="" data-content="divButtonDefault" class="active" data-lang>${_cb.out('Default')}</a>
385
+ <a title="${_cb.out('Hover')}" href="" data-content="divButtonHover" data-lang>${_cb.out('Hover')}</a>
386
+ <a title="${_cb.out('Saved')}" href="" data-content="divMyButtons" data-lang>${_cb.out('Saved')}</a>
387
+
388
+ </div>
389
+ <div id="divButtonDefault" class="is-tab-content" data-group="button" style="display:block">
390
+
391
+ <div style="display:none;margin:10px 0 0">
392
+ <div style="width:160px">
393
+ <label>${_cb.out('Background Color')}:<br />
394
+ <button title="${_cb.out('Background Color')}" class="button-bgcolor is-btn-color" style="margin-top:10px"></button>
395
+ </label>
396
+ </div>
397
+ <div style="width:170px;display:none;"> <!-- Remove the display none to enable button gradient -->
398
+ <label>${_cb.out('Gradient')}:<br />
399
+ <button title="${_cb.out('Gradient')}" class="button-gradient classic-primary" style="margin-top:10px">${_cb.out('Gradient')}</button>
400
+ </label>
401
+ </div>
402
+ <div>
403
+ <label>${_cb.out('Text Color')}:<br />
404
+ <button title="${_cb.out('Text Color')}" class="button-textcolor is-btn-color" style="margin-top:10px"></button>
405
+ </label>
406
+ </div>
407
+ </div>
408
+
409
+
410
+ <div class="flex-row" style="margin:15px 0 0">
411
+ <div class="flex-col" style="margin-right: 40px;">
412
+ <div>
413
+ <label>${_cb.out('Background Color')}</label>:
414
+ </div>
415
+ <div class="flex-row flex-wrap" style="margin-top:5px">
416
+ <button title="${_cb.out('Background Color')}" data-command="0" class="bg-color-command" style="margin-right:4px">${_cb.out('Select')}</button>
417
+
418
+ </div>
419
+ </div>
420
+
421
+ <div class="flex-col" style="">
422
+ <div>
423
+ <label>${_cb.out('Text Color')}</label>:
424
+ </div>
425
+ <div class="flex-row flex-wrap" style="margin-top:5px">
426
+ <button title="${_cb.out('Light')}" data-command="light" class="text-color-command" style="margin-right:4px">${_cb.out('Light')}</button>
427
+ <button title="${_cb.out('Dark')}" data-command="dark" class="text-color-command" style="margin-right:4px">${_cb.out('Dark')}</button>
428
+ </div>
429
+ </div>
430
+ </div>
431
+
432
+ <div class="flex-row" style="margin:15px 0 0">
433
+ <div class="flex-col" style="margin-right: 40px;">
434
+ <div>
435
+ <label>${_cb.out('Border Thickness')}</label>:
436
+ </div>
437
+ <div class="flex-row flex-wrap" style="margin-top:5px">
438
+ <button title="${_cb.out('No Border')}" data-command="0" class="border-width-command" style="margin-right:4px">${_cb.out('No Border')}</button>
439
+ <button title="${_cb.out('1px')}" data-command="1" class="border-width-command" style="text-transform:none;margin-right:4px">1px</button>
440
+ <button title="${_cb.out('2px')}" data-command="2" class="border-width-command" style="text-transform:none;margin-right:4px">2px</button>
441
+ </div>
442
+ </div>
443
+
444
+ <div class="flex-col" style="">
445
+ <div>
446
+ <label>${_cb.out('Border Color')}</label>:
447
+ </div>
448
+ <div class="flex-row flex-wrap" style="margin-top:5px">
449
+ <button title="${_cb.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${_cb.out('Transparent')}</button>
450
+ <button title="${_cb.out('Current')}" data-command="current" class="border-color-command" style="margin-right:4px">${_cb.out('Current')}</button>
451
+ </div>
452
+ </div>
453
+ </div>
454
+
455
+ <div class="flex-col" style="margin:15px 0 0">
456
+ <div>
457
+ <label>${_cb.out('Border Radius')}</label>:
458
+ </div>
459
+ <div class="flex-row flex-wrap" style="margin-top:5px">
460
+ <button title="${_cb.out('None')}" data-command="none" class="border-radius-command" style="margin-right:4px">None</button>
461
+ <button title="${_cb.out('SM')}" data-command="sm" class="border-radius-command" style="margin-right:4px">SM</button>
462
+ <button title="${_cb.out('')}" data-command="" class="border-radius-command" style="margin-right:4px">Normal</button>
463
+ <button title="${_cb.out('MD')}" data-command="md" class="border-radius-command" style="margin-right:4px">MD</button>
464
+ <button title="${_cb.out('LG')}" data-command="lg" class="border-radius-command" style="margin-right:4px">LG</button>
465
+ <button title="${_cb.out('XL')}" data-command="xl" class="border-radius-command" style="margin-right:4px">XL</button>
466
+ <button title="${_cb.out('2XL')}" data-command="2xl" class="border-radius-command" style="margin-right:4px">2XL</button>
467
+ <button title="${_cb.out('3XL')}" data-command="3xl" class="border-radius-command" style="margin-right:4px">3XL</button>
468
+ <button title="${_cb.out('Full')}" data-command="full" class="border-radius-command" style="margin-right:4px">Full</button>
469
+ </div>
470
+ </div>
471
+
472
+ <div class="flex-col" style="margin:15px 0 0">
473
+ <div>
474
+ <label>${_cb.out('Button Size')}</label>:
475
+ </div>
476
+ <div class="flex-row flex-wrap" style="margin-top:5px">
477
+ <button title="${_cb.out('XS')}" data-command="xs" class="button-size-command" style="margin-right:4px">XS</button>
478
+ <button title="${_cb.out('SM')}" data-command="sm" class="button-size-command" style="margin-right:4px">SM</button>
479
+ <button title="${_cb.out('')}" data-command="" class="button-size-command" style="margin-right:4px">Normal</button>
480
+ <button title="${_cb.out('MD')}" data-command="md" class="button-size-command" style="margin-right:4px">MD</button>
481
+ <button title="${_cb.out('LG')}" data-command="lg" class="button-size-command" style="margin-right:4px">LG</button>
482
+ <button title="${_cb.out('XL')}" data-command="xl" class="button-size-command" style="margin-right:4px">XL</button>
483
+ </div>
484
+ </div>
485
+
486
+ <div style="display:none;margin:20px 0 25px">
487
+ <div style="width:145px">
488
+ <label>${_cb.out('Font Size')}</label>: <br />
489
+ <button title="${_cb.out('Decrease')}" class="classic-primary font-size-dec" style="min-width:55px;font-size:18px;margin-top:10px;float:left">-</button>
490
+ <button title="${_cb.out('Increase')}" class="classic-primary font-size-inc" style="min-width:55px;font-size:18px;margin-top:10px;">+</button>
491
+ </div>
492
+ <div style="width:150px">
493
+ <label>${_cb.out('Letter Spacing')}</label>: <br />
494
+ <button title="${_cb.out('Decrease')}" class="classic-primary letter-spacing-dec" style="min-width:55px;font-size:18px;margin-top:10px;float:left">-</button>
495
+ <button title="${_cb.out('Increase')}" class="classic-primary letter-spacing-inc" style="min-width:55px;font-size:18px;margin-top:10px;">+</button>
496
+ </div>
497
+ <div style="width:120px">
498
+ <label>${_cb.out('Upper/lower')}: <br />
499
+ <button title="${_cb.out('Upper/Lower')}" class="classic-primary textcase" style="margin-top:10px;min-width:55px;font-family: serif;font-size: 14px;text-transform: initial;">Aa</button>
500
+ </label>
501
+ </div>
502
+ <div style="width:110px">
503
+ <label for="inpFontWeight">${_cb.out('Weight')}</label>: <br />
504
+ <select id="inpFontWeight" style="margin-top:10px">
505
+ <option value=""></option>
506
+ <option value="100">100</option>
507
+ <option value="200">200</option>
508
+ <option value="300">300</option>
509
+ <option value="400">400</option>
510
+ <option value="500">500</option>
511
+ <option value="600">600</option>
512
+ <option value="700">700</option>
513
+ <option value="800">800</option>
514
+ <option value="900">900</option>
515
+ <option value="bold" data-lang>${_cb.out('Bold')}</option>
516
+ <option value="normal" data-lang>${_cb.out('Normal')}</option>
517
+ </select>
518
+
519
+ <!--<button title="Bold" class="classic-primary fontweight" style="min-width:55px;margin-top:10px;font-family: serif;font-size: 14px;text-transform: initial;">B</button>-->
520
+ </div>
521
+ </div>
522
+
523
+ <div style="display:flex;margin:15px 0 0">
524
+ <button title="${_cb.out('Clear')}" class="input-clear classic-primary" data-lang>${_cb.out('Clear')}</button>
525
+ </div>
526
+
527
+ </div>
528
+ <div id="divButtonHover" class="is-tab-content" data-group="button">
529
+
530
+ <div style="display:flex;margin:10px 0 0">
531
+ <div style="width:160px">
532
+ <label>${_cb.out('Background Color')}:<br>
533
+ <button title="${_cb.out('Background Color')}" class="buttonhover-bgcolor is-btn-color" style="margin-top:10px"></button>
534
+ </label>
535
+ </div>
536
+ <div>
537
+ <label>${_cb.out('Text Color')}:<br />
538
+ <button title="${_cb.out('Text Color')}" class="buttonhover-textcolor is-btn-color" style="margin-top:10px"></button>
539
+ </label>
540
+ </div>
541
+ </div>
542
+
543
+ <div style="display:flex;margin:15px 0 25px">
544
+ <div>
545
+ <label>${_cb.out('Border Color')}:<br>
546
+ <button title="${_cb.out('Border Color')}" class="buttonhover-bordercolor is-btn-color" style="margin-top:10px"></button>
547
+ </label>
548
+ <button title="${_cb.out('Same as bg color')}" class="classic-primary same-as-hoverbg" style="display:block;min-width:40px;margin:0;font-size:11px;height:30px;padding:0 8px;text-transform:none;">${_cb.out('Same as bg color')}</button>
549
+ </div>
550
+ </div>
551
+
552
+ <div style="display:flex;margin:15px 0 0">
553
+ <button title="${_cb.out('Clear')}" class="input-clearhover classic-primary" data-lang>${_cb.out('Clear')}</button>
554
+ </div>
555
+
556
+ </div>
557
+ <div id="divMyButtons" class="is-tab-content" data-group="button" style="padding:0;">
558
+
559
+ <div style="height:90px;padding:20px;box-sizing:border-box;position:absolute;top:0;left:0;z-index:1">
560
+ <button title="${_cb.out('Save Current Button')}" class="input-save classic-primary" style="width:220px;" data-lang>${_cb.out('Save Current Button')}</button>
561
+ </div>
562
+ <div id="divMyButtonList" style="padding:1px 20px 10px;"></div>
563
+
564
+ </div>
565
+
566
+ <script>
567
+
568
+ var activeLink = parent._cb.activeLink;
569
+
570
+ // https://stackoverflow.com/questions/1887104/how-to-get-the-background-color-of-an-element-using-javascript
571
+ var getStyle = function(element, property) {
572
+ return window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(property) : element.style[property.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); })];
573
+ };
574
+
575
+ var appendHtml = function(parent, html) {parent.insertAdjacentHTML('beforeend', html);}
576
+
577
+ var removeClass = function(element, classname) {
578
+ if(!element) return;
579
+ if(element.classList.length>0) {
580
+
581
+ let i, j, imax, jmax;
582
+ let classesToDel = classname.split(' ');
583
+ for (i=0, imax=classesToDel.length; i<imax; ++i) {
584
+ if (!classesToDel[i]) continue;
585
+ let classtoDel = classesToDel[i];
586
+
587
+ let sClassName = '';
588
+ let currentClasses = element.className.split(' ');
589
+ for (j=0, jmax=currentClasses.length; j<jmax; ++j) {
590
+ if (!currentClasses[j]) continue;
591
+ if (currentClasses[j]!==classtoDel) sClassName += currentClasses[j] + ' ';
592
+ }
593
+ element.className = sClassName.trim();
594
+ }
595
+
596
+ if(element.className==='') element.removeAttribute('class');
597
+ }
598
+ }
599
+
600
+ var addClass = function(element, classname) {
601
+ if(!element) return;
602
+ if(hasClass(element,classname)) return;
603
+ if(element.classList.length===0) element.className = classname;
604
+ else element.className = element.className + ' ' + classname;
605
+ element.className = element.className.replace(/ +/g, ' ');
606
+ }
607
+
608
+ var hasClass = function(element, classname) {
609
+ if(!element) return false;
610
+ if(!element.className) return false;
611
+ return (' ' + element.className + ' ').indexOf(' ' + classname+ ' ') > -1;
612
+ }
613
+
614
+ // var elms = document.querySelectorAll('[data-lang]');
615
+ // Array.prototype.forEach.call(elms, function(elm) {
616
+
617
+ // elm.innerText = parent._cb.out(elm.textContent);
618
+
619
+ // });
620
+
621
+ var general = '<a style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(23, 23, 23); border-color: rgb(23, 23, 23); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 3-->' +
622
+ '<a style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgb(220, 220, 220); color: rgb(0, 0, 0); border-color: rgb(220, 220, 220); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 24-->' +
623
+ '<a style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(188, 188, 188); border-color: rgb(188, 188, 188); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 25-->' +
624
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="rgb(23, 23, 23)" data-hover-color="#ffffff" data-hover-bordercolor="rgb(23, 23, 23)" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(23, 23, 23); border-color: rgb(23, 23, 23); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!-- Button 20 -->' +
625
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="rgb(225, 225, 225)" data-hover-color="#000000" data-hover-bordercolor="rgb(225, 225, 225)" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgb(220, 220, 220); color: rgb(0, 0, 0); border-color: rgb(220, 220, 220); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 23-->' +
626
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#ffffff" data-hover-color="#000000" data-hover-bordercolor="#616161" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(158, 158, 158); border-width: 2px; border-color: rgb(188, 188, 188); border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a>';
627
+
628
+
629
+ if (parent._cb.settings.emailMode) {
630
+ var element = activeLink;
631
+ while(element.tagName.toLowerCase() !== 'td') {
632
+ element = element.parentNode;
633
+ }
634
+ activeLink = element;
635
+ var a = activeLink.querySelector('a');
636
+ a.style.color = 'inherit !important';
637
+ a.style.fontWeight = 'inherit !important';
638
+ a.style.fontSize = 'inherit !important';
639
+ }
640
+
641
+ //background color
642
+ var bgcolor = getStyle(activeLink, 'background-color');
643
+ var btnBgColor = document.querySelector('.button-bgcolor');
644
+ btnBgColor.style.backgroundColor = bgcolor;
645
+
646
+ btnBgColor.addEventListener('click', function(e) {
647
+
648
+ parent._cb.uo.saveForUndo(true); // checkLater = true
649
+
650
+ parent._cb.pickColor(function (color) {
651
+
652
+ activeLink.style.backgroundColor = color;
653
+ document.querySelector('.button-bgcolor').style.backgroundColor = color;
654
+
655
+ //Trigger Change event
656
+ parent._cb.opts.onChange();
657
+
658
+ }, document.querySelector('.button-bgcolor').style.backgroundColor);
659
+
660
+ });
661
+
662
+ //Gradient
663
+ var btnGraident = document.querySelector('.button-gradient');
664
+ btnGraident.addEventListener('click', function(e) {
665
+
666
+ parent._cb.uo.saveForUndo(true); // checkLater = true
667
+
668
+ var picker = parent._cb.gradientpicker();
669
+ picker.open(activeLink, function (gradient) {
670
+
671
+ activeLink.style.backgroundImage = gradient;
672
+
673
+ //Trigger Change event
674
+ parent._cb.opts.onChange();
675
+
676
+ }, function() {
677
+ // on Finish
678
+ });
679
+
680
+ });
681
+
682
+ //text color
683
+ var textcolor = getStyle(activeLink, 'color');
684
+ var btnTextColor = document.querySelector('.button-textcolor');
685
+ btnTextColor.style.backgroundColor = textcolor;
686
+
687
+ btnTextColor.addEventListener('click', function(e) {
688
+
689
+ parent._cb.uo.saveForUndo(true); // checkLater = true
690
+
691
+ parent._cb.pickColor(function (color) {
692
+
693
+ activeLink.style.color = color;
694
+ if (parent._cb.settings.emailMode) {
695
+ var a = activeLink.querySelector('a');
696
+ if(a) a.style.color = color;
697
+ }
698
+
699
+ document.querySelector('.button-textcolor').style.backgroundColor = color;
700
+
701
+ //Trigger Change event
702
+ parent._cb.opts.onChange();
703
+
704
+ }, document.querySelector('.button-textcolor').style.backgroundColor);
705
+
706
+ });
707
+
708
+
709
+ //text color
710
+ var btns = document.querySelectorAll('.text-color-command');
711
+ Array.prototype.forEach.call(btns, function(btn) {
712
+
713
+ btn.addEventListener('click', function(e) {
714
+
715
+ parent._cb.uo.saveForUndo();
716
+
717
+ var val = btn.getAttribute('data-command');
718
+
719
+ removeClass(activeLink, 'text-gray-100');
720
+ removeClass(activeLink, 'text-gray-900');
721
+
722
+ if(val==='light') addClass(activeLink, 'text-gray-100');
723
+ else if(val==='dark') addClass(activeLink, 'text-gray-900');
724
+
725
+ parent._cb.opts.onChange();
726
+ });
727
+ });
728
+
729
+ //border color
730
+ var btns = document.querySelectorAll('.border-color-command');
731
+ Array.prototype.forEach.call(btns, function(btn) {
732
+
733
+ btn.addEventListener('click', function(e) {
734
+
735
+ parent._cb.uo.saveForUndo();
736
+
737
+ var val = btn.getAttribute('data-command');
738
+
739
+ removeClass(activeLink, 'border-transparent');
740
+ removeClass(activeLink, 'border-current');
741
+
742
+ if(val==='transparent') addClass(activeLink, 'border-transparent');
743
+ else if(val==='border-current') addClass(activeLink, 'border-current');
744
+
745
+ parent._cb.opts.onChange();
746
+ });
747
+ });
748
+
749
+ //border width
750
+ if(hasClass(activeLink,'border-0')) {
751
+ addClass(document.querySelector('.border-width-command[data-command="0"]'), 'on');
752
+ } else if(hasClass(activeLink,'border')) {
753
+ addClass(document.querySelector('.border-width-command[data-command="1"]'), 'on');
754
+ } else if(hasClass(activeLink,'border-2')) {
755
+ addClass(document.querySelector('.border-width-command[data-command="2"]'), 'on');
756
+ }
757
+
758
+ //border width
759
+ btns = document.querySelectorAll('.border-width-command');
760
+ Array.prototype.forEach.call(btns, function(btn) {
761
+
762
+ removeClass(btn,'on');
763
+
764
+ btn.addEventListener('click', function(e) {
765
+
766
+ parent._cb.uo.saveForUndo();
767
+
768
+ var val = btn.getAttribute('data-command');
769
+
770
+ removeClass(activeLink, 'border-0');
771
+ removeClass(activeLink, 'border');
772
+ removeClass(activeLink, 'border-2');
773
+
774
+ if(val==='0') addClass(activeLink, 'border-0');
775
+ else if(val==='1') addClass(activeLink, 'border');
776
+ else if(val==='2') addClass(activeLink, 'border-2');
777
+
778
+ addClass(btn,'on');
779
+
780
+ parent._cb.opts.onChange();
781
+ });
782
+ });
783
+
784
+ //border radius
785
+ btns = document.querySelectorAll('.border-radius-command');
786
+ Array.prototype.forEach.call(btns, function(btn) {
787
+
788
+ btn.addEventListener('click', function(e) {
789
+
790
+ parent._cb.uo.saveForUndo();
791
+
792
+ var val = btn.getAttribute('data-command');
793
+
794
+ removeClass(activeLink, 'rounded-none');
795
+ removeClass(activeLink, 'rounded-sm');
796
+ removeClass(activeLink, 'rounded');
797
+ removeClass(activeLink, 'rounded-md');
798
+ removeClass(activeLink, 'rounded-lg');
799
+ removeClass(activeLink, 'rounded-xl');
800
+ removeClass(activeLink, 'rounded-2xl');
801
+ removeClass(activeLink, 'rounded-3xl');
802
+ removeClass(activeLink, 'rounded-full');
803
+
804
+ if(val==='') addClass(activeLink, 'rounded');
805
+ else addClass(activeLink, 'rounded-' + val);
806
+
807
+ parent._cb.opts.onChange();
808
+ });
809
+ });
810
+
811
+ //button size
812
+ btns = document.querySelectorAll('.button-size-command');
813
+ Array.prototype.forEach.call(btns, function(btn) {
814
+
815
+ btn.addEventListener('click', function(e) {
816
+
817
+ parent._cb.uo.saveForUndo();
818
+
819
+ var val = btn.getAttribute('data-command');
820
+
821
+ removeClass(activeLink, 'uppercase');
822
+ removeClass(activeLink, 'size-12');
823
+ removeClass(activeLink, 'size-14');
824
+ removeClass(activeLink, 'size-16');
825
+ removeClass(activeLink, 'size-18');
826
+ removeClass(activeLink, 'py-0');
827
+ removeClass(activeLink, 'py-1');
828
+ removeClass(activeLink, 'py-2');
829
+ removeClass(activeLink, 'py-3');
830
+ removeClass(activeLink, 'py-4');
831
+ removeClass(activeLink, 'py-5');
832
+ removeClass(activeLink, 'px-2');
833
+ removeClass(activeLink, 'px-4');
834
+ removeClass(activeLink, 'px-6');
835
+ removeClass(activeLink, 'px-8');
836
+ removeClass(activeLink, 'px-11');
837
+ removeClass(activeLink, 'px-12');
838
+
839
+ if(val==='xs') {
840
+ addClass(activeLink, 'py-0 px-2 size-12');
841
+ }
842
+ if(val==='sm') {
843
+ addClass(activeLink, 'py-1 px-4 size-12');
844
+ }
845
+ if(val==='') {
846
+ addClass(activeLink, 'py-2 px-6 size-14');
847
+ }
848
+ if(val==='md') {
849
+ addClass(activeLink, 'py-3 px-8 size-16');
850
+ }
851
+ if(val==='lg') {
852
+ addClass(activeLink, 'py-4 px-11 size-16');
853
+ }
854
+ if(val==='xl') {
855
+ addClass(activeLink, 'py-5 px-12 size-18');
856
+ }
857
+
858
+ parent._cb.opts.onChange();
859
+ });
860
+ });
861
+
862
+
863
+ //text case
864
+ var btnTextCase = document.querySelector('.textcase');
865
+ btnTextCase.addEventListener('click', function(e) {
866
+
867
+ parent._cb.uo.saveForUndo();
868
+
869
+ var tt = getStyle(activeLink, 'text-transform');
870
+ if (tt == 'uppercase') {
871
+ activeLink.style.textTransform = 'initial';
872
+ } else {
873
+ activeLink.style.textTransform = 'uppercase';
874
+ }
875
+
876
+ //Trigger Change event
877
+ parent._cb.opts.onChange();
878
+ });
879
+
880
+ //font weight
881
+ var fw = getStyle(activeLink, 'font-weight');
882
+ document.querySelector('#inpFontWeight').value = fw;
883
+ var inpFontWeight = document.querySelector('#inpFontWeight');
884
+ inpFontWeight.addEventListener('change', function(e) {
885
+
886
+ parent._cb.uo.saveForUndo();
887
+
888
+ var fw = document.querySelector('#inpFontWeight').value;
889
+ activeLink.style.fontWeight = fw;
890
+
891
+ //Trigger Change event
892
+ parent._cb.opts.onChange();
893
+ });
894
+
895
+ //font size
896
+ var btnFontSizeDec = document.querySelector('.font-size-dec');
897
+ btnFontSizeDec.addEventListener('click', function(e) {
898
+
899
+ parent._cb.uo.saveForUndo();
900
+
901
+ var currFs = getStyle(activeLink, 'font-size');
902
+ var n = parseInt(currFs);
903
+ n = n - 1;
904
+ if (n <= 8) n = 8;
905
+ activeLink.style.fontSize = n + 'px';
906
+
907
+ //added by Jack - apply to child nodes
908
+ var cbDom = parent._cb.cbDom;
909
+ var arrSizes = parent._cb.opts.fontSizeClassValues;
910
+ let elmns = Array.prototype.slice.call(activeLink.getElementsByTagName("*"));
911
+ for(var i=0; i<elmns.length; i++) {
912
+ elmns[i].style.fontSize = n + 'px';
913
+ //remove font-size class
914
+ for(var j=0;j<arrSizes.length; j++) {
915
+ cbDom.removeClass(elmns[i], 'size-'+arrSizes[j]);
916
+ }
917
+ }
918
+ // ----
919
+
920
+ //Trigger Change event
921
+ parent._cb.opts.onChange();
922
+ });
923
+ var btnFontSizeInc = document.querySelector('.font-size-inc');
924
+ btnFontSizeInc.addEventListener('click', function(e) {
925
+
926
+ parent._cb.uo.saveForUndo();
927
+
928
+ var currFs = getStyle(activeLink, 'font-size');
929
+ var n = parseInt(currFs);
930
+ n = n + 1;
931
+ activeLink.style.fontSize = n + 'px';
932
+
933
+ //added by Jack - apply to child nodes
934
+ var cbDom = parent._cb.cbDom;
935
+ var arrSizes = parent._cb.opts.fontSizeClassValues;
936
+ let elmns = Array.prototype.slice.call(activeLink.getElementsByTagName("*"));
937
+ for(var i=0; i<elmns.length; i++) {
938
+ elmns[i].style.fontSize = n + 'px';
939
+ //remove font-size class
940
+ for(var j=0;j<arrSizes.length; j++) {
941
+ cbDom.removeClass(elmns[i], 'size-'+arrSizes[j]);
942
+ }
943
+ }
944
+ // ----
945
+
946
+ //Trigger Change event
947
+ parent._cb.opts.onChange();
948
+ });
949
+
950
+ //letter spacing
951
+ var btnLetterSpacingDec = document.querySelector('.letter-spacing-dec');
952
+ btnLetterSpacingDec.addEventListener('click', function(e) {
953
+
954
+ parent._cb.uo.saveForUndo();
955
+
956
+ var currLs = getStyle(activeLink, 'letter-spacing');
957
+ var n = parseInt(currLs);
958
+ if(!isNaN(n)) {
959
+ n = n - 1;
960
+ if (n <= 0) n = 0;
961
+ } else {
962
+ n = 0;
963
+ }
964
+ activeLink.style.letterSpacing = n + 'px';
965
+
966
+ //Trigger Change event
967
+ parent._cb.opts.onChange();
968
+ });
969
+ var btnLetterSpacingInc = document.querySelector('.letter-spacing-inc');
970
+ btnLetterSpacingInc.addEventListener('click', function(e) {
971
+
972
+ parent._cb.uo.saveForUndo();
973
+
974
+ var currLs = getStyle(activeLink, 'letter-spacing');
975
+ var n = parseInt(currLs);
976
+ if(!isNaN(n)) {
977
+ n = n + 1;
978
+ } else {
979
+ n = 1;
980
+ }
981
+ activeLink.style.letterSpacing = n + 'px';
982
+
983
+ //Trigger Change event
984
+ parent._cb.opts.onChange();
985
+ });
986
+
987
+
988
+ //clear
989
+ var btnClear = document.querySelector('.input-clear');
990
+ btnClear.addEventListener('click', function(e) {
991
+
992
+ parent._cb.uo.saveForUndo();
993
+
994
+ activeLink.setAttribute('style', '');
995
+
996
+ //border width
997
+ //var inpBorderWidth = document.querySelector('#inpBorderWidth');
998
+ //inpBorderWidth.value=2; //default
999
+
1000
+ if (parent._cb.settings.emailMode) {
1001
+ var a = activeLink.querySelector('a');
1002
+ if(a) {
1003
+ a.setAttribute('style', 'color: inherit !important; font-weight: inherit !important; font-size: inherit !important');
1004
+ }
1005
+ }
1006
+
1007
+ var btnBgColor = document.querySelector('.button-bgcolor');
1008
+ btnBgColor.style.backgroundColor = '';
1009
+
1010
+ var btnTextColor = document.querySelector('.button-textcolor');
1011
+ btnTextColor.style.backgroundColor = '';
1012
+
1013
+
1014
+ //Trigger Change event
1015
+ parent._cb.opts.onChange();
1016
+ });
1017
+
1018
+ //hover background color
1019
+ var hoverbgcolor = activeLink.getAttribute('data-hover-bgcolor');
1020
+ var btnHoverBgColor = document.querySelector('.buttonhover-bgcolor');
1021
+ btnHoverBgColor.style.backgroundColor = hoverbgcolor;
1022
+
1023
+ btnHoverBgColor.addEventListener('click', function(e) {
1024
+
1025
+ parent._cb.uo.saveForUndo(true); // checkLater = true
1026
+
1027
+ parent._cb.pickColor(function (color) {
1028
+
1029
+ activeLink.setAttribute('data-hover-bgcolor', color);
1030
+ addButtonScript(activeLink);
1031
+
1032
+ document.querySelector('.buttonhover-bgcolor').style.backgroundColor = color;
1033
+
1034
+ //Trigger Change event
1035
+ parent._cb.opts.onChange();
1036
+
1037
+ }, document.querySelector('.buttonhover-bgcolor').style.backgroundColor);
1038
+
1039
+ });
1040
+
1041
+ //hover text color
1042
+ var hovertextcolor = activeLink.getAttribute('data-hover-color');
1043
+ var btnHoverTextColor = document.querySelector('.buttonhover-textcolor');
1044
+ btnHoverTextColor.style.backgroundColor = hovertextcolor;
1045
+
1046
+ btnHoverTextColor.addEventListener('click', function(e) {
1047
+
1048
+ parent._cb.uo.saveForUndo(true); // checkLater = true
1049
+
1050
+ parent._cb.pickColor(function (color) {
1051
+
1052
+ activeLink.setAttribute('data-hover-color', color);
1053
+ addButtonScript(activeLink);
1054
+
1055
+ document.querySelector('.buttonhover-textcolor').style.backgroundColor = color;
1056
+
1057
+ //Trigger Change event
1058
+ parent._cb.opts.onChange();
1059
+
1060
+ }, document.querySelector('.buttonhover-textcolor').style.backgroundColor);
1061
+
1062
+ });
1063
+
1064
+ //hover border color
1065
+ var hoverbordercolor = activeLink.getAttribute('data-hover-bordercolor');
1066
+ var btnHoverBorderColor = document.querySelector('.buttonhover-bordercolor');
1067
+ btnHoverBorderColor.style.backgroundColor = hoverbordercolor;
1068
+
1069
+ btnHoverBorderColor.addEventListener('click', function(e){
1070
+
1071
+ parent._cb.uo.saveForUndo(true); // checkLater = true
1072
+
1073
+ parent._cb.pickColor(function (color) {
1074
+
1075
+ activeLink.setAttribute('data-hover-bordercolor', color);
1076
+ addButtonScript(activeLink);
1077
+
1078
+ document.querySelector('.buttonhover-bordercolor').style.backgroundColor = color;
1079
+
1080
+ //Trigger Change event
1081
+ parent._cb.opts.onChange();
1082
+
1083
+ }, document.querySelector('.buttonhover-bordercolor').style.backgroundColor);
1084
+
1085
+ });
1086
+
1087
+ //make = hover bg color
1088
+ var btnSameAsHoverBgColor = document.querySelector('.same-as-hoverbg');
1089
+ btnSameAsHoverBgColor.addEventListener('click', function(e){
1090
+
1091
+ parent._cb.uo.saveForUndo();
1092
+
1093
+ var btnHoverBgColor = document.querySelector('.buttonhover-bgcolor');
1094
+ var hoverbgcolor = btnHoverBgColor.style.backgroundColor;
1095
+
1096
+ var btnHoverBorderColor = document.querySelector('.buttonhover-bordercolor');
1097
+ btnHoverBorderColor.style.backgroundColor = hoverbgcolor;
1098
+
1099
+ activeLink.setAttribute('data-hover-bordercolor', hoverbgcolor);
1100
+
1101
+ //Trigger Change event
1102
+ parent._cb.opts.onChange();
1103
+ });
1104
+
1105
+ //clear hover
1106
+ var btnClearHover = document.querySelector('.input-clearhover');
1107
+ btnClearHover.addEventListener('click', function(e) {
1108
+
1109
+ parent._cb.uo.saveForUndo();
1110
+
1111
+ var btnHoverBgColor = document.querySelector('.buttonhover-bgcolor');
1112
+ btnHoverBgColor.style.backgroundColor = '';
1113
+
1114
+ var btnHoverTextColor = document.querySelector('.buttonhover-textcolor');
1115
+ btnHoverTextColor.style.backgroundColor = '';
1116
+
1117
+ var btnHoverBorderColor = document.querySelector('.buttonhover-bordercolor');
1118
+ btnHoverBorderColor.style.backgroundColor = '';
1119
+
1120
+ activeLink.removeAttribute('data-hover-bgcolor');
1121
+ activeLink.removeAttribute('data-hover-color');
1122
+ activeLink.removeAttribute('data-hover-bordercolor');
1123
+
1124
+ activeLink.removeAttribute('onmouseover');
1125
+ activeLink.removeAttribute('onmouseout');
1126
+
1127
+ //Trigger Change event
1128
+ parent._cb.opts.onChange();
1129
+ });
1130
+
1131
+
1132
+ if (localStorage.getItem("_mybuttons") != null) {
1133
+
1134
+ renderMyButtons();
1135
+
1136
+ var buttons = document.querySelectorAll('#divMyButtonList a');
1137
+ Array.prototype.forEach.call(buttons, function(button) {
1138
+
1139
+ var activeButton = button;
1140
+ button.addEventListener('click', function(e){
1141
+
1142
+ parent._cb.uo.saveForUndo();
1143
+
1144
+ var links = document.querySelectorAll('#divMyButtonList a');
1145
+ Array.prototype.forEach.call(links, function(link) {
1146
+ removeClass(link, 'active');
1147
+ });
1148
+ addClass(activeButton, 'active');
1149
+
1150
+ applyStyles(activeLink, activeButton);
1151
+
1152
+ updateSettings(activeLink);
1153
+
1154
+ cleanupClasses(activeLink);
1155
+
1156
+ //Trigger Change event
1157
+ parent._cb.opts.onChange();
1158
+ });
1159
+
1160
+ });
1161
+
1162
+ var btnRemoves = document.querySelectorAll('.is-button-remove');
1163
+ Array.prototype.forEach.call(btnRemoves, function(btnRemove) {
1164
+
1165
+ btnRemove.addEventListener('click', function(e) {
1166
+
1167
+ parent._cb.uo.saveForUndo();
1168
+
1169
+ var button = e.target.parentNode.parentNode;
1170
+
1171
+ if(button.tagName.toLowerCase() !== 'a') button = button.parentNode;
1172
+
1173
+ if (localStorage.getItem("_mybuttons") != null) {
1174
+ var mybuttons = JSON.parse(localStorage.getItem("_mybuttons"));
1175
+
1176
+ var id = button.getAttribute('data-id');
1177
+
1178
+ for (var i = 0; i < mybuttons.length; i++) {
1179
+ if (i == id) {
1180
+ mybuttons.splice(i, 1);
1181
+
1182
+ localStorage.setItem("_mybuttons", JSON.stringify(mybuttons));
1183
+
1184
+ button.parentNode.removeChild(button);
1185
+
1186
+ var n = 0;
1187
+
1188
+ var links = document.querySelectorAll('#divMyButtonList a');
1189
+ Array.prototype.forEach.call(links, function(link) {
1190
+ link.setAttribute('data-id', n);
1191
+ n = n + 1;
1192
+ });
1193
+
1194
+ return;
1195
+ }
1196
+ }
1197
+
1198
+ }
1199
+
1200
+ //Trigger Change event
1201
+ parent._cb.opts.onChange();
1202
+
1203
+ });
1204
+
1205
+ });
1206
+
1207
+ }
1208
+
1209
+ //save button
1210
+ var btnSave = document.querySelector('.input-save');
1211
+ btnSave.addEventListener('click', function(e) {
1212
+
1213
+ var mybuttons = [];
1214
+ if (localStorage.getItem("_mybuttons") != null) {
1215
+ var mybuttons = JSON.parse(localStorage.getItem("_mybuttons"));
1216
+ }
1217
+ mybuttons.push(activeLink.className);
1218
+ localStorage.setItem("_mybuttons", JSON.stringify(mybuttons));
1219
+
1220
+ renderMyButtons();
1221
+
1222
+ var buttons = document.querySelectorAll('#divMyButtonList a');
1223
+ Array.prototype.forEach.call(buttons, function(button) {
1224
+
1225
+ button.addEventListener('click', function(e){
1226
+
1227
+ parent._cb.uo.saveForUndo();
1228
+
1229
+ var links = document.querySelectorAll('#divMyButtonList a');
1230
+ Array.prototype.forEach.call(links, function(link) {
1231
+ removeClass(link, 'active');
1232
+ });
1233
+ addClass(button, 'active');
1234
+
1235
+ applyStyles(activeLink, button);
1236
+
1237
+ updateSettings(activeLink);
1238
+
1239
+ cleanupClasses(activeLink);
1240
+
1241
+ //Trigger Change event
1242
+ parent._cb.opts.onChange();
1243
+ });
1244
+
1245
+ });
1246
+
1247
+
1248
+ var btnRemoves = document.querySelectorAll('.is-button-remove');
1249
+ Array.prototype.forEach.call(btnRemoves, function(btnRemove) {
1250
+
1251
+ btnRemove.addEventListener('click', function(e) {
1252
+
1253
+ parent._cb.uo.saveForUndo();
1254
+
1255
+ var button = e.target.parentNode.parentNode;
1256
+
1257
+ if(button.tagName.toLowerCase() !== 'a') button = button.parentNode;
1258
+
1259
+ if (localStorage.getItem("_mybuttons") != null) {
1260
+ var mybuttons = JSON.parse(localStorage.getItem("_mybuttons"));
1261
+
1262
+ var id = button.getAttribute('data-id');
1263
+
1264
+ for (var i = 0; i < mybuttons.length; i++) {
1265
+ if (i == id) {
1266
+ mybuttons.splice(i, 1);
1267
+
1268
+ localStorage.setItem("_mybuttons", JSON.stringify(mybuttons));
1269
+
1270
+ button.parentNode.removeChild(button);
1271
+
1272
+ var n = 0;
1273
+
1274
+ var links = document.querySelectorAll('#divMyButtonList a');
1275
+ Array.prototype.forEach.call(links, function(link) {
1276
+ link.setAttribute('data-id', n);
1277
+ n = n + 1;
1278
+ });
1279
+
1280
+ return;
1281
+ }
1282
+ }
1283
+
1284
+ }
1285
+
1286
+ //Trigger Change event
1287
+ parent._cb.opts.onChange();
1288
+
1289
+ });
1290
+
1291
+ });
1292
+
1293
+ });
1294
+
1295
+ var buttons = document.querySelectorAll('#divButtonTemplates a');
1296
+ Array.prototype.forEach.call(buttons, function(button) {
1297
+
1298
+ var activeButton = button;
1299
+ button.addEventListener('click', function(e){
1300
+
1301
+ parent._cb.uo.saveForUndo();
1302
+
1303
+ var links = document.querySelectorAll('#divButtonTemplates a');
1304
+ Array.prototype.forEach.call(links, function(link) {
1305
+ removeClass(link, 'active');
1306
+ });
1307
+ addClass(activeButton, 'active');
1308
+
1309
+ applyStyles(activeLink, activeButton);
1310
+
1311
+ updateSettings(activeLink);
1312
+
1313
+ cleanupClasses(activeLink);
1314
+
1315
+ //Trigger Change event
1316
+ parent._cb.opts.onChange();
1317
+ });
1318
+
1319
+ });
1320
+
1321
+ function generateButtons(base) {
1322
+ var template = '' +
1323
+ '<a style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: #34dd87; border-color: #34dd87; border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 18-->' +
1324
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#34dd87" data-hover-color="#f8f8f8" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: #34dd87; border-color: #34dd87; border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 4-->' +
1325
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#34dd87" data-hover-color="#ffffff" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(23, 23, 23); border-color: rgb(23, 23, 23); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 19-->' +
1326
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#34dd87" data-hover-color="#f8f8f8" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgb(220, 220, 220); color: rgb(0, 0, 0); border-color: rgb(220, 220, 220); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 22-->' +
1327
+ /*'<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#34dd87" data-hover-color="#f8f8f8" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(188, 188, 188); border-color: rgb(188, 188, 188); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 9-->' +*/
1328
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="" data-hover-color="#000000" data-hover-bordercolor="#000000" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: #34dd87; border-color: #34dd87; border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 12-->' +
1329
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#ffffff" data-hover-color="#34dd87" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(0, 0, 0); border-color: rgb(17, 17, 17); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 17-->' +
1330
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="" data-hover-color="#34dd87" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgba(0, 0, 0, 0); color: rgb(158, 158, 158); border-color: rgb(188, 188, 188); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 10-->' +
1331
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#3dea92" data-hover-color="#ffffff" data-hover-bordercolor="#3dea92" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: #34dd87; color: rgb(248, 248, 248); border-color: #34dd87; border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 5-->' +
1332
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#2fd07e" data-hover-color="#ffffff" data-hover-bordercolor="#2fd07e" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: #34dd87; color: rgb(255, 255, 255); border-color: #34dd87; border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 400; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 8-->' +
1333
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#000000" data-hover-color="#f8f8f8" data-hover-bordercolor="#000000" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: #34dd87; color: rgb(23, 23, 23); border-color: #34dd87; border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 11-->' +
1334
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#34dd87" data-hover-color="#ffffff" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgb(23, 23, 23); color: #34dd87; border-color: rgb(23, 23, 23); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 14-->' +
1335
+ '<a onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" data-hover-bgcolor="#34dd87" data-hover-color="#ffffff" data-hover-bordercolor="#34dd87" style="display:inline-block;text-decoration:none;transition: all 0.16s ease;border-style:solid;cursor:pointer;background-color: rgb(23, 23, 23); color: rgb(255, 255, 255); border-color: rgb(23, 23, 23); border-width: 2px; border-radius: 0px; padding: 13px 28px; line-height: 21px; text-transform: uppercase; font-weight: 600; font-size: 14px; letter-spacing: 3px;">Button</a><!--Button 16-->';
1336
+ if (!base) return template;
1337
+ var html = '';
1338
+ html = template.replace(new RegExp('#34dd87', 'g'), base);
1339
+ var hover1 = parent._cb.LightenDarkenColor(base, 15);
1340
+ var hover2 = parent._cb.LightenDarkenColor(base, -20);
1341
+ html = html.replace(new RegExp('#3dea92', 'g'), hover1);
1342
+ html = html.replace(new RegExp('#2fd07e', 'g'), hover2);
1343
+ return html;
1344
+ }
1345
+
1346
+ function renderMyButtons() {
1347
+ var mybuttons = JSON.parse(localStorage.getItem("_mybuttons"));
1348
+
1349
+ var html_mybuttons = '';
1350
+ for (var i = 0; i < mybuttons.length; i++) {
1351
+
1352
+ var s = mybuttons[i] + '';
1353
+ var bg = s.split('|')[0]; //not used
1354
+ var css = s.split('|')[1];
1355
+
1356
+ var onmouse = 'onmouseover="this.setAttribute(\\'data-style\\',this.style.cssText);if(this.getAttribute(\\'data-hover-bordercolor\\')) this.style.borderColor=this.getAttribute(\\'data-hover-bordercolor\\');if(this.getAttribute(\\'data-hover-bgcolor\\')) this.style.backgroundColor=this.getAttribute(\\'data-hover-bgcolor\\');if(this.getAttribute(\\'data-hover-color\\')) this.style.color=this.getAttribute(\\'data-hover-color\\');" ' +
1357
+ 'onmouseout="this.setAttribute(\\'style\\',this.getAttribute(\\'data-style\\'));this.removeAttribute(\\'data-style\\')" ';
1358
+ if (s.split('|')[2] == '' && s.split('|')[3] == '' && s.split('|')[4] == '') {
1359
+ onmouse = '';
1360
+ }
1361
+ var datahoverbgcolor = '';
1362
+ if (s.split('|')[2] != '') {
1363
+ datahoverbgcolor = 'data-hover-bgcolor="' + s.split('|')[2] + '" ';
1364
+ }
1365
+ var datahovercolor = '';
1366
+ if (s.split('|')[3] != '') {
1367
+ datahovercolor = 'data-hover-color="' + s.split('|')[3] + '" ';
1368
+ }
1369
+ var datahoverbordercolor = '';
1370
+ if (s.split('|')[4] != '') {
1371
+ datahoverbordercolor = 'data-hover-bordercolor="' + s.split('|')[4] + '" ';
1372
+ }
1373
+
1374
+ html_mybuttons += '<a ' +
1375
+ 'data-id="' + i + '" ' +
1376
+ onmouse +
1377
+ datahoverbgcolor +
1378
+ datahovercolor +
1379
+ datahoverbordercolor +
1380
+ 'data-style="' + css + '" ' +
1381
+ 'style="' + css + '">Button<div class="is-button-remove"><svg class="is-icon-flex" style="fill:rgba(255, 255, 266, 1);width:20px;height:20px;"><use xlink:href="#ion-ios-close-empty"></use></svg></div></a>';
1382
+
1383
+ }
1384
+
1385
+ document.querySelector('#divMyButtonList').innerHTML = html_mybuttons;
1386
+ }
1387
+
1388
+ function applyStyles(link, button) {
1389
+ link.className = button.className;
1390
+ }
1391
+
1392
+ function updateSettings(link) {
1393
+ setTimeout(function () {
1394
+
1395
+ //border width
1396
+ /*
1397
+ var inpBorderWidth = document.querySelector('#inpBorderWidth');
1398
+
1399
+ if(hasClass(link,'border-0')) {
1400
+ inpBorderWidth.value=0;
1401
+ } else if(hasClass(link,'border')) {
1402
+ inpBorderWidth.value=1;
1403
+ } else if(hasClass(link,'border-2')) {
1404
+ inpBorderWidth.value=2;
1405
+ }
1406
+ */
1407
+
1408
+
1409
+ // TODO
1410
+
1411
+ }, 300);
1412
+ }
1413
+
1414
+ function cleanupClasses(link) {
1415
+ removeClass(link, 'is-btn-ghost1');
1416
+ removeClass(link, 'is-btn-ghost2');
1417
+ removeClass(link, 'is-upper');
1418
+ removeClass(link, 'is-btn-small');
1419
+ removeClass(link, 'is-btn');
1420
+ removeClass(link, 'is-rounded-30');
1421
+ removeClass(link, 'btn-primary');
1422
+ removeClass(link, 'btn-default');
1423
+ removeClass(link, 'btn');
1424
+ }
1425
+
1426
+ function addButtonScript(link) {
1427
+ link.setAttribute("onmouseover", "this.setAttribute('data-style',this.style.cssText);" +
1428
+ "if(this.getAttribute('data-hover-bordercolor')) this.style.borderColor=this.getAttribute('data-hover-bordercolor');" +
1429
+ "if(this.getAttribute('data-hover-bgcolor')) this.style.backgroundColor=this.getAttribute('data-hover-bgcolor');" +
1430
+ "if(this.getAttribute('data-hover-color')) this.style.color=this.getAttribute('data-hover-color');");
1431
+
1432
+ link.setAttribute("onmouseout", "this.setAttribute('style',this.getAttribute('data-style'));" +
1433
+ "this.removeAttribute('data-style')");
1434
+
1435
+ }
1436
+
1437
+ /* ------------------- Tabs --------------------- */
1438
+
1439
+ var tabs = document.querySelectorAll('.is-tabs a');
1440
+ Array.prototype.forEach.call(tabs, function(tab) {
1441
+
1442
+ tab.addEventListener('click', function(e){
1443
+
1444
+ if(hasClass(tab, 'active')) {
1445
+ e.preventDefault();
1446
+ return false;
1447
+ }
1448
+ var id = tab.getAttribute('data-content');
1449
+ if(!id) {
1450
+ e.preventDefault();
1451
+ return false;
1452
+ }
1453
+
1454
+ var group = tab.parentNode.getAttribute('data-group');
1455
+
1456
+ var samegrouptabs = document.querySelectorAll('.is-tabs[data-group="' + group + '"] > a');
1457
+ Array.prototype.forEach.call(samegrouptabs, function(samegrouptab) {
1458
+ removeClass(samegrouptab, 'active');
1459
+ });
1460
+ addClass(tab, 'active');
1461
+
1462
+ var samegroupcontents = document.querySelectorAll('.is-tab-content[data-group="' + group + '"]');
1463
+ Array.prototype.forEach.call(samegroupcontents, function(samegroupcontent) {
1464
+ samegroupcontent.style.display = 'none';
1465
+ });
1466
+ document.querySelector('#' + id).style.display = 'block';
1467
+
1468
+ e.preventDefault();
1469
+ return false;
1470
+ });
1471
+
1472
+ });
1473
+
1474
+ </script>
1475
+ </body>
1476
+ </html>
1477
+
1478
+ `;
1479
+
1480
+ return html;
1481
+ }
1482
+
1483
+ })();
1484
+