Blog2Social: Social Media Auto Post & Scheduler - Version 6.9.0

Version Description

Social Media Metrics and more

Download this release

Release Info

Developer PR-Gateway
Plugin Icon 128x128 Blog2Social: Social Media Auto Post & Scheduler
Version 6.9.0
Comparing to
See all releases

Code changes from version 6.8.7 to 6.9.0

assets/css/b2s/metrics.css ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .list-group-item:first-child {
2
+ border-top-left-radius: 0px !important;
3
+ border-top-right-radius: 0px !important;
4
+ }
5
+
6
+ .b2sFavoriteStar {
7
+ font-size: 22px;
8
+ margin-top: 6px;
9
+ color: #ffb900;
10
+ display: block !important;
11
+ }
12
+
13
+ .b2sGetB2SPostsByWpPost {
14
+ cursor: pointer;
15
+ }
16
+
17
+ .b2s-post-publish-area {
18
+ margin-top: 5px;
19
+ }
20
+
21
+ .glyphicon-arrow-up {
22
+ color: green;
23
+ }
24
+
25
+ .glyphicon-arrow-down {
26
+ color: red;
27
+ }
28
+
29
+ .glyphicon-minus {
30
+ color: gray;
31
+ }
32
+
33
+ body.modal-open .b2s-container {
34
+ -webkit-filter: blur(3px);
35
+ -moz-filter: blur(3px);
36
+ -o-filter: blur(3px);
37
+ -ms-filter: blur(3px);
38
+ filter: blur(3px);
39
+ }
40
+
41
+ .padding-right-0 {
42
+ padding-right: 0px !important;
43
+ }
assets/css/b2s/network.css CHANGED
@@ -1,902 +1,906 @@
1
- /*Custom*/
2
-
3
- .b2s-loading-area-modify-collection{
4
- text-align: center;
5
- }
6
-
7
- .list-group-item{
8
- border: 0px !important;
9
- }
10
- @media(max-width: 767px) {
11
- .form-inline {
12
- display: none;
13
- }
14
- .filterHide {
15
- display: none;
16
- }
17
- .form-inline button {
18
- width: 100%;
19
- margin-bottom: 10px;
20
- }
21
- }
22
-
23
- @media(max-width: 450px) {
24
- .add-padding-left{
25
- padding: 0px !important;
26
- }
27
- }
28
-
29
- .error{
30
- border: 1px solid #FF0000 !important;
31
- }
32
- .b2s-network-auth-btn{
33
- margin-left: 2px;
34
- line-height: 2;
35
- }
36
-
37
- .b2s-network-item-auth-list-btn-delete{
38
- line-height: 2;
39
- }
40
-
41
- .b2s-network-get-more-btn{
42
- text-decoration: underline;
43
- }
44
- .b2s-network-auth-count{
45
- font-weight: 700;
46
- line-height: 1.5;
47
- }
48
-
49
- .b2s-sched-manager-title{
50
- font-weight: 700;
51
- line-height: 1.5;
52
- padding-right: 165px;
53
- }
54
-
55
- .b2s-sched-manager-time-area{
56
- width: 150px;
57
- margin-right: -35px;
58
- }
59
-
60
- .b2s-sched-manager-add-padding{
61
- margin-right: -13px;
62
- }
63
-
64
- .b2s-add-padding-network-refresh{
65
- padding: 4px 7px;
66
- }
67
-
68
- .b2s-add-padding-network-team{
69
- padding: 4px 5px;
70
- line-height: 2;
71
- }
72
-
73
- .b2s-sched-manager-best-time-info{
74
- padding-left: 5px;
75
- font-size: 12px;
76
- }
77
-
78
- .b2s-network-time-manager-area{
79
- padding-right: 8px;
80
- }
81
-
82
- .b2s-add-padding-network-edit{
83
- padding: 7px 4px;
84
- }
85
- .b2s-network-mandant-area{
86
- margin-top: -7px !important;
87
- }
88
-
89
- .b2s-add-padding-network-delete{
90
- padding: 4px 5px;
91
- }
92
-
93
- .b2s-sched-manager-day-area{
94
- width: 150px;
95
- padding-top: 2px;
96
- }
97
-
98
- .b2s-sched-manager-premium-area{
99
- width: 195px;
100
- padding-top: 5px;
101
- }
102
-
103
- .b2s-settings-sched-item-input-time, .b2s-settings-sched-item-input-day{
104
- max-width: 90px;
105
- }
106
-
107
- .b2s-network-mandant-select{
108
- min-width: 200px;
109
- }
110
-
111
- .b2s-network-mandant-name{
112
- font-size: 12px;
113
- font-style: italic;
114
- color: #777;
115
- font-weight: normal;
116
-
117
- }
118
-
119
- .b2s-network-approved-from{
120
- font-size: 12px;
121
- font-style: italic;
122
- color: #777;
123
- font-weight: normal;
124
-
125
- }
126
-
127
- .b2s-network-item-auth-list{
128
- padding-top:6px;
129
- font-size: 0.80rem !important;
130
- }
131
-
132
- .b2s-network-auth-list-info{
133
- font-weight: 700;
134
- }
135
-
136
- .b2s-network-auth-list-info a {
137
- text-decoration: underline;
138
- }
139
-
140
- .glyphicon-white{
141
- color:#FFFFFF;
142
- }
143
-
144
- .b2s-network-item-auth-list-li{
145
- border: 1px solid rgba(0,0,0,.1);
146
- border-bottom: 0px;
147
- line-height: 1.5;
148
- padding: 6px;
149
- margin-bottom: 0px !important;
150
- }
151
-
152
- ul.b2s-network-item-auth-list li:last-child{
153
- border-bottom: 1px solid rgba(0,0,0,.1) !important;
154
- }
155
-
156
- .b2s-network-item-auth-type{
157
- font-weight: 600;
158
- line-height: 2;
159
- }
160
-
161
- .b2s-modify-board-and-group-network-modal-footer, .b2s-edit-network-auth-settings-footer{
162
- border: 0px !important;
163
- }
164
-
165
- .b2s-sched-manager-item-input-day {
166
- color: #32373c;
167
- display: inline-block;
168
- vertical-align: middle;
169
- font: 18px/1 Arial,sans-serif;
170
- font-weight: 700;
171
- line-height: 30px;
172
- padding: 0 2px !important;
173
- min-width: 28px;
174
- text-align: center;
175
- border: 0 !important;
176
- width: 2% !important;
177
- -webkit-appearance: none !important;
178
- box-shadow: inset 0px 0px 0px rgba(0,0,0,0) !important;
179
- margin: 0 !important;
180
- background-color:white !important;
181
- }
182
- .b2s-sched-manager-item-input-day-btn-plus {
183
- cursor: pointer;
184
- display: inline-block;
185
- vertical-align: middle;
186
- width: 24px;
187
- height: 24px;
188
- font: 23px/1 Arial,sans-serif;
189
- text-align: center;
190
- border-radius: 50%;
191
- background-color: #eee;
192
- border: 1px solid #ddd;
193
- box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
194
- color: #32373c
195
- }
196
- .b2s-sched-manager-item-input-day-btn-minus {
197
- cursor: pointer;
198
- display: inline-block;
199
- vertical-align: middle;
200
- width: 24px;
201
- height: 24px;
202
- font: 21px/1 Arial,sans-serif;
203
- text-align: center;
204
- border-radius: 50%;
205
- background-clip: padding-box;
206
- background-color: #eee;
207
- border: 1px solid #ddd;
208
- box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
209
- color: #32373c
210
- }
211
- .b2s-text-middle{
212
- vertical-align: middle;
213
- font: 13px/1 Arial,sans-serif;
214
- }
215
-
216
- .b2s-label-warning-border-left{
217
- border-left: 3px solid #FDBF45;
218
- }
219
-
220
- .b2s-label-info-border-left{
221
- border-left: 3px solid #31708f;
222
- }
223
-
224
- .b2s-label-danger-border-left{
225
- border-left: 3px solid #d9534f;
226
- }
227
-
228
- .b2s-label-success-border-left{
229
- border-left: 3px solid #398439;
230
- }
231
-
232
- .b2s-margin-top-8 {
233
- margin-top: 8px;
234
- }
235
-
236
- .b2s-margin-bottom-8 {
237
- margin-bottom: 8px;
238
- }
239
-
240
- #b2s-manage-auth-team-modal, #b2s-edit-network-auth-settings {
241
- z-index: 1049;
242
- }
243
-
244
- .b2s-add-padding-network-placeholder-btn{
245
- padding: 4px 14px;
246
- }
247
-
248
- .b2s-bold{
249
- font-weight: 600;
250
- }
251
-
252
- #b2s-delete-network-sched-post {
253
- float: left;
254
- }
255
-
256
- .b2s-btn-network-delete-list {
257
- margin-left: 36px;
258
- list-style: disc;
259
- }
260
-
261
- .b2s-loading-area-manage-auth-team-modal{
262
- float: left;
263
- text-align: center;
264
- }
265
-
266
-
267
-
268
-
269
- .b2s-edit-template-content-post-item {
270
- appearance:button;
271
- -moz-appearance:button;
272
- -webkit-appearance:button;
273
- display: inline-block;
274
- padding: 2px 5px;
275
- cursor: pointer;
276
- margin-right: 5px !important;
277
- }
278
-
279
- .b2s-edit-template-preview-profile-img-1 {
280
- border: 1px solid lightgray;
281
- border-radius: 25px;
282
- padding: 1px;
283
- height: 36px;
284
- width: 36px;
285
- }
286
-
287
- .b2s-edit-template-preview-profile-img-18 {
288
- border: 1px solid lightgray;
289
- border-radius: 25px;
290
- padding: 1px;
291
- height: 36px;
292
- width: 36px;
293
- }
294
-
295
- .b2s-edit-template-preview-profile-img-17 {
296
- border: 1px solid lightgray;
297
- border-radius: 25px;
298
- padding: 1px;
299
- height: 36px;
300
- width: 36px;
301
- }
302
-
303
- .b2s-edit-template-preview-profile-img-16 {
304
- border: 1px solid lightgray;
305
- border-radius: 25px;
306
- padding: 1px;
307
- height: 36px;
308
- width: 36px;
309
- }
310
-
311
- .b2s-edit-template-preview-profile-img-7 {
312
- border: 1px solid lightgray;
313
- border-radius: 25px;
314
- padding: 1px;
315
- height: 36px;
316
- width: 36px;
317
- }
318
-
319
- .b2s-edit-template-preview-profile-img-3 {
320
- border: 1px solid lightgray;
321
- border-radius: 25px;
322
- padding: 1px;
323
- height: 36px;
324
- width: 36px;
325
- }
326
-
327
- .b2s-edit-template-preview-profile-img-12 {
328
- border: 1px solid lightgray;
329
- border-radius: 25px;
330
- padding: 1px;
331
- height: 36px;
332
- width: 36px;
333
- }
334
-
335
- .b2s-edit-template-preview-profile-img-2 {
336
- border: 1px solid lightgray;
337
- border-radius: 25px;
338
- padding: 1px;
339
- height: 36px;
340
- width: 36px;
341
- }
342
-
343
- .b2s-edit-template-preview-profile-name-1 {
344
- margin-left: -20px;
345
- color: #385898;
346
- font-family: Helvetica, Arial, sans-serif;
347
- font-size: 14px;
348
- font-weight: 600;
349
- }
350
-
351
- .b2s-edit-template-preview-profile-name-7 {
352
- margin-left: -20px;
353
- color: #385898;
354
- font-family: Helvetica, Arial, sans-serif;
355
- font-size: 14px;
356
- font-weight: 600;
357
- }
358
-
359
- .b2s-edit-template-preview-profile-name-18 {
360
- margin-left: -20px;
361
- color: #385898;
362
- font-family: Helvetica, Arial, sans-serif;
363
- font-size: 14px;
364
- font-weight: 600;
365
- }
366
-
367
- .b2s-edit-template-preview-profile-name-17 {
368
- margin-left: -20px;
369
- color: #385898;
370
- font-family: Helvetica, Arial, sans-serif;
371
- font-size: 14px;
372
- font-weight: 600;
373
- }
374
-
375
- .b2s-edit-template-preview-profile-name-16 {
376
- margin-left: -20px;
377
- color: #385898;
378
- font-family: Helvetica, Arial, sans-serif;
379
- font-size: 14px;
380
- font-weight: 600;
381
- }
382
-
383
- .b2s-edit-template-preview-profile-name-3 {
384
- margin-left: -20px;
385
- font-family: Helvetica, Arial, sans-serif;
386
- font-size: 14px;
387
- font-weight: 600;
388
- }
389
-
390
- .b2s-edit-template-preview-profile-name-2 {
391
- font-family: Helvetica, Arial, sans-serif;
392
- font-size: 14px;
393
- font-weight: 600;
394
- }
395
-
396
- .b2s-edit-template-preview-profile-name-12 {
397
- font-family: Helvetica, Arial, sans-serif;
398
- font-size: 12px;
399
- font-weight: 600;
400
- margin-left: -10px;
401
- margin-top: 10px;
402
- }
403
-
404
- .b2s-edit-template-preview-content-profile-name-12 {
405
- font-family: Helvetica, Arial, sans-serif;
406
- font-size: 12px;
407
- font-weight: 600;
408
- margin-right: 5px;
409
- }
410
-
411
- .b2s-edit-template-preview-profile-handle-2 {
412
- font-size: 14px;
413
- color: gray;
414
- }
415
-
416
- .b2s-edit-template-preview-content {
417
- word-wrap: break-word;
418
- }
419
-
420
- .b2s-edit-template-preview-link-image, .b2s-edit-template-preview-image-image {
421
- width: 100%;
422
- }
423
-
424
- .b2s-edit-template-preview-2 {
425
- margin-left: -20px;
426
- }
427
-
428
- .b2s-edit-template-preview-image-image-2 {
429
- border-radius: 10px;
430
- border: 1px solid lightgrey;
431
- margin-top: 10px;
432
- }
433
-
434
- .b2s-edit-template-preview-image-image-3, .b2s-edit-template-preview-link-image-3 {
435
- margin-top: 10px;
436
- border-top: 1px solid lightgray;
437
- border-bottom: 1px solid lightgray;
438
- }
439
-
440
- .b2s-edit-template-preview-link-image-2 {
441
- width: auto !important;
442
- height: 85px;
443
- }
444
-
445
- .b2s-edit-template-preview-image-12 {
446
- width: 100%;
447
- }
448
-
449
- .b2s-edit-template-link-post {
450
- border-top-right-radius: 0px !important;
451
- border-bottom-right-radius: 0px !important;
452
- }
453
-
454
- .b2s-edit-template-image-post {
455
- border-top-left-radius: 0px !important;
456
- border-bottom-left-radius: 0px !important;
457
- }
458
-
459
- .b2s-edit-template-preview-image-border-12 {
460
- padding: 0 !important;
461
- border-top: 1px solid lightgray;
462
- border-bottom: 1px solid lightgray;
463
- margin: 10px 0px;
464
- overflow: hidden;
465
- height: 370px;
466
- }
467
-
468
- .b2s-edit-template-preview-border-12 {
469
- padding: 10px 0px;
470
- }
471
- .b2s-edit-template-preview-border-1 {
472
- padding-top: 10px;
473
- }
474
-
475
- .b2s-edit-template-preview-border-7 {
476
- padding-top: 10px;
477
- }
478
-
479
- .b2s-edit-template-preview-border-18 {
480
- padding-top: 10px;
481
- }
482
-
483
- .b2s-edit-template-preview-border-17 {
484
- padding-top: 10px;
485
- }
486
-
487
- .b2s-edit-template-preview-border-16 {
488
- padding-top: 10px;
489
- }
490
-
491
- .b2s-edit-template-preview-border-3 {
492
- padding-top: 10px;
493
- }
494
-
495
- .b2s-edit-template-preview-border {
496
- border: 1px solid lightgray;
497
- }
498
-
499
- .b2s-edit-template-preview-content-1 {
500
- margin: 5px 0px;
501
- }
502
-
503
- .b2s-edit-template-preview-content-7 {
504
- margin: 5px 0px;
505
- }
506
-
507
- .b2s-edit-template-preview-content-17 {
508
- margin: 5px 0px;
509
- }
510
-
511
- .b2s-edit-template-preview-content-3 {
512
- margin: 5px 0px;
513
- }
514
-
515
- .b2s-edit-template-preview-image-border-1 {
516
- padding: 0px !important;
517
- border-top: 1px solid lightgray;
518
- border-bottom: 1px solid lightgray;
519
- }
520
-
521
- .b2s-edit-template-preview-image-border-7 {
522
- padding: 0px !important;
523
- border-top: 1px solid lightgray;
524
- border-bottom: 1px solid lightgray;
525
- margin-top: 10px;
526
- }
527
-
528
- .b2s-edit-template-preview-image-border-17 {
529
- padding: 0px !important;
530
- border-bottom: 1px solid lightgray;
531
- }
532
-
533
- .b2s-edit-template-preview-image-border-3 {
534
- padding: 0px !important;
535
- }
536
-
537
- .b2s-edit-template-preview-link-title {
538
- font-weight: 700;
539
- font-size: 16px;
540
- }
541
-
542
- .b2s-edit-template-preview-link-meta-box-1 {
543
- background-color: #f2f3f5;
544
- padding-bottom: 5px;
545
- border-bottom: 1px solid lightgray;
546
- }
547
-
548
- .b2s-edit-template-preview-link-meta-box-17 {
549
- padding-bottom: 5px;
550
- padding-top: 5px;
551
- }
552
-
553
- .b2s-edit-template-preview-link-meta-box-2 {
554
- border: 1px solid lightgray;
555
- border-radius: 14px;
556
- margin-left: 0px !important;
557
- margin-top: 10px;
558
- background-color: white;
559
- }
560
-
561
- .b2s-edit-template-preview-link-meta-box-image-2 {
562
- overflow: hidden;
563
- height: 85px;
564
- display: flex;
565
- align-items: center;
566
- justify-content: center;
567
- border-top-left-radius: 14px;
568
- border-bottom-left-radius: 14px;
569
- border-right: 1px solid lightgray;
570
- }
571
-
572
- .b2s-edit-template-preview-link-meta-box-image-2-big {
573
- padding: 0px !important;
574
- border-top-right-radius: 14px;
575
- border-top-left-radius: 14px;
576
- }
577
-
578
- .b2s-edit-template-preview-link-image-2-big {
579
- width: 100%;
580
- border-top-right-radius: 14px;
581
- border-top-left-radius: 14px;
582
- }
583
-
584
- .b2s-edit-template-preview-border-2 {
585
- padding-top: 5px;
586
- background-color: #f8fafb;
587
- }
588
-
589
- .b2s-edit-template-preview-link-meta-box-desc-2 {
590
- color: gray;
591
- }
592
-
593
- .b2s-edit-template-preview-link-meta-box-domain-2 {
594
- color: gray;
595
- }
596
-
597
- .b2s-edit-template-preview-link-meta-box-3 {
598
- background-color: #f2f3f5;
599
- padding: 5px 0px;
600
- border-bottom: 1px solid lightgray;
601
- }
602
-
603
- .b2s-edit-template-preview-link-meta-box-domain-3 {
604
- font-size: 10px;
605
- color: gray;
606
- }
607
-
608
- .b2s-edit-template-preview-link-meta-box-title-3 {
609
- font-weight: 600;
610
- }
611
-
612
- .b2s-edit-template-link-info {
613
- color: #31708f;
614
- }
615
-
616
- .b2s-edit-template-section-headline {
617
- font-size: 14px;
618
- font-weight: 600;
619
- }
620
-
621
- .b2s-edit-template-post-content {
622
- width: 100%;
623
- height: 80px;
624
- }
625
-
626
- .b2s-edit-template-image-cut {
627
- width: 200%;
628
- margin-left: -205px;
629
- margin-top: -83px;
630
- }
631
-
632
- .b2s-edit-template-image-frame {
633
- margin-top: 50px;
634
- }
635
-
636
- .b2s-edit-template-preview-dots-12 {
637
- margin-top: -5px;
638
- font-weight: 1000;
639
- font-size: 15px;
640
- letter-spacing: 2px;
641
- }
642
-
643
- .b2s-edit-template-preview-like-icons-12 {
644
- width: 100px;
645
- margin: -5px 0px 5px -5px;
646
- }
647
-
648
- .b2s-edit-template-preview-like-icons-1 {
649
- width: 100%;
650
- margin: 5px 0px;
651
- }
652
-
653
- .b2s-edit-template-preview-like-icons-7 {
654
- width: 100%;
655
- margin: 5px 0px;
656
- }
657
-
658
- .b2s-edit-template-preview-like-icons-7 {
659
- width: 100%;
660
- margin: 5px 0px;
661
- }
662
-
663
- .b2s-edit-template-preview-like-icons-2 {
664
- width: 100%;
665
- margin-top: 5px;
666
- }
667
-
668
- .b2s-edit-template-preview-like-icons-3 {
669
- margin-top: 5px;
670
- }
671
-
672
- .b2s-edit-template-network-img {
673
- height: 20px;
674
- width: auto !important;
675
- margin-right: 5px;
676
- }
677
-
678
- .b2s-edit-template-character-limit-label{
679
- padding-top: 4px;
680
- font-weight: 600;
681
- }
682
- .b2s-info-character-limit-text{
683
- margin: 0 0 10px;
684
- }
685
-
686
- .b2s-edit-template-preview-border-19 {
687
- padding-top: 15px;
688
- padding-bottom: 15px;
689
- border-radius: 3px;
690
- }
691
-
692
- .b2s-edit-template-preview-profile-img-19 {
693
- height: 40px;
694
- }
695
-
696
- .b2s-edit-template-preview-profile-name-19 {
697
- color: #009090;
698
- font-size: 13px;
699
- font-weight: 600;
700
- line-height: 18px;
701
- }
702
-
703
- .b2s-edit-template-preview-header-19 {
704
- padding-top: 15px;
705
- padding-bottom: 15px;
706
- border-bottom: 1px solid lightgray;
707
- margin-bottom: 15px;
708
- }
709
-
710
- .b2s-edit-template-preview-like-icons-19 {
711
- margin-top: 15px;
712
- width: 120px;
713
- }
714
-
715
- .b2s-edit-template-preview-link-meta-box-title-19 {
716
- color: #009090;
717
- font-size: 18px;
718
- font-weight: 400;
719
- line-height: 22px;
720
- }
721
-
722
- .b2s-edit-template-preview-link-meta-box-desc-19 {
723
- font-size: 13px;
724
- line-height: 18px;
725
- }
726
-
727
- .b2s-edit-template-preview-link-meta-box-domain-19 {
728
- font-size: 13px;
729
- line-height: 18px;
730
- color: gray;
731
- }
732
-
733
- .b2s-edit-template-image-preview .b2s-edit-template-preview-image-border-19 {
734
- padding: 0px;
735
- }
736
-
737
- .b2s-edit-template-preview-content-19 {
738
- margin: 15px 0px;
739
- }
740
-
741
- .b2s-login-form-label {
742
- padding-top: 7px;
743
- margin-top: 0;
744
- margin-bottom: 0;
745
- text-align: right;
746
- font-weight: bold;
747
- }
748
-
749
- #b2s-auth-network-6-location, #b2s-auth-network-6-board {
750
- max-width: 100% !important;
751
- }
752
-
753
- .b2s-edit-template-title {
754
- display: inline;
755
- }
756
-
757
- .b2s-url-parameter-remove-btn {
758
- font-weight: bold;
759
- font-size: 18px;
760
- line-height: 1.5;
761
- cursor: pointer;
762
- }
763
-
764
- .b2s-url-parameter-legend-text {
765
- font-size: 12px;
766
- font-weight: 600;
767
- letter-spacing: 0;
768
- margin-top: 10px;
769
- }
770
-
771
- .b2s-url-parameter-content {
772
- padding-top: 6px;
773
- }
774
-
775
- .b2s-add-network-continue-btn {
776
- margin-top: 20px;
777
- }
778
-
779
- .b2s-edit-template-preview-border-6, b2s-edit-template-preview-image-6 {
780
- border-radius: 10px;
781
- }
782
-
783
- .b2s-pl-0 {
784
- padding-left: 0px;
785
- }
786
- .b2s-pr-0 {
787
- padding-right: 0px;
788
- }
789
-
790
- .b2s-edit-template-preview-profile-img-6 {
791
- width: 30px;
792
- }
793
-
794
- .b2s-edit-template-preview-profile-name-6 {
795
- font-weight: bold;
796
- }
797
-
798
- .b2s-edit-template-preview-title-6 {
799
- margin-top: 10px !important;
800
- font-weight: bold;
801
- }
802
-
803
- .b2s-link-preview-17 {
804
- border: 1px solid lightgray;
805
- }
806
-
807
- .b2s-edit-template-preview-link-link-17 {
808
- color: gray;
809
- }
810
-
811
- .b2s-edit-template-preview-title-16 {
812
- margin-top: 20px !important;
813
- font-weight: bold;
814
- }
815
-
816
- .b2s-edit-template-preview-like-icons-7 {
817
- float: right;
818
- width: 150px;
819
- }
820
-
821
- .b2s-edit-template-preview-title-9 {
822
- font-size: 18px;
823
- font-weight: bold;
824
- }
825
-
826
- .b2s-edit-template-preview-link-9 {
827
- color: gray;
828
- }
829
-
830
- .b2s-edit-template-preview-content-9 {
831
- color: gray;
832
- }
833
-
834
- .b2s-edit-template-preview-title-14 {
835
- font-weight: bold;
836
- font-size: 18px;
837
- }
838
-
839
- .b2s-edit-template-preview-title-11 {
840
- font-weight: bold;
841
- font-size: 18px;
842
- }
843
-
844
- .b2s-edit-template-preview-title-15 {
845
- font-weight: bold;
846
- }
847
-
848
- .b2s-edit-template-preview-profile-img-24 {
849
- width: 30px;
850
- border: 1px solid gray;
851
- border-radius: 50%;
852
- }
853
-
854
- .b2s-edit-template-preview-inner-border-24 {
855
- border: 1px solid gray;
856
- border-radius: 5%;
857
- }
858
-
859
- .b2s-edit-template-preview-border-24, .b2s-edit-template-preview-image-border-24 {
860
- padding: 10px;
861
- }
862
-
863
- .b2s-edit-template-preview-link-meta-box-24 {
864
- margin-left: 16px;
865
- padding-bottom: 10px;
866
- border-left: 3px solid lightblue;
867
- }
868
-
869
- .b2s-auth-network-6-extension-download-area {
870
- text-align: center;
871
- }
872
-
873
- .b2s-edit-template-preview-title-4 {
874
- font-size: 16px;
875
- padding-top: 10px;
876
- }
877
-
878
- .b2s-edit-template-preview-content-4 {
879
- padding-top: 20px;
880
- }
881
-
882
- .b2s-edit-template-preview-link-4 {
883
- padding-top: 10px;
884
- padding-bottom: 10px;
885
- text-decoration: underline;
886
- }
887
-
888
- .b2s-edit-template-preview-like-icons-4 {
889
- float: right;
890
- }
891
-
892
- .b2s-edit-template-btn {
893
- background-color: #eee !important;
894
- }
895
-
896
- .b2s-edit-template-preview-like-icons-27 {
897
- width: 120px;
898
- }
899
-
900
- .b2s-edit-template-preview-image-image-27 {
901
- margin-top: 10px;
 
 
 
 
902
  }
1
+ /*Custom*/
2
+
3
+ .b2s-loading-area-modify-collection{
4
+ text-align: center;
5
+ }
6
+
7
+ .list-group-item{
8
+ border: 0px !important;
9
+ }
10
+ @media(max-width: 767px) {
11
+ .form-inline {
12
+ display: none;
13
+ }
14
+ .filterHide {
15
+ display: none;
16
+ }
17
+ .form-inline button {
18
+ width: 100%;
19
+ margin-bottom: 10px;
20
+ }
21
+ }
22
+
23
+ @media(max-width: 450px) {
24
+ .add-padding-left{
25
+ padding: 0px !important;
26
+ }
27
+ }
28
+
29
+ .error{
30
+ border: 1px solid #FF0000 !important;
31
+ }
32
+ .b2s-network-auth-btn{
33
+ margin-left: 2px;
34
+ line-height: 2;
35
+ }
36
+
37
+ .b2s-network-item-auth-list-btn-delete{
38
+ line-height: 2;
39
+ }
40
+
41
+ .b2s-network-get-more-btn{
42
+ text-decoration: underline;
43
+ }
44
+ .b2s-network-auth-count{
45
+ font-weight: 700;
46
+ line-height: 1.5;
47
+ }
48
+
49
+ .b2s-sched-manager-title{
50
+ font-weight: 700;
51
+ line-height: 1.5;
52
+ padding-right: 165px;
53
+ }
54
+
55
+ .b2s-sched-manager-time-area{
56
+ width: 150px;
57
+ margin-right: -35px;
58
+ }
59
+
60
+ .b2s-sched-manager-add-padding{
61
+ margin-right: -13px;
62
+ }
63
+
64
+ .b2s-add-padding-network-refresh{
65
+ padding: 4px 7px;
66
+ }
67
+
68
+ .b2s-add-padding-network-team{
69
+ padding: 4px 5px;
70
+ line-height: 2;
71
+ }
72
+
73
+ .b2s-sched-manager-best-time-info{
74
+ padding-left: 5px;
75
+ font-size: 12px;
76
+ }
77
+
78
+ .b2s-network-time-manager-area{
79
+ padding-right: 8px;
80
+ }
81
+
82
+ .b2s-add-padding-network-edit{
83
+ padding: 7px 4px;
84
+ }
85
+ .b2s-network-mandant-area{
86
+ margin-top: -7px !important;
87
+ }
88
+
89
+ .b2s-add-padding-network-delete{
90
+ padding: 4px 5px;
91
+ }
92
+
93
+ .b2s-sched-manager-day-area{
94
+ width: 150px;
95
+ padding-top: 2px;
96
+ }
97
+
98
+ .b2s-sched-manager-premium-area{
99
+ width: 195px;
100
+ padding-top: 5px;
101
+ }
102
+
103
+ .b2s-settings-sched-item-input-time, .b2s-settings-sched-item-input-day{
104
+ max-width: 90px;
105
+ }
106
+
107
+ .b2s-network-mandant-select{
108
+ min-width: 200px;
109
+ }
110
+
111
+ .b2s-network-mandant-name{
112
+ font-size: 12px;
113
+ font-style: italic;
114
+ color: #777;
115
+ font-weight: normal;
116
+
117
+ }
118
+
119
+ .b2s-network-approved-from{
120
+ font-size: 12px;
121
+ font-style: italic;
122
+ color: #777;
123
+ font-weight: normal;
124
+
125
+ }
126
+
127
+ .b2s-network-item-auth-list{
128
+ padding-top:6px;
129
+ font-size: 0.80rem !important;
130
+ }
131
+
132
+ .b2s-network-auth-list-info{
133
+ font-weight: 700;
134
+ }
135
+
136
+ .b2s-network-auth-list-info a {
137
+ text-decoration: underline;
138
+ }
139
+
140
+ .glyphicon-white{
141
+ color:#FFFFFF;
142
+ }
143
+
144
+ .b2s-network-item-auth-list-li{
145
+ border: 1px solid rgba(0,0,0,.1);
146
+ border-bottom: 0px;
147
+ line-height: 1.5;
148
+ padding: 6px;
149
+ margin-bottom: 0px !important;
150
+ }
151
+
152
+ ul.b2s-network-item-auth-list li:last-child{
153
+ border-bottom: 1px solid rgba(0,0,0,.1) !important;
154
+ }
155
+
156
+ .b2s-network-item-auth-type{
157
+ font-weight: 600;
158
+ line-height: 2;
159
+ }
160
+
161
+ .b2s-modify-board-and-group-network-modal-footer, .b2s-edit-network-auth-settings-footer{
162
+ border: 0px !important;
163
+ }
164
+
165
+ .b2s-sched-manager-item-input-day {
166
+ color: #32373c;
167
+ display: inline-block;
168
+ vertical-align: middle;
169
+ font: 18px/1 Arial,sans-serif;
170
+ font-weight: 700;
171
+ line-height: 30px;
172
+ padding: 0 2px !important;
173
+ min-width: 28px;
174
+ text-align: center;
175
+ border: 0 !important;
176
+ width: 2% !important;
177
+ -webkit-appearance: none !important;
178
+ box-shadow: inset 0px 0px 0px rgba(0,0,0,0) !important;
179
+ margin: 0 !important;
180
+ background-color:white !important;
181
+ }
182
+ .b2s-sched-manager-item-input-day-btn-plus {
183
+ cursor: pointer;
184
+ display: inline-block;
185
+ vertical-align: middle;
186
+ width: 24px;
187
+ height: 24px;
188
+ font: 23px/1 Arial,sans-serif;
189
+ text-align: center;
190
+ border-radius: 50%;
191
+ background-color: #eee;
192
+ border: 1px solid #ddd;
193
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
194
+ color: #32373c
195
+ }
196
+ .b2s-sched-manager-item-input-day-btn-minus {
197
+ cursor: pointer;
198
+ display: inline-block;
199
+ vertical-align: middle;
200
+ width: 24px;
201
+ height: 24px;
202
+ font: 21px/1 Arial,sans-serif;
203
+ text-align: center;
204
+ border-radius: 50%;
205
+ background-clip: padding-box;
206
+ background-color: #eee;
207
+ border: 1px solid #ddd;
208
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
209
+ color: #32373c
210
+ }
211
+ .b2s-text-middle{
212
+ vertical-align: middle;
213
+ font: 13px/1 Arial,sans-serif;
214
+ }
215
+
216
+ .b2s-label-warning-border-left{
217
+ border-left: 3px solid #FDBF45;
218
+ }
219
+
220
+ .b2s-label-info-border-left{
221
+ border-left: 3px solid #31708f;
222
+ }
223
+
224
+ .b2s-label-danger-border-left{
225
+ border-left: 3px solid #d9534f;
226
+ }
227
+
228
+ .b2s-label-success-border-left{
229
+ border-left: 3px solid #398439;
230
+ }
231
+
232
+ .b2s-margin-top-8 {
233
+ margin-top: 8px;
234
+ }
235
+
236
+ .b2s-margin-bottom-8 {
237
+ margin-bottom: 8px;
238
+ }
239
+
240
+ #b2s-manage-auth-team-modal, #b2s-edit-network-auth-settings {
241
+ z-index: 1049;
242
+ }
243
+
244
+ .b2s-add-padding-network-placeholder-btn{
245
+ padding: 4px 14px;
246
+ }
247
+
248
+ .b2s-bold{
249
+ font-weight: 600;
250
+ }
251
+
252
+ #b2s-delete-network-sched-post {
253
+ float: left;
254
+ }
255
+
256
+ .b2s-btn-network-delete-list {
257
+ margin-left: 36px;
258
+ list-style: disc;
259
+ }
260
+
261
+ .b2s-loading-area-manage-auth-team-modal{
262
+ float: left;
263
+ text-align: center;
264
+ }
265
+
266
+
267
+
268
+
269
+ .b2s-edit-template-content-post-item {
270
+ appearance:button;
271
+ -moz-appearance:button;
272
+ -webkit-appearance:button;
273
+ display: inline-block;
274
+ padding: 2px 5px;
275
+ cursor: pointer;
276
+ margin-right: 5px !important;
277
+ }
278
+
279
+ .b2s-edit-template-preview-profile-img-1 {
280
+ border: 1px solid lightgray;
281
+ border-radius: 25px;
282
+ padding: 1px;
283
+ height: 36px;
284
+ width: 36px;
285
+ }
286
+
287
+ .b2s-edit-template-preview-profile-img-18 {
288
+ border: 1px solid lightgray;
289
+ border-radius: 25px;
290
+ padding: 1px;
291
+ height: 36px;
292
+ width: 36px;
293
+ }
294
+
295
+ .b2s-edit-template-preview-profile-img-17 {
296
+ border: 1px solid lightgray;
297
+ border-radius: 25px;
298
+ padding: 1px;
299
+ height: 36px;
300
+ width: 36px;
301
+ }
302
+
303
+ .b2s-edit-template-preview-profile-img-16 {
304
+ border: 1px solid lightgray;
305
+ border-radius: 25px;
306
+ padding: 1px;
307
+ height: 36px;
308
+ width: 36px;
309
+ }
310
+
311
+ .b2s-edit-template-preview-profile-img-7 {
312
+ border: 1px solid lightgray;
313
+ border-radius: 25px;
314
+ padding: 1px;
315
+ height: 36px;
316
+ width: 36px;
317
+ }
318
+
319
+ .b2s-edit-template-preview-profile-img-3 {
320
+ border: 1px solid lightgray;
321
+ border-radius: 25px;
322
+ padding: 1px;
323
+ height: 36px;
324
+ width: 36px;
325
+ }
326
+
327
+ .b2s-edit-template-preview-profile-img-12 {
328
+ border: 1px solid lightgray;
329
+ border-radius: 25px;
330
+ padding: 1px;
331
+ height: 36px;
332
+ width: 36px;
333
+ }
334
+
335
+ .b2s-edit-template-preview-profile-img-2 {
336
+ border: 1px solid lightgray;
337
+ border-radius: 25px;
338
+ padding: 1px;
339
+ height: 36px;
340
+ width: 36px;
341
+ }
342
+
343
+ .b2s-edit-template-preview-profile-name-1 {
344
+ margin-left: -20px;
345
+ color: #385898;
346
+ font-family: Helvetica, Arial, sans-serif;
347
+ font-size: 14px;
348
+ font-weight: 600;
349
+ }
350
+
351
+ .b2s-edit-template-preview-profile-name-7 {
352
+ margin-left: -20px;
353
+ color: #385898;
354
+ font-family: Helvetica, Arial, sans-serif;
355
+ font-size: 14px;
356
+ font-weight: 600;
357
+ }
358
+
359
+ .b2s-edit-template-preview-profile-name-18 {
360
+ margin-left: -20px;
361
+ color: #385898;
362
+ font-family: Helvetica, Arial, sans-serif;
363
+ font-size: 14px;
364
+ font-weight: 600;
365
+ }
366
+
367
+ .b2s-edit-template-preview-profile-name-17 {
368
+ margin-left: -20px;
369
+ color: #385898;
370
+ font-family: Helvetica, Arial, sans-serif;
371
+ font-size: 14px;
372
+ font-weight: 600;
373
+ }
374
+
375
+ .b2s-edit-template-preview-profile-name-16 {
376
+ margin-left: -20px;
377
+ color: #385898;
378
+ font-family: Helvetica, Arial, sans-serif;
379
+ font-size: 14px;
380
+ font-weight: 600;
381
+ }
382
+
383
+ .b2s-edit-template-preview-profile-name-3 {
384
+ margin-left: -20px;
385
+ font-family: Helvetica, Arial, sans-serif;
386
+ font-size: 14px;
387
+ font-weight: 600;
388
+ }
389
+
390
+ .b2s-edit-template-preview-profile-name-2 {
391
+ font-family: Helvetica, Arial, sans-serif;
392
+ font-size: 14px;
393
+ font-weight: 600;
394
+ }
395
+
396
+ .b2s-edit-template-preview-profile-name-12 {
397
+ font-family: Helvetica, Arial, sans-serif;
398
+ font-size: 12px;
399
+ font-weight: 600;
400
+ margin-left: -10px;
401
+ margin-top: 10px;
402
+ }
403
+
404
+ .b2s-edit-template-preview-content-profile-name-12 {
405
+ font-family: Helvetica, Arial, sans-serif;
406
+ font-size: 12px;
407
+ font-weight: 600;
408
+ margin-right: 5px;
409
+ }
410
+
411
+ .b2s-edit-template-preview-profile-handle-2 {
412
+ font-size: 14px;
413
+ color: gray;
414
+ }
415
+
416
+ .b2s-edit-template-preview-content {
417
+ word-wrap: break-word;
418
+ }
419
+
420
+ .b2s-edit-template-preview-link-image, .b2s-edit-template-preview-image-image {
421
+ width: 100%;
422
+ }
423
+
424
+ .b2s-edit-template-preview-2 {
425
+ margin-left: -20px;
426
+ }
427
+
428
+ .b2s-edit-template-preview-image-image-2 {
429
+ border-radius: 10px;
430
+ border: 1px solid lightgrey;
431
+ margin-top: 10px;
432
+ }
433
+
434
+ .b2s-edit-template-preview-image-image-3, .b2s-edit-template-preview-link-image-3 {
435
+ margin-top: 10px;
436
+ border-top: 1px solid lightgray;
437
+ border-bottom: 1px solid lightgray;
438
+ }
439
+
440
+ .b2s-edit-template-preview-link-image-2 {
441
+ width: auto !important;
442
+ height: 85px;
443
+ }
444
+
445
+ .b2s-edit-template-preview-image-12 {
446
+ width: 100%;
447
+ }
448
+
449
+ .b2s-edit-template-link-post {
450
+ border-top-right-radius: 0px !important;
451
+ border-bottom-right-radius: 0px !important;
452
+ }
453
+
454
+ .b2s-edit-template-image-post {
455
+ border-top-left-radius: 0px !important;
456
+ border-bottom-left-radius: 0px !important;
457
+ }
458
+
459
+ .b2s-edit-template-preview-image-border-12 {
460
+ padding: 0 !important;
461
+ border-top: 1px solid lightgray;
462
+ border-bottom: 1px solid lightgray;
463
+ margin: 10px 0px;
464
+ overflow: hidden;
465
+ height: 370px;
466
+ }
467
+
468
+ .b2s-edit-template-preview-border-12 {
469
+ padding: 10px 0px;
470
+ }
471
+ .b2s-edit-template-preview-border-1 {
472
+ padding-top: 10px;
473
+ }
474
+
475
+ .b2s-edit-template-preview-border-7 {
476
+ padding-top: 10px;
477
+ }
478
+
479
+ .b2s-edit-template-preview-border-18 {
480
+ padding-top: 10px;
481
+ }
482
+
483
+ .b2s-edit-template-preview-border-17 {
484
+ padding-top: 10px;
485
+ }
486
+
487
+ .b2s-edit-template-preview-border-16 {
488
+ padding-top: 10px;
489
+ }
490
+
491
+ .b2s-edit-template-preview-border-3 {
492
+ padding-top: 10px;
493
+ }
494
+
495
+ .b2s-edit-template-preview-border {
496
+ border: 1px solid lightgray;
497
+ }
498
+
499
+ .b2s-edit-template-preview-content-1 {
500
+ margin: 5px 0px;
501
+ }
502
+
503
+ .b2s-edit-template-preview-content-7 {
504
+ margin: 5px 0px;
505
+ }
506
+
507
+ .b2s-edit-template-preview-content-17 {
508
+ margin: 5px 0px;
509
+ }
510
+
511
+ .b2s-edit-template-preview-content-3 {
512
+ margin: 5px 0px;
513
+ }
514
+
515
+ .b2s-edit-template-preview-image-border-1 {
516
+ padding: 0px !important;
517
+ border-top: 1px solid lightgray;
518
+ border-bottom: 1px solid lightgray;
519
+ }
520
+
521
+ .b2s-edit-template-preview-image-border-7 {
522
+ padding: 0px !important;
523
+ border-top: 1px solid lightgray;
524
+ border-bottom: 1px solid lightgray;
525
+ margin-top: 10px;
526
+ }
527
+
528
+ .b2s-edit-template-preview-image-border-17 {
529
+ padding: 0px !important;
530
+ border-bottom: 1px solid lightgray;
531
+ }
532
+
533
+ .b2s-edit-template-preview-image-border-3 {
534
+ padding: 0px !important;
535
+ }
536
+
537
+ .b2s-edit-template-preview-link-title {
538
+ font-weight: 700;
539
+ font-size: 16px;
540
+ }
541
+
542
+ .b2s-edit-template-preview-link-meta-box-1 {
543
+ background-color: #f2f3f5;
544
+ padding-bottom: 5px;
545
+ border-bottom: 1px solid lightgray;
546
+ }
547
+
548
+ .b2s-edit-template-preview-link-meta-box-17 {
549
+ padding-bottom: 5px;
550
+ padding-top: 5px;
551
+ }
552
+
553
+ .b2s-edit-template-preview-link-meta-box-2 {
554
+ border: 1px solid lightgray;
555
+ border-radius: 14px;
556
+ margin-left: 0px !important;
557
+ margin-top: 10px;
558
+ background-color: white;
559
+ }
560
+
561
+ .b2s-edit-template-preview-link-meta-box-image-2 {
562
+ overflow: hidden;
563
+ height: 85px;
564
+ display: flex;
565
+ align-items: center;
566
+ justify-content: center;
567
+ border-top-left-radius: 14px;
568
+ border-bottom-left-radius: 14px;
569
+ border-right: 1px solid lightgray;
570
+ }
571
+
572
+ .b2s-edit-template-preview-link-meta-box-image-2-big {
573
+ padding: 0px !important;
574
+ border-top-right-radius: 14px;
575
+ border-top-left-radius: 14px;
576
+ }
577
+
578
+ .b2s-edit-template-preview-link-image-2-big {
579
+ width: 100%;
580
+ border-top-right-radius: 14px;
581
+ border-top-left-radius: 14px;
582
+ }
583
+
584
+ .b2s-edit-template-preview-border-2 {
585
+ padding-top: 5px;
586
+ background-color: #f8fafb;
587
+ }
588
+
589
+ .b2s-edit-template-preview-link-meta-box-desc-2 {
590
+ color: gray;
591
+ }
592
+
593
+ .b2s-edit-template-preview-link-meta-box-domain-2 {
594
+ color: gray;
595
+ }
596
+
597
+ .b2s-edit-template-preview-link-meta-box-3 {
598
+ background-color: #f2f3f5;
599
+ padding: 5px 0px;
600
+ border-bottom: 1px solid lightgray;
601
+ }
602
+
603
+ .b2s-edit-template-preview-link-meta-box-domain-3 {
604
+ font-size: 10px;
605
+ color: gray;
606
+ }
607
+
608
+ .b2s-edit-template-preview-link-meta-box-title-3 {
609
+ font-weight: 600;
610
+ }
611
+
612
+ .b2s-edit-template-link-info {
613
+ color: #31708f;
614
+ }
615
+
616
+ .b2s-edit-template-section-headline {
617
+ font-size: 14px;
618
+ font-weight: 600;
619
+ }
620
+
621
+ .b2s-edit-template-post-content {
622
+ width: 100%;
623
+ height: 80px;
624
+ }
625
+
626
+ .b2s-edit-template-image-cut {
627
+ width: 200%;
628
+ margin-left: -205px;
629
+ margin-top: -83px;
630
+ }
631
+
632
+ .b2s-edit-template-image-frame {
633
+ margin-top: 50px;
634
+ }
635
+
636
+ .b2s-edit-template-preview-dots-12 {
637
+ margin-top: -5px;
638
+ font-weight: 1000;
639
+ font-size: 15px;
640
+ letter-spacing: 2px;
641
+ }
642
+
643
+ .b2s-edit-template-preview-like-icons-12 {
644
+ width: 100px;
645
+ margin: -5px 0px 5px -5px;
646
+ }
647
+
648
+ .b2s-edit-template-preview-like-icons-1 {
649
+ width: 100%;
650
+ margin: 5px 0px;
651
+ }
652
+
653
+ .b2s-edit-template-preview-like-icons-7 {
654
+ width: 100%;
655
+ margin: 5px 0px;
656
+ }
657
+
658
+ .b2s-edit-template-preview-like-icons-7 {
659
+ width: 100%;
660
+ margin: 5px 0px;
661
+ }
662
+
663
+ .b2s-edit-template-preview-like-icons-2 {
664
+ width: 100%;
665
+ margin-top: 5px;
666
+ }
667
+
668
+ .b2s-edit-template-preview-like-icons-3 {
669
+ margin-top: 5px;
670
+ }
671
+
672
+ .b2s-edit-template-network-img {
673
+ height: 20px;
674
+ width: auto !important;
675
+ margin-right: 5px;
676
+ }
677
+
678
+ .b2s-edit-template-character-limit-label{
679
+ padding-top: 4px;
680
+ font-weight: 600;
681
+ }
682
+ .b2s-info-character-limit-text{
683
+ margin: 0 0 10px;
684
+ }
685
+
686
+ .b2s-edit-template-preview-border-19 {
687
+ padding-top: 15px;
688
+ padding-bottom: 15px;
689
+ border-radius: 3px;
690
+ }
691
+
692
+ .b2s-edit-template-preview-profile-img-19 {
693
+ height: 40px;
694
+ }
695
+
696
+ .b2s-edit-template-preview-profile-name-19 {
697
+ color: #009090;
698
+ font-size: 13px;
699
+ font-weight: 600;
700
+ line-height: 18px;
701
+ }
702
+
703
+ .b2s-edit-template-preview-header-19 {
704
+ padding-top: 15px;
705
+ padding-bottom: 15px;
706
+ border-bottom: 1px solid lightgray;
707
+ margin-bottom: 15px;
708
+ }
709
+
710
+ .b2s-edit-template-preview-like-icons-19 {
711
+ margin-top: 15px;
712
+ width: 120px;
713
+ }
714
+
715
+ .b2s-edit-template-preview-link-meta-box-title-19 {
716
+ color: #009090;
717
+ font-size: 18px;
718
+ font-weight: 400;
719
+ line-height: 22px;
720
+ }
721
+
722
+ .b2s-edit-template-preview-link-meta-box-desc-19 {
723
+ font-size: 13px;
724
+ line-height: 18px;
725
+ }
726
+
727
+ .b2s-edit-template-preview-link-meta-box-domain-19 {
728
+ font-size: 13px;
729
+ line-height: 18px;
730
+ color: gray;
731
+ }
732
+
733
+ .b2s-edit-template-image-preview .b2s-edit-template-preview-image-border-19 {
734
+ padding: 0px;
735
+ }
736
+
737
+ .b2s-edit-template-preview-content-19 {
738
+ margin: 15px 0px;
739
+ }
740
+
741
+ .b2s-login-form-label {
742
+ padding-top: 7px;
743
+ margin-top: 0;
744
+ margin-bottom: 0;
745
+ text-align: right;
746
+ font-weight: bold;
747
+ }
748
+
749
+ #b2s-auth-network-6-location, #b2s-auth-network-6-board {
750
+ max-width: 100% !important;
751
+ }
752
+
753
+ .b2s-edit-template-title {
754
+ display: inline;
755
+ }
756
+
757
+ .b2s-url-parameter-remove-btn {
758
+ font-weight: bold;
759
+ font-size: 18px;
760
+ line-height: 1.5;
761
+ cursor: pointer;
762
+ }
763
+
764
+ .b2s-url-parameter-legend-text {
765
+ font-size: 12px;
766
+ font-weight: 600;
767
+ letter-spacing: 0;
768
+ margin-top: 10px;
769
+ }
770
+
771
+ .b2s-url-parameter-content {
772
+ padding-top: 6px;
773
+ }
774
+
775
+ .b2s-add-network-continue-btn {
776
+ margin-top: 20px;
777
+ }
778
+
779
+ .b2s-edit-template-preview-border-6, b2s-edit-template-preview-image-6 {
780
+ border-radius: 10px;
781
+ }
782
+
783
+ .b2s-pl-0 {
784
+ padding-left: 0px;
785
+ }
786
+ .b2s-pr-0 {
787
+ padding-right: 0px;
788
+ }
789
+
790
+ .b2s-edit-template-preview-profile-img-6 {
791
+ width: 30px;
792
+ }
793
+
794
+ .b2s-edit-template-preview-profile-name-6 {
795
+ font-weight: bold;
796
+ }
797
+
798
+ .b2s-edit-template-preview-title-6 {
799
+ margin-top: 10px !important;
800
+ font-weight: bold;
801
+ }
802
+
803
+ .b2s-link-preview-17 {
804
+ border: 1px solid lightgray;
805
+ }
806
+
807
+ .b2s-edit-template-preview-link-link-17 {
808
+ color: gray;
809
+ }
810
+
811
+ .b2s-edit-template-preview-title-16 {
812
+ margin-top: 20px !important;
813
+ font-weight: bold;
814
+ }
815
+
816
+ .b2s-edit-template-preview-like-icons-7 {
817
+ float: right;
818
+ width: 150px;
819
+ }
820
+
821
+ .b2s-edit-template-preview-title-9 {
822
+ font-size: 18px;
823
+ font-weight: bold;
824
+ }
825
+
826
+ .b2s-edit-template-preview-link-9 {
827
+ color: gray;
828
+ }
829
+
830
+ .b2s-edit-template-preview-content-9 {
831
+ color: gray;
832
+ }
833
+
834
+ .b2s-edit-template-preview-title-14 {
835
+ font-weight: bold;
836
+ font-size: 18px;
837
+ }
838
+
839
+ .b2s-edit-template-preview-title-11 {
840
+ font-weight: bold;
841
+ font-size: 18px;
842
+ }
843
+
844
+ .b2s-edit-template-preview-title-15 {
845
+ font-weight: bold;
846
+ }
847
+
848
+ .b2s-edit-template-preview-profile-img-24 {
849
+ width: 30px;
850
+ border: 1px solid gray;
851
+ border-radius: 50%;
852
+ }
853
+
854
+ .b2s-edit-template-preview-inner-border-24 {
855
+ border: 1px solid gray;
856
+ border-radius: 5%;
857
+ }
858
+
859
+ .b2s-edit-template-preview-border-24, .b2s-edit-template-preview-image-border-24 {
860
+ padding: 10px;
861
+ }
862
+
863
+ .b2s-edit-template-preview-link-meta-box-24 {
864
+ margin-left: 16px;
865
+ padding-bottom: 10px;
866
+ border-left: 3px solid lightblue;
867
+ }
868
+
869
+ .b2s-auth-network-6-extension-download-area {
870
+ text-align: center;
871
+ }
872
+
873
+ .b2s-edit-template-preview-title-4 {
874
+ font-size: 16px;
875
+ padding-top: 10px;
876
+ }
877
+
878
+ .b2s-edit-template-preview-content-4 {
879
+ padding-top: 20px;
880
+ }
881
+
882
+ .b2s-edit-template-preview-link-4 {
883
+ padding-top: 10px;
884
+ padding-bottom: 10px;
885
+ text-decoration: underline;
886
+ }
887
+
888
+ .b2s-edit-template-preview-like-icons-4 {
889
+ float: right;
890
+ }
891
+
892
+ .b2s-edit-template-btn {
893
+ background-color: #eee !important;
894
+ }
895
+
896
+ .b2s-edit-template-preview-like-icons-27 {
897
+ width: 120px;
898
+ }
899
+
900
+ .b2s-edit-template-preview-image-image-27 {
901
+ margin-top: 10px;
902
+ }
903
+
904
+ #clr-picker {
905
+ z-index: 9999;
906
  }
assets/css/b2s/wp/post-box.css CHANGED
@@ -43,6 +43,8 @@
43
  .b2s-meta-box-headline{
44
  margin: 0.55em 0 !important;
45
  font-size: 1.08em !important;
 
 
46
  }
47
 
48
  .b2s-meta-box-auto-post-area{
43
  .b2s-meta-box-headline{
44
  margin: 0.55em 0 !important;
45
  font-size: 1.08em !important;
46
+ text-transform: none !important;
47
+ font-weight: 600 !important;
48
  }
49
 
50
  .b2s-meta-box-auto-post-area{
assets/images/metrics/banner.png ADDED
Binary file
assets/images/metrics/social-symbols.png ADDED
Binary file
assets/js/b2s/autopost.js CHANGED
@@ -7,6 +7,7 @@ jQuery(window).on("load", function () {
7
 
8
  jQuery(".b2s-import-auto-post-type").chosen();
9
  jQuery(".b2s-import-auto-post-categories").chosen();
 
10
  jQuery(".b2s-auto-post-assign-user").chosen();
11
 
12
  jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
@@ -163,6 +164,18 @@ jQuery(document).on('click', '.b2sAutoPostBestTimesInfoModalBtn', function () {
163
  jQuery(document).on('change', '.b2s-auto-post-area-toggle', function() {
164
  if(jQuery(this).is(':checked')) {
165
  jQuery('.b2s-auto-post-area[data-area-type="'+jQuery(this).data('area-type')+'"]').show();
 
 
 
 
 
 
 
 
 
 
 
 
166
  } else {
167
  jQuery('.b2s-auto-post-area[data-area-type="'+jQuery(this).data('area-type')+'"]').hide();
168
  }
7
 
8
  jQuery(".b2s-import-auto-post-type").chosen();
9
  jQuery(".b2s-import-auto-post-categories").chosen();
10
+ jQuery(".b2s-import-auto-post-taxonomies").chosen();
11
  jQuery(".b2s-auto-post-assign-user").chosen();
12
 
13
  jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
164
  jQuery(document).on('change', '.b2s-auto-post-area-toggle', function() {
165
  if(jQuery(this).is(':checked')) {
166
  jQuery('.b2s-auto-post-area[data-area-type="'+jQuery(this).data('area-type')+'"]').show();
167
+ if(jQuery(this).data('area-type') == 'manuell') {
168
+ if(jQuery('.b2s-autopost-m-show-modal').val() == '1') {
169
+ jQuery('#b2sAutoPostMInfoModal').modal('show');
170
+ jQuery('.b2s-autopost-m-show-modal').val('0');
171
+ }
172
+ }
173
+ if(jQuery(this).data('area-type') == 'import') {
174
+ if(jQuery('.b2s-autopost-a-show-modal').val() == '1') {
175
+ jQuery('#b2sAutoPostAInfoModal').modal('show');
176
+ jQuery('.b2s-autopost-a-show-modal').val('0');
177
+ }
178
+ }
179
  } else {
180
  jQuery('.b2s-auto-post-area[data-area-type="'+jQuery(this).data('area-type')+'"]').hide();
181
  }
assets/js/b2s/calendar.js CHANGED
@@ -1,956 +1,956 @@
1
- jQuery.noConflict();
2
-
3
- var curSource = new Array();
4
- curSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=all&filter_status=0&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
5
- var newSource = new Array();
6
-
7
- jQuery(document).ready(function () {
8
- jQuery('#b2s_calendar').fullCalendar({
9
- header: {
10
- left: 'title',
11
- right: 'today month,basicWeek, prev,next'
12
- },
13
- views: {
14
- month: {
15
- eventLimit: 2
16
- },
17
- basicWeek: {
18
- eventLimit: false
19
- }
20
- },
21
- editable: b2s_has_premium,
22
- locale: b2s_calendar_locale,
23
- timeFormat: 'H:mm',
24
- eventSources: [curSource[0]],
25
- eventRender: function (event, element) {
26
- show = true;
27
- $header = jQuery("<div>").addClass("b2s-calendar-header").attr('data-b2s-id', event.b2s_id);
28
- $isRelayPost = '';
29
- $isCuratedPost = '';
30
- $isRePost = '';
31
- if (event.post_type == 'b2s_ex_post') {
32
- $isCuratedPost = ' (Curated Post)';
33
- }
34
- if (event.relay_primary_post_id > 0) {
35
- $isRelayPost = ' (Retweet)';
36
- }
37
- if (event.b2s_sched_type == 5) {
38
- $isRePost = ' (Re-Share)';
39
- }
40
- $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost + $isRePost).addClass("network-name").css("display", "block");
41
- element.find(".fc-time").after($network_name);
42
- element.html(element.html());
43
- $parent = element.parent();
44
- $header.append(element.find(".fc-content"));
45
- element.append($header);
46
- $body = jQuery("<div>").addClass("b2s-calendar-body");
47
- $body.append(event.avatar);
48
- if (event.status == "error") {
49
- $body.append(jQuery('<i>').addClass('glyphicon glyphicon-warning-sign glyphicon-danger'));
50
- }
51
- $body.append(element.find(".fc-title"));
52
- $body.append(jQuery("<br>"));
53
- var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
54
- $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
55
- $em.append(event.network_name);
56
- $em.append(jQuery("<span>").text(": " + event.profile));
57
- $body.append($em);
58
- element.append($body);
59
- if (event.status != "scheduled") {
60
- event.editable = false;
61
- }
62
- },
63
- dayRender: function (date, element) {
64
- var view = jQuery('#b2s_calendar').fullCalendar('getView');
65
- if (!jQuery(element[0]).hasClass('fc-past')) {
66
- var date = jQuery(element[0]).attr('data-date');
67
- var sel_element = '';
68
- if (view.type == 'month') {
69
- sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
70
- } else {
71
- sel_element = jQuery('.fc-basicWeek-view').find('th[data-date="' + date + '"]');
72
- }
73
- $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddPost").val() + "</span>").addClass("b2s-calendar-sched-new-post-btn").attr('href', '#');
74
- sel_element.append($header);
75
- }
76
-
77
- },
78
- eventDrop: function (event, delta, revertFunc) {
79
- jQuery.ajax({
80
- url: ajaxurl,
81
- type: "POST",
82
- dataType: "json",
83
- cache: false,
84
- data: {
85
- 'action': 'b2s_calendar_move_post',
86
- 'b2s_id': event.b2s_id,
87
- 'user_timezone': event.user_timezone,
88
- 'sched_date': event.start.format(),
89
- 'post_for_relay': event.post_for_relay,
90
- 'post_for_approve': event.post_for_approve,
91
- 'network_type': event.network_type,
92
- 'nework_id': event.network_id,
93
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
94
- },
95
- success: function (data) {
96
- refreshCalender();
97
- wp.heartbeat.connectNow();
98
- }
99
- });
100
- },
101
- eventAllow: function (dropLocation, draggedEvent) {
102
- return dropLocation.start.isAfter(b2s_calendar_date) && draggedEvent.start.isAfter(b2s_calendar_datetime);
103
- },
104
- eventClick: function (calEvent, jsEvent, view) {
105
- if (calEvent.status == "scheduled") {
106
- showEditSchedCalendarPost(calEvent.b2s_id, calEvent.post_id, calEvent.network_auth_id, calEvent.network_type, calEvent.network_id, calEvent.post_format, calEvent.relay_primary_post_id);
107
- } else {
108
- if (calEvent.publish_link != "") {
109
- window.open(calEvent.publish_link, '_blank');
110
- } else {
111
- if(calEvent.errorText != null && calEvent.errorText != "") {
112
- jQuery('.b2s-error-text').html(calEvent.errorText);
113
- jQuery('#b2s-show-error-modal').modal('show');
114
- }
115
- }
116
- }
117
- },
118
- loading: function (bool) {
119
- if (!bool) {
120
- //Routing from Dashboard - loading edit post preview
121
- var rfd = jQuery('#b2s_rfd').val();
122
- if (rfd == 1) {
123
- jQuery('#b2s_rfd').val("0");
124
- jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
125
- }
126
- }
127
- }
128
-
129
- });
130
- jQuery(".b2s-loading-area").hide();
131
- });
132
-
133
-
134
- function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
135
- if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
136
- {
137
- jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
138
- }
139
- b2s_current_post_id = post_id;
140
- jQuery("#b2sPostId").val(post_id);
141
- var $modal = jQuery("<div>");
142
- jQuery.ajax({
143
- url: ajaxurl,
144
- type: "POST",
145
- cache: false,
146
- async: false,
147
- data: {
148
- 'action': 'b2s_get_post_edit_modal',
149
- 'id': b2s_id,
150
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
151
- },
152
- success: function (data) {
153
- if (data.error == 'nonce') {
154
- jQuery('.b2s-nonce-check-fail').show();
155
- } else {
156
- $modal = $modal.html(data);
157
- }
158
- }
159
- });
160
- jQuery("body").append($modal);
161
- jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
162
- jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
163
- activatePortal(network_auth_id);
164
- initSceditor(network_auth_id);
165
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
166
- var postFormatText = b2s_calendar_formats;
167
- var isSetPostFormat = false;
168
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
169
- //is set post format => override current condidtions by user settings for this post
170
- if (post_format !== null) {
171
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
172
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
173
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
174
- //edit modal select post format
175
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
176
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"][data-post-format="' + post_format + '"]').addClass('b2s-settings-checked');
177
- } else {
178
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val()]);
179
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val());
180
- }
181
-
182
- //if linkpost then show btn meta tags
183
- var isMetaChecked = false;
184
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
185
- if (typeof network_id != 'undefined' && jQuery.inArray(network_id.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
186
- isMetaChecked = true;
187
- }
188
- if ((network_id == "2" || network_id == "24") && jQuery('#isCardMetaChecked').val() == "1") {
189
- isMetaChecked = true;
190
- }
191
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
192
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
193
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
194
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
195
- //jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
196
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
197
- if (dataMetaType == "og") {
198
- jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
199
- } else {
200
- jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
201
- }
202
- } else {
203
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
204
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
205
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
206
- }
207
-
208
- //Content Curation
209
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
210
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
211
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
212
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
213
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
214
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
215
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
216
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
217
- } else {
218
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
219
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
220
- }
221
- }
222
- }
223
- var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + network_auth_id + '"]').attr('data-network-text-limit');
224
- if (textLimit != "0") {
225
- networkLimitAll(network_auth_id, network_id, textLimit);
226
- } else {
227
- networkCount(network_auth_id);
228
- }
229
- var today = new Date();
230
- var dateFormat = "yyyy-mm-dd";
231
- var language = "en";
232
- var showMeridian = true;
233
- if (jQuery('#b2sUserLang').val() == "de") {
234
- dateFormat = "dd.mm.yyyy";
235
- language = "de";
236
- }
237
- if (jQuery('#b2sUserTimeFormat').val() == 0) {
238
- showMeridian = false;
239
- }
240
-
241
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
242
- format: dateFormat,
243
- language: language,
244
- maxViewMode: 2,
245
- todayHighlight: true,
246
- startDate: today,
247
- calendarWeeks: true,
248
- autoclose: true
249
- });
250
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
251
- minuteStep: 15,
252
- appendWidgetTo: 'body',
253
- showSeconds: false,
254
- showMeridian: showMeridian,
255
- defaultTime: 'current',
256
- snapToStep: true
257
- });
258
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
259
- checkSchedDateTime(network_auth_id);
260
- });
261
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
262
- checkSchedDateTime(network_auth_id);
263
- });
264
- init();
265
-
266
- //is relay post?
267
- if (relay_primary_post_id > 0) {
268
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
269
- if (!jQuery(this).hasClass('b2s-input-hidden') && !jQuery(this).hasClass('b2s-modal-close') && !jQuery(this).hasClass('b2s-post-item-details-relay-input-delay') && !jQuery(this).hasClass('b2s-edit-post-delete') && !jQuery(this).hasClass('b2s-edit-post-save-this')) {
270
- jQuery(this).prop("disabled", true);
271
- }
272
- });
273
- }
274
-
275
- if (!b2s_has_premium)
276
- {
277
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
278
- if (!jQuery(this).hasClass('b2s-modal-close')) {
279
- jQuery(this).prop("disabled", true);
280
- }
281
- });
282
- }
283
- }
284
-
285
- jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
286
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
287
- newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
288
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
289
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
290
- curSource[0] = newSource[0];
291
-
292
- jQuery('.b2s-calendar-filter-network-account-list').html("");
293
- jQuery('.b2s-calendar-filter-network-account-list').hide();
294
- if (jQuery(this).val() != 'all') {
295
- jQuery.ajax({
296
- url: ajaxurl,
297
- type: "POST",
298
- dataType: "json",
299
- cache: false,
300
- async: false,
301
- data: {
302
- 'action': 'b2s_get_calendar_filter_network_auth',
303
- 'network_id': jQuery(this).val(),
304
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
305
- },
306
- success: function (data) {
307
- if (data.result == true) {
308
- jQuery(".b2s-calendar-filter-network-account-list").show();
309
- jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
310
- } else {
311
- if (data.error == 'nonce') {
312
- jQuery('.b2s-nonce-check-fail').show();
313
- }
314
- }
315
- }
316
- });
317
- }
318
- return false;
319
- });
320
-
321
-
322
- jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
323
- var filter_network_details_auth_id = jQuery(this).val();
324
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
325
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
326
- newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
327
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
328
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
329
- curSource[0] = newSource[0];
330
-
331
- return false;
332
-
333
- });
334
-
335
- jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
336
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
337
- var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
338
- if (typeof filter_network_details_auth_id == 'undefined') {
339
- filter_network_details_auth_id = 'all';
340
- }
341
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
342
- newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
343
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
344
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
345
- curSource[0] = newSource[0];
346
-
347
- return false;
348
-
349
- });
350
-
351
-
352
- //Modal Edit Post close
353
- jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
354
- jQuery(jQuery(this).attr('data-modal-name')).remove();
355
- return false;
356
- });
357
-
358
-
359
- jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
360
- jQuery('#b2sPagination').val("1");
361
- b2sSortFormSubmit();
362
- return false;
363
- });
364
-
365
- jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
366
- if (event.keyCode == 13) { //Hide Enter
367
- return false;
368
- }
369
- });
370
-
371
- jQuery(document).on('click', '.b2s-pagination-btn', function () {
372
- jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
373
- b2sSortFormSubmit();
374
- return false;
375
- });
376
-
377
- jQuery(document).on('change', '.b2s-select', function () {
378
- jQuery('#b2sPagination').val("1");
379
- b2sSortFormSubmit();
380
- return false;
381
- });
382
-
383
- jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
384
- jQuery('#b2sPagination').val("1");
385
- jQuery('#b2sSortPostTitle').val("");
386
- jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
387
- jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
388
- jQuery('#b2sSortPostType').prop('selectedIndex', 0);
389
- jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
390
- jQuery('#b2sShowByDate').val("");
391
- jQuery('#b2sUserAuthId').val("");
392
- jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
393
- jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
394
- b2sSortFormSubmit();
395
- return false;
396
- });
397
-
398
- jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
399
- if (jQuery('#user_version').val() == 0) {
400
- jQuery('#b2s-sched-post-modal').modal('show');
401
- return false;
402
- }
403
- jQuery('#b2s-show-post-type-modal').modal('show');
404
- var view = jQuery('#b2s_calendar').fullCalendar('getView');
405
- var selSchedDate;
406
- if (view.type == 'month') {
407
- selSchedDate = jQuery(this).parent('td').attr('data-date');
408
- } else {
409
- selSchedDate = jQuery(this).parent('th').attr('data-date');
410
- }
411
- jQuery('#b2sSelSchedDate').val(selSchedDate);
412
- return false;
413
- });
414
-
415
- jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
416
- jQuery('#b2s-show-post-type-modal').modal('hide');
417
- jQuery('#b2s-show-post-all-modal').modal('show');
418
- if (!jQuery('#b2sSelSchedDate').length > 0) {
419
- jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
420
- }
421
- b2sSortFormSubmit();
422
- return false;
423
- });
424
-
425
- jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
426
- window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
427
- return false;
428
- });
429
-
430
- function showFilter(typ) {
431
- if (typ == 'show') {
432
- jQuery('.filterShow').hide();
433
- jQuery('.form-inline').show();
434
- jQuery('.filterHide').show();
435
- } else {
436
- jQuery('.filterShow').show();
437
- jQuery('.form-inline').hide();
438
- jQuery('.filterHide').hide();
439
- }
440
- }
441
-
442
- //b2sSortForm
443
- function b2sSortFormSubmit() {
444
- jQuery(".b2s-loading-area").show();
445
- jQuery('.b2s-sort-result-item-area').html('');
446
- jQuery('.b2s-sort-pagination-area').html('');
447
-
448
- var data = {
449
- 'action': 'b2s_sort_data',
450
- 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
451
- 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
452
- 'b2sSortPostSharedBy': jQuery('#b2sSortPostSharedBy').val(),
453
- 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
454
- 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
455
- 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
456
- 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
457
- 'b2sType': jQuery('#b2sType').val(),
458
- 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
459
- 'b2sPagination': jQuery('#b2sPagination').val(),
460
- 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
461
- 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
462
- 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
463
- 'b2sSortPostShareStatus': jQuery('#b2sSortPostShareStatus').val(),
464
- 'b2sUserLang': jQuery('#b2sUserLang').val(),
465
- 'b2sSchedDate': jQuery('#b2sSelSchedDate').val(),
466
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
467
- };
468
-
469
- if (jQuery('#b2sPostsPerPage').length > 0) {
470
- data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
471
- }
472
-
473
- jQuery.ajax({
474
- url: ajaxurl,
475
- type: "POST",
476
- dataType: "json",
477
- cache: false,
478
- data: data,
479
- error: function () {
480
- jQuery('.b2s-server-connection-fail').show();
481
- return false;
482
- },
483
- success: function (data) {
484
- if (typeof data === 'undefined' || data === null) {
485
- jQuery('.b2s-server-connection-fail').show();
486
- return false;
487
- }
488
- if (data.result == true) {
489
- jQuery('.b2s-loading-area').hide();
490
- jQuery('.b2s-sort-result-item-area').html(data.content).show();
491
- jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
492
- } else {
493
- if (data.error == 'nonce') {
494
- jQuery('.b2s-nonce-check-fail').show();
495
- } else {
496
- jQuery('.b2s-server-connection-fail').show();
497
- }
498
- return false;
499
- }
500
- }
501
- });
502
- return false;
503
- }
504
- //Overlay second modal
505
- jQuery('#b2s-show-post-all-modal').on('shown.bs.modal', function () {
506
- jQuery('body').addClass('modal-open');
507
- });
508
-
509
- //Overlay second modal
510
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
511
- jQuery('body').addClass('modal-open');
512
- });
513
-
514
- //Overlay second modal
515
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
516
- jQuery('body').addClass('modal-open');
517
- });
518
-
519
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
520
- jQuery('.b2s-network-select-image-content').html("");
521
- jQuery.ajax({
522
- url: ajaxurl,
523
- type: "POST",
524
- cache: false,
525
- async: false,
526
- data: {
527
- 'action': 'b2s_get_image_modal',
528
- 'id': jQuery(this).data('post-id'),
529
- 'image_url': jQuery(this).data('image-url'),
530
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
531
- },
532
- success: function (data) {
533
- if (data.error == 'nonce') {
534
- jQuery('.b2s-nonce-check-fail').show();
535
- } else {
536
- jQuery(".b2s-network-select-image-content").html(data);
537
- }
538
- }
539
- });
540
- var authId = jQuery(this).data('network-auth-id');
541
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
542
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
543
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
544
- jQuery('.b2s-selected-network-for-image-info').html(content);
545
- jQuery('#b2sInsertImageType').val("0");
546
- jQuery('.networkImage').each(function () {
547
- var width = this.naturalWidth;
548
- var height = this.naturalHeight;
549
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
550
- });
551
- jQuery('#b2s-network-select-image').modal('show');
552
- return false;
553
- });
554
- jQuery(document).on("click", ".b2s-edit-post-delete", function () {
555
- var id = jQuery(this).data("b2s-id");
556
- var post_id = jQuery(this).data("post-id");
557
- var post_for_relay = jQuery(this).data("data-post-for-relay");
558
- var post_for_approve = jQuery(this).data("data-post-for-approve");
559
- jQuery.ajax({
560
- url: ajaxurl,
561
- type: "POST",
562
- dataType: "json",
563
- cache: false,
564
- data: {
565
- 'action': 'b2s_delete_post',
566
- 'b2s_id': id,
567
- 'post_id': post_id,
568
- 'post_for_relay': post_for_relay,
569
- 'post_for_approve': post_for_approve,
570
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
571
- },
572
- success: function (data) {
573
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
574
- refreshCalender();
575
- wp.heartbeat.connectNow();
576
- }
577
- });
578
- });
579
-
580
- /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
581
- jQuery('#save_method').val("apply-all");
582
- e.preventDefault();
583
- var id = jQuery(this).data("b2s-id");
584
- jQuery.ajax({
585
- url: ajaxurl,
586
- type: "POST",
587
- dataType: "json",
588
- cache: false,
589
- data: jQuery(this).closest("form").serialize(),
590
- success: function (data) {
591
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
592
- refreshCalender();
593
- jQuery('#b2s-edit-event-modal-' + id).remove();
594
- wp.heartbeat.connectNow();
595
- }
596
- });
597
- });*/
598
-
599
- jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
600
- e.preventDefault();
601
- jQuery('#save_method').val("apply-this");
602
- var id = jQuery(this).data("b2s-id");
603
- jQuery.ajax({
604
- url: ajaxurl,
605
- type: "POST",
606
- dataType: "json",
607
- cache: false,
608
- data: jQuery(this).closest("form").serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
609
- success: function (data) {
610
- if (data.error == 'nonce') {
611
- jQuery('.b2s-nonce-check-fail').show();
612
- }
613
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
614
- refreshCalender();
615
- jQuery('#b2s-edit-event-modal-' + id).remove();
616
- jQuery('body').removeClass('modal-open');
617
- jQuery('body').removeAttr('style');
618
- wp.heartbeat.connectNow();
619
- }
620
- });
621
- });
622
- jQuery(document).on("click", ".release_locks", function () {
623
- jQuery.ajax({
624
- url: ajaxurl,
625
- type: "POST",
626
- cache: false,
627
- async: false,
628
- data: {
629
- 'action': 'b2s_get_calendar_release_locks',
630
- 'post_id': jQuery('#post_id').val(),
631
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
632
- },
633
- success: function (data) {
634
- if (data.error == 'nonce') {
635
- jQuery('.b2s-nonce-check-fail').show();
636
- }
637
- wp.heartbeat.connectNow();
638
- }
639
- });
640
- });
641
- function refreshCalender() {
642
- jQuery('#b2s_calendar').fullCalendar('refetchEvents');
643
- }
644
-
645
- jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
646
- jQuery('body').addClass('modal-open');
647
- });
648
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
649
- jQuery('body').addClass('modal-open');
650
- });
651
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
652
- jQuery('body').addClass('modal-open');
653
- });
654
- jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
655
- jQuery('body').addClass('modal-open');
656
- });
657
- //jQuery(this).attr('data-network-auth-id')
658
- function checkSchedDateTime(dataNetworkAuthId) {
659
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
660
- var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
661
- var dateStr = jQuery(dateElement).val();
662
- var minStr = jQuery(timeElement).val();
663
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
664
- if (jQuery('#b2sUserLang').val() == 'de') {
665
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
666
- } else {
667
- var minParts = minStr.split(' ');
668
- var minParts2 = minParts[0].split(':');
669
- if (minParts[1] == 'PM') {
670
- minParts2[0] = parseInt(minParts2[0]) + 12;
671
- }
672
- minStr = minParts2[0] + ':' + minParts2[1];
673
- }
674
-
675
- var minParts3 = minStr.split(':');
676
- if (minParts3[0] < 10) {
677
- minParts3[0] = '0' + minParts3[0];
678
- }
679
- var dateParts = dateStr.split('-');
680
- //utc current time
681
- var now = new Date();
682
- //offset between utc und user
683
- var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
684
- //enter hour to user time
685
- var hour = parseInt(minParts3[0]) + timeZone + offset;
686
- //calculate datetime in utc
687
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
688
- //compare enter date time with allowed user time
689
- if (enter.getTime() < now.getTime()) {
690
- //enter set on next 15 minutes and calculate on user timezone
691
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
692
- jQuery(dateElement).datepicker('update', enter);
693
- jQuery(timeElement).timepicker('setTime', enter);
694
- }
695
- }
696
-
697
-
698
- function printDateFormat(dataNetworkAuthId) {
699
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
700
- var dateStr = jQuery(dateElement).val();
701
- dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
702
- jQuery(dateElement).val(dateStr);
703
- }
704
-
705
- jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
706
- jQuery('.b2s-server-connection-fail').hide();
707
- jQuery.ajax({
708
- url: ajaxurl,
709
- type: "POST",
710
- dataType: "json",
711
- cache: false,
712
- data: {
713
- 'action': 'b2s_get_settings_sched_time_default',
714
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
715
- },
716
- error: function () {
717
- jQuery('.b2s-server-connection-fail').show();
718
- return false;
719
- },
720
- success: function (data) {
721
- if (data.result == true) {
722
- var tomorrow = new Date();
723
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
724
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
725
- }
726
- tomorrow.setDate(tomorrow.getDate() + 1);
727
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
728
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
729
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
730
- var today = new Date();
731
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
732
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
733
- }
734
-
735
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
736
- var todayDate = ("0" + today.getDate()).slice(-2);
737
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
738
- var lang = jQuery('#b2sUserLang').val();
739
- if (lang == "de") {
740
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
741
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
742
- }
743
-
744
- jQuery.each(data.times, function (network_id, time) {
745
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
746
- time.forEach(function (network_type_time, count) {
747
- if (network_type_time != "") {
748
-
749
-
750
- var hours = network_type_time.substring(0, 2);
751
- if (lang == "en") {
752
- var timeparts = network_type_time.split(' ');
753
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
754
- }
755
- if (hours < today.getHours()) {
756
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
757
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
758
- } else {
759
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
760
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
761
- }
762
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
763
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
764
-
765
- count++;
766
- }
767
- });
768
- }
769
- });
770
- } else {
771
- if (data.error == 'nonce') {
772
- jQuery('.b2s-nonce-check-fail').show();
773
- }
774
- }
775
- }
776
- });
777
- return false;
778
- });
779
-
780
-
781
-
782
- jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
783
- jQuery('.b2s-server-connection-fail').hide();
784
- jQuery.ajax({
785
- url: ajaxurl,
786
- type: "POST",
787
- dataType: "json",
788
- cache: false,
789
- data: {
790
- 'action': 'b2s_get_settings_sched_time_user',
791
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
792
- },
793
- error: function () {
794
- jQuery('.b2s-server-connection-fail').show();
795
- return false;
796
- },
797
- success: function (data) {
798
- var tomorrow = new Date();
799
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
800
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
801
- }
802
-
803
- tomorrow.setDate(tomorrow.getDate() + 1);
804
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
805
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
806
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
807
- var today = new Date();
808
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
809
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
810
- }
811
-
812
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
813
- var todayDate = ("0" + today.getDate()).slice(-2);
814
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
815
- var lang = jQuery('#b2sUserLang').val();
816
- if (lang == "de") {
817
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
818
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
819
- }
820
- if (data.result == true) {
821
- //V5.1.0 seeding
822
- if (data.type == 'new') {
823
- //new
824
- jQuery.each(data.times, function (network_auth_id, time) {
825
- if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
826
- //is not set special dates
827
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
828
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
829
- }
830
- var hours = time.substring(0, 2);
831
- var timeparts = time.split(' ');
832
- if (typeof timeparts[1] != 'undefined') {
833
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
834
- }
835
-
836
- var isDelay = false;
837
- var delayDay = data.delay_day[network_auth_id];
838
- if (delayDay != undefined) {
839
- if (delayDay > 0) {
840
- var delay = new Date();
841
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
842
- delay.setTime(jQuery('#b2sBlogPostSchedDate').val());
843
- }
844
- delay.setDate(delay.getDate() + parseInt(delayDay));
845
- var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
846
- var delayDate = ("0" + delay.getDate()).slice(-2);
847
- var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
848
- if (lang == 'de') {
849
- dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
850
- }
851
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
852
- isDelay = true;
853
-
854
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
855
- }
856
- }
857
- if (!isDelay) {
858
- if (hours < today.getHours()) {
859
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
860
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
861
- } else {
862
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
863
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
864
- }
865
- }
866
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
867
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').timepicker('setTime', new Date(today.getFullYear(), today.getMonth(), today.getDate(), hours, time.slice(3, 5)));
868
- }
869
- });
870
- } else {
871
- //old
872
- jQuery.each(data.times, function (network_id, time) {
873
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
874
- time.forEach(function (network_type_time, count) {
875
- if (network_type_time != "") {
876
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
877
- //is not set special dates
878
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() != '1') {
879
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
880
- }
881
- var hours = network_type_time.substring(0, 2);
882
- if (lang == "en") {
883
- var timeparts = network_type_time.split(' ');
884
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
885
- }
886
- if (hours < today.getHours()) {
887
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
888
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
889
- } else {
890
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
891
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
892
- }
893
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
894
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
895
- count++;
896
- }
897
- });
898
- }
899
- });
900
- }
901
- } else {
902
- if (data.error == 'nonce') {
903
- jQuery('.b2s-nonce-check-fail').show();
904
- }
905
- //default load best Times
906
- //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
907
- //set current time
908
- jQuery('.b2s-post-item:visible').each(function () {
909
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
910
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
911
- //is not set special dates
912
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
913
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
914
- }
915
- }
916
- });
917
- }
918
- }
919
- });
920
- return false;
921
- });
922
-
923
- jQuery(document).on('click', '.b2s-add-multi-image', function() {
924
- jQuery('.b2s-network-select-image-content').html("");
925
- jQuery.ajax({
926
- url: ajaxurl,
927
- type: "POST",
928
- cache: false,
929
- async: false,
930
- data: {
931
- 'action': 'b2s_get_image_modal',
932
- 'id': jQuery('#post_id').val(),
933
- 'image_url': jQuery(this).data('image-url'),
934
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
935
- },
936
- success: function (data) {
937
- if (data.error == 'nonce') {
938
- jQuery('.b2s-nonce-check-fail').show();
939
- } else {
940
- jQuery(".b2s-network-select-image-content").html(data);
941
- }
942
- }
943
- });
944
- var authId = jQuery(this).data('network-auth-id');
945
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
946
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
947
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
948
- jQuery('.b2s-selected-network-for-image-info').html(content);
949
- jQuery('#b2sInsertImageType').val("0");
950
- jQuery('.networkImage').each(function () {
951
- var width = this.naturalWidth;
952
- var height = this.naturalHeight;
953
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
954
- });
955
- jQuery('#b2s-network-select-image').modal('show');
956
  });
1
+ jQuery.noConflict();
2
+
3
+ var curSource = new Array();
4
+ curSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=all&filter_status=0&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
5
+ var newSource = new Array();
6
+
7
+ jQuery(document).ready(function () {
8
+ jQuery('#b2s_calendar').fullCalendar({
9
+ header: {
10
+ left: 'title',
11
+ right: 'today month,basicWeek, prev,next'
12
+ },
13
+ views: {
14
+ month: {
15
+ eventLimit: 2
16
+ },
17
+ basicWeek: {
18
+ eventLimit: false
19
+ }
20
+ },
21
+ editable: b2s_has_premium,
22
+ locale: b2s_calendar_locale,
23
+ timeFormat: 'H:mm',
24
+ eventSources: [curSource[0]],
25
+ eventRender: function (event, element) {
26
+ show = true;
27
+ $header = jQuery("<div>").addClass("b2s-calendar-header").attr('data-b2s-id', event.b2s_id);
28
+ $isRelayPost = '';
29
+ $isCuratedPost = '';
30
+ $isRePost = '';
31
+ if (event.post_type == 'b2s_ex_post') {
32
+ $isCuratedPost = ' (Curated Post)';
33
+ }
34
+ if (event.relay_primary_post_id > 0) {
35
+ $isRelayPost = ' (Retweet)';
36
+ }
37
+ if (event.b2s_sched_type == 5) {
38
+ $isRePost = ' (Re-Share)';
39
+ }
40
+ $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost + $isRePost).addClass("network-name").css("display", "block");
41
+ element.find(".fc-time").after($network_name);
42
+ element.html(element.html());
43
+ $parent = element.parent();
44
+ $header.append(element.find(".fc-content"));
45
+ element.append($header);
46
+ $body = jQuery("<div>").addClass("b2s-calendar-body");
47
+ $body.append(event.avatar);
48
+ if (event.status == "error") {
49
+ $body.append(jQuery('<i>').addClass('glyphicon glyphicon-warning-sign glyphicon-danger'));
50
+ }
51
+ $body.append(element.find(".fc-title"));
52
+ $body.append(jQuery("<br>"));
53
+ var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
54
+ $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
55
+ $em.append(event.network_name);
56
+ $em.append(jQuery("<span>").text(": " + event.profile));
57
+ $body.append($em);
58
+ element.append($body);
59
+ if (event.status != "scheduled") {
60
+ event.editable = false;
61
+ }
62
+ },
63
+ dayRender: function (date, element) {
64
+ var view = jQuery('#b2s_calendar').fullCalendar('getView');
65
+ if (!jQuery(element[0]).hasClass('fc-past')) {
66
+ var date = jQuery(element[0]).attr('data-date');
67
+ var sel_element = '';
68
+ if (view.type == 'month') {
69
+ sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
70
+ } else {
71
+ sel_element = jQuery('.fc-basicWeek-view').find('th[data-date="' + date + '"]');
72
+ }
73
+ $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddPost").val() + "</span>").addClass("b2s-calendar-sched-new-post-btn").attr('href', '#');
74
+ sel_element.append($header);
75
+ }
76
+
77
+ },
78
+ eventDrop: function (event, delta, revertFunc) {
79
+ jQuery.ajax({
80
+ url: ajaxurl,
81
+ type: "POST",
82
+ dataType: "json",
83
+ cache: false,
84
+ data: {
85
+ 'action': 'b2s_calendar_move_post',
86
+ 'b2s_id': event.b2s_id,
87
+ 'user_timezone': event.user_timezone,
88
+ 'sched_date': event.start.format(),
89
+ 'post_for_relay': event.post_for_relay,
90
+ 'post_for_approve': event.post_for_approve,
91
+ 'network_type': event.network_type,
92
+ 'nework_id': event.network_id,
93
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
94
+ },
95
+ success: function (data) {
96
+ refreshCalender();
97
+ wp.heartbeat.connectNow();
98
+ }
99
+ });
100
+ },
101
+ eventAllow: function (dropLocation, draggedEvent) {
102
+ return dropLocation.start.isAfter(b2s_calendar_date) && draggedEvent.start.isAfter(b2s_calendar_datetime);
103
+ },
104
+ eventClick: function (calEvent, jsEvent, view) {
105
+ if (calEvent.status == "scheduled") {
106
+ showEditSchedCalendarPost(calEvent.b2s_id, calEvent.post_id, calEvent.network_auth_id, calEvent.network_type, calEvent.network_id, calEvent.post_format, calEvent.relay_primary_post_id);
107
+ } else {
108
+ if (calEvent.publish_link != "") {
109
+ window.open(calEvent.publish_link, '_blank');
110
+ } else {
111
+ if(calEvent.errorText != null && calEvent.errorText != "") {
112
+ jQuery('.b2s-error-text').html(calEvent.errorText);
113
+ jQuery('#b2s-show-error-modal').modal('show');
114
+ }
115
+ }
116
+ }
117
+ },
118
+ loading: function (bool) {
119
+ if (!bool) {
120
+ //Routing from Dashboard - loading edit post preview
121
+ var rfd = jQuery('#b2s_rfd').val();
122
+ if (rfd == 1) {
123
+ jQuery('#b2s_rfd').val("0");
124
+ jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
125
+ }
126
+ }
127
+ }
128
+
129
+ });
130
+ jQuery(".b2s-loading-area").hide();
131
+ });
132
+
133
+
134
+ function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
135
+ if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
136
+ {
137
+ jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
138
+ }
139
+ b2s_current_post_id = post_id;
140
+ jQuery("#b2sPostId").val(post_id);
141
+ var $modal = jQuery("<div>");
142
+ jQuery.ajax({
143
+ url: ajaxurl,
144
+ type: "POST",
145
+ cache: false,
146
+ async: false,
147
+ data: {
148
+ 'action': 'b2s_get_post_edit_modal',
149
+ 'id': b2s_id,
150
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
151
+ },
152
+ success: function (data) {
153
+ if (data.error == 'nonce') {
154
+ jQuery('.b2s-nonce-check-fail').show();
155
+ } else {
156
+ $modal = $modal.html(data);
157
+ }
158
+ }
159
+ });
160
+ jQuery("body").append($modal);
161
+ jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
162
+ jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
163
+ activatePortal(network_auth_id);
164
+ initSceditor(network_auth_id);
165
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
166
+ var postFormatText = b2s_calendar_formats;
167
+ var isSetPostFormat = false;
168
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
169
+ //is set post format => override current condidtions by user settings for this post
170
+ if (post_format !== null) {
171
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
172
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
173
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
174
+ //edit modal select post format
175
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
176
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"][data-post-format="' + post_format + '"]').addClass('b2s-settings-checked');
177
+ } else {
178
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val()]);
179
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val());
180
+ }
181
+
182
+ //if linkpost then show btn meta tags
183
+ var isMetaChecked = false;
184
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
185
+ if (typeof network_id != 'undefined' && jQuery.inArray(network_id.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
186
+ isMetaChecked = true;
187
+ }
188
+ if ((network_id == "2" || network_id == "24") && jQuery('#isCardMetaChecked').val() == "1") {
189
+ isMetaChecked = true;
190
+ }
191
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
192
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
193
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
194
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
195
+ //jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
196
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
197
+ if (dataMetaType == "og") {
198
+ jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
199
+ } else {
200
+ jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
201
+ }
202
+ } else {
203
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
204
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
205
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
206
+ }
207
+
208
+ //Content Curation
209
+ if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
210
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
211
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
212
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
213
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
214
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
215
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
216
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
217
+ } else {
218
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
219
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
220
+ }
221
+ }
222
+ }
223
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + network_auth_id + '"]').attr('data-network-text-limit');
224
+ if (textLimit != "0") {
225
+ networkLimitAll(network_auth_id, network_id, textLimit);
226
+ } else {
227
+ networkCount(network_auth_id);
228
+ }
229
+ var today = new Date();
230
+ var dateFormat = "yyyy-mm-dd";
231
+ var language = "en";
232
+ var showMeridian = true;
233
+ if (jQuery('#b2sUserLang').val() == "de") {
234
+ dateFormat = "dd.mm.yyyy";
235
+ language = "de";
236
+ }
237
+ if (jQuery('#b2sUserTimeFormat').val() == 0) {
238
+ showMeridian = false;
239
+ }
240
+
241
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
242
+ format: dateFormat,
243
+ language: language,
244
+ maxViewMode: 2,
245
+ todayHighlight: true,
246
+ startDate: today,
247
+ calendarWeeks: true,
248
+ autoclose: true
249
+ });
250
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
251
+ minuteStep: 15,
252
+ appendWidgetTo: 'body',
253
+ showSeconds: false,
254
+ showMeridian: showMeridian,
255
+ defaultTime: 'current',
256
+ snapToStep: true
257
+ });
258
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
259
+ checkSchedDateTime(network_auth_id);
260
+ });
261
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
262
+ checkSchedDateTime(network_auth_id);
263
+ });
264
+ init();
265
+
266
+ //is relay post?
267
+ if (relay_primary_post_id > 0) {
268
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
269
+ if (!jQuery(this).hasClass('b2s-input-hidden') && !jQuery(this).hasClass('b2s-modal-close') && !jQuery(this).hasClass('b2s-post-item-details-relay-input-delay') && !jQuery(this).hasClass('b2s-edit-post-delete') && !jQuery(this).hasClass('b2s-edit-post-save-this')) {
270
+ jQuery(this).prop("disabled", true);
271
+ }
272
+ });
273
+ }
274
+
275
+ if (!b2s_has_premium)
276
+ {
277
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
278
+ if (!jQuery(this).hasClass('b2s-modal-close')) {
279
+ jQuery(this).prop("disabled", true);
280
+ }
281
+ });
282
+ }
283
+ }
284
+
285
+ jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
286
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
287
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
288
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
289
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
290
+ curSource[0] = newSource[0];
291
+
292
+ jQuery('.b2s-calendar-filter-network-account-list').html("");
293
+ jQuery('.b2s-calendar-filter-network-account-list').hide();
294
+ if (jQuery(this).val() != 'all') {
295
+ jQuery.ajax({
296
+ url: ajaxurl,
297
+ type: "POST",
298
+ dataType: "json",
299
+ cache: false,
300
+ async: false,
301
+ data: {
302
+ 'action': 'b2s_get_calendar_filter_network_auth',
303
+ 'network_id': jQuery(this).val(),
304
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
305
+ },
306
+ success: function (data) {
307
+ if (data.result == true) {
308
+ jQuery(".b2s-calendar-filter-network-account-list").show();
309
+ jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
310
+ } else {
311
+ if (data.error == 'nonce') {
312
+ jQuery('.b2s-nonce-check-fail').show();
313
+ }
314
+ }
315
+ }
316
+ });
317
+ }
318
+ return false;
319
+ });
320
+
321
+
322
+ jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
323
+ var filter_network_details_auth_id = jQuery(this).val();
324
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
325
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
326
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
327
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
328
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
329
+ curSource[0] = newSource[0];
330
+
331
+ return false;
332
+
333
+ });
334
+
335
+ jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
336
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
337
+ var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
338
+ if (typeof filter_network_details_auth_id == 'undefined') {
339
+ filter_network_details_auth_id = 'all';
340
+ }
341
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
342
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
343
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
344
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
345
+ curSource[0] = newSource[0];
346
+
347
+ return false;
348
+
349
+ });
350
+
351
+
352
+ //Modal Edit Post close
353
+ jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
354
+ jQuery(jQuery(this).attr('data-modal-name')).remove();
355
+ return false;
356
+ });
357
+
358
+
359
+ jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
360
+ jQuery('#b2sPagination').val("1");
361
+ b2sSortFormSubmit();
362
+ return false;
363
+ });
364
+
365
+ jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
366
+ if (event.keyCode == 13) { //Hide Enter
367
+ return false;
368
+ }
369
+ });
370
+
371
+ jQuery(document).on('click', '.b2s-pagination-btn', function () {
372
+ jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
373
+ b2sSortFormSubmit();
374
+ return false;
375
+ });
376
+
377
+ jQuery(document).on('change', '.b2s-select', function () {
378
+ jQuery('#b2sPagination').val("1");
379
+ b2sSortFormSubmit();
380
+ return false;
381
+ });
382
+
383
+ jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
384
+ jQuery('#b2sPagination').val("1");
385
+ jQuery('#b2sSortPostTitle').val("");
386
+ jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
387
+ jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
388
+ jQuery('#b2sSortPostType').prop('selectedIndex', 0);
389
+ jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
390
+ jQuery('#b2sShowByDate').val("");
391
+ jQuery('#b2sUserAuthId').val("");
392
+ jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
393
+ jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
394
+ b2sSortFormSubmit();
395
+ return false;
396
+ });
397
+
398
+ jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
399
+ if (jQuery('#user_version').val() == 0) {
400
+ jQuery('#b2s-sched-post-modal').modal('show');
401
+ return false;
402
+ }
403
+ jQuery('#b2s-show-post-type-modal').modal('show');
404
+ var view = jQuery('#b2s_calendar').fullCalendar('getView');
405
+ var selSchedDate;
406
+ if (view.type == 'month') {
407
+ selSchedDate = jQuery(this).parent('td').attr('data-date');
408
+ } else {
409
+ selSchedDate = jQuery(this).parent('th').attr('data-date');
410
+ }
411
+ jQuery('#b2sSelSchedDate').val(selSchedDate);
412
+ return false;
413
+ });
414
+
415
+ jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
416
+ jQuery('#b2s-show-post-type-modal').modal('hide');
417
+ jQuery('#b2s-show-post-all-modal').modal('show');
418
+ if (!jQuery('#b2sSelSchedDate').length > 0) {
419
+ jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
420
+ }
421
+ b2sSortFormSubmit();
422
+ return false;
423
+ });
424
+
425
+ jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
426
+ window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
427
+ return false;
428
+ });
429
+
430
+ function showFilter(typ) {
431
+ if (typ == 'show') {
432
+ jQuery('.filterShow').hide();
433
+ jQuery('.form-inline').show();
434
+ jQuery('.filterHide').show();
435
+ } else {
436
+ jQuery('.filterShow').show();
437
+ jQuery('.form-inline').hide();
438
+ jQuery('.filterHide').hide();
439
+ }
440
+ }
441
+
442
+ //b2sSortForm
443
+ function b2sSortFormSubmit() {
444
+ jQuery(".b2s-loading-area").show();
445
+ jQuery('.b2s-sort-result-item-area').html('');
446
+ jQuery('.b2s-sort-pagination-area').html('');
447
+
448
+ var data = {
449
+ 'action': 'b2s_sort_data',
450
+ 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
451
+ 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
452
+ 'b2sSortPostSharedBy': jQuery('#b2sSortPostSharedBy').val(),
453
+ 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
454
+ 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
455
+ 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
456
+ 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
457
+ 'b2sType': jQuery('#b2sType').val(),
458
+ 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
459
+ 'b2sPagination': jQuery('#b2sPagination').val(),
460
+ 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
461
+ 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
462
+ 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
463
+ 'b2sSortPostShareStatus': jQuery('#b2sSortPostShareStatus').val(),
464
+ 'b2sUserLang': jQuery('#b2sUserLang').val(),
465
+ 'b2sSchedDate': jQuery('#b2sSelSchedDate').val(),
466
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
467
+ };
468
+
469
+ if (jQuery('#b2sPostsPerPage').length > 0) {
470
+ data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
471
+ }
472
+
473
+ jQuery.ajax({
474
+ url: ajaxurl,
475
+ type: "POST",
476
+ dataType: "json",
477
+ cache: false,
478
+ data: data,
479
+ error: function () {
480
+ jQuery('.b2s-server-connection-fail').show();
481
+ return false;
482
+ },
483
+ success: function (data) {
484
+ if (typeof data === 'undefined' || data === null) {
485
+ jQuery('.b2s-server-connection-fail').show();
486
+ return false;
487
+ }
488
+ if (data.result == true) {
489
+ jQuery('.b2s-loading-area').hide();
490
+ jQuery('.b2s-sort-result-item-area').html(data.content).show();
491
+ jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
492
+ } else {
493
+ if (data.error == 'nonce') {
494
+ jQuery('.b2s-nonce-check-fail').show();
495
+ } else {
496
+ jQuery('.b2s-server-connection-fail').show();
497
+ }
498
+ return false;
499
+ }
500
+ }
501
+ });
502
+ return false;
503
+ }
504
+ //Overlay second modal
505
+ jQuery('#b2s-show-post-all-modal').on('shown.bs.modal', function () {
506
+ jQuery('body').addClass('modal-open');
507
+ });
508
+
509
+ //Overlay second modal
510
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
511
+ jQuery('body').addClass('modal-open');
512
+ });
513
+
514
+ //Overlay second modal
515
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
516
+ jQuery('body').addClass('modal-open');
517
+ });
518
+
519
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
520
+ jQuery('.b2s-network-select-image-content').html("");
521
+ jQuery.ajax({
522
+ url: ajaxurl,
523
+ type: "POST",
524
+ cache: false,
525
+ async: false,
526
+ data: {
527
+ 'action': 'b2s_get_image_modal',
528
+ 'id': jQuery(this).data('post-id'),
529
+ 'image_url': jQuery(this).data('image-url'),
530
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
531
+ },
532
+ success: function (data) {
533
+ if (data.error == 'nonce') {
534
+ jQuery('.b2s-nonce-check-fail').show();
535
+ } else {
536
+ jQuery(".b2s-network-select-image-content").html(data);
537
+ }
538
+ }
539
+ });
540
+ var authId = jQuery(this).data('network-auth-id');
541
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
542
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
543
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
544
+ jQuery('.b2s-selected-network-for-image-info').html(content);
545
+ jQuery('#b2sInsertImageType').val("0");
546
+ jQuery('.networkImage').each(function () {
547
+ var width = this.naturalWidth;
548
+ var height = this.naturalHeight;
549
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
550
+ });
551
+ jQuery('#b2s-network-select-image').modal('show');
552
+ return false;
553
+ });
554
+ jQuery(document).on("click", ".b2s-edit-post-delete", function () {
555
+ var id = jQuery(this).data("b2s-id");
556
+ var post_id = jQuery(this).data("post-id");
557
+ var post_for_relay = jQuery(this).data("data-post-for-relay");
558
+ var post_for_approve = jQuery(this).data("data-post-for-approve");
559
+ jQuery.ajax({
560
+ url: ajaxurl,
561
+ type: "POST",
562
+ dataType: "json",
563
+ cache: false,
564
+ data: {
565
+ 'action': 'b2s_delete_post',
566
+ 'b2s_id': id,
567
+ 'post_id': post_id,
568
+ 'post_for_relay': post_for_relay,
569
+ 'post_for_approve': post_for_approve,
570
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
571
+ },
572
+ success: function (data) {
573
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
574
+ refreshCalender();
575
+ wp.heartbeat.connectNow();
576
+ }
577
+ });
578
+ });
579
+
580
+ /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
581
+ jQuery('#save_method').val("apply-all");
582
+ e.preventDefault();
583
+ var id = jQuery(this).data("b2s-id");
584
+ jQuery.ajax({
585
+ url: ajaxurl,
586
+ type: "POST",
587
+ dataType: "json",
588
+ cache: false,
589
+ data: jQuery(this).closest("form").serialize(),
590
+ success: function (data) {
591
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
592
+ refreshCalender();
593
+ jQuery('#b2s-edit-event-modal-' + id).remove();
594
+ wp.heartbeat.connectNow();
595
+ }
596
+ });
597
+ });*/
598
+
599
+ jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
600
+ e.preventDefault();
601
+ jQuery('#save_method').val("apply-this");
602
+ var id = jQuery(this).data("b2s-id");
603
+ jQuery.ajax({
604
+ url: ajaxurl,
605
+ type: "POST",
606
+ dataType: "json",
607
+ cache: false,
608
+ data: jQuery(this).closest("form").serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
609
+ success: function (data) {
610
+ if (data.error == 'nonce') {
611
+ jQuery('.b2s-nonce-check-fail').show();
612
+ }
613
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
614
+ refreshCalender();
615
+ jQuery('#b2s-edit-event-modal-' + id).remove();
616
+ jQuery('body').removeClass('modal-open');
617
+ jQuery('body').removeAttr('style');
618
+ wp.heartbeat.connectNow();
619
+ }
620
+ });
621
+ });
622
+ jQuery(document).on("click", ".release_locks", function () {
623
+ jQuery.ajax({
624
+ url: ajaxurl,
625
+ type: "POST",
626
+ cache: false,
627
+ async: false,
628
+ data: {
629
+ 'action': 'b2s_get_calendar_release_locks',
630
+ 'post_id': jQuery('#post_id').val(),
631
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
632
+ },
633
+ success: function (data) {
634
+ if (data.error == 'nonce') {
635
+ jQuery('.b2s-nonce-check-fail').show();
636
+ }
637
+ wp.heartbeat.connectNow();
638
+ }
639
+ });
640
+ });
641
+ function refreshCalender() {
642
+ jQuery('#b2s_calendar').fullCalendar('refetchEvents');
643
+ }
644
+
645
+ jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
646
+ jQuery('body').addClass('modal-open');
647
+ });
648
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
649
+ jQuery('body').addClass('modal-open');
650
+ });
651
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
652
+ jQuery('body').addClass('modal-open');
653
+ });
654
+ jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
655
+ jQuery('body').addClass('modal-open');
656
+ });
657
+ //jQuery(this).attr('data-network-auth-id')
658
+ function checkSchedDateTime(dataNetworkAuthId) {
659
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
660
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
661
+ var dateStr = jQuery(dateElement).val();
662
+ var minStr = jQuery(timeElement).val();
663
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
664
+ if (jQuery('#b2sUserLang').val() == 'de') {
665
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
666
+ } else {
667
+ var minParts = minStr.split(' ');
668
+ var minParts2 = minParts[0].split(':');
669
+ if (minParts[1] == 'PM') {
670
+ minParts2[0] = parseInt(minParts2[0]) + 12;
671
+ }
672
+ minStr = minParts2[0] + ':' + minParts2[1];
673
+ }
674
+
675
+ var minParts3 = minStr.split(':');
676
+ if (minParts3[0] < 10) {
677
+ minParts3[0] = '0' + minParts3[0];
678
+ }
679
+ var dateParts = dateStr.split('-');
680
+ //utc current time
681
+ var now = new Date();
682
+ //offset between utc und user
683
+ var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
684
+ //enter hour to user time
685
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
686
+ //calculate datetime in utc
687
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
688
+ //compare enter date time with allowed user time
689
+ if (enter.getTime() < now.getTime()) {
690
+ //enter set on next 15 minutes and calculate on user timezone
691
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
692
+ jQuery(dateElement).datepicker('update', enter);
693
+ jQuery(timeElement).timepicker('setTime', enter);
694
+ }
695
+ }
696
+
697
+
698
+ function printDateFormat(dataNetworkAuthId) {
699
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
700
+ var dateStr = jQuery(dateElement).val();
701
+ dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
702
+ jQuery(dateElement).val(dateStr);
703
+ }
704
+
705
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
706
+ jQuery('.b2s-server-connection-fail').hide();
707
+ jQuery.ajax({
708
+ url: ajaxurl,
709
+ type: "POST",
710
+ dataType: "json",
711
+ cache: false,
712
+ data: {
713
+ 'action': 'b2s_get_settings_sched_time_default',
714
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
715
+ },
716
+ error: function () {
717
+ jQuery('.b2s-server-connection-fail').show();
718
+ return false;
719
+ },
720
+ success: function (data) {
721
+ if (data.result == true) {
722
+ var tomorrow = new Date();
723
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
724
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
725
+ }
726
+ tomorrow.setDate(tomorrow.getDate() + 1);
727
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
728
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
729
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
730
+ var today = new Date();
731
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
732
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
733
+ }
734
+
735
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
736
+ var todayDate = ("0" + today.getDate()).slice(-2);
737
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
738
+ var lang = jQuery('#b2sUserLang').val();
739
+ if (lang == "de") {
740
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
741
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
742
+ }
743
+
744
+ jQuery.each(data.times, function (network_id, time) {
745
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
746
+ time.forEach(function (network_type_time, count) {
747
+ if (network_type_time != "") {
748
+
749
+
750
+ var hours = network_type_time.substring(0, 2);
751
+ if (lang == "en") {
752
+ var timeparts = network_type_time.split(' ');
753
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
754
+ }
755
+ if (hours < today.getHours()) {
756
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
757
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
758
+ } else {
759
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
760
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
761
+ }
762
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
763
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
764
+
765
+ count++;
766
+ }
767
+ });
768
+ }
769
+ });
770
+ } else {
771
+ if (data.error == 'nonce') {
772
+ jQuery('.b2s-nonce-check-fail').show();
773
+ }
774
+ }
775
+ }
776
+ });
777
+ return false;
778
+ });
779
+
780
+
781
+
782
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
783
+ jQuery('.b2s-server-connection-fail').hide();
784
+ jQuery.ajax({
785
+ url: ajaxurl,
786
+ type: "POST",
787
+ dataType: "json",
788
+ cache: false,
789
+ data: {
790
+ 'action': 'b2s_get_settings_sched_time_user',
791
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
792
+ },
793
+ error: function () {
794
+ jQuery('.b2s-server-connection-fail').show();
795
+ return false;
796
+ },
797
+ success: function (data) {
798
+ var tomorrow = new Date();
799
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
800
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
801
+ }
802
+
803
+ tomorrow.setDate(tomorrow.getDate() + 1);
804
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
805
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
806
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
807
+ var today = new Date();
808
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
809
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
810
+ }
811
+
812
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
813
+ var todayDate = ("0" + today.getDate()).slice(-2);
814
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
815
+ var lang = jQuery('#b2sUserLang').val();
816
+ if (lang == "de") {
817
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
818
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
819
+ }
820
+ if (data.result == true) {
821
+ //V5.1.0 seeding
822
+ if (data.type == 'new') {
823
+ //new
824
+ jQuery.each(data.times, function (network_auth_id, time) {
825
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
826
+ //is not set special dates
827
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
828
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
829
+ }
830
+ var hours = time.substring(0, 2);
831
+ var timeparts = time.split(' ');
832
+ if (typeof timeparts[1] != 'undefined') {
833
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
834
+ }
835
+
836
+ var isDelay = false;
837
+ var delayDay = data.delay_day[network_auth_id];
838
+ if (delayDay != undefined) {
839
+ if (delayDay > 0) {
840
+ var delay = new Date();
841
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
842
+ delay.setTime(jQuery('#b2sBlogPostSchedDate').val());
843
+ }
844
+ delay.setDate(delay.getDate() + parseInt(delayDay));
845
+ var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
846
+ var delayDate = ("0" + delay.getDate()).slice(-2);
847
+ var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
848
+ if (lang == 'de') {
849
+ dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
850
+ }
851
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
852
+ isDelay = true;
853
+
854
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
855
+ }
856
+ }
857
+ if (!isDelay) {
858
+ if (hours < today.getHours()) {
859
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
860
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
861
+ } else {
862
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
863
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
864
+ }
865
+ }
866
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
867
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').timepicker('setTime', new Date(today.getFullYear(), today.getMonth(), today.getDate(), hours, time.slice(3, 5)));
868
+ }
869
+ });
870
+ } else {
871
+ //old
872
+ jQuery.each(data.times, function (network_id, time) {
873
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
874
+ time.forEach(function (network_type_time, count) {
875
+ if (network_type_time != "") {
876
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
877
+ //is not set special dates
878
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() != '1') {
879
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
880
+ }
881
+ var hours = network_type_time.substring(0, 2);
882
+ if (lang == "en") {
883
+ var timeparts = network_type_time.split(' ');
884
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
885
+ }
886
+ if (hours < today.getHours()) {
887
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
888
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
889
+ } else {
890
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
891
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
892
+ }
893
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
894
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
895
+ count++;
896
+ }
897
+ });
898
+ }
899
+ });
900
+ }
901
+ } else {
902
+ if (data.error == 'nonce') {
903
+ jQuery('.b2s-nonce-check-fail').show();
904
+ }
905
+ //default load best Times
906
+ //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
907
+ //set current time
908
+ jQuery('.b2s-post-item:visible').each(function () {
909
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
910
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
911
+ //is not set special dates
912
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
913
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
914
+ }
915
+ }
916
+ });
917
+ }
918
+ }
919
+ });
920
+ return false;
921
+ });
922
+
923
+ jQuery(document).on('click', '.b2s-add-multi-image', function() {
924
+ jQuery('.b2s-network-select-image-content').html("");
925
+ jQuery.ajax({
926
+ url: ajaxurl,
927
+ type: "POST",
928
+ cache: false,
929
+ async: false,
930
+ data: {
931
+ 'action': 'b2s_get_image_modal',
932
+ 'id': jQuery('#post_id').val(),
933
+ 'image_url': jQuery(this).data('image-url'),
934
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
935
+ },
936
+ success: function (data) {
937
+ if (data.error == 'nonce') {
938
+ jQuery('.b2s-nonce-check-fail').show();
939
+ } else {
940
+ jQuery(".b2s-network-select-image-content").html(data);
941
+ }
942
+ }
943
+ });
944
+ var authId = jQuery(this).data('network-auth-id');
945
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
946
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
947
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
948
+ jQuery('.b2s-selected-network-for-image-info').html(content);
949
+ jQuery('#b2sInsertImageType').val("0");
950
+ jQuery('.networkImage').each(function () {
951
+ var width = this.naturalWidth;
952
+ var height = this.naturalHeight;
953
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
954
+ });
955
+ jQuery('#b2s-network-select-image').modal('show');
956
  });
assets/js/b2s/general.js CHANGED
@@ -10,6 +10,10 @@ jQuery(window).on("load", function () {
10
  jQuery('#b2sModalPrivacyPolicy').modal('show');
11
  }
12
  }
 
 
 
 
13
  });
14
 
15
  jQuery(document).on('click', '.b2s-show-feedback-modal', function () {
@@ -344,4 +348,5 @@ jQuery(document).on("click", ".b2s-scroll-modal-down", function (e) {
344
 
345
  jQuery(document).on('click', '.b2s-network-auth-info-close', function() {
346
  jQuery(this).closest('.b2s-network-auth-info').hide();
347
- });
 
10
  jQuery('#b2sModalPrivacyPolicy').modal('show');
11
  }
12
  }
13
+
14
+ if(jQuery('#b2s-metrics-banner-show').val() == '0' && jQuery('.b2s-metrics-starting-modal').length == 0) {
15
+ jQuery('#b2s-metrics-banner-modal').modal('show');
16
+ }
17
  });
18
 
19
  jQuery(document).on('click', '.b2s-show-feedback-modal', function () {
348
 
349
  jQuery(document).on('click', '.b2s-network-auth-info-close', function() {
350
  jQuery(this).closest('.b2s-network-auth-info').hide();
351
+ });
352
+
assets/js/b2s/metrics.js ADDED
@@ -0,0 +1,358 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+
3
+ var filterDates = [];
4
+
5
+ if (typeof wp.heartbeat !== "undefined") {
6
+ jQuery(document).on('heartbeat-send', function (e, data) {
7
+ data['b2s_heartbeat'] = 'b2s_listener';
8
+ });
9
+ wp.heartbeat.connectNow();
10
+ }
11
+
12
+ jQuery(window).on("load", function () {
13
+
14
+ if(jQuery('#b2sOptionMetricsStarted').val() == '0') {
15
+ jQuery('.b2s-metrics-starting-modal').modal('show');
16
+ }
17
+
18
+ var today = new Date();
19
+ var startDate = new Date();
20
+ startDate.setTime(startDate.getTime() - ((24*60*60*1000) * 30));//today -30 days
21
+ var metricsDatePicker = jQuery('#b2s-metrics-date-picker').b2sdatepicker({
22
+ 'autoClose': true,
23
+ 'range': true,
24
+ 'multipleDatesSeparator': ' - ',
25
+ 'toggleSelected': false,
26
+ 'maxDate': today,
27
+ 'startDate': today,
28
+ 'dateFormat': 'dd.mm.yyyy',
29
+ onSelect: function onSelect(formattedDate, date, inst) {
30
+ filterDates = [];
31
+ date.forEach(function(item){
32
+ filterDates.push(item.getFullYear() + '-' + (String(item.getMonth()+1).padStart(2, "0")) + '-' + (String(item.getDate()).padStart(2, "0")));
33
+ });
34
+ },
35
+ onHide: function onHide() {
36
+ loadInsights();
37
+ }
38
+ });
39
+
40
+ metricsDatePicker.b2sdatepicker().data('b2sdatepicker').selectedDates = [startDate, today];
41
+ metricsDatePicker.b2sdatepicker().data('b2sdatepicker').update();
42
+
43
+ loadInsights();
44
+ });
45
+
46
+ function loadInsights() {
47
+ jQuery('.b2s-metrics-area').hide();
48
+ jQuery('.b2s-loading-area').show();
49
+ var filterNetwork = jQuery('.b2s-calendar-filter-network-btn:checked').val();
50
+ jQuery.ajax({
51
+ url: ajaxurl,
52
+ type: "GET",
53
+ dataType: "json",
54
+ cache: false,
55
+ data: {
56
+ 'action': 'b2s_load_insights',
57
+ 'filter_network': filterNetwork,
58
+ 'filter_dates': filterDates,
59
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
60
+ },
61
+ error: function () {
62
+ jQuery('.b2s-server-connection-fail').show();
63
+ return false;
64
+ },
65
+ success: function (data) {
66
+ jQuery('.b2s-metrics-area').show();
67
+ jQuery('.b2s-loading-area').hide();
68
+ if(data.result == true) {
69
+ jQuery('.b2s-sort-result-item-area').html(data.data.posts);
70
+
71
+ jQuery('.b2s-posts-total-data').html(data.data.general.postCountTotal);
72
+ jQuery('.b2s-impressions-total-data').html(data.data.general.impressionsTotal);
73
+ jQuery('.b2s-engagements-total-data').html(data.data.general.engagementsTotal);
74
+
75
+ jQuery('.b2s-posts-gain-data').html(data.data.general.postCountToday);
76
+ jQuery('.b2s-impressions-gain-data').html(data.data.general.impressionsToday);
77
+ jQuery('.b2s-engagements-gain-data').html(data.data.general.engagementsToday);
78
+
79
+ jQuery('#b2s-posts-status').removeClass('glyphicon-arrow-up').removeClass('glyphicon-arrow-down').removeClass('glyphicon-minus');
80
+ jQuery('#b2s-impressions-status').removeClass('glyphicon-arrow-up').removeClass('glyphicon-arrow-down').removeClass('glyphicon-minus');
81
+ jQuery('#b2s-engagements-status').removeClass('glyphicon-arrow-up').removeClass('glyphicon-arrow-down').removeClass('glyphicon-minus');
82
+
83
+ if(data.data.general.postCountToday == data.data.general.impressionsCompare) {
84
+ jQuery('#b2s-posts-status').addClass('glyphicon-minus');
85
+ } else if(data.data.general.postCountToday > data.data.general.impressionsCompare) {
86
+ jQuery('#b2s-posts-status').addClass('glyphicon-arrow-up');
87
+ } else if(data.data.general.postCountToday < data.data.general.impressionsCompare) {
88
+ jQuery('#b2s-posts-status').addClass('glyphicon-arrow-down');
89
+ }
90
+
91
+ if(data.data.general.impressionsToday == data.data.general.impressionsCompare) {
92
+ jQuery('#b2s-impressions-status').addClass('glyphicon-minus');
93
+ } else if(data.data.general.impressionsToday > data.data.general.impressionsCompare) {
94
+ jQuery('#b2s-impressions-status').addClass('glyphicon-arrow-up');
95
+ } else if(data.data.general.impressionsToday < data.data.general.impressionsCompare) {
96
+ jQuery('#b2s-impressions-status').addClass('glyphicon-arrow-down');
97
+ }
98
+
99
+ if(data.data.general.engagementsToday == data.data.general.engagementsCompare) {
100
+ jQuery('#b2s-engagements-status').addClass('glyphicon-minus');
101
+ } else if(data.data.general.engagementsToday > data.data.general.engagementsCompare) {
102
+ jQuery('#b2s-engagements-status').addClass('glyphicon-arrow-up');
103
+ } else if(data.data.general.engagementsToday < data.data.general.engagementsCompare) {
104
+ jQuery('#b2s-engagements-status').addClass('glyphicon-arrow-down');
105
+ }
106
+ }
107
+ }
108
+ });
109
+ }
110
+
111
+ jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function() {
112
+ loadInsights();
113
+ });
114
+
115
+ jQuery(document).on('click', '.b2s-sort-posts', function() {
116
+ jQuery('.b2s-sort-posts').removeClass('btn-primary').addClass('btn-default');
117
+ jQuery(this).addClass('btn-primary').removeClass('btn-default');
118
+ var sortType = jQuery(this).data('sort-type');
119
+ jQuery(".b2s-sort-result-item-area li").sort(sort_posts).appendTo('.b2s-sort-result-item-area');
120
+ function sort_posts(a, b) {
121
+ return (jQuery(b).data(sortType)) < (jQuery(a).data(sortType)) ? -1 : 1;
122
+ }
123
+ });
124
+
125
+ jQuery(document).on('change', '.b2s-filter-active', function() {
126
+ var activeType = jQuery(this).val();
127
+ jQuery(".b2s-sort-result-item-area li").each(function(element) {
128
+ if(activeType == "0") {
129
+ jQuery(this).show();
130
+ }
131
+ if(activeType == "1") {
132
+ if(jQuery(this).data('active') == "1") {
133
+ jQuery(this).show();
134
+ } else {
135
+ jQuery(this).hide();
136
+ }
137
+ }
138
+ if(activeType == "2") {
139
+ if(jQuery(this).data('active') == "0") {
140
+ jQuery(this).show();
141
+ } else {
142
+ jQuery(this).hide();
143
+ }
144
+ }
145
+ });
146
+ });
147
+
148
+ jQuery(document).on('click', '.b2sGetB2SPostsByWpPost', function () {
149
+ var postId = jQuery(this).attr('data-post-id');
150
+ var showByDate = jQuery(this).attr('data-search-date');
151
+ var filterNetwork = jQuery('.b2s-calendar-filter-network-btn:checked').val();
152
+ if (jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').html() == '') {
153
+ jQuery('.b2s-server-connection-fail').hide();
154
+ jQuery.ajax({
155
+ url: ajaxurl,
156
+ type: "POST",
157
+ dataType: "json",
158
+ cache: false,
159
+ data: {
160
+ 'action': 'b2s_publish_post_data',
161
+ 'postId': postId,
162
+ 'type': 'metrics',
163
+ 'showByDate': showByDate,
164
+ 'sharedByUser': jQuery('#b2sSortPostSharedBy').val(),
165
+ 'sharedOnNetwork': filterNetwork,
166
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
167
+ },
168
+ error: function () {
169
+ jQuery('.b2s-server-connection-fail').show();
170
+ return false;
171
+ },
172
+ success: function (data) {
173
+ if (data.result == true) {
174
+ jQuery('.b2s-post-publish-area[data-post-id="' + data.postId + '"]').html(data.content);
175
+ } else {
176
+ if (data.error == 'nonce') {
177
+ jQuery('.b2s-nonce-check-fail').show();
178
+ }
179
+ }
180
+ // wp.heartbeat.connectNow();
181
+ }
182
+ });
183
+ // jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
184
+ } else {
185
+ if (jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').is(':visible')) {
186
+ jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').hide();
187
+ // jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
188
+ } else {
189
+ jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').show();
190
+ // jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
191
+ }
192
+ }
193
+ });
194
+
195
+ jQuery(document).on('click', '.b2sFavoriteStar', function () {
196
+ jQuery(this).addClass('b2sFavoriteStarLoading');
197
+ var postId = jQuery(this).data('post-id');
198
+ var newStatus = (jQuery(this).data('is-favorite') == "1" ? 0 : 1);
199
+ jQuery.ajax({
200
+ url: ajaxurl,
201
+ type: "POST",
202
+ dataType: "json",
203
+ cache: false,
204
+ data: {
205
+ 'action': 'b2s_change_favorite_status',
206
+ 'postId': postId,
207
+ 'setStatus': newStatus,
208
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
209
+ },
210
+ error: function () {
211
+ jQuery('.b2sFavoriteStar[data-post-id="'+postId+'"]').removeClass('b2sFavoriteStarLoading');
212
+ jQuery('.b2s-server-connection-fail').show();
213
+ return false;
214
+ },
215
+ success: function (data) {
216
+ if (data.result == true) {
217
+ jQuery('.b2sFavoriteStar[data-post-id="'+postId+'"]').data('is-favorite', newStatus);
218
+ if(newStatus == 1){
219
+ jQuery('.b2sFavoriteStar[data-post-id="'+postId+'"]').removeClass('glyphicon-star-empty');
220
+ jQuery('.b2sFavoriteStar[data-post-id="'+postId+'"]').addClass('glyphicon-star');
221
+ } else {
222
+ jQuery('.b2sFavoriteStar[data-post-id="'+postId+'"]').removeClass('glyphicon-star');
223
+ jQuery('.b2sFavoriteStar[data-post-id="'+postId+'"]').addClass('glyphicon-star-empty');
224
+ }
225
+ if(jQuery('#b2sType').val() == 'favorites') {
226
+ jQuery('.b2s-favorite-list-entry[data-post-id="'+postId+'"]').remove();
227
+ if(jQuery('.b2s-favorite-list-entry').length == 0) {
228
+ jQuery('.b2s-sort-result-item-area').html('<li class="list-group-item"><div class="media"><div class="media-body"></div>'+jQuery('#b2sNoFavoritesText').val()+'</div></li>');
229
+ jQuery('.b2s-sort-pagination-area').hide();
230
+ }
231
+ }
232
+ }
233
+ jQuery('.b2sFavoriteStar[data-post-id="'+postId+'"]').removeClass('b2sFavoriteStarLoading');
234
+ return true;
235
+ }
236
+ });
237
+
238
+ });
239
+
240
+ jQuery(document).on('click', '.checkbox-all', function () {
241
+ if (jQuery('.checkbox-all').is(":checked")) {
242
+ jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]').prop("checked", true);
243
+ } else {
244
+ jQuery('.checkboxes[data-blog-post-id="' + jQuery('.checkbox-all').attr('data-blog-post-id') + '"]').prop("checked", false);
245
+ }
246
+ });
247
+
248
+ jQuery(document).on('click', '.checkbox-post-publish-all-btn', function () {
249
+ var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
250
+ if (checkboxes.length > 0) {
251
+ var items = [];
252
+ jQuery(checkboxes).each(function (i, selected) {
253
+ items[i] = jQuery(selected).val();
254
+ });
255
+ jQuery('#b2s-delete-confirm-post-id').val(items.join());
256
+ jQuery('#b2s-delete-confirm-post-count').html(items.length);
257
+ jQuery('.b2s-delete-publish-modal').modal('show');
258
+ jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
259
+ }
260
+ });
261
+
262
+
263
+ jQuery(document).on('click', '.checkbox-post-approve-all-btn', function () {
264
+ var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
265
+ if (checkboxes.length > 0) {
266
+ var items = [];
267
+ jQuery(checkboxes).each(function (i, selected) {
268
+ items[i] = jQuery(selected).val();
269
+ });
270
+ jQuery('#b2s-delete-confirm-post-id').val(items.join());
271
+ jQuery('#b2s-delete-confirm-post-count').html(items.length);
272
+ jQuery('.b2s-delete-approve-modal').modal('show');
273
+ jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
274
+ }
275
+ });
276
+
277
+ jQuery(document).on('click', '.b2s-post-publish-area-drop-btn', function () {
278
+ jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
279
+ jQuery('#b2s-delete-confirm-post-count').html('1');
280
+ jQuery('.b2s-delete-publish-modal').modal('show');
281
+ jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
282
+ });
283
+
284
+ jQuery(document).on('click', '.b2s-publish-delete-confirm-btn', function () {
285
+ jQuery('.b2s-post-remove-fail').hide();
286
+ jQuery('.b2s-post-remove-success').hide();
287
+ jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', true);
288
+ jQuery('.b2s-server-connection-fail').hide();
289
+ jQuery.ajax({
290
+ url: ajaxurl,
291
+ type: "POST",
292
+ dataType: "json",
293
+ cache: false,
294
+ data: {
295
+ 'action': 'b2s_delete_user_publish_post',
296
+ 'postId': jQuery('#b2s-delete-confirm-post-id').val(),
297
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
298
+ },
299
+ error: function () {
300
+ jQuery('.b2s-server-connection-fail').show();
301
+ return false;
302
+ },
303
+ success: function (data) {
304
+ jQuery('.b2s-delete-publish-modal').modal('hide');
305
+ if (data.result == true) {
306
+ var count = parseInt(jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html());
307
+ var newCount = count - data.postCount;
308
+ jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
309
+ if (newCount >= 1) {
310
+ jQuery.each(data.postId, function (i, id) {
311
+ jQuery('.b2s-post-publish-area-li[data-post-id="' + id + '"]').remove();
312
+ });
313
+ } else {
314
+ jQuery('.b2s-post-publish-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
315
+ }
316
+ jQuery('.b2s-post-remove-success').show();
317
+ } else {
318
+ if (data.error == 'nonce') {
319
+ jQuery('.b2s-nonce-check-fail').show();
320
+ }
321
+ jQuery('.b2s-post-remove-fail').show();
322
+ }
323
+ wp.heartbeat.connectNow();
324
+ return true;
325
+ }
326
+ });
327
+ });
328
+
329
+ jQuery(document).on('click', '.b2s-metrics-starting-confirm-btn', function () {
330
+ jQuery('.b2s-metrics-starting-modal').modal('hide');
331
+ jQuery.ajax({
332
+ url: ajaxurl,
333
+ type: "POST",
334
+ dataType: "json",
335
+ cache: false,
336
+ data: {
337
+ 'action': 'b2s_metrics_starting_confirm',
338
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
339
+ }
340
+ });
341
+ });
342
+
343
+ jQuery(document).on('click', '.b2s-metrics-info-btn', function () {
344
+ jQuery('.b2s-metrics-info-modal').modal('show');
345
+ });
346
+
347
+ jQuery(document).on('click', '.b2s-metrics-info-close-btn', function () {
348
+ jQuery('.b2s-metrics-info-modal').modal('hide');
349
+ });
350
+
351
+ jQuery(document).on('click', '.b2s-metrics-legend-info-modal-btn', function () {
352
+ jQuery('.b2s-metrics-legend-info-modal').modal('show');
353
+ });
354
+
355
+ jQuery(document).on('click', '.b2s-metrics-feedback-btn', function () {
356
+ jQuery('.b2s-metrics-feedback-modal').modal('show');
357
+ });
358
+
assets/js/b2s/network.js CHANGED
@@ -926,6 +926,25 @@ jQuery(document).on('click', '.b2s-edit-template-btn', function () {
926
  jQuery('.b2s-edit-template-save-btn').removeClass('b2s-btn-disabled');
927
  }
928
  jQuery('.b2s-edit-template-post-content').trigger('keyup');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
929
  } else {
930
  if (data.error == 'nonce') {
931
  jQuery('.b2s-nonce-check-fail').show();
@@ -943,7 +962,7 @@ jQuery(window).on("load", function () {
943
  jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('0');
944
  jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
945
  jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
946
- if(jQuery('#b2s-edit-template-network-id').val() == 1 || jQuery('#b2s-edit-template-network-id').val() == 2) {
947
  jQuery('.b2s-edit-template-enable-link-area[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
948
  }
949
  });
@@ -954,7 +973,7 @@ jQuery(window).on("load", function () {
954
  jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('1');
955
  jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
956
  jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
957
- if(jQuery('#b2s-edit-template-network-id').val() == 1 || jQuery('#b2s-edit-template-network-id').val() == 2) {
958
  jQuery('.b2s-edit-template-enable-link-area[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
959
  }
960
  });
@@ -1180,6 +1199,7 @@ jQuery(document).on('click', '.b2s-edit-template-save-btn', function () {
1180
  } else {
1181
  template_data[networkType]['shuffleHashtags'] = false;
1182
  }
 
1183
  }
1184
  });
1185
 
@@ -1308,7 +1328,11 @@ jQuery(document).on('click', '.b2s-auth-network-6-login-btn', function () {
1308
  if (typeof data.error != 'undefined' && data.error != '') {
1309
  jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
1310
  } else {
1311
- jQuery('.b2s-auth-network-6-info[data-info="login"]').show();
 
 
 
 
1312
  }
1313
  jQuery('.b2s-auth-network-6-login-btn').show();
1314
  }
926
  jQuery('.b2s-edit-template-save-btn').removeClass('b2s-btn-disabled');
927
  }
928
  jQuery('.b2s-edit-template-post-content').trigger('keyup');
929
+ if(networkId == 12) {
930
+ Coloris({
931
+ el: '.b2s-edit-template-colorpicker',
932
+ theme: 'polaroid',
933
+ swatches: [
934
+ '#ffffff',
935
+ '#000000',
936
+ '#ff0000',
937
+ '#00ff00',
938
+ '#0000ff',
939
+ '#ffff00',
940
+ '#c3073f',
941
+ '#5cdb95',
942
+ '#659dbd',
943
+ '#f9db7a',
944
+ '#e46de0'
945
+ ]
946
+ });
947
+ }
948
  } else {
949
  if (data.error == 'nonce') {
950
  jQuery('.b2s-nonce-check-fail').show();
962
  jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('0');
963
  jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
964
  jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
965
+ if(jQuery('#b2s-edit-template-network-id').val() == 1 || jQuery('#b2s-edit-template-network-id').val() == 2 || jQuery('#b2s-edit-template-network-id').val() == 24) {
966
  jQuery('.b2s-edit-template-enable-link-area[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
967
  }
968
  });
973
  jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('1');
974
  jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
975
  jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
976
+ if(jQuery('#b2s-edit-template-network-id').val() == 1 || jQuery('#b2s-edit-template-network-id').val() == 2 || jQuery('#b2s-edit-template-network-id').val() == 24) {
977
  jQuery('.b2s-edit-template-enable-link-area[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
978
  }
979
  });
1199
  } else {
1200
  template_data[networkType]['shuffleHashtags'] = false;
1201
  }
1202
+ template_data[networkType]['frameColor'] = jQuery('#b2s-edit-template-colorpicker').val();
1203
  }
1204
  });
1205
 
1328
  if (typeof data.error != 'undefined' && data.error != '') {
1329
  jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
1330
  } else {
1331
+ jQuery('.b2s-auth-network-6-extension-info-area').show();
1332
+ jQuery('.b2s-auth-network-6-extension-continue-btn').show();
1333
+ var messageData = {action: 'BWEC', type: 'BWECT'};
1334
+ window.postMessage(messageData, '*');
1335
+ return false;
1336
  }
1337
  jQuery('.b2s-auth-network-6-login-btn').show();
1338
  }
assets/js/b2s/ship.js CHANGED
@@ -1,4327 +1,4337 @@
1
- jQuery.noConflict();
2
-
3
- var b2sTosXingGroupCount = 0;
4
- var currentOGImage = '';
5
- var changedOGImage = false;
6
-
7
- jQuery(document).on('heartbeat-send', function (e, data) {
8
- data['b2s_heartbeat'] = 'b2s_listener';
9
- });
10
-
11
- jQuery.xhrPool = [];
12
-
13
- jQuery(window).on("load", function () {
14
- init(true);
15
- imageSize();
16
- if (jQuery('.toggelbutton').is(':visible') && !jQuery("#b2s-wrapper").hasClass("toggled")) {
17
- jQuery('.btn-toggle-menu').trigger('click');
18
- }
19
- });
20
-
21
- //Stop duplicate posts by page refreshing during the post process
22
- jQuery(document).on('keydown', '#b2sNetworkSent', function (event) {
23
- if (event.keyCode == 116) {
24
- event.preventDefault();
25
- return false;
26
- }
27
- });
28
-
29
- jQuery(document).on('click', '.btn-toggle-menu', function () {
30
- if (jQuery('.toggelbutton').is(':visible')) {
31
- jQuery("#b2s-wrapper").toggleClass("toggled");
32
- if (jQuery("#b2s-wrapper").hasClass("toggled")) {
33
- jQuery(".sidebar-brand").hide();
34
- jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-right').addClass('glyphicon-chevron-left');
35
- } else {
36
- jQuery(".sidebar-brand").show();
37
- jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-left').addClass('glyphicon-chevron-right');
38
- }
39
- }
40
- });
41
-
42
- jQuery.sceditor.formats.xhtml.allowedTags = ['h1', 'h2', 'p', 'br', 'i', 'em', 'b', 'a', 'img', 'span'];
43
- jQuery.sceditor.command.set(
44
- "h1", {
45
- exec: function () {
46
- if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H1') {
47
- this.wysiwygEditorInsertHtml('<h1>', '</h1>');
48
- } else {
49
- jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
50
- }
51
- },
52
- txtExec: ["<h1>", "</h1>"],
53
- tooltip: "H1"
54
- });
55
- jQuery.sceditor.command.set(
56
- "h2", {
57
- exec: function () {
58
- if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H2') {
59
- this.wysiwygEditorInsertHtml('<h2>', '</h2>');
60
- } else {
61
- jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
62
- }
63
- },
64
- txtExec: ["<h2>", "</h2>"], tooltip: "H2"});
65
-
66
- jQuery.sceditor.command.set(
67
- "custom-image", {
68
- exec: function () {
69
- var me = this;
70
- if (typeof (b2s_is_calendar) != "undefined" && b2s_is_calendar)
71
- {
72
- jQuery('.b2s-network-select-image-content').html("");
73
- jQuery.ajax({
74
- url: ajaxurl,
75
- type: "POST",
76
- cache: false,
77
- async: false,
78
- data: {
79
- 'action': 'b2s_get_image_modal',
80
- 'id': b2s_current_post_id,
81
- 'image_url': '',
82
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
83
- },
84
- success: function (data) {
85
- if (data.error == 'nonce') {
86
- jQuery('.b2s-nonce-check-fail').show();
87
- } else {
88
- jQuery(".b2s-network-select-image-content").html(data);
89
- }
90
- }
91
- });
92
- }
93
- var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
94
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
95
- jQuery('.b2s-image-change-this-network').show();
96
- jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
97
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
98
- jQuery('.b2s-selected-network-for-image-info').html(content);
99
- jQuery('#b2s-network-select-image').modal('show');
100
- jQuery('.b2s-image-change-meta-network').hide();
101
- jQuery('#b2sInsertImageType').val("1");
102
- imageSize();
103
-
104
- },
105
- txtExec: function () {
106
- var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
107
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
108
- jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
109
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
110
- jQuery('.b2s-selected-network-for-image-info').html(content);
111
- jQuery('#b2s-network-select-image').modal('show');
112
- jQuery('#b2sInsertImageType').val("1");
113
- imageSize();
114
- }, tooltip: "Image"});
115
- jQuery.sceditor.command.set(
116
- "custom-emoji", {
117
- exec: function () {
118
- var me = this;
119
- if (pickerHTML.pickerVisible) {
120
- pickerHTML.hidePicker();
121
- } else {
122
- pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
123
- currentPickerHTMLContent = this;
124
- }
125
- },
126
- txtExec: function () {
127
- var me = this;
128
- if (pickerHTML.pickerVisible) {
129
- pickerHTML.hidePicker();
130
- } else {
131
- pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
132
- currentPickerHTMLContent = this;
133
- }
134
- }, tooltip: "Emoji"});
135
-
136
-
137
- jQuery(document).on('click', '.b2s-toogle-calendar-btn', function () {
138
-
139
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
140
- var networkId = jQuery(this).attr('data-network-id');
141
- var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
142
- var currentBtnText = jQuery(this).text();
143
-
144
- jQuery(this).text(toogleBtnText);
145
- jQuery(this).attr('data-toogle-text-btn', currentBtnText);
146
-
147
- //change to show
148
- var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
149
- if (calendar.hasClass('hide')) {
150
- calendar.removeClass('hide');
151
- calendar.addClass('show');
152
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').removeClass('hide');
153
-
154
- if (calendar.is(':empty')) {
155
- b2s_cur_source_ship_calendar[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + networkId + '&filter_status=2' + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
156
-
157
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar({
158
- editable: false,
159
- locale: b2s_calendar_locale,
160
- eventLimit: 2,
161
- contentHeight: 530,
162
- timeFormat: 'H:mm',
163
- eventSources: [b2s_cur_source_ship_calendar[0]],
164
- eventRender: function (event, element) {
165
- show = true;
166
- $header = jQuery("<div>").addClass("b2s-calendar-header");
167
- $isRelayPost = '';
168
- $isCuratedPost = '';
169
- if (event.post_type == 'b2s_ex_post') {
170
- $isCuratedPost = ' (Curated Post)';
171
- }
172
- if (event.relay_primary_post_id > 0) {
173
- $isRelayPost = ' (Retweet)';
174
- }
175
- $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
176
- element.find(".fc-time").after($network_name);
177
- element.html(element.html());
178
- $parent = element.parent();
179
- $header.append(element.find(".fc-content"));
180
- element.append($header);
181
- $body = jQuery("<div>").addClass("b2s-calendar-body");
182
- $body.append(event.avatar);
183
- $body.append(element.find(".fc-title"));
184
- $body.append(jQuery("<br>"));
185
- var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
186
- $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
187
- $em.append(event.network_name);
188
- $em.append(jQuery("<span>").text(": " + event.profile));
189
- $body.append($em);
190
- element.append($body);
191
- },
192
- dayRender: function (date, element) {
193
- if (!jQuery(element[0]).hasClass('fc-past')) {
194
- var date = jQuery(element[0]).attr('data-date');
195
- var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
196
- $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddSchedule").val() + "</span>").addClass("b2s-calendar-add-schedule-btn").attr('href', '#').attr('data-network-auth-id', networkAuthId);
197
- sel_element.append($header);
198
- }
199
- }
200
- });
201
- } else {
202
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar('refetchEvents');
203
- }
204
-
205
- } else {
206
- calendar.removeClass('show');
207
- calendar.addClass('hide');
208
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
209
-
210
- }
211
-
212
- return false;
213
-
214
- });
215
-
216
- jQuery(document).on('click', '.b2s-calendar-add-schedule-btn', function () {
217
- var selSchedDate = jQuery(this).parent('td').attr('data-date');
218
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
219
-
220
- if (jQuery('#user_version').val() == 0) {
221
- jQuery('.b2s-post-item-details-release-input-date-select-reset[data-network-auth-id="' + networkAuthId + '"]').val('0');
222
- jQuery('#b2s-sched-post-modal').modal('show');
223
- return false;
224
- }
225
-
226
- if (jQuery('#b2sUserLang').val() == 'de') {
227
- selSchedDate = selSchedDate.substring(8, 10) + '.' + selSchedDate.substring(5, 7) + '.' + selSchedDate.substring(0, 4);
228
- }
229
-
230
- //isfirst
231
- if (!jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"] option[value="1"]:selected').length > 0) {
232
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
233
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
234
- } else {
235
- //add
236
- var curSel = jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"]').filter(':visible');
237
- if (curSel.length > 0) {
238
- curSel.trigger('click');
239
- netCountNext = parseInt(curSel.attr('data-network-count')) + 1;
240
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + netCountNext + '"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
241
- } else {
242
- //do not adding write to first
243
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
244
- }
245
- }
246
- return false;
247
- });
248
-
249
- jQuery(document).on('change', '.b2s-calendar-filter-network-sel', function () {
250
- var newSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=2' + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
251
- var oldSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).attr('data-last-sel') + '&filter_status=2' + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
252
- jQuery(this).attr('data-last-sel', jQuery(this).val());
253
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('removeEventSource', oldSource);
254
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('addEventSource', newSource);
255
- return false;
256
- });
257
-
258
-
259
- jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
260
- jQuery('.b2s-server-connection-fail').hide();
261
- jQuery.ajax({
262
- url: ajaxurl,
263
- type: "POST",
264
- dataType: "json",
265
- cache: false,
266
- data: {
267
- 'action': 'b2s_get_settings_sched_time_default',
268
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
269
- },
270
- error: function () {
271
- jQuery('.b2s-server-connection-fail').show();
272
- return false;
273
- },
274
- success: function (data) {
275
- if (data.result == true) {
276
- var tomorrow = new Date();
277
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
278
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
279
- }
280
- tomorrow.setDate(tomorrow.getDate() + 1);
281
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
282
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
283
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
284
- var today = new Date();
285
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
286
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
287
- }
288
-
289
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
290
- var todayDate = ("0" + today.getDate()).slice(-2);
291
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
292
- var lang = jQuery('#b2sUserLang').val();
293
- if (lang == "de") {
294
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
295
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
296
- }
297
-
298
- jQuery.each(data.times, function (network_id, time) {
299
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
300
- time.forEach(function (network_type_time, count) {
301
- if (network_type_time != "") {
302
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
303
- if (jQuery(this).is(':not(:disabled)')) {
304
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
305
- //is not set special dates
306
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() == '0') {
307
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
308
- }
309
- var hours = network_type_time.substring(0, 2);
310
- if (lang == "en") {
311
- var timeparts = network_type_time.split(' ');
312
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
313
- }
314
- if (hours < today.getHours()) {
315
- if (jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val() < dateTomorrow) {
316
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
317
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
318
- }
319
- } else {
320
- if (jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val() < dateToday) {
321
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
322
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
323
- }
324
- }
325
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
326
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
327
- }
328
- });
329
- count++;
330
- }
331
- });
332
- }
333
- });
334
- } else {
335
- if (data.error == 'nonce') {
336
- jQuery('.b2s-nonce-check-fail').show();
337
- }
338
- }
339
- }
340
- });
341
- return false;
342
- });
343
-
344
-
345
- function formatAMPM(date) {
346
- var hours = date.getHours();
347
- var minutes = date.getMinutes();
348
- var ampm = hours >= 12 ? 'pm' : 'am';
349
- hours = hours % 12;
350
- hours = hours ? hours : 12; // the hour '0' should be '12'
351
- minutes = minutes < 10 ? '0' + minutes : minutes;
352
- var strTime = hours + ':' + minutes + ' ' + ampm;
353
- return strTime;
354
- }
355
-
356
-
357
-
358
- jQuery(document).on('click', '.b2s-sidbar-network-auth-btn', function () {
359
- jQuery('#b2s-network-list-modal').modal('show');
360
- return false;
361
- });
362
- jQuery(document).on('click', '.change-meta-tag', function () {
363
- var attr = jQuery(this).attr('readonly');
364
- if (typeof attr !== typeof undefined && attr !== false) {
365
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
366
- //Content cuation
367
- var postType = jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-post-wp-type');
368
- if (postType != "ex") {
369
- jQuery('.meta-text').hide();
370
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
371
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
372
- var isMetaChecked = false;
373
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
374
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
375
- isMetaChecked = true;
376
- }
377
- if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
378
- isMetaChecked = true;
379
- }
380
- var showDefault = true;
381
- if (postFormat == "0" && !isMetaChecked) { //isLinkPost
382
- showDefault = false;
383
- if (networkId == "1") {
384
- jQuery('.isOgMetaChecked').show();
385
- } else {
386
- jQuery('.isCardMetaChecked').show();
387
- }
388
- }
389
- if (showDefault) {
390
- jQuery('.isLinkPost').show();
391
- }
392
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
393
- }
394
- }
395
- return false;
396
- });
397
- // Linkpost change Meta Tags title + desc
398
- jQuery(document).on('keyup', '.change-meta-tag', function () {
399
- var currentText = jQuery(this).val();
400
- var metaTag = jQuery(this).attr('data-meta');
401
- jQuery('.change-meta-tag[data-meta=' + metaTag + ']').each(function () {
402
- //override this content with current content by keyup
403
- jQuery(this).val(currentText);
404
- });
405
- return false;
406
- });
407
- jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
408
- jQuery('.b2s-server-connection-fail').hide();
409
- jQuery.ajax({
410
- url: ajaxurl,
411
- type: "POST",
412
- dataType: "json",
413
- cache: false,
414
- data: {
415
- 'action': 'b2s_get_settings_sched_time_user',
416
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
417
- },
418
- error: function () {
419
- jQuery('.b2s-server-connection-fail').show();
420
- return false;
421
- },
422
- success: function (data) {
423
- var tomorrow = new Date();
424
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
425
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
426
- }
427
-
428
- tomorrow.setDate(tomorrow.getDate() + 1);
429
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
430
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
431
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
432
- var today = new Date();
433
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
434
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
435
- }
436
-
437
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
438
- var todayDate = ("0" + today.getDate()).slice(-2);
439
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
440
- var lang = jQuery('#b2sUserLang').val();
441
- if (lang == "de") {
442
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
443
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
444
- }
445
- if (data.result == true) {
446
- //V5.1.0 seeding
447
- if (data.type == 'new') {
448
- //new
449
- jQuery.each(data.times, function (network_auth_id, time) {
450
- if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
451
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').is(':not(:disabled)')) {
452
- //is not set special dates
453
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
454
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
455
- }
456
- var hours = time.substring(0, 2);
457
- var timeparts = time.split(' ');
458
- if (typeof timeparts[1] != 'undefined') {
459
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
460
- }
461
-
462
- var isDelay = false;
463
- var delayDay = data.delay_day[network_auth_id];
464
- if (delayDay != undefined) {
465
- if (delayDay > 0) {
466
- var delay = new Date();
467
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
468
- delay.setTime(jQuery('#b2sBlogPostSchedDate').val());
469
- }
470
- delay.setDate(delay.getDate() + parseInt(delayDay));
471
- var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
472
- var delayDate = ("0" + delay.getDate()).slice(-2);
473
- var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
474
- if (lang == 'de') {
475
- dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
476
- }
477
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
478
- isDelay = true;
479
-
480
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
481
- }
482
- }
483
- if (!isDelay) {
484
- if (hours < today.getHours()) {
485
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
486
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
487
- } else {
488
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
489
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
490
- }
491
- }
492
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
493
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').timepicker('setTime', new Date(today.getFullYear(), today.getMonth(), today.getDate(), hours, time.slice(3, 5)));
494
- }
495
- }
496
- });
497
- } else {
498
- //old
499
- jQuery.each(data.times, function (network_id, time) {
500
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
501
- time.forEach(function (network_type_time, count) {
502
- if (network_type_time != "") {
503
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
504
- if (jQuery(this).is(':not(:disabled)')) {
505
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
506
- //is not set special dates
507
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() != '1') {
508
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
509
- }
510
- var hours = network_type_time.substring(0, 2);
511
- if (lang == "en") {
512
- var timeparts = network_type_time.split(' ');
513
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
514
- }
515
- if (hours < today.getHours()) {
516
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
517
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
518
- } else {
519
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
520
- jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
521
- }
522
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
523
- jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
524
- }
525
- });
526
- count++;
527
- }
528
- });
529
- }
530
- });
531
- }
532
- } else {
533
- if (data.error == 'nonce') {
534
- jQuery('.b2s-nonce-check-fail').show();
535
- }
536
- //default load best Times
537
- //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
538
- //set current time
539
- jQuery('.b2s-post-item:visible').each(function () {
540
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
541
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
542
- //is not set special dates
543
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
544
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
545
- }
546
- }
547
- });
548
- }
549
- }
550
- });
551
- return false;
552
- });
553
- jQuery('#b2sPreFeatureModal').on('show.bs.modal', function () {
554
- jQuery('.b2s-post-item-details-release-input-date-select-reset').val('0');
555
- });
556
- jQuery(document).on('click', '.b2s-network-list-add-btn-profeature', function () {
557
- jQuery('#b2s-network-list-modal').modal('hide');
558
- });
559
- jQuery(document).on('click', '.b2s-post-item-details-release-area-sched-for-all', function () {
560
- var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
561
- var dataNetworkCount = 0;
562
- var selMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val();
563
- if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="1"]').is(":visible")) {
564
- dataNetworkCount = 1;
565
- }
566
- if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="2"]').is(":visible")) {
567
- dataNetworkCount = 2;
568
- }
569
-
570
- jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
571
- if (jQuery(this).attr('data-network-auth-id') != dataNetworkAuthId && jQuery(this).has('option[value="' + jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val() + '"]').length > 0) {
572
- jQuery(this).val(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val());
573
- //view elements
574
- releaseChoose(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
575
- //view elements interval
576
- if (selMode == 2) {
577
- for (var i = 0; i <= dataNetworkCount; i++) {
578
- var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
579
- releaseChooseInterval(curInterval, '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]', i);
580
- }
581
- }
582
- }
583
- });
584
- //set values
585
- for (var i = 0; i <= dataNetworkCount; i++) {
586
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
587
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
588
- if (selMode == 2) {
589
- var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
590
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]').val(curInterval);
591
- if (curInterval == 0) {
592
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
593
- jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
594
- jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
595
- jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
596
- jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
597
- jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
598
- jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
599
- jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
600
- }
601
- if (curInterval == 1) {
602
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
603
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
604
- }
605
- if (curInterval == 2) {
606
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
607
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
608
- }
609
- }
610
- }
611
-
612
- if (dataNetworkCount == 2) {
613
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
614
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
615
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').hide();
616
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"]').show();
617
- } else if (dataNetworkCount == 1) {
618
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
619
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').show();
620
- }
621
-
622
- return false;
623
- });
624
- jQuery(document).on("click", ".b2s-user-network-settings-post-format", function () {
625
- changePostFormat(jQuery(this).attr("data-network-id"), jQuery(this).attr("data-network-type"), jQuery(this).val(), jQuery(this).attr("data-network-auth-id"), jQuery(this).attr("data-post-format-type"), jQuery(this).attr("data-post-wp-type"), true);
626
- return false;
627
- });
628
- jQuery(document).on("click", ".b2s-post-ship-item-full-text", function () {
629
- jQuery('.b2s-server-connection-fail').hide();
630
- var curSchedCount = jQuery(this).attr('data-network-count');
631
- jQuery.ajax({
632
- url: ajaxurl,
633
- type: "POST",
634
- dataType: "json",
635
- cache: false,
636
- data: {
637
- 'action': 'b2s_ship_item_full_text',
638
- 'postId': jQuery('#b2sPostId').val(),
639
- 'userLang': jQuery('#b2sUserLang').val(),
640
- 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
641
- 'networkId': jQuery(this).attr('data-network-id'),
642
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
643
- },
644
- error: function () {
645
- jQuery('.b2s-server-connection-fail').show();
646
- return false;
647
- },
648
- success: function (data) {
649
- if (data.result == true) {
650
- messageInput = jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + curSchedCount + '"][data-network-auth-id="' + data.networkAuthId + '"]');
651
- messageInput.val(data.text);
652
- networkCount(data.networkAuthId);
653
- networkTextLimit = messageInput.attr('data-network-text-limit');
654
- if (typeof networkTextLimit != undefined) {
655
- if (parseInt(networkTextLimit) > 0 && parseInt(data.networkId) > 0) {
656
- networkLimitAll(data.networkAuthId, data.networkId, networkTextLimit);
657
- }
658
- }
659
- } else {
660
- if (data.error == 'nonce') {
661
- jQuery('.b2s-nonce-check-fail').show();
662
- }
663
- }
664
- }
665
- });
666
- return false;
667
- });
668
- jQuery(document).on("click", ".b2s-post-ship-item-message-delete", function () {
669
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
670
- var networkCountId = jQuery(this).attr('data-network-count');
671
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
672
- initSceditor(networkAuthId);
673
- networkCount(networkAuthId);
674
- return false;
675
- });
676
- jQuery(document).on("click", ".b2s-post-ship-item-copy-original-text", function () {
677
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
678
- var networkCountId = jQuery(this).attr('data-network-count');
679
- var networkId = jQuery(this).attr('data-network-id');
680
- var text = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').val();
681
- if (text == "" && networkId == 2) {
682
- text = jQuery('#b2sTwitterOrginalPost').val();
683
- }
684
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(text);
685
- networkCount(networkAuthId);
686
- return false;
687
- });
688
- jQuery(document).on("click", ".b2s-network-select-btn", function () {
689
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
690
- var networkId = jQuery(this).attr('data-network-id');
691
- var networkType = jQuery(this).attr('data-network-type');
692
- var metaType = jQuery(this).attr('data-meta-type');
693
-
694
- //doppelklick Schutz
695
- if (!jQuery(this).hasClass('b2s-network-select-btn-deactivate')) {
696
- //active?
697
- if (!jQuery(this).children().hasClass('active')) {
698
- //TOS XING Groups
699
- if ((networkId == 8 || networkId == 19) && networkType == 2) {
700
- if ((b2sTosXingGroupCount == jQuery('#b2sTosXingGroupCrosspostingLimit').val()) || (networkId == 19 && jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-tos-group-id="' + jQuery(this).attr('data-network-tos-group-id') + '"]').children().hasClass('active'))) {
701
- jQuery('#b2s-tos-xing-group-modal').modal('show');
702
- return false;
703
- } else {
704
- b2sTosXingGroupCount++;
705
- }
706
- }
707
- //schon vorhanden?
708
- if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').length > 0 && !jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').hasClass('b2s-post-item-connection-fail-dummy')) {
709
- activatePortal(networkAuthId);
710
- //PostFormat
711
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0 || networkId == 15) {
712
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
713
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').attr('data-post-format-type');
714
- if (jQuery('#user_version').val() >= 2) {
715
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
716
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
717
- //if linkpost then show btn meta tags
718
- var isMetaChecked = false;
719
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
720
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
721
- isMetaChecked = true;
722
- }
723
- if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
724
- isMetaChecked = true;
725
- }
726
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
727
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
728
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
729
- var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
730
- if (dataMetaType == "og") {
731
- jQuery('#b2sChangeOgMeta').val("1");
732
- } else {
733
- jQuery('#b2sChangeCardMeta').val("1");
734
- }
735
-
736
- //Copy from further item meta tags by same network
737
- jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
738
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "0" && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
739
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
740
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
741
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
742
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
743
- if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
744
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
745
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
746
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
747
- }
748
- } else {
749
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
750
- }
751
-
752
- return true;
753
- }
754
- });
755
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
756
- if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').data('meta-type') == 'og' && changedOGImage == true) {
757
- if (currentOGImage != "") {
758
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
759
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
760
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
761
- } else {
762
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
763
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
764
- }
765
- } else {
766
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
767
- }
768
- if ((networkId == "2" || networkId == "24")) {
769
- jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').show();
770
- }
771
- } else {
772
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
773
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
774
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
775
- if ((networkId == "2" || networkId == "24")) {
776
- jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').hide();
777
- }
778
- }
779
-
780
- } else {
781
- jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
782
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
783
- }
784
-
785
- //Content Curation
786
- if (jQuery('#b2sPostType').val() == 'ex') {
787
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
788
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
789
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
790
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 0) {
791
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
792
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
793
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
794
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
795
- } else {
796
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
797
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
798
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
799
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
800
- }
801
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
802
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
803
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
804
- }
805
- }
806
- }
807
-
808
- //XING TOS Group
809
- jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"').show();
810
-
811
- //Twitter TOS 032018 - protected multiple accounts with same content to same time
812
- //delete comment field one more
813
- if (networkId == 2) {
814
- if (jQuery('.b2s-post-item[data-network-id="' + networkId + '"]:visible').length == 1) {
815
- jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text(jQuery('#b2sTwitterOrginalPost').val());
816
- } else {
817
- jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text("");
818
- }
819
- }
820
- checkGifAnimation(networkAuthId, networkId);
821
- } else {
822
- jQuery(this).addClass('b2s-network-select-btn-deactivate');
823
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').show();
824
- jQuery('.b2s-empty-area').hide();
825
- loadingDummyShow(networkAuthId, jQuery(this).attr('data-network-id'));
826
- jQuery('.b2s-server-connection-fail').hide();
827
- var legacyMode = jQuery('#isLegacyMode').val();
828
- if (legacyMode == "1") {
829
- legacyMode = false; // loading is sync (stack)
830
- } else {
831
- legacyMode = true; // loading is async (parallel)
832
- }
833
- jQuery.ajax({
834
- url: ajaxurl,
835
- type: "POST",
836
- dataType: "json",
837
- async: legacyMode,
838
- cache: false,
839
- data: {
840
- 'action': 'b2s_ship_item',
841
- 'networkAuthId': networkAuthId,
842
- 'networkType': jQuery(this).attr('data-network-type'),
843
- 'networkKind': jQuery(this).attr('data-network-kind'),
844
- 'networkId': networkId,
845
- 'networkDisplayName': jQuery(this).attr('data-network-display-name'),
846
- 'instantSharing': jQuery(this).attr('data-instant-sharing'),
847
- 'networkTosGroupId': jQuery(this).attr('data-network-tos-group-id'),
848
- 'userLang': jQuery('#b2sUserLang').val(),
849
- 'postId': jQuery('#b2sPostId').val(),
850
- 'relayCount': jQuery('#b2sRelayCount').val(),
851
- 'selSchedDate': jQuery('#selSchedDate').val(),
852
- 'b2sPostType': jQuery('#b2sPostType').val(),
853
- 'b2sIsDraft': jQuery('#b2sIsDraft').val(),
854
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
855
- },
856
- beforeSend: function (jqXHR) { // before jQuery send the request we will push it to our array
857
- jQuery.xhrPool.push(jqXHR);
858
- },
859
- complete: function (jqXHR) { // when some of the requests completed it will splice from the array
860
- var index = jQuery.xhrPool.indexOf(jqXHR);
861
- if (index > -1) {
862
- jQuery.xhrPool.splice(index, 1);
863
- }
864
- },
865
- error: function (jqXHR) {
866
- var index = jQuery.xhrPool.indexOf(jqXHR);
867
- if (index > -1) {
868
- jQuery.xhrPool.splice(index, 1);
869
- }
870
- loadingDummyConnectionFail(networkAuthId, networkId);
871
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').hide();
872
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
873
- jQuery('.b2s-server-connection-fail').show();
874
- return true;
875
- },
876
- success: function (data) {
877
- if (data != undefined) {
878
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + data.networkAuthId + '"]').hide();
879
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
880
- if (data.result == true) {
881
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
882
- var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
883
- var pos = order.indexOf(data.networkAuthId.toString());
884
- var add = false;
885
- for (var i = pos; i >= 0; i--) {
886
- if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
887
- jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(data.content);
888
- i = -1;
889
- add = true;
890
- }
891
- }
892
- if (add == false) {
893
- jQuery('.b2s-post-list').prepend(data.content);
894
- }
895
-
896
- activatePortal(data.networkAuthId);
897
- var dateFormat = "yyyy-mm-dd";
898
- var language = "en";
899
- var showMeridian = true;
900
- if (jQuery('#b2sUserLang').val() == "de") {
901
- dateFormat = "dd.mm.yyyy";
902
- language = "de";
903
- }
904
- if (jQuery('#b2sUserTimeFormat').val() == 0) {
905
- showMeridian = false;
906
- }
907
- var today = new Date();
908
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
909
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
910
- }
911
-
912
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
913
- format: dateFormat,
914
- language: language,
915
- maxViewMode: 2,
916
- todayHighlight: true,
917
- startDate: today,
918
- calendarWeeks: true,
919
- autoclose: true
920
- });
921
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
922
- minuteStep: 15,
923
- appendWidgetTo: 'body',
924
- showSeconds: false,
925
- showMeridian: showMeridian,
926
- defaultTime: today, //'current',
927
- snapToStep: true
928
- });
929
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
930
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
931
- });
932
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
933
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
934
- });
935
- //Check Text Limit
936
- var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-text-limit');
937
- if (textLimit != "0") {
938
- networkLimitAll(data.networkAuthId, data.networkId, textLimit);
939
- } else {
940
- networkCount(data.networkAuthId);
941
- }
942
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger("change");
943
- initSceditor(data.networkAuthId);
944
- //Bild setzen
945
- if (jQuery('#b2s_blog_default_image').val() != "") {
946
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').length > 0) {
947
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
948
- var attachmenUrl = jQuery('#b2s_blog_default_image').val();
949
- var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
950
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
951
- if (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1) {
952
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-network-default-image').val());
953
- } else {
954
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
955
- }
956
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
957
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
958
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="0"]').show();
959
- } else {
960
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
961
- }
962
- }
963
- jQuery('.b2s-image-url-hidden-field').val(jQuery('#b2s_blog_default_image').val());
964
- }
965
-
966
- //Time zone
967
- jQuery('.b2s-settings-time-zone-text').html(jQuery('#user_timezone_text').val());
968
- //PostFormat
969
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0 || data.networkId == 15) {
970
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
971
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').attr('data-post-format-type');
972
- if (jQuery('#user_version').val() >= 2) {
973
- //Multi Image
974
- if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == 1 && ((data.networkId == 1 && (data.networkType == 1 || data.networkType == 2)) || (data.networkId == 2))) {
975
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + data.networkAuthId + '"]').show();
976
- }
977
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + data.networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
978
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
979
- var isMetaChecked = false;
980
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
981
- if (typeof data.networkId != 'undefined' && jQuery.inArray(data.networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
982
- isMetaChecked = true;
983
- }
984
- if ((data.networkId == "2" || data.networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
985
- isMetaChecked = true;
986
- }
987
-
988
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
989
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
990
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
991
- var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').attr("data-meta-type");
992
- if (dataMetaType == "og") {
993
- jQuery('#b2sChangeOgMeta').val("1");
994
- //TODO change image to OG image
995
- } else {
996
- jQuery('#b2sChangeCardMeta').val("1");
997
- }
998
-
999
- //Copy from further item meta tags by same network
1000
- jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
1001
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "0" && jQuery(this).attr('data-network-auth-id') != data.networkAuthId) { //other Linkpost by same network
1002
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1003
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1004
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
1005
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1006
-
1007
- if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
1008
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1009
- } else {
1010
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1011
- }
1012
- return true;
1013
- }
1014
- });
1015
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1016
- if (data.draft == false) {
1017
- if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').data('meta-type') == 'og' && changedOGImage == true) {
1018
- if (currentOGImage != "") {
1019
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1020
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1021
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1022
- } else {
1023
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1024
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1025
- }
1026
- } else {
1027
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1028
- }
1029
-
1030
- }
1031
- if ((networkId == "2" || networkId == "24")) {
1032
- jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').show();
1033
- }
1034
- } else {
1035
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1036
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1037
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1038
- if ((networkId == "2" || networkId == "24")) {
1039
- jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').hide();
1040
- }
1041
- }
1042
-
1043
- } else {
1044
- jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + data.networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
1045
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
1046
- }
1047
-
1048
-
1049
- if (jQuery('#selSchedDate').val() != "") {
1050
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1051
- }
1052
-
1053
-
1054
- //Twitter TOS 032018 - protected multiple accounts with same content to same time
1055
- //delete comment field one more
1056
- if (data.networkId == 2) {
1057
-
1058
- //set original post
1059
- if (jQuery('#b2sTwitterOrginalPost').val() == "") {
1060
- jQuery('#b2sTwitterOrginalPost').val(jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').val());
1061
- }
1062
-
1063
- if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 1) {
1064
- var firstAuth = jQuery('.b2s-post-item[data-network-id="' + data.networkId + '"]:first').attr('data-network-auth-id');
1065
- if (firstAuth != data.networkAuthId) {
1066
- jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1067
- } else {
1068
- if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 2) {
1069
- jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1070
- }
1071
- }
1072
- }
1073
- }
1074
-
1075
- //Content Curation
1076
- if (jQuery('#b2sPostType').val() == 'ex') {
1077
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1078
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1079
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + data.networkAuthId + '"]').attr("style", "display:none !important");
1080
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == 0) {
1081
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1082
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1083
- } else {
1084
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1085
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1086
- }
1087
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1088
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1089
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1090
- }
1091
-
1092
- //CC Imagepost V6.0.0
1093
- if (jQuery('#b2sExPostFormat').val() == 0 || jQuery('#b2sExPostFormat').val() == 1 || jQuery('#b2sExPostFormat').val() == 2) {
1094
- if (jQuery('#user_version').val() >= 1) {
1095
- var exPostFormat = jQuery('#b2sExPostFormat').val();
1096
- if (exPostFormat == 2) {
1097
- exPostFormat = 1;
1098
- }
1099
- openPostFormat(data.networkId, data.networkType, data.networkAuthId, 'ex', false);
1100
- changePostFormat(data.networkId, data.networkType, exPostFormat, data.networkAuthId, 'post', 'ex', false);
1101
- }
1102
- }
1103
- }
1104
-
1105
- }
1106
-
1107
- //Draft
1108
- if (data.draft == true) {
1109
- if (data.draftActions.post_format == "0" || data.draftActions.post_format == "1") {
1110
- jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1111
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').addClass('disabled');
1112
- jQuery('.b2s-user-network-settings-post-format[value="' + data.draftActions.post_format + '"][data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').trigger('click');
1113
- }
1114
-
1115
- jQuery.each(data.draftActions.sched_image_url, function (index, value) {
1116
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1117
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1118
- if (currentOGImage == '') {
1119
- currentOGImage = value;
1120
- } else {
1121
- value = currentOGImage;
1122
- }
1123
- }
1124
- if (value == "") {
1125
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + index + '"]').hide();
1126
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', jQuery('.b2s-network-default-image').val());
1127
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val("");
1128
- } else {
1129
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', value);
1130
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1131
- }
1132
- });
1133
-
1134
- if (data.draftActions.releaseSelect == "1") {
1135
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1136
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1137
-
1138
- jQuery.each(data.draftActions.date, function (index, value) {
1139
- if (index == "1" || index == "2") {
1140
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1141
- }
1142
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1143
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1144
- });
1145
- jQuery.each(data.draftActions.time, function (index, value) {
1146
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1147
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1148
- });
1149
- jQuery.each(data.draftActions.sched_content, function (index, value) {
1150
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1151
- });
1152
- }
1153
- if (data.draftActions.releaseSelect == "2") {
1154
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1155
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1156
-
1157
- jQuery.each(data.draftActions.intervalSelect, function (index, value) {
1158
- if (index == "1" || index == "2") {
1159
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1160
- }
1161
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1162
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1163
- });
1164
- jQuery.each(data.draftActions.weeks, function (index, value) {
1165
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1166
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1167
- });
1168
- jQuery.each(data.draftActions.duration_month, function (index, value) {
1169
- jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1170
- jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1171
- });
1172
- jQuery.each(data.draftActions.duration_time, function (index, value) {
1173
- jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1174
- jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1175
- });
1176
- jQuery.each(data.draftActions.select_day, function (index, value) {
1177
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1178
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1179
- });
1180
- jQuery.each(data.draftActions.select_timespan, function (index, value) {
1181
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1182
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1183
- });
1184
- jQuery.each(data.draftActions.mo, function (index, value) {
1185
- jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1186
- });
1187
- jQuery.each(data.draftActions.di, function (index, value) {
1188
- jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1189
- });
1190
- jQuery.each(data.draftActions.mi, function (index, value) {
1191
- jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1192
- });
1193
- jQuery.each(data.draftActions.do, function (index, value) {
1194
- jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1195
- });
1196
- jQuery.each(data.draftActions.fr, function (index, value) {
1197
- jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1198
- });
1199
- jQuery.each(data.draftActions.sa, function (index, value) {
1200
- jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1201
- });
1202
- jQuery.each(data.draftActions.so, function (index, value) {
1203
- jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1204
- });
1205
- jQuery.each(data.draftActions.date, function (index, value) {
1206
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1207
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1208
- });
1209
- jQuery.each(data.draftActions.time, function (index, value) {
1210
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1211
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1212
- });
1213
- }
1214
-
1215
- if (data.draftActions.post_relay == "1") {
1216
- jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').attr('checked', true);
1217
- jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1218
-
1219
- jQuery.each(data.draftActions.post_relay_account, function (index, value) {
1220
- if (index >= 1) {
1221
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1222
- }
1223
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1224
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1225
- });
1226
- jQuery.each(data.draftActions.post_relay_delay, function (index, value) {
1227
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1228
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1229
- });
1230
- }
1231
-
1232
- while (jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').is(':visible')) {
1233
- jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1234
- }
1235
- jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val('');
1236
- jQuery.each(data.draftActions.tags, function (index, value) {
1237
- if (index >= 1) {
1238
- jQuery('.ad-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1239
- }
1240
- jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val(value);
1241
- });
1242
-
1243
- jQuery('.b2s-post-item-details-item-title-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.custom_title);
1244
-
1245
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.url);
1246
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('error');
1247
-
1248
-
1249
- if (data.networkId == 1) {
1250
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_title);
1251
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_desc);
1252
- }
1253
-
1254
- if (data.networkId == 2) {
1255
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_title);
1256
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_desc);
1257
- }
1258
-
1259
- if (data.draftActions.image_url == "") {
1260
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1261
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', jQuery('.b2s-network-default-image').val());
1262
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val("");
1263
- } else {
1264
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', data.draftActions.image_url);
1265
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val(data.draftActions.image_url);
1266
- }
1267
- checkSchedDateTime(data.networkAuthId);
1268
-
1269
-
1270
- if (data.draftActions.multi_image_1 != "") {
1271
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').attr('src', data.draftActions.multi_image_1);
1272
- jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').val(data.draftActions.multi_image_1);
1273
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').show();
1274
- jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').show();
1275
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').hide();
1276
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1277
- jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').show();
1278
- }
1279
- if (data.draftActions.multi_image_2 != "") {
1280
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').attr('src', data.draftActions.multi_image_2);
1281
- jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').val(data.draftActions.multi_image_2);
1282
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1283
- jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1284
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').hide();
1285
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="3"]').show();
1286
- jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1287
- }
1288
- if (data.draftActions.multi_image_3 != "") {
1289
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').attr('src', data.draftActions.multi_image_3);
1290
- jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').val(data.draftActions.multi_image_3);
1291
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1292
- jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1293
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').hide();
1294
- jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1295
- }
1296
- }
1297
-
1298
- //XING Groups
1299
- if (data.networkId == 19 && data.networkType == 2) {
1300
- if (jQuery('.networkKind[data-network-auth-id="' + data.networkAuthId + '"]').val() == '3') {
1301
- jQuery('.marketplace_area[data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + data.networkId + '"]').show();
1302
- }
1303
- }
1304
- //XING TOS Group
1305
- if (data.networkId == 19) {
1306
- jQuery('.b2s-content-info[data-network-auth-id="' + data.networkAuthId + '"').show();
1307
- }
1308
-
1309
- if (metaType == 'og' && currentOGImage != '') {
1310
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1311
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1312
- }
1313
-
1314
- } else {
1315
- if (data.error == 'nonce') {
1316
- jQuery('.b2s-nonce-check-fail').show();
1317
- }
1318
- //TOS XING Groups
1319
- if (typeof data.reason !== "undefined") {
1320
- if (data.reason == 'tos_xing_group_exists') {
1321
- b2sTosXingGroupCount--;
1322
- deactivatePortal(data.networkAuthId);
1323
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1324
- jQuery('#b2s-tos-xing-group-modal').modal('show');
1325
- return false;
1326
- }
1327
- }
1328
- }
1329
- checkGifAnimation(data.networkAuthId, data.networkId);
1330
- }
1331
- }
1332
- });
1333
- }
1334
- } else {
1335
- //TOS XING Groups
1336
- if ((networkId == 8 || networkId == 19) && networkType == 2) {
1337
- b2sTosXingGroupCount--;
1338
- }
1339
- deactivatePortal(networkAuthId);
1340
- }
1341
- }
1342
- return false;
1343
- });
1344
- jQuery(document).on('click', '.b2s-post-item-details-url-image', function () {
1345
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
1346
- var networkCountId = jQuery(this).attr("data-network-count");
1347
- if (jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').is(":visible")) {
1348
-
1349
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1350
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
1351
- var isMetaChecked = false;
1352
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1353
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1354
- isMetaChecked = true;
1355
- }
1356
- if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
1357
- isMetaChecked = true;
1358
- }
1359
-
1360
- if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Faceboo or Twitter
1361
- jQuery('.meta-text').hide();
1362
- if (!isMetaChecked) {
1363
- if (networkId == "1") {
1364
- jQuery('.isOgMetaChecked').show();
1365
- } else {
1366
- jQuery('.isCardMetaChecked').show();
1367
- }
1368
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1369
- return false;
1370
- }
1371
- }
1372
-
1373
- jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1374
- }
1375
- return false;
1376
- });
1377
- jQuery(document).on('click', '.b2s-submit-btn-scroll', function () {
1378
- jQuery('.b2s-submit-btn').trigger('click');
1379
- });
1380
- jQuery(document).on('click', '.b2s-post-ship-item-post-format', function () {
1381
- openPostFormat(jQuery(this).attr('data-network-id'), jQuery(this).attr('data-network-type'), jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-post-wp-type'), true);
1382
- return false;
1383
- });
1384
- jQuery(document).on('click', '.b2s-btn-trigger-post-ship-item-post-format', function () {
1385
- jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1386
- return false;
1387
- });
1388
- jQuery(document).on('click', '.b2s-post-item-details-release-input-days', function () {
1389
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1390
- });
1391
- jQuery(document).on('change', '.b2s-post-item-details-release-input-time', function () {
1392
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1393
- });
1394
- jQuery(document).on('change', '.b2s-post-item-details-release-input-date', function () {
1395
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1396
- });
1397
- jQuery('.b2s-network-details-mandant-select').change(function () {
1398
- hideDuplicateAuths();
1399
- chooseMandant();
1400
- });
1401
- jQuery(document).on('change', '.b2s-post-item-details-item-group-select', function () {
1402
- if (jQuery(this).attr('data-change-network-display-name') == 'true') {
1403
- var label = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
1404
- jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').html(label);
1405
- jQuery('.b2s-post-ship-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(label);
1406
- }
1407
- //Xing groups
1408
- if (jQuery(this).attr('data-network-id') == '19') {
1409
- var option = jQuery('option:selected', this).attr('data-network-kind');
1410
- if (option == '3') { //Marketplace
1411
- jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1412
- } else {
1413
- jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').hide();
1414
- }
1415
- jQuery('.networkKind[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(option);
1416
- }
1417
-
1418
- return false;
1419
- });
1420
- //select recurrent sched interval mode
1421
- jQuery(document).on('change', '.b2s-post-item-details-release-input-interval-select', function () {
1422
- var interval = jQuery(this).val();
1423
- var selectorInput = '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
1424
- var dataCount = jQuery(this).attr('data-network-count');
1425
- releaseChooseInterval(interval, selectorInput, dataCount);
1426
- return false;
1427
- });
1428
- //select shipping mode
1429
- jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select', function () {
1430
- var dataNetworkCount = 0;
1431
- if (jQuery(this).val() == 0) {
1432
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1433
- if (jQuery(this).attr('data-network-id') == 2) {
1434
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1435
- }
1436
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
1437
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
1438
- }
1439
- }
1440
- if (jQuery(this).val() == 2) {
1441
- if (jQuery(this).attr('data-user-version') == 0) {
1442
- jQuery('#b2s-sched-post-modal').modal('show');
1443
- return false;
1444
- } else {
1445
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1446
- if (jQuery(this).attr('data-network-id') == 2) {
1447
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1448
- }
1449
-
1450
- for (var i = 1; i <= 2; i++) {
1451
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + i + '"]').each(function () {
1452
- if (jQuery(this).prop('checked')) {
1453
- dataNetworkCount = 1;
1454
- }
1455
- });
1456
- }
1457
- if (dataNetworkCount == 2) {
1458
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1459
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1460
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1461
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1462
- } else if (dataNetworkCount == 1) {
1463
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1464
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1465
- }
1466
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
1467
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
1468
- }
1469
- }
1470
- }
1471
- if (jQuery(this).val() == 1) {
1472
- if (jQuery(this).attr('data-user-version') == 0) {
1473
- jQuery('#b2s-sched-post-modal').modal('show');
1474
- return false;
1475
- } else {
1476
-
1477
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1478
- if (jQuery(this).attr('data-network-id') == 2) {
1479
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1480
- } else {
1481
- //set orginal edit content for customize sched content
1482
- var content = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').val();
1483
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(content);
1484
-
1485
- }
1486
-
1487
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1488
- if (dataNetworkCount == 2) {
1489
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1490
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1491
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1492
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1493
- } else if (dataNetworkCount == 1) {
1494
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1495
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1496
- }
1497
-
1498
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
1499
- }
1500
- }
1501
- releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
1502
- // jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').focus();
1503
- var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('data-network-text-limit');
1504
- if (textLimit != "0") {
1505
- networkLimitAll(jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-id'), textLimit);
1506
- } else {
1507
- networkCount(jQuery(this).attr('data-network-auth-id'));
1508
- }
1509
- });
1510
- jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function () {
1511
- jQuery('#b2sSchedPostInfoIgnore').val("1");
1512
- jQuery('.b2s-submit-btn').trigger("click");
1513
- return false;
1514
- });
1515
- jQuery(document).on('click', '.b2s-re-share-btn', function () {
1516
- jQuery('.panel-group').removeClass('b2s-border-color-warning');
1517
- jQuery(".b2s-settings-user-sched-time-area").show();
1518
- jQuery('#b2s-sidebar-wrapper').show();
1519
- jQuery('.b2s-post-item-info-area').show();
1520
- jQuery('.b2s-post-item-details-message-info').show();
1521
- jQuery('.b2s-post-item-details-edit-area').show();
1522
- jQuery('.b2s-post-item-details-message-result').hide();
1523
- jQuery('.b2s-post-item-details-message-result').html("");
1524
- jQuery(".b2s-post-area").show();
1525
- jQuery('.b2s-publish-area').show();
1526
- jQuery('.b2s-footer-menu').show();
1527
- window.scrollTo(0, 0);
1528
- jQuery('.b2s-reporting-btn-area').hide();
1529
- jQuery('#b2sSchedPostInfoIgnore').val("0");
1530
- //Calendar close for resfresh
1531
- jQuery('.b2s-toogle-calendar-btn').each(function () {
1532
- if (!jQuery(this).hasClass('hide')) {
1533
- var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
1534
- var currentBtnText = jQuery(this).text();
1535
- jQuery(this).text(toogleBtnText);
1536
- jQuery(this).attr('data-toogle-text-btn', currentBtnText);
1537
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1538
- var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
1539
- calendar.removeClass('show');
1540
- calendar.addClass('hide');
1541
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
1542
- }
1543
- });
1544
-
1545
- //TOS XING Group
1546
- jQuery('.b2s-network-select-btn').each(function () {
1547
- if (jQuery(this).children().hasClass('active')) {
1548
- if (jQuery(this).attr('data-network-id') == "19" && jQuery(this).attr('data-network-type') == "2") {
1549
- b2sTosXingGroupCount--;
1550
- deactivatePortal(jQuery(this).attr('data-network-auth-id'));
1551
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-network-select-btn-deactivate');
1552
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
1553
- }
1554
- }
1555
- });
1556
-
1557
- return false;
1558
- });
1559
- jQuery(document).on('click', '.b2s-post-item-details-release-input-add', function () {
1560
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1561
- var netCount = jQuery(this).attr('data-network-count');
1562
- var networkId = jQuery(this).attr('data-network-id');
1563
- var networkType = jQuery(this).attr('data-network-type');
1564
- var netCountNext = parseInt(netCount) + 1;
1565
- var curMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val();
1566
- jQuery(this).hide();
1567
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]').hide();
1568
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1569
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1570
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1571
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1572
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1573
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1574
-
1575
- if (curMode == 1) {
1576
- //since 4.9.0 custom content
1577
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1578
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1579
- }
1580
- //recurrently
1581
- if (curMode == 2) {
1582
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1583
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1584
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1585
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1586
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1587
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1588
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').val('1');
1589
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1590
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1591
- //since 4.9.0 custom content
1592
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').hide();
1593
- }
1594
-
1595
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').focus();
1596
- var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').attr('data-network-text-limit');
1597
- if (textLimit != "0") {
1598
- networkLimitAll(networkAuthId, networkId, textLimit);
1599
- } else {
1600
- networkCount(networkAuthId);
1601
- }
1602
- return false;
1603
- });
1604
- jQuery(document).on('click', '.b2s-post-item-details-release-input-hide', function () {
1605
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1606
- var netCount = jQuery(this).attr('data-network-count');
1607
- var netCountBevor = parseInt(netCount) - 1;
1608
- var selectorInput = '[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]'
1609
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
1610
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1611
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1612
- //clean all fields
1613
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
1614
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
1615
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).val('');
1616
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
1617
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('checked', false);
1618
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
1619
- //since 4.9.0 custom content
1620
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput).prop('disabled', true);
1621
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput).removeClass('error');
1622
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
1623
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
1624
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
1625
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
1626
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
1627
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled', true);
1628
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).val("1");
1629
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
1630
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled', true);
1631
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).val("1");
1632
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
1633
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
1634
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled', true);
1635
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).val("1");
1636
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
1637
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled', true);
1638
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).val("1");
1639
- return false;
1640
- });
1641
- jQuery(document).on("keyup", ".complete_network_url", function () {
1642
- var url = jQuery(this).val();
1643
- jQuery(this).removeClass("error");
1644
- if (url.length != "0") {
1645
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
1646
- url = "http://" + url;
1647
- jQuery(this).val(url);
1648
- }
1649
- } else if (jQuery(this).hasClass("required_network_url")) {
1650
- if (!((jQuery(this).attr('data-network-id') == 1 || jQuery(this).attr('data-network-id') == 3 || jQuery(this).attr('data-network-id') == 19) && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == 1)) { //Facebook & Linkedin Imagepost don't require Link
1651
- url = jQuery("#b2sDefault_url").val();
1652
- jQuery(this).val(url);
1653
- }
1654
- }
1655
- });
1656
- jQuery(document).on('click', '.scroll-to-top', function () {
1657
- window.scrollTo(0, 0);
1658
- return false;
1659
- });
1660
- jQuery(document).on('click', '.scroll-to-bottom', function () {
1661
- window.scrollTo(0, document.body.scrollHeight);
1662
- return false;
1663
- });
1664
- jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', function () {
1665
- var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+(?:\.[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.ÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß]+$/);
1666
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1667
- var url = jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val();
1668
- if (re.test(url)) {
1669
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
1670
- jQuery(this).addClass('glyphicon-refresh-animate');
1671
- jQuery('.b2s-server-connection-fail').hide();
1672
- jQuery.ajax({
1673
- url: ajaxurl,
1674
- type: "POST",
1675
- dataType: "json",
1676
- cache: false,
1677
- data: {
1678
- 'action': 'b2s_ship_item_reload_url',
1679
- 'networkId': jQuery(this).attr('data-network-id'),
1680
- 'networkAuthId': networkAuthId,
1681
- 'postId': jQuery('#b2sPostId').val(),
1682
- 'defaultUrl': jQuery('#b2sDefault_url').val(),
1683
- 'url': url,
1684
- 'postType': jQuery('#b2sPostType').val(),
1685
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1686
- },
1687
- error: function () {
1688
- jQuery('.b2s-server-connection-fail').show();
1689
- return false;
1690
- },
1691
- success: function (data) {
1692
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
1693
- if (data.result == true) {
1694
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.title);
1695
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.description);
1696
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
1697
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1698
- }
1699
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '1') {
1700
- if (data.image != "") {
1701
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1702
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(data.image);
1703
- } else {
1704
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1705
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1706
- }
1707
- checkGifAnimation(data.networkAuthId, data.networkId);
1708
- }
1709
- } else {
1710
- if (data.error == 'nonce') {
1711
- jQuery('.b2s-nonce-check-fail').show();
1712
- }
1713
- }
1714
- }
1715
-
1716
- });
1717
- } else {
1718
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
1719
- }
1720
- });
1721
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
1722
- jQuery('.b2s-upload-image-invalid-extension').hide();
1723
- jQuery('.b2s-image-change-meta-network').hide();
1724
- jQuery('.b2s-image-add-this-network').hide();
1725
- jQuery('.b2s-image-change-this-network').show();
1726
- var metaType = jQuery(this).attr('data-meta-type');
1727
- var authId = jQuery(this).attr('data-network-auth-id');
1728
- var countId = jQuery(this).attr('data-network-count');
1729
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').val();
1730
- var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + authId + ']').attr("data-network-id");
1731
- var isMetaChecked = false;
1732
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1733
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1734
- isMetaChecked = true;
1735
- }
1736
- if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
1737
- isMetaChecked = true;
1738
- }
1739
-
1740
- if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Facebook or Twitter
1741
- jQuery('.meta-text').hide();
1742
- if (!isMetaChecked) {
1743
- if (networkId == "1") {
1744
- jQuery('.isOgMetaChecked').show();
1745
- } else {
1746
- jQuery('.isCardMetaChecked').show();
1747
- }
1748
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1749
- return false;
1750
- }
1751
- }
1752
-
1753
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId);
1754
- jQuery('.b2s-image-change-all-network').attr('data-network-count', countId).attr('data-network-id', networkId);
1755
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId).attr('data-network-count', countId);
1756
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
1757
- jQuery('.b2s-selected-network-for-image-info').html(content);
1758
- jQuery('#b2sInsertImageType').val("0");
1759
- if (typeof metaType !== 'undefined') {
1760
- jQuery('.b2s-image-change-this-network').attr('data-meta-type', metaType);
1761
-
1762
- if (postFormat != "1") {
1763
- var activeMetaNetworks = {};
1764
- var inactiveMetaNetworks = {};
1765
- jQuery('.b2s-network-select-btn[data-meta-type="' + metaType + '"]').each(function () {
1766
- if (jQuery(this).find('.active').length > 0) {
1767
- activeMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1768
- } else {
1769
- inactiveMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1770
- }
1771
- });
1772
-
1773
- jQuery('.b2s-change-meta-image-networks').html('');
1774
- jQuery.each(activeMetaNetworks, function (key, value) {
1775
- jQuery('.b2s-change-meta-image-networks').append('<div style="display: inline-block;"><img class="b2s-meta-image-network-icon" src="' + jQuery('#b2sPortalImagePath').val() + value + '_flat.png' + '"> ' + jQuery('.b2s-network-select-btn[data-network-auth-id="' + key + '"]').attr('data-network-display-name').toUpperCase() + '</div>');
1776
- });
1777
- jQuery.each(inactiveMetaNetworks, function (key, value) {
1778
- jQuery('.b2s-change-meta-image-networks').append('<div style="display: inline-block;"><img class="b2s-meta-image-network-icon b2s-btn-disabled" src="' + jQuery('#b2sPortalImagePath').val() + value + '_flat.png' + '"> ' + jQuery('.b2s-network-select-btn[data-network-auth-id="' + key + '"]').attr('data-network-display-name').toUpperCase() + '</div>');
1779
- });
1780
- jQuery('.b2s-change-meta-image-info').show();
1781
-
1782
- jQuery('.b2s-image-change-meta-network').show();
1783
- jQuery('.b2s-image-change-this-network').hide();
1784
-
1785
- jQuery(document).on('click', '.b2s-image-change-meta-network', function () {
1786
- currentOGImage = jQuery('input[name=image_url]:checked').val();
1787
- changedOGImage = true;
1788
- if (jQuery('.b2s-input-hidden[name="action"][value="b2s_edit_save_post"]').length > 0) { //sched or calender view
1789
- jQuery('.b2s-image-change-this-network').trigger('click');
1790
- } else { //ship view
1791
- jQuery.each(activeMetaNetworks, function (networkAuthId, networkId) {
1792
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1793
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1794
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1795
- checkGifAnimation(networkAuthId, networkId);
1796
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1797
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1798
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1799
- }
1800
- }
1801
- });
1802
- jQuery.each(inactiveMetaNetworks, function (networkAuthId, networkId) {
1803
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1804
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1805
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1806
- checkGifAnimation(networkAuthId, networkId);
1807
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1808
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1809
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1810
- }
1811
- }
1812
- });
1813
- }
1814
- jQuery('#b2s-network-select-image').modal('hide');
1815
- });
1816
- } else {
1817
- jQuery('.b2s-change-meta-image-info').hide();
1818
- }
1819
-
1820
- } else {
1821
- jQuery('.b2s-image-change-this-network').attr('data-meta-type', "");
1822
- jQuery('.b2s-change-meta-image-info').hide();
1823
- }
1824
- //set selected image
1825
- var selImageVal = jQuery('.b2s-post-item-details-url-image[data-network-count="' + countId + '"][data-network-auth-id="' + authId + '"]').attr('src');
1826
- jQuery('#b2s-network-select-image').modal('show');
1827
- jQuery('.checkNetworkImage[data-src="' + selImageVal + '"]').attr('checked', 'checked');
1828
- imageSize();
1829
- return false;
1830
- });
1831
- jQuery(document).on('click', '.b2s-image-remove-btn', function () {
1832
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1833
- var networkCountId = jQuery(this).attr('data-network-count');
1834
- var defaultImage = jQuery('#b2sDefaultNoImage').val();
1835
- //default
1836
- if (networkCountId == -1) {
1837
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1838
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1839
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1840
- } else {
1841
- //customize sched content
1842
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1843
- jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
1844
- jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').hide();
1845
- }
1846
-
1847
- //add check linkpost change meta tag image for this network
1848
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1849
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1850
- if (typeof postFormat !== typeof undefined && postFormat !== false) {
1851
- if (postFormat == "0") { //if linkpost
1852
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1853
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1854
- //override this image with current image
1855
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1856
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1857
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1858
- }
1859
- });
1860
- if (jQuery('.b2s-select-image-modal-open[data-network-auth-id=' + networkAuthId + ']').attr('data-meta-type') == 'og') {
1861
- jQuery('.b2s-select-image-modal-open[data-meta-type="og"]').each(function () {
1862
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == "0") {
1863
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1864
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1865
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1866
- }
1867
- });
1868
- currentOGImage = '';
1869
- changedOGImage = true;
1870
- }
1871
- //customize sched content
1872
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1873
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1874
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1875
- }
1876
- }
1877
- return false;
1878
- });
1879
- jQuery(document).on('click', '.b2s-image-change-this-network', function () {
1880
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1881
- var networkCountId = jQuery(this).attr('data-network-count');
1882
- var networkId = jQuery(this).attr('data-network-id');
1883
- var currentImage = jQuery('input[name=image_url]:checked').val();
1884
- if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
1885
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
1886
- sceditor.insert("<br /><img src='" + currentImage + "'/><br />");
1887
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage); //Torial
1888
- } else {
1889
- //default
1890
- if (networkCountId == -1) {
1891
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1892
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1893
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1894
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1895
- } else {
1896
- //customize sched content
1897
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1898
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1899
- jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1900
- jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').show();
1901
- }
1902
-
1903
- if (jQuery(this).attr('data-meta-type') == "og") {
1904
- jQuery('#b2sChangeOgMeta').val("1");
1905
- }
1906
- if (jQuery(this).attr('data-meta-type') == "card") {
1907
- jQuery('#b2sChangeCardMeta').val("1");
1908
- }
1909
-
1910
- //add check linkpost change meta tag image for this network
1911
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1912
- var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1913
- if (typeof postFormat !== typeof undefined && postFormat !== false) {
1914
- if (networkId != 12) { // ignore for instagram
1915
- if (postFormat == "0") { //if linkpost
1916
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1917
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1918
- //override this image with current image
1919
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentImage);
1920
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
1921
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentImage);
1922
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1923
- if (networkCountId >= 0) {
1924
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1925
- }
1926
- }
1927
- });
1928
- //customize sched content
1929
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1930
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1931
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1932
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1933
- if (networkCountId >= 0) {
1934
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').hide();
1935
- }
1936
- }
1937
- }
1938
- }
1939
- }
1940
- jQuery('.b2s-upload-image-invalid-extension').hide();
1941
- jQuery('.b2s-upload-image-no-permission').hide();
1942
- jQuery('.b2s-upload-image-free-version-info').hide();
1943
- jQuery('#b2s-network-select-image').modal('hide');
1944
- checkGifAnimation(networkAuthId, networkId);
1945
- return false;
1946
- });
1947
- jQuery(document).on('change', '.b2s-post-item-details-relay', function () {
1948
- if (jQuery(this).attr('data-user-version') == 0) {
1949
- jQuery(this).prop("checked", false);
1950
- jQuery('#b2sInfoPostRelayModal').modal('show');
1951
- return false;
1952
- }
1953
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1954
- if (jQuery(this).is(":checked")) {
1955
-
1956
- if (jQuery('#b2sRelayAccountData').val() != "") {
1957
- jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1958
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1959
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1960
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1961
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1962
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1963
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
1964
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
1965
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1966
- //Relay Html Data
1967
- if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').has('option').length == 0) {
1968
- var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
1969
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').append(optionData);
1970
- }
1971
-
1972
- } else {
1973
- jQuery(this).prop("checked", false);
1974
- }
1975
-
1976
- } else {
1977
- jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1978
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1979
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1980
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1981
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1982
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
1983
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
1984
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1985
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1986
- }
1987
- return false;
1988
- });
1989
- jQuery(document).on('click', '.b2s-post-item-details-relay-input-add', function () {
1990
- var netCount = jQuery(this).attr('data-network-count');
1991
- var netCountNext = parseInt(netCount) + 1;
1992
- jQuery(this).hide();
1993
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1994
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1995
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1996
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1997
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1998
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1999
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
2000
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2001
- jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2002
- //Relay Html Data
2003
- if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').has('option').length == 0) {
2004
- var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2005
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').append(optionData);
2006
- }
2007
-
2008
- return false;
2009
- });
2010
- jQuery(document).on('click', '.b2s-post-item-details-relay-input-hide', function () {
2011
- var netCount = jQuery(this).attr('data-network-count');
2012
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2013
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2014
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2015
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2016
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2017
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
2018
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
2019
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide()
2020
- jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2021
- if (netCount >= 1) {
2022
- var before = netCount - 1;
2023
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + before + '"]').show();
2024
- }
2025
-
2026
- return false;
2027
- });
2028
- jQuery(document).on('click', '.b2s-image-change-all-network', function () {
2029
- jQuery('.b2s-post-item-details-item-message-input-allow-html').each(function () {
2030
- var sce = jQuery(this).sceditor('instance');
2031
- if (typeof sce !== 'undefined' && typeof sce.insert !== 'undefined') {
2032
- if (jQuery(sce.getBody().innerHTML).find(".b2s-post-item-details-image-html-src").length > 0) {
2033
- var innerHtml = sce.getBody().innerHTML;
2034
- innerHtml = innerHtml.replace(/class="b2s-post-item-details-image-html-src" src=".*"/, 'class="b2s-post-item-details-image-html-src" src="' + jQuery('input[name=image_url]:checked').val() + '"');
2035
- innerHtml = innerHtml.replace(/src=".*" class="b2s-post-item-details-image-html-src"/, 'class="b2s-post-item-details-image-html-src" src="' + jQuery('input[name=image_url]:checked').val() + '"');
2036
- jQuery('.b2s-post-ship-item-message-delete[data-network-auth-id="' + jQuery(this).data('network-auth-id') + '"]').trigger('click')
2037
- var sce = jQuery(this).sceditor('instance');
2038
- sce.insert(innerHtml);
2039
- } else {
2040
- sce.insert("<br /><img class='b2s-post-item-details-image-html-src' src='" + jQuery('input[name=image_url]:checked').val() + "'/><br />");
2041
- }
2042
- }
2043
- });
2044
- var noGifs = '';
2045
- if (typeof jQuery('input[name=image_url]:checked').val() !== typeof undefined) {
2046
- var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1).toLowerCase();
2047
- if (attachmenUrlExt == 'gif') {
2048
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2049
- jQuery.each(networkNotAllowGif, function (key, value) {
2050
- noGifs += ':not([data-network-id="' + value + '"])';
2051
- });
2052
- }
2053
- }
2054
- jQuery('.b2s-post-item-details-url-image[data-network-image-change="1"]' + noGifs).attr('src', jQuery('input[name=image_url]:checked').val());
2055
- jQuery('#b2s_blog_default_image').val(jQuery('input[name=image_url]:checked').val());
2056
- jQuery('.b2s-post-item-details-url-image' + noGifs).removeClass('b2s-img-required');
2057
- jQuery('.b2s-image-url-hidden-field' + noGifs).val(jQuery('input[name=image_url]:checked').val());
2058
- jQuery('.b2s-image-remove-btn' + noGifs).show();
2059
- jQuery('.b2s-post-item-details-release-input-date-select' + noGifs).each(function () {
2060
- if (jQuery(this).val() == 1) {
2061
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]' + noGifs).hide();
2062
- }
2063
- });
2064
-
2065
- jQuery('.b2s-upload-image-invalid-extension').hide();
2066
- jQuery('.b2s-upload-image-no-permission').hide();
2067
- jQuery('.b2s-upload-image-free-version-info').hide();
2068
- jQuery('.b2sChangeOgMeta').val("1");
2069
- jQuery('.b2sChangeCardMeta').val("1");
2070
- jQuery('#b2s-network-select-image').modal('hide');
2071
-
2072
- currentOGImage = jQuery('input[name=image_url]:checked').val();
2073
- changedOGImage = true;
2074
- if (typeof currentOGImage !== typeof undefined) {
2075
- var attachmenUrlExt = currentOGImage.substr(currentOGImage.lastIndexOf('.') + 1);
2076
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
2077
- if (attachmenUrlExt == 'gif') {
2078
- jQuery('.b2s-image-url-hidden-field').each(function () {
2079
- checkGifAnimation(jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-id'));
2080
- });
2081
- }
2082
- }
2083
- return false;
2084
- });
2085
- jQuery(document).on('click', '.b2s-upload-image', function () {
2086
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
2087
- if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
2088
- jQuery('#b2s-network-select-image').modal('hide');
2089
- wpMedia = wp.media({
2090
- title: jQuery('#b2s_wp_media_headline').val(),
2091
- button: {
2092
- text: jQuery('#b2s_wp_media_btn').val(),
2093
- },
2094
- multiple: false,
2095
- library: {type: 'image'}
2096
- });
2097
- wpMedia.open();
2098
- wpMedia.on('select', function () {
2099
- var validExtensions = ['jpg', 'jpeg', 'png', 'gif'];
2100
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2101
- var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2102
- var attachment = wpMedia.state().get('selection').first().toJSON();
2103
- var attachmenUrl = attachment.url;
2104
- var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
2105
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
2106
- if (jQuery.inArray(attachmenUrlExt, validExtensions) == -1 || (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1)) {
2107
- jQuery('#b2s-network-select-image').modal('show');
2108
- jQuery('.b2s-upload-image-invalid-extension').show();
2109
- jQuery('#b2s-upload-image-invalid-extension-file-name').html('<span class="glyphicon glyphicon-ban-circle"></span> ' + attachment.name + '.' + attachmenUrlExt + '<br>');
2110
- jQuery('.b2s-choose-image-no-image-info-text').hide();
2111
- jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2112
- return false;
2113
- }
2114
- var count = parseInt(jQuery('.b2s-choose-image-count').val());
2115
- count = count + 1;
2116
- jQuery('.b2s-choose-image-count').val(count);
2117
- var content = '<div class="b2s-image-item">' +
2118
- '<div class="b2s-image-item-thumb">' +
2119
- '<label for="b2s-image-count-' + count + '">' +
2120
- '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
2121
- '</label>' +
2122
- '</div>' +
2123
- '<div class="b2s-image-item-caption text-center">' +
2124
- '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
2125
- '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
2126
- '</div>' +
2127
- '</div>';
2128
- jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
2129
- // jQuery('.b2s-image-change-btn-area').show();
2130
- jQuery('.b2s-choose-image-no-image-info-text').hide();
2131
- jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2132
- jQuery('.b2s-upload-image-invalid-extension').hide();
2133
- jQuery('input[name=image_url]:last').prop("checked", true);
2134
- jQuery('#b2s-network-select-image').modal('show');
2135
- imageSize();
2136
- });
2137
- wpMedia.on('close', function () {
2138
- jQuery('#b2s-network-select-image').modal('show');
2139
- });
2140
- } else {
2141
- jQuery('.b2s-upload-image-no-permission').show();
2142
- }
2143
- return false;
2144
- });
2145
- jQuery(document).on('change', '.checkNetworkImage', function () {
2146
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2147
- var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1);
2148
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
2149
- if (attachmenUrlExt == 'gif') {
2150
- var networkAuthId = jQuery('.b2s-upload-image').attr('data-network-auth-id');
2151
- var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2152
- if (jQuery.inArray(networkId, networkNotAllowGif) != -1) {
2153
- jQuery('.b2s-image-change-this-network').attr('disabled', true);
2154
- jQuery('.b2s-image-change-all-network').attr('disabled', true);
2155
- jQuery('.b2s-upload-image-invalid-extension').show();
2156
- jQuery('#b2s-upload-image-invalid-extension-file-name').html();
2157
- } else {
2158
- jQuery('.b2s-image-change-this-network').attr('disabled', false);
2159
- jQuery('.b2s-image-change-all-network').attr('disabled', false);
2160
- }
2161
- jQuery('.b2s-gif-support-info').show();
2162
- } else {
2163
- jQuery('.b2s-image-change-this-network').attr('disabled', false);
2164
- jQuery('.b2s-image-change-all-network').attr('disabled', false);
2165
- jQuery('.b2s-gif-support-info').hide();
2166
- }
2167
- });
2168
- jQuery('#b2s-network-select-image').on('shown.bs.modal', function () {
2169
- jQuery('.checkNetworkImage').trigger('change');
2170
- });
2171
- jQuery(document).on('click', '.b2s-upload-image-free-version', function () {
2172
- jQuery('.b2s-upload-image-free-version-info').show();
2173
- });
2174
- jQuery("#b2sNetworkSent").keypress(function (e) {
2175
- if (e.keyCode == 13 && e.target.tagName == "INPUT")
2176
- return false;
2177
- });
2178
- jQuery.validator.addMethod("checkUrl", function (value, element, regexp) {
2179
- var re = new RegExp(regexp);
2180
- return this.optional(element) || re.test(value);
2181
- }, "Invalid Url");
2182
- jQuery.validator.addClassRules("b2s-post-item-details-item-url-input", {
2183
- checkUrl: /^(https?:\/\/)+[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+(?:\.[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.ÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß]+$/
2184
- });
2185
- //Twitter TOS 032018 - protected multiple accounts with same content to same time ( by all connections)
2186
- jQuery.validator.addMethod("unique", function (value, element, params) {
2187
- var curNetworkAuthId = jQuery(element).attr('data-network-auth-id');
2188
- var curNetworkId = jQuery(element).attr('data-network-id');
2189
- var prefix = params;
2190
- var selector = jQuery.validator.format("[name!='{0}'][unique='{1}'][data-network-id='" + curNetworkId + "']", element.name, prefix);
2191
- var matches = new Array();
2192
-
2193
- jQuery('.b2s-unique-content[data-network-id="' + curNetworkId + '"]').hide();
2194
- jQuery('.tw-textarea-input').removeClass('error');
2195
-
2196
- jQuery(selector).each(function (index, item) {
2197
- //none disabled elements || ignore default content if curSchedMode=1
2198
- if (!jQuery(item).is(':not(:disabled)') || !jQuery(item).is(':visible') || !jQuery('.b2s-post-item[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').is(':visible') || (jQuery(item).attr('data-network-count') == -1 && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"] option[value="1"]:selected').length > 0)) {
2199
- return true;
2200
- }
2201
- if (jQuery.trim(value) == jQuery.trim(jQuery(item).val())) {
2202
- jQuery('.b2s-unique-content[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').show();
2203
- matches.push(item);
2204
- }
2205
- });
2206
- if (matches.length != 0) {
2207
- jQuery('.b2s-unique-content[data-network-auth-id="' + curNetworkAuthId + '"]').show();
2208
- }
2209
- return true;
2210
- });
2211
-
2212
-
2213
- jQuery.validator.classRuleSettings.unique = {
2214
- unique: true
2215
- };
2216
- jQuery.validator.addMethod("checkTags", function (value, element, test) {
2217
- var allowed_tags = ['p', 'h1', 'h2', 'br', 'i', 'em', 'b', 'a', 'img', 'span'];
2218
- var tags = value.match(/(<([^>]+)>)/ig);
2219
- if (tags !== null && tags.length > 0) {
2220
- if (jQuery(element).hasClass('b2s-post-item-details-item-message-input-allow-html')) {
2221
- for (var i = 0; i < tags.length; i++) {
2222
- var allowed_count = 0;
2223
- for (var e = 0; e < allowed_tags.length; e++) {
2224
- var regex = new RegExp("<\s*(\/)?" + allowed_tags[e] + "(( [^>]*>)|[>])");
2225
- if (tags[i].match(regex) != null) {
2226
- allowed_count = 1;
2227
- }
2228
- }
2229
- if (allowed_count == 0) {
2230
- return false;
2231
- }
2232
- }
2233
- } else {
2234
- return false;
2235
- }
2236
- }
2237
- return true;
2238
- });
2239
- jQuery.validator.addClassRules('b2s-post-item-details-item-message-input', {'checkTags': true});
2240
- jQuery.validator.addClassRules('b2s-post-item-details-release-input-date-select', {'checkSched': true});
2241
- jQuery.validator.addClassRules('b2s-post-item-details-item-title-input', {required: true});
2242
- jQuery.validator.addMethod('checkSched', function (value, element, rest) {
2243
- if (jQuery(element).is(':not(:disabled)') && jQuery(element).val() != 0) {
2244
- var networkAuthId = jQuery(element).attr('data-network-auth-id');
2245
- if (jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2246
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2247
- return false;
2248
- } else {
2249
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2250
- }
2251
- if (jQuery(element).val() == 1) {
2252
- if (jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2253
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2254
- return false;
2255
- } else {
2256
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2257
- }
2258
-
2259
- } else {
2260
- var maxCount = jQuery('.b2s-post-item-details-release-input-daySelect[data-network-auth-id="' + networkAuthId + '"]').length;
2261
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2262
- var daySelect = false;
2263
- var daySelectErrorCount = 0;
2264
- for (var count = 0; count < maxCount; count++) {
2265
- if (jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').is(':not(:disabled)')) {
2266
- daySelect = false;
2267
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').each(function () {
2268
- if (jQuery(this).is(':checked')) {
2269
- daySelect = true;
2270
- }
2271
- });
2272
- if (daySelect === false) {
2273
- daySelectErrorCount += 1;
2274
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').addClass('error');
2275
- }
2276
- }
2277
- }
2278
- if (daySelectErrorCount != 0) {
2279
- return false;
2280
- }
2281
- }
2282
- }
2283
- return true;
2284
- });
2285
- jQuery("#b2sNetworkSent").validate({
2286
- ignore: "",
2287
- errorPlacement: function () {
2288
- return false;
2289
- },
2290
- submitHandler: function (form) {
2291
- if (checkNetworkSelected() == false) {
2292
- return false;
2293
- }
2294
- if (checkPostSchedOnBlog() == false) {
2295
- return false;
2296
- }
2297
- if (checkImageByImageNetworks() == false) {
2298
- return false;
2299
- }
2300
-
2301
- var userDate = new Date();
2302
- var pubDate = userDate.getFullYear() + "-" + padDate(userDate.getMonth() + 1) + "-" + padDate(userDate.getDate()) + " " + padDate(userDate.getHours()) + ":" + padDate(userDate.getMinutes()) + ":" + padDate(userDate.getSeconds());
2303
- jQuery('#publish_date').val(pubDate);
2304
- jQuery(".b2s-loading-area").show();
2305
- jQuery(".b2s-post-area").hide();
2306
- jQuery(".b2s-settings-user-sched-time-area").hide();
2307
- jQuery('#b2s-sidebar-wrapper').hide();
2308
- jQuery('.b2s-post-item-info-area').hide();
2309
- jQuery.xhrPool.abortAll();
2310
- jQuery('.b2s-server-connection-fail').hide();
2311
- jQuery.ajax({
2312
- processData: false,
2313
- url: ajaxurl,
2314
- type: "POST",
2315
- dataType: "json",
2316
- cache: false,
2317
- data: jQuery(form).serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
2318
- error: function () {
2319
- jQuery('.b2s-server-connection-fail').show();
2320
- return false;
2321
- },
2322
- success: function (data) {
2323
- if (data.error == 'nonce') {
2324
- jQuery('.b2s-nonce-check-fail').show();
2325
- return false;
2326
- }
2327
- var content = data.content;
2328
- jQuery(".b2s-loading-area").hide();
2329
- for (var i = 0; i < content.length; i++) {
2330
- jQuery('.b2s-post-item-details-message-info[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2331
- jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2332
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
2333
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
2334
- jQuery('.b2s-content-info').hide();
2335
- if (typeof content[i]['approve'] !== typeof undefined) {
2336
- jQuery('.panel-group[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').addClass('b2s-border-color-warning');
2337
- }
2338
- }
2339
- jQuery(".b2s-post-area").show();
2340
- jQuery('.b2s-publish-area').hide();
2341
- jQuery('.b2s-footer-menu').hide();
2342
- window.scrollTo(0, 0);
2343
- jQuery('.b2s-empty-area').hide();
2344
- jQuery('.b2s-reporting-btn-area').show();
2345
- wp.heartbeat.connectNow();
2346
- }
2347
- });
2348
- return false;
2349
- }
2350
- });
2351
- jQuery('#b2s-network-list-modal').on('show.bs.modal', function (e) {
2352
- jQuery('.b2s-network-list-modal-mandant').html(jQuery(".b2s-network-details-mandant-select option:selected").text());
2353
- });
2354
- jQuery(window).on("load", function () {
2355
- var showMeridian = true;
2356
- if (jQuery('#b2sUserTimeFormat').val() == 0) {
2357
- showMeridian = false;
2358
- }
2359
- jQuery('.b2s-settings-sched-item-input-time').timepicker({
2360
- minuteStep: 30,
2361
- appendWidgetTo: 'body',
2362
- showSeconds: false,
2363
- showMeridian: showMeridian,
2364
- defaultTime: 'current'
2365
- });
2366
- });
2367
-
2368
- jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
2369
- var selectedAuth = new Array();
2370
- jQuery('.b2s-network-list.active').each(function () {
2371
- selectedAuth.push(jQuery(this).parents('.b2s-network-select-btn').attr('data-network-auth-id'));
2372
- });
2373
- jQuery('.b2s-server-connection-fail').hide();
2374
- jQuery.ajax({
2375
- url: ajaxurl,
2376
- type: "POST",
2377
- dataType: "json",
2378
- cache: false,
2379
- data: {
2380
- 'action': 'b2s_ship_navbar_save_settings',
2381
- 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
2382
- 'selectedAuth': selectedAuth,
2383
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2384
- },
2385
- error: function () {
2386
- jQuery('.b2s-server-connection-fail').show();
2387
- return false;
2388
- },
2389
- success: function (data) {
2390
- if (data.result == true) {
2391
- jQuery('.b2s-ship-settings-save').show();
2392
- window.scrollTo(0, 0);
2393
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2394
- jQuery('.b2s-network-list').each(function () {
2395
- var jsonMandantIds = jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
2396
- if (jsonMandantIds !== undefined) {
2397
- var jsonMandantIds = jQuery.parseJSON(jsonMandantIds);
2398
- if (jsonMandantIds.indexOf(mandantId) !== -1 && !jQuery(this).hasClass('active')) {
2399
- //remove
2400
- var newMandant = new Array();
2401
- jQuery(jsonMandantIds).each(function (index, item) {
2402
- if (item !== mandantId) {
2403
- newMandant.push(item);
2404
- }
2405
- });
2406
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(newMandant));
2407
- } else if (jsonMandantIds.indexOf(mandantId) == -1 && jQuery(this).hasClass('active')) {
2408
- //add
2409
- jsonMandantIds.push(mandantId);
2410
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(jsonMandantIds));
2411
- }
2412
- }
2413
- });
2414
- } else {
2415
- if (data.error == 'nonce') {
2416
- jQuery('.b2s-nonce-check-fail').show();
2417
- }
2418
- }
2419
- }
2420
- });
2421
- });
2422
- window.addEventListener('message', function (e) {
2423
- if (e.origin == jQuery('#b2sServerUrl').val()) {
2424
- var data = JSON.parse(e.data);
2425
- if (typeof data.action !== typeof undefined && data.action == 'approve') {
2426
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + data.networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2427
- jQuery.ajax({
2428
- url: ajaxurl,
2429
- type: "POST",
2430
- cache: false,
2431
- async: false,
2432
- data: {
2433
- 'action': 'b2s_update_approve_post',
2434
- 'post_id': data.post_id,
2435
- 'publish_link': data.publish_link,
2436
- 'publish_error_code': data.publish_error_code,
2437
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2438
- },
2439
- success: function (data) {
2440
- }
2441
- });
2442
- } else {
2443
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId, data.instant_sharing);
2444
- }
2445
- }
2446
- });
2447
-
2448
- jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
2449
- var postId = jQuery('#b2s-approve-post-id').val();
2450
- var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
2451
- if (postId > 0) {
2452
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2453
- jQuery('.b2s-publish-approve-modal').modal('hide');
2454
- jQuery.ajax({
2455
- url: ajaxurl,
2456
- type: "POST",
2457
- cache: false,
2458
- async: false,
2459
- data: {
2460
- 'action': 'b2s_update_approve_post',
2461
- 'post_id': postId,
2462
- 'publish_link': "",
2463
- 'publish_error_code': "",
2464
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2465
- },
2466
- success: function (data) {
2467
- }
2468
- });
2469
- }
2470
- });
2471
-
2472
-
2473
-
2474
- jQuery.xhrPool.abortAll = function () { // our abort function
2475
- jQuery(this).each(function (idx, jqXHR) {
2476
- jqXHR.abort();
2477
- });
2478
- jQuery.xhrPool.length = 0
2479
- };
2480
- function loadingDummyShow(networkAuthId, networkId) {
2481
- jQuery('.b2s-post-item-connection-fail-dummy[data-network-auth-id="' + networkAuthId + '"]').remove();
2482
- var html = '<div class="b2s-post-item b2s-post-item-loading-dummy" data-network-auth-id="' + networkAuthId + '">'
2483
- + '<div class="panel panel-group">'
2484
- + '<div class="panel-body">'
2485
- + '<div class="b2s-post-item-area">'
2486
- + '<div class="b2s-post-item-details">'
2487
- + '<div class="b2s-loader-impulse b2s-loader-impulse-md b2s-post-item-loading-impulse-area">'
2488
- + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2489
- + '</div>'
2490
- + '<div class="clearfix"></div>'
2491
- + '<div class="text-center"><small>'
2492
- + jQuery('#b2sJsTextLoading').val()
2493
- + '</small></div>'
2494
- + '</div>'
2495
- + '</div>'
2496
- + '</div>'
2497
- + '</div>';
2498
- var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
2499
- var pos = order.indexOf(networkAuthId.toString());
2500
- var add = false;
2501
- for (var i = pos; i >= 0; i--) {
2502
- if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
2503
- jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(html);
2504
- i = -1;
2505
- add = true;
2506
- }
2507
- }
2508
- if (add == false) {
2509
- jQuery('.b2s-post-list').prepend(html);
2510
- }
2511
- }
2512
-
2513
- function loadingDummyConnectionFail(networkAuthId, networkId) {
2514
- var html = '<div class="b2s-post-item b2s-post-item-connection-fail-dummy" data-network-auth-id="' + networkAuthId + '">'
2515
- + '<div class="panel panel-group">'
2516
- + '<div class="panel-body">'
2517
- + '<div class="b2s-post-item-area">'
2518
- + '<div class="b2s-post-item-details">'
2519
- + '<div class="b2s-post-item-details-portal-img-area">'
2520
- + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2521
- + '</div>'
2522
- + '<div class="clearfix"></div>'
2523
- + '<div class="text-center"><small>'
2524
- + jQuery('#b2sJsTextConnectionFail').val()
2525
- + '</small>'
2526
- + '<br/>'
2527
- + '<a class="btn btn-link btn-sm" target="_blank" href="' + jQuery('#b2sJsTextConnectionFailLink').val() + '">' + jQuery('#b2sJsTextConnectionFailLinkText').val() + '</a>'
2528
- + '</div>'
2529
- + '</div>'
2530
- + '</div>'
2531
- + '</div>'
2532
- + '</div>';
2533
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + networkAuthId + '"]').replaceWith(html);
2534
- }
2535
-
2536
- function init(firstrun) {
2537
- var dateFormat = "yyyy-mm-dd";
2538
- var language = "en";
2539
- var showMeridian = true;
2540
- if (jQuery('#b2sUserLang').val() == "de") {
2541
- dateFormat = "dd.mm.yyyy";
2542
- language = "de";
2543
- }
2544
- if (jQuery('#b2sUserTimeFormat').val() == 0) {
2545
- showMeridian = false;
2546
- }
2547
- var today = new Date();
2548
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
2549
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
2550
- }
2551
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
2552
- format: dateFormat,
2553
- language: language,
2554
- maxViewMode: 2,
2555
- todayHighlight: true,
2556
- startDate: today,
2557
- calendarWeeks: true,
2558
- autoclose: true
2559
- });
2560
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
2561
- minuteStep: 15,
2562
- appendWidgetTo: 'body',
2563
- showSeconds: false,
2564
- showMeridian: showMeridian,
2565
- defaultTime: 'current',
2566
- snapToStep: true
2567
- });
2568
- checkNetworkSelected();
2569
- //imageCheck();
2570
- if (firstrun == true) {
2571
- jQuery(window).scroll(function () {
2572
- submitArea();
2573
- });
2574
- jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
2575
- releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), 0);
2576
- });
2577
-
2578
- //V5.0.0 Content Curation set selected Profile
2579
- if (jQuery(".b2s-network-details-mandant-select option[value='" + jQuery('#selProfile').val() + "']").length > 0) {
2580
- jQuery('.b2s-network-details-mandant-select').val(jQuery('#selProfile').val());
2581
- }
2582
- hideDuplicateAuths();
2583
- chooseMandant();
2584
- }
2585
- }
2586
-
2587
-
2588
-
2589
- function initSceditor(networkAuthId) {
2590
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2591
- if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2592
- sceditor.destroy();
2593
- }
2594
- if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').data('network-id') == 14) {// Torial is only HTML Network that dose not support Emojis
2595
- var toolbar = "h1,h2,bold,italic,link,unlink,custom-image|source";
2596
- } else {
2597
- var toolbar = "h1,h2,bold,italic,link,unlink,custom-image,custom-emoji|source";
2598
- }
2599
- jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor({
2600
- plugins: 'xhtml',
2601
- toolbar: toolbar,
2602
- autoUpdate: true,
2603
- emoticonsEnabled: false
2604
- });
2605
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2606
- if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2607
- sceditor.height(500);
2608
- sceditor.width(window.getComputedStyle(document.querySelector('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]')).width);
2609
- sceditor.keyUp(function () {
2610
- jQuery('.b2s-post-item-countChar[data-network-auth-id="' + networkAuthId + '"]').html(jQuery(this).prev('.b2s-post-item-details-item-message-input').prevObject[0].getBody().textContent.length);
2611
- });
2612
- jQuery('.b2s-post-item-countChar[data-network-auth-id="' + networkAuthId + '"]').html(jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').prev('.b2s-post-item-details-item-message-input').prevObject[0]._sceditor.getBody().textContent.length);
2613
- }
2614
-
2615
-
2616
- }
2617
-
2618
- function submitArea() {
2619
- if (jQuery('.b2s-publish-area').length > 0) {
2620
- if (jQuery(window).scrollTop() + jQuery(window.top).height() >= jQuery('.b2s-publish-area').offset().top) {
2621
- jQuery(".b2s-footer-menu").hide();
2622
- } else {
2623
- jQuery(".b2s-footer-menu").show();
2624
- }
2625
- }
2626
- }
2627
-
2628
- function imageSize() {
2629
- jQuery('.networkImage').each(function () {
2630
- var width = this.naturalWidth;
2631
- var height = this.naturalHeight;
2632
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
2633
- if (width == 0)
2634
- {
2635
- setTimeout(function () {
2636
- imageSize();
2637
- }, 50);
2638
- }
2639
- });
2640
- }
2641
-
2642
- function navbarDeactivatePortal(reason) {
2643
- if (reason == "image") {
2644
- var portale = Array(6, 7, 12);
2645
- for (var i = 0; i <= portale.length; i++) {
2646
- jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').addClass('b2s-network-select-btn-deactivate');
2647
- jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').show();
2648
- }
2649
- }
2650
- }
2651
-
2652
- function navbarActivatePortal(reason) {
2653
- if (reason == "image") {
2654
- var portale = Array(6, 7, 12);
2655
- for (var i = 0; i <= portale.length; i++) {
2656
- jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').removeClass('b2s-network-select-btn-deactivate');
2657
- jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').hide();
2658
- }
2659
- }
2660
- }
2661
-
2662
- function deactivatePortal(networkAuthId) {
2663
- var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2664
- jQuery(selector).hide();
2665
- jQuery(selector).find('.form-control').each(function () {
2666
- jQuery(this).attr("disabled", "disabled");
2667
- });
2668
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
2669
- checkNetworkSelected();
2670
- submitArea();
2671
- return true;
2672
- }
2673
-
2674
- function activatePortal(networkAuthId, check) {
2675
- var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2676
- jQuery(selector).show();
2677
- jQuery(selector).find('.form-control').each(function () {
2678
-
2679
- if (!jQuery(this).hasClass('b2s-post-item-details-item-message-input')) {
2680
- jQuery(this).removeAttr("disabled", "disabled");
2681
- }
2682
-
2683
- if ((jQuery(this).hasClass('b2s-post-item-details-release-input-weeks')) ||
2684
- (jQuery(this).hasClass('b2s-post-item-details-release-input-date')) ||
2685
- (jQuery(this).hasClass('b2s-post-item-details-release-input-time')) ||
2686
- (jQuery(this).hasClass('b2s-post-item-details-release-input-days')) ||
2687
- (jQuery(this).hasClass('b2s-post-item-details-relay-input-delay')) ||
2688
- (jQuery(this).hasClass('b2s-post-item-details-relay-input-account'))) {
2689
- if (!jQuery(this).is(':visible')) {
2690
- jQuery(this).prop('disabled', true);
2691
- }
2692
- }
2693
- });
2694
- //Customize Content
2695
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
2696
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
2697
- jQuery(selector).find('.b2s-post-item-details-item-message-input').each(function () {
2698
- if (jQuery(this).is(':visible')) {
2699
- jQuery(this).removeAttr("disabled", "disabled");
2700
- }
2701
- });
2702
- } else {
2703
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').removeAttr("disabled", "disabled");
2704
- }
2705
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().addClass('active').find('.b2s-network-hide').removeClass('b2s-network-hide');
2706
- checkNetworkSelected();
2707
- submitArea();
2708
- }
2709
-
2710
- function checkNetworkSelected() {
2711
- //überprüfen ob mindestens ein PostItem vorhanden und sichtbar ist
2712
- var visible = false;
2713
- jQuery('.b2s-post-list').find('.b2s-post-item').each(function () {
2714
- if (jQuery(this).is(":visible")) {
2715
- visible = true;
2716
- }
2717
- });
2718
- if (jQuery('.b2s-post-list').text().trim() == "" || visible == false) {
2719
- jQuery('.b2s-publish-area').hide();
2720
- jQuery('.b2s-footer-menu').hide();
2721
- jQuery('.b2s-empty-area').show();
2722
- return false;
2723
- } else {
2724
- jQuery('.b2s-publish-area').show();
2725
- if (jQuery('.b2s-publish-area').length > 0) {
2726
- if (jQuery(window).scrollTop() + jQuery(window.top).height() < jQuery('.b2s-publish-area').offset().top) {
2727
- jQuery('.b2s-footer-menu').show();
2728
- }
2729
- }
2730
- jQuery('.b2s-empty-area').hide();
2731
- return true;
2732
- }
2733
- }
2734
-
2735
- function checkPostSchedOnBlog() {
2736
- if (jQuery('#b2sBlogPostSchedDate').length > 0 && jQuery('#b2sPostType').val() == "") {
2737
- if (jQuery('#b2sSchedPostInfoIgnore').val() == "0") {
2738
- if (jQuery('.b2s-post-item-details-release-input-date-select option[value="0"]:selected').length > 0) {
2739
- jQuery('#b2s-network-sched-post-info').modal("show");
2740
- return false;
2741
- }
2742
- }
2743
- }
2744
- return true;
2745
- }
2746
-
2747
- function checkImageByImageNetworks() {
2748
- var result = true;
2749
- jQuery('.b2sOnlyWithImage').each(function () {
2750
- if (jQuery(this).is(":visible")) {
2751
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
2752
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]:visible').each(function () {
2753
- if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + jQuery(this).attr('data-network-count') + '"]').val() == "") {
2754
- if (!jQuery('#b2s-network-select-image').hasClass('in')) {
2755
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + jQuery(this).attr('data-network-count') + '"]').addClass('b2s-img-required');
2756
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
2757
- jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
2758
- jQuery('#b2s-network-select-image').modal('show');
2759
- imageSize();
2760
- window.scrollTo(0, (jQuery(this).offset().top - 45));
2761
- return false;
2762
- }
2763
- result = false;
2764
- }
2765
- });
2766
- }
2767
- });
2768
- return result;
2769
- }
2770
-
2771
-
2772
- function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
2773
- var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
2774
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2775
- if (choose == 0) {
2776
-
2777
- //since 4.8.0 customize content
2778
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2779
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2780
- jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2781
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2782
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2783
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2784
- jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2785
- jQuery('.b2s-post-tool-area' + selectorInput).show();
2786
- }
2787
-
2788
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2789
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2790
- jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2791
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2792
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2793
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2794
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2795
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
2796
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2797
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2798
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2799
- //monthly- duration month
2800
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2801
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2802
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2803
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2804
- //monthly- publish day (select-day)
2805
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2806
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2807
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2808
- //own period- duration times
2809
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2810
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2811
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2812
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2813
- //own period- timespan
2814
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2815
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2816
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2817
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled');
2818
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2819
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).hide();
2820
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2821
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', true);
2822
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2823
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2824
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2825
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2826
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).hide();
2827
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).hide();
2828
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2829
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2830
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2831
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2832
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).hide();
2833
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2834
- } else if (choose == 1) {
2835
-
2836
- //since 4.8.0 customize content
2837
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2838
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').prop('disabled', true);
2839
- jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').hide();
2840
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').hide();
2841
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').hide();
2842
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').hide();
2843
- jQuery('.b2s-post-original-area' + selectorInput).removeClass('col-sm-7').removeClass('col-lg-9');
2844
- jQuery('.b2s-post-tool-area' + selectorInput).hide();
2845
- //TOS Network Twitter
2846
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-id') == "2") {
2847
- jQuery('.b2s-post-ship-item-copy-original-text' + selectorInput + '[data-network-count="0"]').trigger('click');
2848
- }
2849
- }
2850
-
2851
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2852
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2853
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2854
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2855
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2856
- for (var i = 0; i <= dataNetworkCount; i++) {
2857
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2858
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2859
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2860
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2861
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2862
- //since 4.8.0 customize content
2863
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2864
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2865
- }
2866
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2867
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled');
2868
- //monthly- duration month
2869
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2870
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2871
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2872
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2873
- //monthly- publish day (select-day)
2874
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2875
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2876
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2877
- //own period- duration times
2878
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2879
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2880
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2881
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2882
- //own period- timespan
2883
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2884
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2885
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2886
- //new since v.4.5.0
2887
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2888
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2889
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2890
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2891
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2892
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
2893
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2894
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2895
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2896
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).show();
2897
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2898
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2899
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2900
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2901
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2902
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2903
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).show();
2904
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2905
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2906
- } else if (choose == 2) {
2907
-
2908
- //since 4.8.0 customize content
2909
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2910
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2911
- jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2912
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2913
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2914
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2915
- jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2916
- jQuery('.b2s-post-tool-area' + selectorInput).show();
2917
- }
2918
-
2919
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2920
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2921
- jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2922
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2923
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2924
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2925
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2926
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2927
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).show();
2928
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2929
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2930
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2931
- for (var i = 0; i <= dataNetworkCount; i++) {
2932
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2933
- //new since v4.5.0
2934
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).show();
2935
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2936
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2937
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2938
- jQuery('.b2s-post-item-details-release-input-daySelect[data-network-count="' + i + '"]' + selectorInput).show();
2939
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2940
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2941
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).show();
2942
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2943
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2944
- }
2945
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).show();
2946
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).show();
2947
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2948
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2949
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).show();
2950
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).show();
2951
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).show();
2952
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2953
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2954
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).show();
2955
- }
2956
-
2957
- var showMeridian = true;
2958
- if (jQuery('#b2sUserTimeFormat').val() == 0) {
2959
- showMeridian = false;
2960
- }
2961
-
2962
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
2963
- minuteStep: 15,
2964
- appendWidgetTo: 'body',
2965
- showSeconds: false,
2966
- showMeridian: showMeridian,
2967
- defaultTime: 'current',
2968
- snapToStep: true
2969
- });
2970
- }
2971
-
2972
-
2973
- function releaseChooseInterval(interval, selectorInput, dataCount) {
2974
- //change view
2975
- if (interval == 0) { //weekly,default
2976
- // show
2977
- //select days
2978
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2979
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
2980
- //duration weeks
2981
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2982
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2983
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).show();
2984
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2985
- //hide
2986
- //monthly- duration month
2987
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2988
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2989
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2990
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2991
- //monthly- publish day (select-day)
2992
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2993
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2994
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2995
- //own period- duration times
2996
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2997
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2998
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2999
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3000
- //own period- timespan
3001
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3002
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3003
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3004
- }
3005
-
3006
- if (interval == 1) { //monthly
3007
- // show
3008
- //duration month
3009
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3010
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3011
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).show();
3012
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3013
- //publish day (select-day)
3014
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3015
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3016
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3017
- //hide
3018
- //weekly - select days
3019
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3020
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3021
- //weekly- duration weeks
3022
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3023
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3024
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3025
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3026
- //own period- duration times
3027
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3028
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3029
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3030
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3031
- //own period- timespan
3032
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3033
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3034
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3035
- }
3036
-
3037
- if (interval == 2) { //own period
3038
- // show
3039
- //duration times
3040
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3041
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3042
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).show(); //select
3043
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled'); //select
3044
- //timespan
3045
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3046
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3047
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3048
- //hide
3049
- //weekly - select days
3050
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3051
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3052
- //weekly- duration weeks
3053
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3054
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3055
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3056
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3057
- //monthly- duration month
3058
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3059
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3060
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3061
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3062
- //monthly- publish day (select-day)
3063
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3064
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3065
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3066
- }
3067
- }
3068
-
3069
-
3070
-
3071
- function addTag(networkAuthId) {
3072
- var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3073
- jQuery(selector).last().after('<input class="form-control b2s-post-item-details-tag-input-elem" data-network-auth-id="' + networkAuthId + '" value="" name="b2s[' + networkAuthId + '][tags][]">');
3074
- jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3075
- var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3076
- if (typeof limit !== typeof undefined && limit !== false) {
3077
- if (jQuery(selector).length >= limit) {
3078
- jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3079
- }
3080
- }
3081
- }
3082
-
3083
- function removeTag(networkAuthId) {
3084
- var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3085
- jQuery(selector).last().remove();
3086
- if (jQuery(selector).length === 1) {
3087
- jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3088
- }
3089
- var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3090
- if (typeof limit !== typeof undefined && limit !== false) {
3091
- if (jQuery(selector).length < limit) {
3092
- jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3093
- }
3094
- }
3095
- }
3096
-
3097
- function networkLimitAll(networkAuthId, networkId, limit) {
3098
-
3099
- var networkCountId = -1; //default;
3100
- if (jQuery(':focus').length > 0) {
3101
- var attr = jQuery(':focus').attr('data-network-count');
3102
- if (typeof attr !== typeof undefined && attr !== false) {
3103
- networkCountId = attr;
3104
- }
3105
- }
3106
-
3107
- var regX = /(<([^>]+)>)/ig;
3108
- var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3109
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3110
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3111
- if (url.length != "0") {
3112
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3113
- url = "http://" + url;
3114
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3115
- }
3116
- } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3117
- if (!((jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 3 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 19) && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook & Linkedin Imagepost don't require Link
3118
- url = jQuery("#b2sDefault_url").val();
3119
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3120
- }
3121
- }
3122
-
3123
- var textLength = text.length;
3124
- var newText = text;
3125
- if (networkId == "2") { //twitter
3126
- if (url.length != "0") {
3127
- limit = limit - 26;
3128
- }
3129
- }
3130
- if (networkId == "3") { //linkedin
3131
- if (url.length != "0") {
3132
- limit = limit - url.length;
3133
- }
3134
- }
3135
- if (networkId == "19" && jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-type') == 0 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 1) { //xing
3136
- if (url.length != "0") {
3137
- limit = limit - url.length;
3138
- }
3139
- }
3140
- if (networkId == "12") { //instagram
3141
- var matches = text.match(/(#[^# ]{1,})/g);
3142
- if (matches != null && matches.length > 30) {
3143
- jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').show();
3144
- jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").addClass("warning");
3145
- } else {
3146
- jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').hide();
3147
- jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").removeClass("warning");
3148
- }
3149
- }
3150
-
3151
- if (textLength >= limit) {
3152
- newText = text.substring(0, limit);
3153
- var pos = getCaretPos(this);
3154
- jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val(newText.replace(regX, ""));
3155
- setCaretPos(this, pos);
3156
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3157
- var textLength = text.length;
3158
- }
3159
- jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
3160
- }
3161
-
3162
- function networkCount(networkAuthId) {
3163
-
3164
- var networkCountId = -1; //default;
3165
- if (jQuery(':focus').length > 0) {
3166
- var attr = jQuery(':focus').attr('data-network-count');
3167
- if (typeof attr !== typeof undefined && attr !== false) {
3168
- networkCountId = attr;
3169
- }
3170
- }
3171
- var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3172
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3173
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3174
- if (url.length != "0") {
3175
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3176
- url = "http://" + url;
3177
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3178
- }
3179
- } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3180
- if (!((jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 3 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 19) && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook & Linkedin Imagepost don't require Link
3181
- url = jQuery("#b2sDefault_url").val();
3182
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3183
- }
3184
- }
3185
- if (typeof text !== 'undefined' && jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3186
- var textLength = text.length;
3187
- jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
3188
- }
3189
- }
3190
-
3191
-
3192
- function getCaretPos(domElem) {
3193
- var pos;
3194
- if (document.selection) {
3195
- domElem.focus();
3196
- var sel = document.selection.createRange();
3197
- sel.moveStart("character", -domElem.value.length);
3198
- pos = sel.text.length;
3199
- } else if (domElem.selectionStart || domElem.selectionStart == "0")
3200
- pos = domElem.selectionStart;
3201
- return pos;
3202
- }
3203
-
3204
- function setCaretPos(domElem, pos) {
3205
- if (domElem.setSelectionRange) {
3206
- domElem.focus();
3207
- domElem.setSelectionRange(pos, pos);
3208
- } else if (domElem.createTextRange) {
3209
- var range = domElem.createTextRange();
3210
- range.collapse(true);
3211
- range.moveEnd("character", pos);
3212
- range.moveStart("character", pos);
3213
- range.select();
3214
- }
3215
- }
3216
-
3217
- function ucfirst(str) {
3218
- str += '';
3219
- return str.charAt(0).toUpperCase() + str.substr(1);
3220
- }
3221
-
3222
-
3223
- function hideDuplicateAuths() {
3224
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3225
- jQuery(this).show();
3226
- });
3227
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3228
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3229
- if (jQuery(this).is(":visible")) {
3230
- var dataNetworkDisplayName = jQuery(this).children('.b2s-network-select-btn').attr('data-network-display-name');
3231
- var dataNetworkId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-id');
3232
- var dataNetworkType = jQuery(this).children('.b2s-network-select-btn').attr('data-network-type');
3233
- var dataNetworkAuthId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-auth-id');
3234
- jQuery('.b2s-network-select-btn[data-network-display-name="' + dataNetworkDisplayName + '"][data-network-id="' + dataNetworkId + '"][data-network-type="' + dataNetworkType + '"][data-network-auth-id!="' + dataNetworkAuthId + '"]').each(function () {
3235
- var selectedDataMandantId = jQuery.parseJSON(jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id'));
3236
- if (jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-default-id') != mandantId && selectedDataMandantId.indexOf(mandantId) == -1) {
3237
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').hide();
3238
- }
3239
- });
3240
- }
3241
- });
3242
- }
3243
-
3244
- function chooseMandant() {
3245
- //Laden abbrechen und anzeige zurück setzten
3246
- jQuery.xhrPool.abortAll();
3247
- jQuery('.b2s-post-item-loading-dummy').remove();
3248
- jQuery('.b2s-network-status-img-loading').hide();
3249
- jQuery('.b2s-network-select-btn-deactivate').removeClass('b2s-network-select-btn-deactivate');
3250
- //imageCheck();
3251
- //TOS XING Groups
3252
- b2sTosXingGroupCount = 0;
3253
- //expiredDate wieder setzten
3254
- jQuery('.b2s-network-status-expiredDate').each(function () {
3255
- if (jQuery(this).is(':visible')) {
3256
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').addClass('b2s-network-select-btn-deactivate');
3257
- }
3258
- });
3259
- jQuery('.b2s-network-select-btn-deactivate')
3260
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3261
- jQuery('.b2s-post-item').hide();
3262
- jQuery('.b2s-post-item').find('.form-control').each(function () {
3263
- jQuery(this).attr("disabled", "disabled");
3264
- jQuery(this).removeClass('error');
3265
- });
3266
- jQuery('.b2s-network-select-btn').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
3267
- //Check IS RE-PUBLISH
3268
- var isMultiSelectNetwork = false;
3269
- if (typeof jQuery('#b2sMultiSelectedNetworkAuthId') != 'undefined' && typeof jQuery('#b2sMultiSelectedNetworkAuthId').val() != 'undefined' && jQuery('#b2sMultiSelectedNetworkAuthId').val() != '') { //exisits?
3270
- var selectedNetworks = jQuery('#b2sMultiSelectedNetworkAuthId').val().split(',');
3271
- var preventMutliClick = [];
3272
- selectedNetworks.forEach(function (selectedAuthId) {
3273
- if (!isMultiSelectNetwork && jQuery(".b2s-network-select-btn[data-network-auth-id='" + selectedAuthId + "']").length > 0) {
3274
- isMultiSelectNetwork = true;
3275
- var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + selectedAuthId + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
3276
- jQuery('.b2s-network-details-mandant-select').val(mandantId);
3277
- jQuery('#b2sSelectedMultiNetworkAuthId').val("0");
3278
- }
3279
- if (!preventMutliClick.includes(selectedAuthId)) {
3280
- jQuery(".b2s-network-select-btn[data-network-auth-id='" + selectedAuthId + "']").trigger('click');
3281
- preventMutliClick.push(selectedAuthId);
3282
- }
3283
- });
3284
- }
3285
- if (!isMultiSelectNetwork) {
3286
- if (jQuery('#b2sSelectedNetworkAuthId').val() > 0 && jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").length > 0) { //exisits?
3287
- jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").trigger('click');
3288
- var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
3289
- jQuery('.b2s-network-details-mandant-select').val(mandantId);
3290
- jQuery('#b2sSelectedNetworkAuthId').val("0");
3291
- } else {
3292
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3293
- var mandantIds = jQuery.parseJSON(jQuery(this).attr('data-mandant-id'));
3294
- if (mandantIds.indexOf(mandantId) != -1 && !jQuery(this).children('.b2s-network-select-btn').hasClass('b2s-network-select-btn-deactivate')) {
3295
- jQuery(this).children('.b2s-network-select-btn').trigger('click');
3296
- }
3297
- });
3298
- }
3299
- }
3300
-
3301
- checkNetworkSelected();
3302
- }
3303
-
3304
- function padDate(n) {
3305
- return ("0" + n).slice(-2);
3306
- }
3307
-
3308
- function wop(url, name) {
3309
- jQuery('.b2s-network-auth-success').hide();
3310
- var location = window.location.protocol + '//' + window.location.hostname;
3311
- url = encodeURI(url + '&mandant_id=' + jQuery('.b2s-network-details-mandant-select').val() + '&location=' + location);
3312
- window.open(url, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3313
- }
3314
-
3315
-
3316
- function wopApprove(networkAuthId, postId, url, name) {
3317
- var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
3318
- var win = window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3319
- if (postId > 0) {
3320
- function checkIfWinClosed(intervalID) {
3321
- if (win.closed) {
3322
- clearInterval(intervalID);
3323
- //Show Modal
3324
- jQuery('.b2s-publish-approve-modal').modal('show');
3325
- jQuery('#b2s-approve-post-id').val(postId);
3326
- jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
3327
- }
3328
- }
3329
- var interval = setInterval(function () {
3330
- checkIfWinClosed(interval);
3331
- }, 500);
3332
- }
3333
- }
3334
-
3335
-
3336
- function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId, instant_sharing) {
3337
- jQuery('.b2s-network-auth-success').show();
3338
- jQuery('#b2s-network-list-modal').modal('hide');
3339
- jQuery('#b2s-network-list-modal').hide();
3340
- jQuery('body').removeClass('modal-open');
3341
- jQuery('body').removeAttr('style');
3342
- if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3343
- jQuery('.b2s-server-connection-fail').hide();
3344
- jQuery.ajax({
3345
- url: ajaxurl,
3346
- type: "POST",
3347
- dataType: "json",
3348
- cache: false,
3349
- data: {
3350
- 'action': 'b2s_ship_navbar_item',
3351
- 'networkId': networkId,
3352
- 'networkType': networkType,
3353
- 'displayName': displayName,
3354
- 'networkAuthId': networkAuthId,
3355
- 'instant_sharing': instant_sharing,
3356
- 'mandandId': mandandId,
3357
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3358
- },
3359
- error: function () {
3360
- jQuery('.b2s-server-connection-fail').show();
3361
- return false;
3362
- },
3363
- success: function (data) {
3364
- if (data.result == true) {
3365
- jQuery(data.content).insertAfter('.b2s-sidbar-network-auth-btn');
3366
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
3367
- } else {
3368
- if (data.error == 'nonce') {
3369
- jQuery('.b2s-nonce-check-fail').show();
3370
- }
3371
- }
3372
- }
3373
- });
3374
- } else {
3375
- jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + networkAuthId + '"]').remove();
3376
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
3377
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
3378
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-display-name', displayName);
3379
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"] > .b2s-network-list > .b2s-network-details > h4').text(displayName);
3380
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
3381
- }
3382
- jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-display-name="' + displayName.toLowerCase() + '"]').each(function () {
3383
- jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
3384
- jQuery(this).removeClass('b2s-network-select-btn-deactivate');
3385
- jQuery(this).removeAttr('onclick');
3386
- });
3387
- }
3388
-
3389
- //jQuery(this).attr('data-network-auth-id')
3390
- function checkSchedDateTime(dataNetworkAuthId) {
3391
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
3392
- var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
3393
- var dateStr = jQuery(dateElement).val();
3394
- var minStr = jQuery(timeElement).val();
3395
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
3396
- if (jQuery('#b2sUserLang').val() == 'de') {
3397
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
3398
- } else {
3399
- var minParts = minStr.split(' ');
3400
- var minParts2 = minParts[0].split(':');
3401
- if (minParts[1] == 'PM') {
3402
- minParts2[0] = parseInt(minParts2[0]) + 12;
3403
- }
3404
- minStr = minParts2[0] + ':' + minParts2[1];
3405
- }
3406
-
3407
- var minParts3 = minStr.split(':');
3408
- if (minParts3[0] < 10) {
3409
- minParts3[0] = '0' + minParts3[0];
3410
- }
3411
- var dateParts = dateStr.split('-');
3412
- //utc current time
3413
- var now = new Date();
3414
- //offset between utc und user
3415
- var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
3416
- //enter hour to user time
3417
- var hour = parseInt(minParts3[0]) + timeZone + offset;
3418
- //calculate datetime in utc
3419
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
3420
- //compare enter date time with allowed user time
3421
- if (enter.getTime() < now.getTime()) {
3422
- //enter set on next 15 minutes and calculate on user timezone
3423
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
3424
- jQuery(dateElement).datepicker('update', enter);
3425
- jQuery(timeElement).timepicker('setTime', enter);
3426
- }
3427
-
3428
- //network deprecated
3429
- if (jQuery(dateElement).attr('data-network-id') == '8') {
3430
- var deprecatedDate = new Date('2019-03-30T23:59:59');
3431
- var count = jQuery(dateElement).attr('data-network-count');
3432
- if (enter.getTime() > deprecatedDate.getTime()) {
3433
- jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3434
- jQuery(dateElement).datepicker('update', now);
3435
- jQuery(timeElement).timepicker('setTime', now);
3436
- }
3437
- }
3438
-
3439
- //network deprecated
3440
- if (jQuery(dateElement).attr('data-network-id') == '10') {
3441
- var deprecatedDate = new Date('2019-04-01T23:59:59');
3442
- var count = jQuery(dateElement).attr('data-network-count');
3443
- if (enter.getTime() > deprecatedDate.getTime()) {
3444
- jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3445
- jQuery(dateElement).datepicker('update', now);
3446
- jQuery(timeElement).timepicker('setTime', now);
3447
- }
3448
- }
3449
-
3450
- }
3451
-
3452
- jQuery(document).on("click", ".b2s-draft-btn", function (event) {
3453
- event.preventDefault();
3454
- jQuery('.b2s-loader-btn-ship').css('display', 'inline-block');
3455
- jQuery('.b2s-submit-btn').prop('disabled', true);
3456
- jQuery('.b2s-submit-btn-scroll').prop('disabled', true);
3457
- jQuery('.b2s-post-draft-saved-success').hide();
3458
- jQuery('.b2s-post-draft-saved-fail').hide();
3459
- jQuery('.b2s-server-connection-fail').hide();
3460
-
3461
- jQuery.ajax({
3462
- url: ajaxurl,
3463
- type: "GET",
3464
- cache: false,
3465
- data: {
3466
- action: 'b2s_check_draft_exists',
3467
- postId: jQuery('#post_id').val(),
3468
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3469
- },
3470
- error: function () {
3471
- saveDraft();
3472
- return false;
3473
- },
3474
- success: function (data) {
3475
- result = JSON.parse(data);
3476
- if (result.result == true) {
3477
- jQuery('#b2s-save-draft-modal').modal('show');
3478
- return true;
3479
- } else {
3480
- if (result.error == 'nonce') {
3481
- jQuery('.b2s-nonce-check-fail').show();
3482
- }
3483
- }
3484
- saveDraft();
3485
- return false;
3486
- }
3487
- });
3488
-
3489
- });
3490
-
3491
- jQuery(document).on('click', '.b2s-draft-btn-scroll', function () {
3492
- jQuery('.b2s-draft-btn').trigger('click');
3493
- });
3494
-
3495
- function saveDraft() {
3496
- jQuery('#action').val('b2s_save_draft_data');
3497
- var data = jQuery('#b2sNetworkSent').serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
3498
- jQuery('#action').val('b2s_save_ship_data');
3499
- jQuery.ajax({
3500
- url: ajaxurl,
3501
- type: "POST",
3502
- cache: false,
3503
- data: data,
3504
- error: function () {
3505
- jQuery('.b2s-loader-btn-ship').css('display', 'none');
3506
- jQuery('.b2s-submit-btn').removeAttr('disabled');
3507
- jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3508
- jQuery('.b2s-server-connection-fail').show();
3509
- window.scrollTo(0, 0);
3510
- return false;
3511
- },
3512
- success: function (data) {
3513
- jQuery('.b2s-loader-btn-ship').css('display', 'none');
3514
- jQuery('.b2s-submit-btn').removeAttr('disabled');
3515
- jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3516
- result = JSON.parse(data);
3517
- if (result.result == true) {
3518
- jQuery('.b2s-post-draft-saved-success').show();
3519
- window.setTimeout(function () {
3520
- jQuery('.b2s-post-draft-saved-success').fadeOut();
3521
- }, 5000);
3522
- } else {
3523
- if (result.error == 'nonce') {
3524
- jQuery('.b2s-nonce-check-fail').show();
3525
- }
3526
- jQuery('.b2s-post-draft-saved-fail').show();
3527
- window.setTimeout(function () {
3528
- jQuery('.b2s-post-draft-saved-fail').fadeOut();
3529
- }, 5000);
3530
- }
3531
- window.scrollTo(0, 0);
3532
- return true;
3533
- }
3534
- });
3535
- }
3536
-
3537
- jQuery('#b2s-save-draft-modal').on('hidden.bs.modal', function () {
3538
- jQuery('.b2s-loader-btn-ship').css('display', 'none');
3539
- jQuery('.b2s-submit-btn').removeAttr('disabled');
3540
- jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3541
- });
3542
-
3543
- jQuery(document).on('click', '.b2s-save-draft-confirm-btn', function () {
3544
- saveDraft();
3545
- jQuery('#b2s-save-draft-modal').modal('hide');
3546
- return true;
3547
- });
3548
-
3549
- jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3550
- jQuery('body').addClass('modal-open');
3551
- });
3552
-
3553
- // START Pinterest
3554
- jQuery(document).on('click', '.b2s-auth-network-6-login-btn', function () {
3555
- jQuery('#b2s-auth-network-6-username').removeClass('error');
3556
- jQuery('#b2s-auth-network-6-password').removeClass('error');
3557
- var loginDataCheck = true;
3558
- if (jQuery('#b2s-auth-network-6-username').val() == '') {
3559
- jQuery('#b2s-auth-network-6-username').addClass('error');
3560
- loginDataCheck = false;
3561
- }
3562
- if (jQuery('#b2s-auth-network-6-password').val() == '') {
3563
- jQuery('#b2s-auth-network-6-password').addClass('error');
3564
- loginDataCheck = false;
3565
- }
3566
- if (!loginDataCheck) {
3567
- return false;
3568
- }
3569
- jQuery('.b2s-loading-area').show();
3570
- jQuery('.b2s-auth-network-6-login-area').hide();
3571
- jQuery('.b2s-auth-network-6-login-btn').hide();
3572
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
3573
- jQuery('.b2s-auth-network-6-info').hide();
3574
- jQuery.ajax({
3575
- url: ajaxurl,
3576
- type: "POST",
3577
- dataType: "json",
3578
- cache: false,
3579
- data: {
3580
- 'action': 'b2s_auth_network_login',
3581
- 'username': jQuery('#b2s-auth-network-6-username').val(),
3582
- 'password': jQuery('#b2s-auth-network-6-password').val(),
3583
- 'location': jQuery('#b2s-auth-network-6-location').val(),
3584
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3585
- },
3586
- error: function (jqXHR) {
3587
- jQuery('.b2s-loading-area').hide();
3588
- jQuery('.b2s-auth-network-6-login-area').show();
3589
- jQuery('.b2s-auth-network-6-login-btn').show();
3590
- if (jqXHR.status == 403) {
3591
- jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3592
- } else {
3593
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3594
- }
3595
- return false;
3596
- },
3597
- success: function (data) {
3598
- jQuery('.b2s-loading-area').hide();
3599
- if (data.result == true) {
3600
- jQuery('#b2s-auth-network-6-board').html(data.boards);
3601
- jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
3602
- jQuery('.b2s-auth-network-6-board-area').show();
3603
- jQuery('.b2s-auth-network-6-confirm-btn').show();
3604
- jQuery('.b2s-auth-network-6-info[data-info="success"]').show();
3605
- } else {
3606
- if (data.error == 'nonce') {
3607
- jQuery('.b2s-nonce-check-fail').show();
3608
- } else if (data.error == 'invalid' || data.error == 'login' || data.error == 'access' || data.error == 'http_request_failed' || data.error == 'error_code_403') {
3609
- jQuery('.b2s-auth-network-6-extension-info-area').show();
3610
- jQuery('.b2s-auth-network-6-go-to-network-btn').show();
3611
- var messageData = {action: 'BWEC', type: 'BWECT'};
3612
- window.postMessage(messageData, '*');
3613
- return false;
3614
- }
3615
- if (typeof data.error != 'undefined' && data.error != '') {
3616
- jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3617
- } else {
3618
- jQuery('.b2s-auth-network-6-info[data-info="login"]').show();
3619
- }
3620
- jQuery('.b2s-auth-network-6-login-btn').show();
3621
- }
3622
- jQuery('.b2s-auth-network-6-login-area').show();
3623
- }
3624
- });
3625
- });
3626
-
3627
- jQuery(document).on('click', '.b2s-auth-network-6-confirm-btn', function () {
3628
- jQuery('.b2s-loading-area').show();
3629
- jQuery('.b2s-auth-network-6-login-area').hide();
3630
- jQuery('.b2s-auth-network-6-login-btn').hide();
3631
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
3632
- jQuery.ajax({
3633
- url: ajaxurl,
3634
- type: "POST",
3635
- dataType: "json",
3636
- cache: false,
3637
- data: {
3638
- 'action': 'b2s_auth_network_confirm',
3639
- 'username': jQuery('#b2s-auth-network-6-username').val(),
3640
- 'password': jQuery('#b2s-auth-network-6-password').val(),
3641
- 'boardId': jQuery('#b2s-auth-network-6-board').val(),
3642
- 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
3643
- 'mandantId': jQuery('#b2s-auth-network-6-mandant-id').val(),
3644
- 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
3645
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3646
- },
3647
- error: function (jqXHR) {
3648
- jQuery('.b2s-loading-area').hide();
3649
- jQuery('.b2s-auth-network-6-login-area').show();
3650
- jQuery('.b2s-auth-network-6-confirm-btn').show();
3651
- if (jqXHR.status == 403) {
3652
- jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3653
- } else {
3654
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3655
- }
3656
- return false;
3657
- },
3658
- success: function (data) {
3659
- jQuery('.b2s-loading-area').hide();
3660
- jQuery('.b2s-auth-network-6-login-area').show();
3661
- jQuery('.b2s-auth-network-6-confirm-btn').show();
3662
- if (data.result == true) {
3663
- jQuery('#b2sAuthNetwork6Modal').modal('hide');
3664
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
3665
- } else {
3666
- if (data.error == 'nonce') {
3667
- jQuery('.b2s-nonce-check-fail').show();
3668
- }
3669
- if (typeof data.error != 'undefined' && data.error != '') {
3670
- jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3671
- return false;
3672
- }
3673
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3674
- }
3675
- }
3676
- });
3677
- });
3678
-
3679
- jQuery(document).on('click', '.b2s-network-list-add-btn[data-auth-method="client"]', function () {
3680
- jQuery('#b2sAuthNetwork6Modal').modal('show');
3681
- });
3682
-
3683
- jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3684
- jQuery('.b2s-loading-area').hide();
3685
- jQuery('.b2s-auth-network-6-login-area').show();
3686
- jQuery('#b2s-auth-network-6-auth-id').val('');
3687
- jQuery('#b2s-auth-network-6-board').html('');
3688
- jQuery('#b2s-auth-network-6-ident-data').val('');
3689
- jQuery('.b2s-auth-network-6-info').hide();
3690
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
3691
- jQuery('.b2s-auth-network-6-login-btn').show();
3692
- jQuery('.b2s-auth-network-6-board-area').hide();
3693
- jQuery('#b2s-auth-network-6-username').val('');
3694
- jQuery('#b2s-auth-network-6-password').val('');
3695
- });
3696
-
3697
- jQuery(".b2s-auth-network-6-reveal").mousedown(function () {
3698
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'text'));
3699
- });
3700
- jQuery(".b2s-auth-network-6-reveal").mouseup(function () {
3701
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3702
- });
3703
- jQuery(".b2s-auth-network-6-reveal").mouseout(function () {
3704
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3705
- });
3706
- // END Pinterest
3707
-
3708
- jQuery(document).on('click', '.b2sInfoPostRelayModalBtn', function () {
3709
- jQuery('#b2sInfoPostRelayModal').modal('show');
3710
- });
3711
- jQuery(document).on('click', '.b2sInfoSchedTimesModalBtn', function () {
3712
- jQuery('#b2sInfoSchedTimesModal').modal('show');
3713
- });
3714
- jQuery(document).on('click', '.b2s-network-setting-save-btn', function () {
3715
- jQuery('#b2s-network-setting-save').modal('show');
3716
- });
3717
- jQuery(document).on('click', '.b2s-network-list-modal-btn', function () {
3718
- jQuery('#b2s-network-list-modal').modal('show');
3719
- });
3720
- jQuery(document).on('click', '.b2s-re-share-info-btn', function () {
3721
- jQuery('#b2s-re-share-info').modal('show');
3722
- });
3723
-
3724
- function checkGifAnimation(networkAuthId, networkId) {
3725
- if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').length >= 1 && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != '') {
3726
- var attachmenUrlExt = jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val().substr(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val().lastIndexOf('.') + 1);
3727
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
3728
- if (attachmenUrlExt == 'gif') {
3729
- var postFormat = 0;
3730
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').length > 0) {
3731
- postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val();
3732
- }
3733
- var animatedGif = JSON.parse(jQuery('#b2sAnimateGif').val());
3734
- if (typeof animatedGif[networkId] != "undefined" && animatedGif[networkId][postFormat] == true) {
3735
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val());
3736
- } else {
3737
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').each(function () {
3738
- var imgItem = this;
3739
- window.setTimeout(function () {
3740
- freeze_gif(imgItem);
3741
- }, 1);
3742
- });
3743
- }
3744
- } else {
3745
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') != jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val()) {
3746
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val());
3747
- }
3748
- }
3749
- }
3750
- return false;
3751
- }
3752
-
3753
- function freeze_gif(i) {
3754
- var c = document.createElement('canvas');
3755
- var w = c.width = i.width;
3756
- var h = c.height = i.height;
3757
- c.getContext('2d').drawImage(i, 0, 0, w, h);
3758
- try {
3759
- i.src = c.toDataURL("image/gif"); // if possible, retain all css aspects
3760
- } catch (e) { // cross-domain -- mimic original with all its tag attributes
3761
- for (var j = 0, a; a = i.attributes[j]; j++)
3762
- c.setAttribute(a.name, a.value);
3763
- i.parentNode.replaceChild(c, i);
3764
- }
3765
- return false;
3766
- }
3767
-
3768
- var currentEmojiNetworkAuthId = 0;
3769
- var currentEmojiNetworkCount = -1;
3770
- var emojiTranslation = JSON.parse(jQuery('#b2sEmojiTranslation').val());
3771
- var picker = new EmojiButton({
3772
- position: 'auto',
3773
- autoHide: false,
3774
- i18n: {
3775
- search: emojiTranslation['search'],
3776
- categories: {
3777
- recents: emojiTranslation['recents'],
3778
- smileys: emojiTranslation['smileys'],
3779
- animals: emojiTranslation['animals'],
3780
- food: emojiTranslation['food'],
3781
- activities: emojiTranslation['activities'],
3782
- travel: emojiTranslation['travel'],
3783
- objects: emojiTranslation['objects'],
3784
- symbols: emojiTranslation['symbols'],
3785
- flags: emojiTranslation['flags']
3786
- },
3787
- notFound: emojiTranslation['notFound']
3788
- }
3789
- });
3790
- picker.on('emoji', function (emoji) {
3791
- if (currentEmojiNetworkAuthId > 0) {
3792
- var text = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val();
3793
- var start = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionStart');
3794
- var end = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionEnd');
3795
- if (typeof start == 'undefined' || typeof end == 'undefined') {
3796
- start = text.length;
3797
- end = text.length;
3798
- }
3799
- var newText = text.slice(0, start) + emoji + text.slice(end);
3800
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val(newText);
3801
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').focus();
3802
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionStart", parseInt(start) + emoji.length);
3803
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionEnd", parseInt(start) + emoji.length);
3804
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').trigger('keyup');
3805
- }
3806
- });
3807
-
3808
- jQuery(document).on('click', '.b2s-post-item-details-item-message-emoji-btn', function () {
3809
- if (picker.pickerVisible) {
3810
- picker.hidePicker();
3811
- } else {
3812
- currentEmojiNetworkAuthId = jQuery(this).attr('data-network-auth-id');
3813
- currentEmojiNetworkCount = jQuery(this).attr('data-network-count');
3814
- picker.showPicker(jQuery(this));
3815
- }
3816
- });
3817
-
3818
- jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-post-item-details-item-message-input', function () {
3819
- var tb = jQuery(this).get(0);
3820
- jQuery(this).attr('selectionStart', tb.selectionStart);
3821
- jQuery(this).attr('selectionEnd', tb.selectionEnd);
3822
- });
3823
-
3824
- var pickerHTML = new EmojiButton({
3825
- position: 'auto',
3826
- autoHide: false,
3827
- i18n: {
3828
- search: emojiTranslation['search'],
3829
- categories: {
3830
- recents: emojiTranslation['recents'],
3831
- smileys: emojiTranslation['smileys'],
3832
- animals: emojiTranslation['animals'],
3833
- food: emojiTranslation['food'],
3834
- activities: emojiTranslation['activities'],
3835
- travel: emojiTranslation['travel'],
3836
- objects: emojiTranslation['objects'],
3837
- symbols: emojiTranslation['symbols'],
3838
- flags: emojiTranslation['flags']
3839
- },
3840
- notFound: emojiTranslation['notFound']
3841
- }
3842
- });
3843
- var currentPickerHTMLContent;
3844
- pickerHTML.on('emoji', function (emoji) {
3845
- currentPickerHTMLContent.insert(emoji);
3846
- });
3847
-
3848
- jQuery(document).on('click', '.b2s-add-multi-image', function () {
3849
- var imageCount = jQuery(this).attr('data-image-count');
3850
- var authId = jQuery(this).attr('data-network-auth-id');
3851
- var countId = jQuery(this).attr('data-network-count');
3852
- var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + authId + ']').attr("data-network-id");
3853
- jQuery('.b2s-image-change-all-network').hide();
3854
- jQuery('.b2s-image-change-meta-network').hide();
3855
- jQuery('.b2s-image-change-this-network').hide();
3856
- jQuery('.b2s-image-add-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId).attr('data-image-count', imageCount);
3857
- jQuery('.b2s-image-add-this-network').show();
3858
- var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
3859
- jQuery('.b2s-selected-network-for-image-info').html(content);
3860
- jQuery('.b2s-multi-image-info-text').show();
3861
- jQuery('.b2s-default-image-info-text').hide();
3862
- jQuery('#b2s-network-select-image').modal('show');
3863
- return false;
3864
- });
3865
-
3866
- jQuery(document).on('hidden.bs.modal', '#b2s-network-select-image', function () {
3867
- jQuery('.b2s-multi-image-info-text').hide();
3868
- jQuery('.b2s-default-image-info-text').show();
3869
- return false;
3870
- });
3871
-
3872
- jQuery(document).on('click', '.b2s-image-add-this-network', function () {
3873
- var currentImage = jQuery('input[name=image_url]:checked').val();
3874
- var imageCount = jQuery(this).attr('data-image-count');
3875
- var authId = jQuery(this).attr('data-network-auth-id');
3876
- var countId = jQuery(this).attr('data-network-count');
3877
- if (countId == -1) {
3878
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').attr('src', currentImage);
3879
- jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').val(currentImage);
3880
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').show();
3881
- jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').show();
3882
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').hide();
3883
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + (parseInt(imageCount) + 1) + '"]').show();
3884
- jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').show();
3885
- } else {
3886
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').attr('src', currentImage);
3887
- jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').val(currentImage);
3888
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3889
- jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3890
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3891
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + (parseInt(imageCount) + 1) + '"][data-network-count="' + countId + '"]').show();
3892
- jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3893
- }
3894
- jQuery('#b2s-network-select-image').modal('hide');
3895
- return false;
3896
- });
3897
-
3898
- jQuery(document).on('click', '.b2s-multi-image-remove-btn', function () {
3899
- var imageCount = jQuery(this).attr('data-image-count');
3900
- var authId = jQuery(this).attr('data-network-auth-id');
3901
- var countId = jQuery(this).attr('data-network-count');
3902
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').attr('src', '');
3903
- jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').val('');
3904
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3905
- jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3906
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3907
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + (parseInt(imageCount) + 1) + '"][data-network-count="' + countId + '"]').hide();
3908
- jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3909
- return false;
3910
- });
3911
-
3912
- jQuery(document).on('click', '.b2s-post-item-details-url-image-multi', function () {
3913
- var imageCount = jQuery(this).attr('data-image-count');
3914
- var authId = jQuery(this).attr('data-network-auth-id');
3915
- var countId = jQuery(this).attr('data-network-count');
3916
- jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').trigger('click');
3917
- return false;
3918
- });
3919
-
3920
- jQuery(document).on('click', '.b2s-select-multi-image-modal-open', function () {
3921
- var imageCount = jQuery(this).attr('data-image-count');
3922
- var authId = jQuery(this).attr('data-network-auth-id');
3923
- var countId = jQuery(this).attr('data-network-count');
3924
- jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').trigger('click');
3925
- return false;
3926
- });
3927
-
3928
- jQuery(document).on('click', '.b2s-auth-network-6-extension-auth-btn', function () {
3929
- jQuery('.b2s-auth-network-6-extension-info-area').hide();
3930
- jQuery('.b2s-auth-network-6-extension-start-area').hide();
3931
- jQuery('.b2s-auth-network-6-extension-auth-btn').hide();
3932
- jQuery('.b2s-auth-network-6-go-to-network-btn').hide();
3933
- jQuery('.b2s-loading-area').show();
3934
- var messageData = {action: 'BWESP', type: 'BWECT', data: [
3935
- 'pinterest.com',
3936
- 'pinterest.de',
3937
- 'accounts.pinterest.com',
3938
- 'www.pinterest.com',
3939
- 'www.pinterest.de',
3940
- '.www.pinterest.com',
3941
- '.www.pinterest.de',
3942
- 'gr.pinterest.com', 'in.pinterest.com', 'www.pinterest.ie', 'www.pinterest.it', 'www.pinterest.ch', 'cz.pinterest.com', 'id.pinterest.com', 'www.pinterest.es', 'www.pinterest.ca', 'www.pinterest.co.uk', 'www.pinterest.ru', 'nl.pinterest.com', 'br.pinterest.com', 'no.pinterest.com', 'tr.pinterest.com', 'www.pinterest.com.au', 'www.pinterest.at', 'pl.pinterest.com', 'www.pinterest.fr', 'ro.pinterest.com', 'www.pinterest.de', 'www.pinterest.dk', 'www.pinterest.nz', 'fi.pinterest.com', 'hu.pinterest.com', 'www.pinterest.jp', 'www.pinterest.pt', 'ar.pinterest.com', 'www.pinterest.co.kr', 'www.pinterest.se', 'www.pinterest.com.mx', 'sk.pinterest.com', 'www.pinterest.cl', 'co.pinterest.com', 'za.pinterest.com', 'www.pinterest.ph']};
3943
- window.postMessage(messageData, '*');
3944
- return false;
3945
- });
3946
-
3947
- window.addEventListener("message", function (event) {
3948
- if (typeof event.data == "string") {
3949
- var result = JSON.parse(event.data);
3950
- if (result.type == 'BWECR' && result.version >= '1.5.5' && result.inkognito == false && result.enabled == true) {
3951
- jQuery('.b2s-auth-network-6-extension-info-area').hide();
3952
- jQuery('.b2s-auth-network-6-extension-continue-btn').hide();
3953
- jQuery('.b2s-auth-network-6-go-to-network-btn').hide();
3954
- jQuery('.b2s-auth-network-6-extension-start-area').show();
3955
- jQuery('.b2s-auth-network-6-extension-auth-btn').show();
3956
- }
3957
- if (result.type == 'BWEPR') {
3958
- jQuery.ajax({
3959
- url: ajaxurl,
3960
- type: "POST",
3961
- dataType: "json",
3962
- cache: false,
3963
- data: {
3964
- 'action': 'b2s_network_check_user_data',
3965
- 'networkUserData': result.data,
3966
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3967
- },
3968
- error: function () {
3969
- jQuery('.b2s-server-connection-fail').show();
3970
- return false;
3971
- },
3972
- success: function (data) {
3973
- jQuery('#b2sAuthNetwork6Modal').modal('show');
3974
- jQuery('.b2s-loading-area').hide();
3975
- if (data.result == true) {
3976
- jQuery('.b2s-auth-network-6-extension-success-area').show();
3977
- jQuery('#b2s-auth-network-6-board-extension').html(data.boards);
3978
- jQuery('#b2s-auth-network-6-username-extension').val(data.username);
3979
- jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
3980
- jQuery('.b2s-auth-network-6-extension-success-area').show();
3981
- jQuery('.b2s-auth-network-6-confirm-extension-btn').show();
3982
- jQuery('.b2s-auth-network-6-extension-start-area').hide();
3983
- } else {
3984
- jQuery('.b2s-auth-network-6-extension-info-area').show();
3985
- jQuery('.b2s-auth-network-6-extension-continue-btn').show();
3986
- if (data.error == 'nonce') {
3987
- jQuery('.b2s-nonce-check-fail').show();
3988
- }
3989
- jQuery('.b2s-auth-network-6-extension-error').show();
3990
- }
3991
- }
3992
- });
3993
- return false;
3994
- }
3995
- }
3996
- });
3997
-
3998
- jQuery(document).on('click', '.b2s-auth-network-6-confirm-extension-btn', function () {
3999
- jQuery('.b2s-loading-area').show();
4000
- jQuery('.b2s-auth-network-6-extension-success-area').hide();
4001
- jQuery('.b2s-auth-network-6-confirm-extension-btn').hide();
4002
- jQuery.ajax({
4003
- url: ajaxurl,
4004
- type: "POST",
4005
- dataType: "json",
4006
- cache: false,
4007
- data: {
4008
- 'action': 'b2s_auth_network_confirm',
4009
- 'username': jQuery('#b2s-auth-network-6-username-extension').val(),
4010
- 'boardId': jQuery('#b2s-auth-network-6-board-extension').val(),
4011
- 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
4012
- 'mandantId': jQuery('#b2s-auth-network-6-mandant-id').val(),
4013
- 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
4014
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
4015
- },
4016
- error: function (jqXHR) {
4017
- jQuery('.b2s-loading-area').hide();
4018
- jQuery('.b2s-auth-network-6-extension-success-area').show();
4019
- jQuery('.b2s-auth-network-6-confirm-extension-btn').show();
4020
- jQuery('.b2s-auth-network-6-extension-error').show();
4021
- return false;
4022
- },
4023
- success: function (data) {
4024
- jQuery('.b2s-loading-area').hide();
4025
- jQuery('.b2s-auth-network-6-extension-success-area').show();
4026
- jQuery('.b2s-auth-network-6-confirm-extension-btn').show();
4027
- if (data.result == true) {
4028
- jQuery('#b2sAuthNetwork6Modal').modal('hide');
4029
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
4030
- } else {
4031
- if (data.error == 'nonce') {
4032
- jQuery('.b2s-nonce-check-fail').show();
4033
- }
4034
- jQuery('.b2s-auth-network-6-extension-error').show();
4035
- }
4036
- }
4037
- });
4038
- });
4039
-
4040
-
4041
- function updateNetworkAuth6(networkId) {
4042
- jQuery('#b2s-auth-network-6-auth-id').val(networkId);
4043
- jQuery('#b2s-auth-network-6-mandant-id').val(jQuery('.b2s-network-details-mandant-select').val());
4044
- jQuery('#b2sAuthNetwork6Modal').modal('show');
4045
- }
4046
- ;
4047
- //reset
4048
- jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
4049
- jQuery('.b2s-loading-area').hide();
4050
- jQuery('.b2s-auth-network-6-extension-info-area').hide();
4051
- jQuery('.b2s-auth-network-6-extension-success-area').hide();
4052
- jQuery('.b2s-auth-network-6-extension-start-area').hide();
4053
- jQuery('.b2s-auth-network-6-confirm-extension-btn').hide();
4054
- jQuery('.b2s-auth-network-6-go-to-network-btn').hide();
4055
- jQuery('.b2s-auth-network-6-extension-auth-btn').hide();
4056
- jQuery('.b2s-auth-network-6-login-area').show();
4057
- jQuery('#b2s-auth-network-6-auth-id').val('');
4058
- jQuery('#b2s-auth-network-6-board').html('');
4059
- jQuery('#b2s-auth-network-6-ident-data').val('');
4060
- jQuery('.b2s-auth-network-6-info').hide();
4061
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
4062
- jQuery('.b2s-auth-network-6-login-btn').show();
4063
- jQuery('.b2s-auth-network-6-board-area').hide();
4064
- jQuery('#b2s-auth-network-6-username').val('');
4065
- jQuery('#b2s-auth-network-6-password').val('');
4066
- });
4067
-
4068
- jQuery(document).on('click', '.b2s-auth-network-6-go-to-network-btn', function () {
4069
- var add = '';
4070
- if (jQuery('#b2s-auth-network-6-auth-id').val() != "") {
4071
- add += '&authId=' + jQuery('#b2s-auth-network-6-auth-id').val();
4072
- }
4073
- if (jQuery('#b2s-auth-network-6-mandant-id').val() != "") {
4074
- add += '&mandantId=' + jQuery('#b2s-auth-network-6-mandant-id').val();
4075
- }
4076
- window.location.href = window.location.href.split('?')[0] + '?page=blog2social-network#b2s-add-network-6' + add;
4077
- });
4078
-
4079
- jQuery(document).on('click', '.b2s-network-add-page-info-btn', function () {
4080
- jQuery('#b2sNetworkAddPageInfoModal').modal('show');
4081
- var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4082
- jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4083
- jQuery('#b2sNetworkAddPageInfoModal').modal('hide');
4084
- wop(b2sAuthUrl + '&choose=page', 'Blog2Social Network');
4085
- return false;
4086
- });
4087
- return false;
4088
- });
4089
-
4090
- jQuery(document).on('click', '.b2s-network-add-group-info-btn', function () {
4091
- jQuery('#b2sNetworkAddGroupInfoModal').modal('show');
4092
- var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4093
- jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4094
- jQuery('#b2sNetworkAddGroupInfoModal').modal('hide');
4095
- wop(b2sAuthUrl + '&choose=group', 'Blog2Social Network');
4096
- return false;
4097
- });
4098
- return false;
4099
- });
4100
-
4101
- jQuery(document).on('click', '.b2s-network-add-instagram-info-btn', function () {
4102
- jQuery('#b2sNetworkAddInstagramInfoModal').modal('show');
4103
- var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4104
- jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4105
- jQuery('#b2sNetworkAddInstagramInfoModal').modal('hide');
4106
- wop(b2sAuthUrl + '&choose=profile', 'Blog2Social Network');
4107
- return false;
4108
- });
4109
- return false;
4110
- });
4111
-
4112
- jQuery(document).on('click', '.b2s-network-add-instagram-business-info-btn', function () {
4113
- jQuery('#b2sNetworkAddInstagramBusinessInfoModal').modal('show');
4114
- var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4115
- jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4116
- jQuery('#b2sNetworkAddInstagramBusinessInfoModal').modal('hide');
4117
- wop(b2sAuthUrl + '&choose=page', 'Blog2Social Network');
4118
- return false;
4119
- });
4120
- return false;
4121
- });
4122
-
4123
- function openPostFormat(networkId, networkType, networkAuthId, wpType, showModal) {
4124
- if (jQuery('#user_version').val() >= 1) {
4125
- jQuery('.b2s-user-network-settings-post-format-area').hide();
4126
- jQuery('.b2s-user-network-settings-post-format-area[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').show();
4127
- jQuery('#b2s-post-ship-item-post-format-network-title').html(jQuery('.b2s-user-network-settings-post-format-area[data-network-id="' + networkId + '"]').attr('data-network-title'));
4128
- if (jQuery('#user_version').val() >= 2) {
4129
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
4130
- var currentPostFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val();
4131
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"][data-post-format="' + currentPostFormat + '"]').addClass('b2s-settings-checked');
4132
- jQuery('#b2s-post-ship-item-post-format-network-display-name').html(jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').text().toUpperCase());
4133
- }
4134
- jQuery('.b2s-post-format-settings-info').hide();
4135
- jQuery('.b2s-post-format-settings-info[data-network-id="' + networkId + '"]').show();
4136
- if (showModal) {
4137
- jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
4138
- }
4139
- jQuery('.b2s-user-network-settings-post-format').attr('data-network-auth-id', networkAuthId);
4140
- jQuery('.b2s-user-network-settings-post-format').attr('data-post-wp-type', wpType);
4141
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == "1" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != currentOGImage && jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-meta-type') == 'og') {
4142
- jQuery('.b2s-select-link-chang-image').show();
4143
- } else {
4144
- jQuery('.b2s-select-link-chang-image').hide();
4145
- }
4146
- } else {
4147
- if (showModal) {
4148
- jQuery('#b2sInfoFormatModal').modal('show');
4149
- }
4150
- }
4151
- return false;
4152
- }
4153
-
4154
- function changePostFormat(networkId, networkType, postFormat, networkAuthId, postFormatType, postType, closeModal) {
4155
- jQuery('.b2s-settings-user-success').hide();
4156
- jQuery('.b2s-settings-user-error').hide();
4157
- jQuery('.b2s-server-connection-fail').hide();
4158
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
4159
- //PostFormat
4160
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
4161
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
4162
- if (jQuery('#user_version').val() >= 2) {
4163
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][postFormat]);
4164
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(postFormat);
4165
- } else {
4166
- jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][postFormat]);
4167
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
4168
- }
4169
- if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-meta-type') == 'og' && postType != "ex") {
4170
- if (currentOGImage == '' && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != '') {
4171
- currentOGImage = jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val();
4172
- if (postFormat == "0") {
4173
- jQuery('.b2s-network-select-btn[data-meta-type="og"]').each(function () {
4174
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentOGImage);
4175
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentOGImage);
4176
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
4177
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
4178
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
4179
- }
4180
- });
4181
- }
4182
- }
4183
- if (postFormat == "0" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != currentOGImage) {
4184
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
4185
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
4186
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
4187
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
4188
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4189
- }
4190
- }
4191
- }
4192
- }
4193
- var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').attr('data-network-text-limit');
4194
- if (textLimit != "0") {
4195
- networkLimitAll(networkAuthId, networkId, textLimit);
4196
- } else {
4197
- networkCount(networkAuthId);
4198
- }
4199
-
4200
- //Edit Meta Tags
4201
- var isMetaChecked = false;
4202
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
4203
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
4204
- isMetaChecked = true;
4205
- }
4206
- if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
4207
- isMetaChecked = true;
4208
- }
4209
- if (isMetaChecked && postFormat == '0' && jQuery('#user_version').val() > 0) { //If linkpost
4210
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
4211
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
4212
- var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
4213
- if (dataMetaType == "og") {
4214
- jQuery('#b2sChangeOgMeta').val("1");
4215
- } else {
4216
- jQuery('#b2sChangeCardMeta').val("1");
4217
- }
4218
-
4219
- //Copy from further item meta tags by same network
4220
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
4221
- if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
4222
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
4223
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
4224
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
4225
- if (jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]:visible').length == 1) {
4226
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
4227
- } else {
4228
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
4229
- }
4230
-
4231
- return true;
4232
- }
4233
- });
4234
-
4235
- //Set & Check Link
4236
- if (typeof jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]') !== undefined) {
4237
- //Facebook + Twitter && Linkpost
4238
- if (networkId == 1 || networkId == 2 && postFormat == 0) {
4239
- if (jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
4240
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefault_url').val());
4241
- }
4242
- }
4243
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
4244
- if (jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hasClass('disabled')) {
4245
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').removeClass('disabled');
4246
- }
4247
- }
4248
-
4249
- } else {
4250
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4251
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4252
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
4253
- }
4254
-
4255
- //Content Curation V5.0.0
4256
- if (postType == "ex") {
4257
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4258
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4259
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
4260
- if (postFormat == '0') {
4261
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
4262
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
4263
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
4264
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
4265
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
4266
- } else {
4267
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
4268
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
4269
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
4270
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
4271
- }
4272
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
4273
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4274
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4275
- }
4276
- }
4277
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
4278
- jQuery('.b2s-user-network-settings-post-format[data-network-auth-id="' + networkAuthId + '"][data-post-format="' + postFormat + '"]').addClass('b2s-settings-checked');
4279
- if (closeModal) {
4280
- jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
4281
- }
4282
- checkGifAnimation(networkAuthId, networkId);
4283
-
4284
- //Multi Image
4285
- if (postFormat == 1 && ((networkId == 1 && (networkType == 1 || networkType == 2)) || (networkId == 2)) && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != 1) {
4286
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').show();
4287
- } else {
4288
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4289
- }
4290
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="0"]').show();
4291
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="1"]').show();
4292
- jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="2"]').show();
4293
-
4294
- if (postFormat == 0 && networkId == 1) {
4295
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('required_network_url');
4296
- }
4297
-
4298
- if (networkId == 2) {
4299
- if (postFormat == 0) {
4300
- jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').show();
4301
- } else {
4302
- jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').hide();
4303
- }
4304
- }
4305
- return false;
4306
- }
4307
-
4308
- //Network: Tumblr post format
4309
- jQuery(document).on('change', '.b2s-post-item-details-post-format[data-network-id="4"]', function () {
4310
- var type = jQuery(this).val();
4311
- var networkAuthId = jQuery(this).data('network-auth-id');
4312
- if (type == 2) {
4313
- jQuery('.b2s-format-area-tumblr-image[data-network-auth-id="' + networkAuthId + '"]').hide();
4314
- jQuery('.b2s-format-area-tumblr-link[data-network-auth-id="' + networkAuthId + '"]').show();
4315
- jQuery('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]').show();
4316
- }
4317
- if (type == 1) {
4318
- jQuery('.b2s-format-area-tumblr-link[data-network-auth-id="' + networkAuthId + '"]').show();
4319
- jQuery('.b2s-format-area-tumblr-image[data-network-auth-id="' + networkAuthId + '"]').show();
4320
- jQuery('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]').hide();
4321
- }
4322
- if (type == 0) {
4323
- jQuery('.b2s-format-area-tumblr-link[data-network-auth-id="' + networkAuthId + '"]').hide();
4324
- jQuery('.b2s-format-area-tumblr-image[data-network-auth-id="' + networkAuthId + '"]').hide();
4325
- jQuery('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]').show();
4326
- }
 
 
 
 
 
 
 
 
 
 
4327
  });
1
+ jQuery.noConflict();
2
+
3
+ var b2sTosXingGroupCount = 0;
4
+ var currentOGImage = '';
5
+ var changedOGImage = false;
6
+
7
+ jQuery(document).on('heartbeat-send', function (e, data) {
8
+ data['b2s_heartbeat'] = 'b2s_listener';
9
+ });
10
+
11
+ jQuery.xhrPool = [];
12
+
13
+ jQuery(window).on("load", function () {
14
+ init(true);
15
+ imageSize();
16
+ if (jQuery('.toggelbutton').is(':visible') && !jQuery("#b2s-wrapper").hasClass("toggled")) {
17
+ jQuery('.btn-toggle-menu').trigger('click');
18
+ }
19
+ });
20
+
21
+ //Stop duplicate posts by page refreshing during the post process
22
+ jQuery(document).on('keydown', '#b2sNetworkSent', function (event) {
23
+ if (event.keyCode == 116) {
24
+ event.preventDefault();
25
+ return false;
26
+ }
27
+ });
28
+
29
+ jQuery(document).on('click', '.btn-toggle-menu', function () {
30
+ if (jQuery('.toggelbutton').is(':visible')) {
31
+ jQuery("#b2s-wrapper").toggleClass("toggled");
32
+ if (jQuery("#b2s-wrapper").hasClass("toggled")) {
33
+ jQuery(".sidebar-brand").hide();
34
+ jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-right').addClass('glyphicon-chevron-left');
35
+ } else {
36
+ jQuery(".sidebar-brand").show();
37
+ jQuery(".btn-toggle-glyphicon").removeClass('glyphicon-chevron-left').addClass('glyphicon-chevron-right');
38
+ }
39
+ }
40
+ });
41
+
42
+ jQuery.sceditor.formats.xhtml.allowedTags = ['h1', 'h2', 'p', 'br', 'i', 'em', 'b', 'a', 'img', 'span'];
43
+ jQuery.sceditor.command.set(
44
+ "h1", {
45
+ exec: function () {
46
+ if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H1') {
47
+ this.wysiwygEditorInsertHtml('<h1>', '</h1>');
48
+ } else {
49
+ jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
50
+ }
51
+ },
52
+ txtExec: ["<h1>", "</h1>"],
53
+ tooltip: "H1"
54
+ });
55
+ jQuery.sceditor.command.set(
56
+ "h2", {
57
+ exec: function () {
58
+ if (this.currentBlockNode() == undefined || this.currentBlockNode().nodeName != 'H2') {
59
+ this.wysiwygEditorInsertHtml('<h2>', '</h2>');
60
+ } else {
61
+ jQuery(this.currentBlockNode()).replaceWith(this.currentBlockNode().innerText);
62
+ }
63
+ },
64
+ txtExec: ["<h2>", "</h2>"], tooltip: "H2"});
65
+
66
+ jQuery.sceditor.command.set(
67
+ "custom-image", {
68
+ exec: function () {
69
+ var me = this;
70
+ if (typeof (b2s_is_calendar) != "undefined" && b2s_is_calendar)
71
+ {
72
+ jQuery('.b2s-network-select-image-content').html("");
73
+ jQuery.ajax({
74
+ url: ajaxurl,
75
+ type: "POST",
76
+ cache: false,
77
+ async: false,
78
+ data: {
79
+ 'action': 'b2s_get_image_modal',
80
+ 'id': b2s_current_post_id,
81
+ 'image_url': '',
82
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
83
+ },
84
+ success: function (data) {
85
+ if (data.error == 'nonce') {
86
+ jQuery('.b2s-nonce-check-fail').show();
87
+ } else {
88
+ jQuery(".b2s-network-select-image-content").html(data);
89
+ }
90
+ }
91
+ });
92
+ }
93
+ var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
94
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
95
+ jQuery('.b2s-image-change-this-network').show();
96
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
97
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
98
+ jQuery('.b2s-selected-network-for-image-info').html(content);
99
+ jQuery('#b2s-network-select-image').modal('show');
100
+ jQuery('.b2s-image-change-meta-network').hide();
101
+ jQuery('#b2sInsertImageType').val("1");
102
+ imageSize();
103
+
104
+ },
105
+ txtExec: function () {
106
+ var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
107
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
108
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
109
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').html();
110
+ jQuery('.b2s-selected-network-for-image-info').html(content);
111
+ jQuery('#b2s-network-select-image').modal('show');
112
+ jQuery('#b2sInsertImageType').val("1");
113
+ imageSize();
114
+ }, tooltip: "Image"});
115
+ jQuery.sceditor.command.set(
116
+ "custom-emoji", {
117
+ exec: function () {
118
+ var me = this;
119
+ if (pickerHTML.pickerVisible) {
120
+ pickerHTML.hidePicker();
121
+ } else {
122
+ pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
123
+ currentPickerHTMLContent = this;
124
+ }
125
+ },
126
+ txtExec: function () {
127
+ var me = this;
128
+ if (pickerHTML.pickerVisible) {
129
+ pickerHTML.hidePicker();
130
+ } else {
131
+ pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
132
+ currentPickerHTMLContent = this;
133
+ }
134
+ }, tooltip: "Emoji"});
135
+
136
+
137
+ jQuery(document).on('click', '.b2s-toogle-calendar-btn', function () {
138
+
139
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
140
+ var networkId = jQuery(this).attr('data-network-id');
141
+ var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
142
+ var currentBtnText = jQuery(this).text();
143
+
144
+ jQuery(this).text(toogleBtnText);
145
+ jQuery(this).attr('data-toogle-text-btn', currentBtnText);
146
+
147
+ //change to show
148
+ var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
149
+ if (calendar.hasClass('hide')) {
150
+ calendar.removeClass('hide');
151
+ calendar.addClass('show');
152
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').removeClass('hide');
153
+
154
+ if (calendar.is(':empty')) {
155
+ b2s_cur_source_ship_calendar[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + networkId + '&filter_status=2' + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
156
+
157
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar({
158
+ editable: false,
159
+ locale: b2s_calendar_locale,
160
+ eventLimit: 2,
161
+ contentHeight: 530,
162
+ timeFormat: 'H:mm',
163
+ eventSources: [b2s_cur_source_ship_calendar[0]],
164
+ eventRender: function (event, element) {
165
+ show = true;
166
+ $header = jQuery("<div>").addClass("b2s-calendar-header");
167
+ $isRelayPost = '';
168
+ $isCuratedPost = '';
169
+ if (event.post_type == 'b2s_ex_post') {
170
+ $isCuratedPost = ' (Curated Post)';
171
+ }
172
+ if (event.relay_primary_post_id > 0) {
173
+ $isRelayPost = ' (Retweet)';
174
+ }
175
+ $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
176
+ element.find(".fc-time").after($network_name);
177
+ element.html(element.html());
178
+ $parent = element.parent();
179
+ $header.append(element.find(".fc-content"));
180
+ element.append($header);
181
+ $body = jQuery("<div>").addClass("b2s-calendar-body");
182
+ $body.append(event.avatar);
183
+ $body.append(element.find(".fc-title"));
184
+ $body.append(jQuery("<br>"));
185
+ var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
186
+ $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
187
+ $em.append(event.network_name);
188
+ $em.append(jQuery("<span>").text(": " + event.profile));
189
+ $body.append($em);
190
+ element.append($body);
191
+ },
192
+ dayRender: function (date, element) {
193
+ if (!jQuery(element[0]).hasClass('fc-past')) {
194
+ var date = jQuery(element[0]).attr('data-date');
195
+ var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
196
+ $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddSchedule").val() + "</span>").addClass("b2s-calendar-add-schedule-btn").attr('href', '#').attr('data-network-auth-id', networkAuthId);
197
+ sel_element.append($header);
198
+ }
199
+ }
200
+ });
201
+ } else {
202
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar('refetchEvents');
203
+ }
204
+
205
+ } else {
206
+ calendar.removeClass('show');
207
+ calendar.addClass('hide');
208
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
209
+
210
+ }
211
+
212
+ return false;
213
+
214
+ });
215
+
216
+ jQuery(document).on('click', '.b2s-calendar-add-schedule-btn', function () {
217
+ var selSchedDate = jQuery(this).parent('td').attr('data-date');
218
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
219
+
220
+ if (jQuery('#user_version').val() == 0) {
221
+ jQuery('.b2s-post-item-details-release-input-date-select-reset[data-network-auth-id="' + networkAuthId + '"]').val('0');
222
+ jQuery('#b2s-sched-post-modal').modal('show');
223
+ return false;
224
+ }
225
+
226
+ if (jQuery('#b2sUserLang').val() == 'de') {
227
+ selSchedDate = selSchedDate.substring(8, 10) + '.' + selSchedDate.substring(5, 7) + '.' + selSchedDate.substring(0, 4);
228
+ }
229
+
230
+ //isfirst
231
+ if (!jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"] option[value="1"]:selected').length > 0) {
232
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
233
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
234
+ } else {
235
+ //add
236
+ var curSel = jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"]').filter(':visible');
237
+ if (curSel.length > 0) {
238
+ curSel.trigger('click');
239
+ netCountNext = parseInt(curSel.attr('data-network-count')) + 1;
240
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + netCountNext + '"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
241
+ } else {
242
+ //do not adding write to first
243
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
244
+ }
245
+ }
246
+ return false;
247
+ });
248
+
249
+ jQuery(document).on('change', '.b2s-calendar-filter-network-sel', function () {
250
+ var newSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=2' + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
251
+ var oldSource = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).attr('data-last-sel') + '&filter_status=2' + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
252
+ jQuery(this).attr('data-last-sel', jQuery(this).val());
253
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('removeEventSource', oldSource);
254
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('addEventSource', newSource);
255
+ return false;
256
+ });
257
+
258
+
259
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
260
+ jQuery('.b2s-server-connection-fail').hide();
261
+ jQuery.ajax({
262
+ url: ajaxurl,
263
+ type: "POST",
264
+ dataType: "json",
265
+ cache: false,
266
+ data: {
267
+ 'action': 'b2s_get_settings_sched_time_default',
268
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
269
+ },
270
+ error: function () {
271
+ jQuery('.b2s-server-connection-fail').show();
272
+ return false;
273
+ },
274
+ success: function (data) {
275
+ if (data.result == true) {
276
+ var tomorrow = new Date();
277
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
278
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
279
+ }
280
+ tomorrow.setDate(tomorrow.getDate() + 1);
281
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
282
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
283
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
284
+ var today = new Date();
285
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
286
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
287
+ }
288
+
289
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
290
+ var todayDate = ("0" + today.getDate()).slice(-2);
291
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
292
+ var lang = jQuery('#b2sUserLang').val();
293
+ if (lang == "de") {
294
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
295
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
296
+ }
297
+
298
+ jQuery.each(data.times, function (network_id, time) {
299
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
300
+ time.forEach(function (network_type_time, count) {
301
+ if (network_type_time != "") {
302
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
303
+ if (jQuery(this).is(':not(:disabled)')) {
304
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
305
+ //is not set special dates
306
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() == '0') {
307
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
308
+ }
309
+ var hours = network_type_time.substring(0, 2);
310
+ if (lang == "en") {
311
+ var timeparts = network_type_time.split(' ');
312
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
313
+ }
314
+ if (hours < today.getHours()) {
315
+ if (jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val() < dateTomorrow) {
316
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
317
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
318
+ }
319
+ } else {
320
+ if (jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val() < dateToday) {
321
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
322
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
323
+ }
324
+ }
325
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
326
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
327
+ }
328
+ });
329
+ count++;
330
+ }
331
+ });
332
+ }
333
+ });
334
+ } else {
335
+ if (data.error == 'nonce') {
336
+ jQuery('.b2s-nonce-check-fail').show();
337
+ }
338
+ }
339
+ }
340
+ });
341
+ return false;
342
+ });
343
+
344
+
345
+ function formatAMPM(date) {
346
+ var hours = date.getHours();
347
+ var minutes = date.getMinutes();
348
+ var ampm = hours >= 12 ? 'pm' : 'am';
349
+ hours = hours % 12;
350
+ hours = hours ? hours : 12; // the hour '0' should be '12'
351
+ minutes = minutes < 10 ? '0' + minutes : minutes;
352
+ var strTime = hours + ':' + minutes + ' ' + ampm;
353
+ return strTime;
354
+ }
355
+
356
+
357
+
358
+ jQuery(document).on('click', '.b2s-sidbar-network-auth-btn', function () {
359
+ jQuery('#b2s-network-list-modal').modal('show');
360
+ return false;
361
+ });
362
+ jQuery(document).on('click', '.change-meta-tag', function () {
363
+ var attr = jQuery(this).attr('readonly');
364
+ if (typeof attr !== typeof undefined && attr !== false) {
365
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
366
+ //Content cuation
367
+ var postType = jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-post-wp-type');
368
+ if (postType != "ex") {
369
+ jQuery('.meta-text').hide();
370
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
371
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
372
+ var isMetaChecked = false;
373
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
374
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
375
+ isMetaChecked = true;
376
+ }
377
+ if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
378
+ isMetaChecked = true;
379
+ }
380
+ var showDefault = true;
381
+ if (postFormat == "0" && !isMetaChecked) { //isLinkPost
382
+ showDefault = false;
383
+ if (networkId == "1") {
384
+ jQuery('.isOgMetaChecked').show();
385
+ } else {
386
+ jQuery('.isCardMetaChecked').show();
387
+ }
388
+ }
389
+ if (showDefault) {
390
+ jQuery('.isLinkPost').show();
391
+ }
392
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
393
+ }
394
+ }
395
+ return false;
396
+ });
397
+ // Linkpost change Meta Tags title + desc
398
+ jQuery(document).on('keyup', '.change-meta-tag', function () {
399
+ var currentText = jQuery(this).val();
400
+ var metaTag = jQuery(this).attr('data-meta');
401
+ jQuery('.change-meta-tag[data-meta=' + metaTag + ']').each(function () {
402
+ //override this content with current content by keyup
403
+ jQuery(this).val(currentText);
404
+ });
405
+ return false;
406
+ });
407
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
408
+ jQuery('.b2s-server-connection-fail').hide();
409
+ jQuery.ajax({
410
+ url: ajaxurl,
411
+ type: "POST",
412
+ dataType: "json",
413
+ cache: false,
414
+ data: {
415
+ 'action': 'b2s_get_settings_sched_time_user',
416
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
417
+ },
418
+ error: function () {
419
+ jQuery('.b2s-server-connection-fail').show();
420
+ return false;
421
+ },
422
+ success: function (data) {
423
+ var tomorrow = new Date();
424
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
425
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
426
+ }
427
+
428
+ tomorrow.setDate(tomorrow.getDate() + 1);
429
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
430
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
431
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
432
+ var today = new Date();
433
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
434
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
435
+ }
436
+
437
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
438
+ var todayDate = ("0" + today.getDate()).slice(-2);
439
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
440
+ var lang = jQuery('#b2sUserLang').val();
441
+ if (lang == "de") {
442
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
443
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
444
+ }
445
+ if (data.result == true) {
446
+ //V5.1.0 seeding
447
+ if (data.type == 'new') {
448
+ //new
449
+ jQuery.each(data.times, function (network_auth_id, time) {
450
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
451
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').is(':not(:disabled)')) {
452
+ //is not set special dates
453
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
454
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
455
+ }
456
+ var hours = time.substring(0, 2);
457
+ var timeparts = time.split(' ');
458
+ if (typeof timeparts[1] != 'undefined') {
459
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
460
+ }
461
+
462
+ var isDelay = false;
463
+ var delayDay = data.delay_day[network_auth_id];
464
+ if (delayDay != undefined) {
465
+ if (delayDay > 0) {
466
+ var delay = new Date();
467
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
468
+ delay.setTime(jQuery('#b2sBlogPostSchedDate').val());
469
+ }
470
+ delay.setDate(delay.getDate() + parseInt(delayDay));
471
+ var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
472
+ var delayDate = ("0" + delay.getDate()).slice(-2);
473
+ var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
474
+ if (lang == 'de') {
475
+ dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
476
+ }
477
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
478
+ isDelay = true;
479
+
480
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
481
+ }
482
+ }
483
+ if (!isDelay) {
484
+ if (hours < today.getHours()) {
485
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
486
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
487
+ } else {
488
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
489
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
490
+ }
491
+ }
492
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
493
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').timepicker('setTime', new Date(today.getFullYear(), today.getMonth(), today.getDate(), hours, time.slice(3, 5)));
494
+ }
495
+ }
496
+ });
497
+ } else {
498
+ //old
499
+ jQuery.each(data.times, function (network_id, time) {
500
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
501
+ time.forEach(function (network_type_time, count) {
502
+ if (network_type_time != "") {
503
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
504
+ if (jQuery(this).is(':not(:disabled)')) {
505
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
506
+ //is not set special dates
507
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val() != '1') {
508
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"]').val('1').trigger("change");
509
+ }
510
+ var hours = network_type_time.substring(0, 2);
511
+ if (lang == "en") {
512
+ var timeparts = network_type_time.split(' ');
513
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
514
+ }
515
+ if (hours < today.getHours()) {
516
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateTomorrow);
517
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
518
+ } else {
519
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(dateToday);
520
+ jQuery('.b2s-post-item-details-release-input-date[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').datepicker('update', dateToday);
521
+ }
522
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
523
+ jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-auth-id="' + networkAuthId + '"][data-network-type="' + count + '"][data-network-count="0"]').timepicker('setTime', network_type_time);
524
+ }
525
+ });
526
+ count++;
527
+ }
528
+ });
529
+ }
530
+ });
531
+ }
532
+ } else {
533
+ if (data.error == 'nonce') {
534
+ jQuery('.b2s-nonce-check-fail').show();
535
+ }
536
+ //default load best Times
537
+ //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
538
+ //set current time
539
+ jQuery('.b2s-post-item:visible').each(function () {
540
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
541
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
542
+ //is not set special dates
543
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
544
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
545
+ }
546
+ }
547
+ });
548
+ }
549
+ }
550
+ });
551
+ return false;
552
+ });
553
+ jQuery('#b2sPreFeatureModal').on('show.bs.modal', function () {
554
+ jQuery('.b2s-post-item-details-release-input-date-select-reset').val('0');
555
+ });
556
+ jQuery(document).on('click', '.b2s-network-list-add-btn-profeature', function () {
557
+ jQuery('#b2s-network-list-modal').modal('hide');
558
+ });
559
+ jQuery(document).on('click', '.b2s-post-item-details-release-area-sched-for-all', function () {
560
+ var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
561
+ var dataNetworkCount = 0;
562
+ var selMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val();
563
+ if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="1"]').is(":visible")) {
564
+ dataNetworkCount = 1;
565
+ }
566
+ if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="2"]').is(":visible")) {
567
+ dataNetworkCount = 2;
568
+ }
569
+
570
+ jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
571
+ if (jQuery(this).attr('data-network-auth-id') != dataNetworkAuthId && jQuery(this).has('option[value="' + jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val() + '"]').length > 0) {
572
+ jQuery(this).val(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val());
573
+ //view elements
574
+ releaseChoose(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
575
+ //view elements interval
576
+ if (selMode == 2) {
577
+ for (var i = 0; i <= dataNetworkCount; i++) {
578
+ var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
579
+ releaseChooseInterval(curInterval, '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]', i);
580
+ }
581
+ }
582
+ }
583
+ });
584
+ //set values
585
+ for (var i = 0; i <= dataNetworkCount; i++) {
586
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
587
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
588
+ if (selMode == 2) {
589
+ var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
590
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]').val(curInterval);
591
+ if (curInterval == 0) {
592
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
593
+ jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
594
+ jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
595
+ jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
596
+ jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
597
+ jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
598
+ jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
599
+ jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"]').prop('checked', jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"').prop('checked'));
600
+ }
601
+ if (curInterval == 1) {
602
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
603
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
604
+ }
605
+ if (curInterval == 2) {
606
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
607
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"]').val(jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val());
608
+ }
609
+ }
610
+ }
611
+
612
+ if (dataNetworkCount == 2) {
613
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
614
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
615
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').hide();
616
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"]').show();
617
+ } else if (dataNetworkCount == 1) {
618
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
619
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').show();
620
+ }
621
+
622
+ return false;
623
+ });
624
+ jQuery(document).on("click", ".b2s-user-network-settings-post-format", function () {
625
+ changePostFormat(jQuery(this).attr("data-network-id"), jQuery(this).attr("data-network-type"), jQuery(this).val(), jQuery(this).attr("data-network-auth-id"), jQuery(this).attr("data-post-format-type"), jQuery(this).attr("data-post-wp-type"), true);
626
+ return false;
627
+ });
628
+ jQuery(document).on("click", ".b2s-post-ship-item-full-text", function () {
629
+ jQuery('.b2s-server-connection-fail').hide();
630
+ var curSchedCount = jQuery(this).attr('data-network-count');
631
+ jQuery.ajax({
632
+ url: ajaxurl,
633
+ type: "POST",
634
+ dataType: "json",
635
+ cache: false,
636
+ data: {
637
+ 'action': 'b2s_ship_item_full_text',
638
+ 'postId': jQuery('#b2sPostId').val(),
639
+ 'userLang': jQuery('#b2sUserLang').val(),
640
+ 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
641
+ 'networkId': jQuery(this).attr('data-network-id'),
642
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
643
+ },
644
+ error: function () {
645
+ jQuery('.b2s-server-connection-fail').show();
646
+ return false;
647
+ },
648
+ success: function (data) {
649
+ if (data.result == true) {
650
+ messageInput = jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + curSchedCount + '"][data-network-auth-id="' + data.networkAuthId + '"]');
651
+ messageInput.val(data.text);
652
+ networkCount(data.networkAuthId);
653
+ networkTextLimit = messageInput.attr('data-network-text-limit');
654
+ if (typeof networkTextLimit != undefined) {
655
+ if (parseInt(networkTextLimit) > 0 && parseInt(data.networkId) > 0) {
656
+ networkLimitAll(data.networkAuthId, data.networkId, networkTextLimit);
657
+ }
658
+ }
659
+ } else {
660
+ if (data.error == 'nonce') {
661
+ jQuery('.b2s-nonce-check-fail').show();
662
+ }
663
+ }
664
+ }
665
+ });
666
+ return false;
667
+ });
668
+ jQuery(document).on("click", ".b2s-post-ship-item-message-delete", function () {
669
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
670
+ var networkCountId = jQuery(this).attr('data-network-count');
671
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
672
+ initSceditor(networkAuthId);
673
+ networkCount(networkAuthId);
674
+ return false;
675
+ });
676
+ jQuery(document).on("click", ".b2s-post-ship-item-copy-original-text", function () {
677
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
678
+ var networkCountId = jQuery(this).attr('data-network-count');
679
+ var networkId = jQuery(this).attr('data-network-id');
680
+ var text = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').val();
681
+ if (text == "" && networkId == 2) {
682
+ text = jQuery('#b2sTwitterOrginalPost').val();
683
+ }
684
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(text);
685
+ networkCount(networkAuthId);
686
+ return false;
687
+ });
688
+ jQuery(document).on("click", ".b2s-network-select-btn", function () {
689
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
690
+ var networkId = jQuery(this).attr('data-network-id');
691
+ var networkType = jQuery(this).attr('data-network-type');
692
+ var metaType = jQuery(this).attr('data-meta-type');
693
+
694
+ //doppelklick Schutz
695
+ if (!jQuery(this).hasClass('b2s-network-select-btn-deactivate')) {
696
+ //active?
697
+ if (!jQuery(this).children().hasClass('active')) {
698
+ //TOS XING Groups
699
+ if ((networkId == 8 || networkId == 19) && networkType == 2) {
700
+ if ((b2sTosXingGroupCount == jQuery('#b2sTosXingGroupCrosspostingLimit').val()) || (networkId == 19 && jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-tos-group-id="' + jQuery(this).attr('data-network-tos-group-id') + '"]').children().hasClass('active'))) {
701
+ jQuery('#b2s-tos-xing-group-max-count-modal').modal('show');
702
+ return false;
703
+ } else {
704
+ b2sTosXingGroupCount++;
705
+ }
706
+ }
707
+ //schon vorhanden?
708
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').length > 0 && !jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').hasClass('b2s-post-item-connection-fail-dummy')) {
709
+ activatePortal(networkAuthId);
710
+ //PostFormat
711
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0 || networkId == 15) {
712
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
713
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').attr('data-post-format-type');
714
+ if (jQuery('#user_version').val() >= 2) {
715
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
716
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
717
+ //if linkpost then show btn meta tags
718
+ var isMetaChecked = false;
719
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
720
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
721
+ isMetaChecked = true;
722
+ }
723
+ if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
724
+ isMetaChecked = true;
725
+ }
726
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
727
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
728
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
729
+ var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
730
+ if (dataMetaType == "og") {
731
+ jQuery('#b2sChangeOgMeta').val("1");
732
+ } else {
733
+ jQuery('#b2sChangeCardMeta').val("1");
734
+ }
735
+
736
+ //Copy from further item meta tags by same network
737
+ jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
738
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "0" && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
739
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
740
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
741
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
742
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
743
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
744
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
745
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
746
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
747
+ }
748
+ } else {
749
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
750
+ }
751
+
752
+ return true;
753
+ }
754
+ });
755
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
756
+ if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').data('meta-type') == 'og' && changedOGImage == true) {
757
+ if (currentOGImage != "") {
758
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
759
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
760
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
761
+ } else {
762
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
763
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
764
+ }
765
+ } else {
766
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
767
+ }
768
+ if ((networkId == "2" || networkId == "24")) {
769
+ jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').show();
770
+ }
771
+ } else {
772
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
773
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
774
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
775
+ if ((networkId == "2" || networkId == "24")) {
776
+ jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').hide();
777
+ }
778
+ }
779
+
780
+ } else {
781
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
782
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
783
+ }
784
+
785
+ //Content Curation
786
+ if (jQuery('#b2sPostType').val() == 'ex') {
787
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
788
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
789
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
790
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 0) {
791
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
792
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
793
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
794
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
795
+ } else {
796
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
797
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
798
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
799
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
800
+ }
801
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
802
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
803
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
804
+ }
805
+ }
806
+ }
807
+
808
+ //XING TOS Group
809
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"').show();
810
+
811
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time
812
+ //delete comment field one more
813
+ if (networkId == 2) {
814
+ if (jQuery('.b2s-post-item[data-network-id="' + networkId + '"]:visible').length == 1) {
815
+ jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text(jQuery('#b2sTwitterOrginalPost').val());
816
+ } else {
817
+ jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text("");
818
+ }
819
+ }
820
+ checkGifAnimation(networkAuthId, networkId);
821
+ } else {
822
+ jQuery(this).addClass('b2s-network-select-btn-deactivate');
823
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').show();
824
+ jQuery('.b2s-empty-area').hide();
825
+ loadingDummyShow(networkAuthId, jQuery(this).attr('data-network-id'));
826
+ jQuery('.b2s-server-connection-fail').hide();
827
+ var legacyMode = jQuery('#isLegacyMode').val();
828
+ if (legacyMode == "1") {
829
+ legacyMode = false; // loading is sync (stack)
830
+ } else {
831
+ legacyMode = true; // loading is async (parallel)
832
+ }
833
+ jQuery.ajax({
834
+ url: ajaxurl,
835
+ type: "POST",
836
+ dataType: "json",
837
+ async: legacyMode,
838
+ cache: false,
839
+ data: {
840
+ 'action': 'b2s_ship_item',
841
+ 'networkAuthId': networkAuthId,
842
+ 'networkType': jQuery(this).attr('data-network-type'),
843
+ 'networkKind': jQuery(this).attr('data-network-kind'),
844
+ 'networkId': networkId,
845
+ 'networkDisplayName': jQuery(this).attr('data-network-display-name'),
846
+ 'instantSharing': jQuery(this).attr('data-instant-sharing'),
847
+ 'networkTosGroupId': jQuery(this).attr('data-network-tos-group-id'),
848
+ 'userLang': jQuery('#b2sUserLang').val(),
849
+ 'postId': jQuery('#b2sPostId').val(),
850
+ 'relayCount': jQuery('#b2sRelayCount').val(),
851
+ 'selSchedDate': jQuery('#selSchedDate').val(),
852
+ 'b2sPostType': jQuery('#b2sPostType').val(),
853
+ 'b2sIsDraft': jQuery('#b2sIsDraft').val(),
854
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
855
+ },
856
+ beforeSend: function (jqXHR) { // before jQuery send the request we will push it to our array
857
+ jQuery.xhrPool.push(jqXHR);
858
+ },
859
+ complete: function (jqXHR) { // when some of the requests completed it will splice from the array
860
+ var index = jQuery.xhrPool.indexOf(jqXHR);
861
+ if (index > -1) {
862
+ jQuery.xhrPool.splice(index, 1);
863
+ }
864
+ },
865
+ error: function (jqXHR) {
866
+ var index = jQuery.xhrPool.indexOf(jqXHR);
867
+ if (index > -1) {
868
+ jQuery.xhrPool.splice(index, 1);
869
+ }
870
+ loadingDummyConnectionFail(networkAuthId, networkId);
871
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').hide();
872
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
873
+ jQuery('.b2s-server-connection-fail').show();
874
+ return true;
875
+ },
876
+ success: function (data) {
877
+ if (data != undefined) {
878
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + data.networkAuthId + '"]').hide();
879
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
880
+ if (data.result == true) {
881
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
882
+ var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
883
+ var pos = order.indexOf(data.networkAuthId.toString());
884
+ var add = false;
885
+ for (var i = pos; i >= 0; i--) {
886
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
887
+ jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(data.content);
888
+ i = -1;
889
+ add = true;
890
+ }
891
+ }
892
+ if (add == false) {
893
+ jQuery('.b2s-post-list').prepend(data.content);
894
+ }
895
+
896
+ activatePortal(data.networkAuthId);
897
+ var dateFormat = "yyyy-mm-dd";
898
+ var language = "en";
899
+ var showMeridian = true;
900
+ if (jQuery('#b2sUserLang').val() == "de") {
901
+ dateFormat = "dd.mm.yyyy";
902
+ language = "de";
903
+ }
904
+ if (jQuery('#b2sUserTimeFormat').val() == 0) {
905
+ showMeridian = false;
906
+ }
907
+ var today = new Date();
908
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
909
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
910
+ }
911
+
912
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
913
+ format: dateFormat,
914
+ language: language,
915
+ maxViewMode: 2,
916
+ todayHighlight: true,
917
+ startDate: today,
918
+ calendarWeeks: true,
919
+ autoclose: true
920
+ });
921
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
922
+ minuteStep: 15,
923
+ appendWidgetTo: 'body',
924
+ showSeconds: false,
925
+ showMeridian: showMeridian,
926
+ defaultTime: today, //'current',
927
+ snapToStep: true
928
+ });
929
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
930
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
931
+ });
932
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
933
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
934
+ });
935
+ //Check Text Limit
936
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-text-limit');
937
+ if (textLimit != "0") {
938
+ networkLimitAll(data.networkAuthId, data.networkId, textLimit);
939
+ } else {
940
+ networkCount(data.networkAuthId);
941
+ }
942
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger("change");
943
+ initSceditor(data.networkAuthId);
944
+ //Bild setzen
945
+ if (jQuery('#b2s_blog_default_image').val() != "") {
946
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').length > 0) {
947
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
948
+ var attachmenUrl = jQuery('#b2s_blog_default_image').val();
949
+ var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
950
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
951
+ if (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1) {
952
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-network-default-image').val());
953
+ } else {
954
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
955
+ }
956
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
957
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
958
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="0"]').show();
959
+ } else {
960
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
961
+ }
962
+ }
963
+ jQuery('.b2s-image-url-hidden-field').val(jQuery('#b2s_blog_default_image').val());
964
+ }
965
+
966
+ //Time zone
967
+ jQuery('.b2s-settings-time-zone-text').html(jQuery('#user_timezone_text').val());
968
+ //PostFormat
969
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0 || data.networkId == 15) {
970
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
971
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').attr('data-post-format-type');
972
+ if (jQuery('#user_version').val() >= 2) {
973
+ //Multi Image
974
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == 1 && ((data.networkId == 1 && (data.networkType == 1 || data.networkType == 2)) || (data.networkId == 2))) {
975
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + data.networkAuthId + '"]').show();
976
+ }
977
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + data.networkAuthId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
978
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
979
+ var isMetaChecked = false;
980
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
981
+ if (typeof data.networkId != 'undefined' && jQuery.inArray(data.networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
982
+ isMetaChecked = true;
983
+ }
984
+ if ((data.networkId == "2" || data.networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
985
+ isMetaChecked = true;
986
+ }
987
+
988
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
989
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
990
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
991
+ var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').attr("data-meta-type");
992
+ if (dataMetaType == "og") {
993
+ jQuery('#b2sChangeOgMeta').val("1");
994
+ //TODO change image to OG image
995
+ } else {
996
+ jQuery('#b2sChangeCardMeta').val("1");
997
+ }
998
+
999
+ //Copy from further item meta tags by same network
1000
+ jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
1001
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "0" && jQuery(this).attr('data-network-auth-id') != data.networkAuthId) { //other Linkpost by same network
1002
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1003
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1004
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
1005
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
1006
+
1007
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
1008
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1009
+ } else {
1010
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1011
+ }
1012
+ return true;
1013
+ }
1014
+ });
1015
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1016
+ if (data.draft == false) {
1017
+ if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').data('meta-type') == 'og' && changedOGImage == true) {
1018
+ if (currentOGImage != "") {
1019
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1020
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1021
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1022
+ } else {
1023
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1024
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1025
+ }
1026
+ } else {
1027
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1028
+ }
1029
+
1030
+ }
1031
+ if ((networkId == "2" || networkId == "24")) {
1032
+ jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').show();
1033
+ }
1034
+ } else {
1035
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1036
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1037
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1038
+ if ((networkId == "2" || networkId == "24")) {
1039
+ jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').hide();
1040
+ }
1041
+ }
1042
+
1043
+ } else {
1044
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + data.networkId + '"]').html(postFormatText[postFormatType][jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
1045
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
1046
+ }
1047
+
1048
+
1049
+ if (jQuery('#selSchedDate').val() != "") {
1050
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1051
+ }
1052
+
1053
+
1054
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time
1055
+ //delete comment field one more
1056
+ if (data.networkId == 2) {
1057
+
1058
+ //set original post
1059
+ if (jQuery('#b2sTwitterOrginalPost').val() == "") {
1060
+ jQuery('#b2sTwitterOrginalPost').val(jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').val());
1061
+ }
1062
+
1063
+ if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 1) {
1064
+ var firstAuth = jQuery('.b2s-post-item[data-network-id="' + data.networkId + '"]:first').attr('data-network-auth-id');
1065
+ if (firstAuth != data.networkAuthId) {
1066
+ jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1067
+ } else {
1068
+ if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 2) {
1069
+ jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+
1075
+ //Content Curation
1076
+ if (jQuery('#b2sPostType').val() == 'ex') {
1077
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1078
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1079
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + data.networkAuthId + '"]').attr("style", "display:none !important");
1080
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == 0) {
1081
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1082
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1083
+ } else {
1084
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1085
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1086
+ }
1087
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1088
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1089
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1090
+ }
1091
+
1092
+ //CC Imagepost V6.0.0
1093
+ if (jQuery('#b2sExPostFormat').val() == 0 || jQuery('#b2sExPostFormat').val() == 1 || jQuery('#b2sExPostFormat').val() == 2) {
1094
+ if (jQuery('#user_version').val() >= 1) {
1095
+ var exPostFormat = jQuery('#b2sExPostFormat').val();
1096
+ if (exPostFormat == 2) {
1097
+ exPostFormat = 1;
1098
+ }
1099
+ openPostFormat(data.networkId, data.networkType, data.networkAuthId, 'ex', false);
1100
+ changePostFormat(data.networkId, data.networkType, exPostFormat, data.networkAuthId, 'post', 'ex', false);
1101
+ }
1102
+ }
1103
+ }
1104
+
1105
+ }
1106
+
1107
+ //Draft
1108
+ if (data.draft == true) {
1109
+ if (data.draftActions.post_format == "0" || data.draftActions.post_format == "1") {
1110
+ jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1111
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').addClass('disabled');
1112
+ jQuery('.b2s-user-network-settings-post-format[value="' + data.draftActions.post_format + '"][data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').trigger('click');
1113
+ }
1114
+
1115
+ jQuery.each(data.draftActions.sched_image_url, function (index, value) {
1116
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1117
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1118
+ if (currentOGImage == '') {
1119
+ currentOGImage = value;
1120
+ } else {
1121
+ value = currentOGImage;
1122
+ }
1123
+ }
1124
+ if (value == "") {
1125
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + index + '"]').hide();
1126
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', jQuery('.b2s-network-default-image').val());
1127
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val("");
1128
+ } else {
1129
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', value);
1130
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1131
+ }
1132
+ });
1133
+
1134
+ if (data.draftActions.releaseSelect == "1") {
1135
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1136
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1137
+
1138
+ jQuery.each(data.draftActions.date, function (index, value) {
1139
+ if (index == "1" || index == "2") {
1140
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1141
+ }
1142
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1143
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1144
+ });
1145
+ jQuery.each(data.draftActions.time, function (index, value) {
1146
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1147
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1148
+ });
1149
+ jQuery.each(data.draftActions.sched_content, function (index, value) {
1150
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1151
+ });
1152
+ }
1153
+ if (data.draftActions.releaseSelect == "2") {
1154
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1155
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1156
+
1157
+ jQuery.each(data.draftActions.intervalSelect, function (index, value) {
1158
+ if (index == "1" || index == "2") {
1159
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1160
+ }
1161
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1162
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1163
+ });
1164
+ jQuery.each(data.draftActions.weeks, function (index, value) {
1165
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1166
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1167
+ });
1168
+ jQuery.each(data.draftActions.duration_month, function (index, value) {
1169
+ jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1170
+ jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1171
+ });
1172
+ jQuery.each(data.draftActions.duration_time, function (index, value) {
1173
+ jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1174
+ jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1175
+ });
1176
+ jQuery.each(data.draftActions.select_day, function (index, value) {
1177
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1178
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1179
+ });
1180
+ jQuery.each(data.draftActions.select_timespan, function (index, value) {
1181
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1182
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1183
+ });
1184
+ jQuery.each(data.draftActions.mo, function (index, value) {
1185
+ jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1186
+ });
1187
+ jQuery.each(data.draftActions.di, function (index, value) {
1188
+ jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1189
+ });
1190
+ jQuery.each(data.draftActions.mi, function (index, value) {
1191
+ jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1192
+ });
1193
+ jQuery.each(data.draftActions.do, function (index, value) {
1194
+ jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1195
+ });
1196
+ jQuery.each(data.draftActions.fr, function (index, value) {
1197
+ jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1198
+ });
1199
+ jQuery.each(data.draftActions.sa, function (index, value) {
1200
+ jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1201
+ });
1202
+ jQuery.each(data.draftActions.so, function (index, value) {
1203
+ jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1204
+ });
1205
+ jQuery.each(data.draftActions.date, function (index, value) {
1206
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1207
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1208
+ });
1209
+ jQuery.each(data.draftActions.time, function (index, value) {
1210
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1211
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1212
+ });
1213
+ }
1214
+
1215
+ if (data.draftActions.post_relay == "1") {
1216
+ jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').attr('checked', true);
1217
+ jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1218
+
1219
+ jQuery.each(data.draftActions.post_relay_account, function (index, value) {
1220
+ if (index >= 1) {
1221
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1222
+ }
1223
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1224
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1225
+ });
1226
+ jQuery.each(data.draftActions.post_relay_delay, function (index, value) {
1227
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1228
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1229
+ });
1230
+ }
1231
+
1232
+ while (jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').is(':visible')) {
1233
+ jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1234
+ }
1235
+ jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val('');
1236
+ jQuery.each(data.draftActions.tags, function (index, value) {
1237
+ if (index >= 1) {
1238
+ jQuery('.ad-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1239
+ }
1240
+ jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val(value);
1241
+ });
1242
+
1243
+ jQuery('.b2s-post-item-details-item-title-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.custom_title);
1244
+
1245
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.url);
1246
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('error');
1247
+
1248
+
1249
+ if (data.networkId == 1) {
1250
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_title);
1251
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_desc);
1252
+ }
1253
+
1254
+ if (data.networkId == 2) {
1255
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_title);
1256
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_desc);
1257
+ }
1258
+
1259
+ if (data.draftActions.image_url == "") {
1260
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1261
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', jQuery('.b2s-network-default-image').val());
1262
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val("");
1263
+ } else {
1264
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', data.draftActions.image_url);
1265
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val(data.draftActions.image_url);
1266
+ }
1267
+ checkSchedDateTime(data.networkAuthId);
1268
+
1269
+
1270
+ if (data.draftActions.multi_image_1 != "") {
1271
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').attr('src', data.draftActions.multi_image_1);
1272
+ jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').val(data.draftActions.multi_image_1);
1273
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').show();
1274
+ jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').show();
1275
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').hide();
1276
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1277
+ jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="1"]').show();
1278
+ }
1279
+ if (data.draftActions.multi_image_2 != "") {
1280
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').attr('src', data.draftActions.multi_image_2);
1281
+ jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').val(data.draftActions.multi_image_2);
1282
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1283
+ jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1284
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').hide();
1285
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="3"]').show();
1286
+ jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1287
+ }
1288
+ if (data.draftActions.multi_image_3 != "") {
1289
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').attr('src', data.draftActions.multi_image_3);
1290
+ jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').val(data.draftActions.multi_image_3);
1291
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1292
+ jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1293
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').hide();
1294
+ jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-image-count="2"]').show();
1295
+ }
1296
+ }
1297
+
1298
+ //XING Groups
1299
+ if (data.networkId == 19 && data.networkType == 2) {
1300
+ if (jQuery('.networkKind[data-network-auth-id="' + data.networkAuthId + '"]').val() == '3') {
1301
+ jQuery('.marketplace_area[data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + data.networkId + '"]').show();
1302
+ }
1303
+ }
1304
+ //XING TOS Group
1305
+ if (data.networkId == 19) {
1306
+ jQuery('.b2s-content-info[data-network-auth-id="' + data.networkAuthId + '"').show();
1307
+ }
1308
+
1309
+ if (metaType == 'og' && currentOGImage != '') {
1310
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1311
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1312
+ }
1313
+
1314
+ } else {
1315
+ if (data.error == 'nonce') {
1316
+ jQuery('.b2s-nonce-check-fail').show();
1317
+ }
1318
+ //TOS XING Groups
1319
+ if (typeof data.reason !== "undefined") {
1320
+ if (data.reason == 'tos_xing_group_exists') {
1321
+ b2sTosXingGroupCount--;
1322
+ deactivatePortal(data.networkAuthId);
1323
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1324
+ jQuery('#b2s-tos-xing-group-modal').modal('show');
1325
+ return false;
1326
+ }
1327
+ }
1328
+ }
1329
+ checkGifAnimation(data.networkAuthId, data.networkId);
1330
+ }
1331
+ }
1332
+ });
1333
+ }
1334
+ } else {
1335
+ //TOS XING Groups
1336
+ if ((networkId == 8 || networkId == 19) && networkType == 2) {
1337
+ b2sTosXingGroupCount--;
1338
+ }
1339
+ deactivatePortal(networkAuthId);
1340
+ }
1341
+ }
1342
+ return false;
1343
+ });
1344
+ jQuery(document).on('click', '.b2s-post-item-details-url-image', function () {
1345
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
1346
+ var networkCountId = jQuery(this).attr("data-network-count");
1347
+ if (jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').is(":visible")) {
1348
+
1349
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1350
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
1351
+ var isMetaChecked = false;
1352
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1353
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1354
+ isMetaChecked = true;
1355
+ }
1356
+ if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
1357
+ isMetaChecked = true;
1358
+ }
1359
+
1360
+ if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Faceboo or Twitter
1361
+ jQuery('.meta-text').hide();
1362
+ if (!isMetaChecked) {
1363
+ if (networkId == "1") {
1364
+ jQuery('.isOgMetaChecked').show();
1365
+ } else {
1366
+ jQuery('.isCardMetaChecked').show();
1367
+ }
1368
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1369
+ return false;
1370
+ }
1371
+ }
1372
+
1373
+ jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1374
+ }
1375
+ return false;
1376
+ });
1377
+ jQuery(document).on('click', '.b2s-submit-btn-scroll', function () {
1378
+ jQuery('.b2s-submit-btn').trigger('click');
1379
+ });
1380
+ jQuery(document).on('click', '.b2s-post-ship-item-post-format', function () {
1381
+ openPostFormat(jQuery(this).attr('data-network-id'), jQuery(this).attr('data-network-type'), jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-post-wp-type'), true);
1382
+ return false;
1383
+ });
1384
+ jQuery(document).on('click', '.b2s-btn-trigger-post-ship-item-post-format', function () {
1385
+ jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1386
+ return false;
1387
+ });
1388
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-days', function () {
1389
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1390
+ });
1391
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-time', function () {
1392
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1393
+ });
1394
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-date', function () {
1395
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1396
+ });
1397
+ jQuery('.b2s-network-details-mandant-select').change(function () {
1398
+ hideDuplicateAuths();
1399
+ chooseMandant();
1400
+ });
1401
+ jQuery(document).on('change', '.b2s-post-item-details-item-group-select', function () {
1402
+ if (jQuery(this).attr('data-change-network-display-name') == 'true') {
1403
+ var label = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
1404
+ jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').html(label);
1405
+ jQuery('.b2s-post-ship-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(label);
1406
+ }
1407
+ //Xing groups
1408
+ if (jQuery(this).attr('data-network-id') == '19') {
1409
+ var option = jQuery('option:selected', this).attr('data-network-kind');
1410
+ if (option == '3') { //Marketplace
1411
+ jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1412
+ } else {
1413
+ jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').hide();
1414
+ }
1415
+ jQuery('.networkKind[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(option);
1416
+ }
1417
+
1418
+ return false;
1419
+ });
1420
+ //select recurrent sched interval mode
1421
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-interval-select', function () {
1422
+ var interval = jQuery(this).val();
1423
+ var selectorInput = '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
1424
+ var dataCount = jQuery(this).attr('data-network-count');
1425
+ releaseChooseInterval(interval, selectorInput, dataCount);
1426
+ return false;
1427
+ });
1428
+ //select shipping mode
1429
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select', function () {
1430
+ var dataNetworkCount = 0;
1431
+ if (jQuery(this).val() == 0) {
1432
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1433
+ if (jQuery(this).attr('data-network-id') == 2) {
1434
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1435
+ }
1436
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
1437
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
1438
+ }
1439
+ }
1440
+ if (jQuery(this).val() == 2) {
1441
+ if (jQuery(this).attr('data-user-version') == 0) {
1442
+ jQuery('#b2s-sched-post-modal').modal('show');
1443
+ return false;
1444
+ } else {
1445
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1446
+ if (jQuery(this).attr('data-network-id') == 2) {
1447
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1448
+ }
1449
+
1450
+ for (var i = 1; i <= 2; i++) {
1451
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + i + '"]').each(function () {
1452
+ if (jQuery(this).prop('checked')) {
1453
+ dataNetworkCount = 1;
1454
+ }
1455
+ });
1456
+ }
1457
+ if (dataNetworkCount == 2) {
1458
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1459
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1460
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1461
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1462
+ } else if (dataNetworkCount == 1) {
1463
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1464
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1465
+ }
1466
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
1467
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
1468
+ }
1469
+ }
1470
+ }
1471
+ if (jQuery(this).val() == 1) {
1472
+ if (jQuery(this).attr('data-user-version') == 0) {
1473
+ jQuery('#b2s-sched-post-modal').modal('show');
1474
+ return false;
1475
+ } else {
1476
+
1477
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1478
+ if (jQuery(this).attr('data-network-id') == 2) {
1479
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1480
+ } else {
1481
+ //set orginal edit content for customize sched content
1482
+ var content = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').val();
1483
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(content);
1484
+
1485
+ }
1486
+
1487
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1488
+ if (dataNetworkCount == 2) {
1489
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1490
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1491
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1492
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1493
+ } else if (dataNetworkCount == 1) {
1494
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1495
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1496
+ }
1497
+
1498
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
1499
+ }
1500
+ }
1501
+ releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
1502
+ // jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').focus();
1503
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('data-network-text-limit');
1504
+ if (textLimit != "0") {
1505
+ networkLimitAll(jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-id'), textLimit);
1506
+ } else {
1507
+ networkCount(jQuery(this).attr('data-network-auth-id'));
1508
+ }
1509
+ });
1510
+ jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function () {
1511
+ jQuery('#b2sSchedPostInfoIgnore').val("1");
1512
+ jQuery('.b2s-submit-btn').trigger("click");
1513
+ return false;
1514
+ });
1515
+ jQuery(document).on('click', '.b2s-re-share-btn', function () {
1516
+ jQuery('.panel-group').removeClass('b2s-border-color-warning');
1517
+ jQuery(".b2s-settings-user-sched-time-area").show();
1518
+ jQuery('#b2s-sidebar-wrapper').show();
1519
+ jQuery('.b2s-post-item-info-area').show();
1520
+ jQuery('.b2s-post-item-details-message-info').show();
1521
+ jQuery('.b2s-post-item-details-edit-area').show();
1522
+ jQuery('.b2s-post-item-details-message-result').hide();
1523
+ jQuery('.b2s-post-item-details-message-result').html("");
1524
+ jQuery(".b2s-post-area").show();
1525
+ jQuery('.b2s-publish-area').show();
1526
+ jQuery('.b2s-footer-menu').show();
1527
+ window.scrollTo(0, 0);
1528
+ jQuery('.b2s-reporting-btn-area').hide();
1529
+ jQuery('#b2sSchedPostInfoIgnore').val("0");
1530
+ //Calendar close for resfresh
1531
+ jQuery('.b2s-toogle-calendar-btn').each(function () {
1532
+ if (!jQuery(this).hasClass('hide')) {
1533
+ var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
1534
+ var currentBtnText = jQuery(this).text();
1535
+ jQuery(this).text(toogleBtnText);
1536
+ jQuery(this).attr('data-toogle-text-btn', currentBtnText);
1537
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1538
+ var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
1539
+ calendar.removeClass('show');
1540
+ calendar.addClass('hide');
1541
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
1542
+ }
1543
+ });
1544
+
1545
+ //TOS XING Group
1546
+ jQuery('.b2s-network-select-btn').each(function () {
1547
+ if (jQuery(this).children().hasClass('active')) {
1548
+ if (jQuery(this).attr('data-network-id') == "19" && jQuery(this).attr('data-network-type') == "2") {
1549
+ b2sTosXingGroupCount--;
1550
+ deactivatePortal(jQuery(this).attr('data-network-auth-id'));
1551
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-network-select-btn-deactivate');
1552
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
1553
+ }
1554
+ }
1555
+ });
1556
+
1557
+ return false;
1558
+ });
1559
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-add', function () {
1560
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1561
+ var netCount = jQuery(this).attr('data-network-count');
1562
+ var networkId = jQuery(this).attr('data-network-id');
1563
+ var networkType = jQuery(this).attr('data-network-type');
1564
+ var netCountNext = parseInt(netCount) + 1;
1565
+ var curMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val();
1566
+ jQuery(this).hide();
1567
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]').hide();
1568
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1569
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1570
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1571
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1572
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1573
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1574
+
1575
+ if (curMode == 1) {
1576
+ //since 4.9.0 custom content
1577
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1578
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1579
+ }
1580
+ //recurrently
1581
+ if (curMode == 2) {
1582
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1583
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1584
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1585
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1586
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1587
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1588
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').val('1');
1589
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1590
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1591
+ //since 4.9.0 custom content
1592
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').hide();
1593
+ }
1594
+
1595
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').focus();
1596
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').attr('data-network-text-limit');
1597
+ if (textLimit != "0") {
1598
+ networkLimitAll(networkAuthId, networkId, textLimit);
1599
+ } else {
1600
+ networkCount(networkAuthId);
1601
+ }
1602
+ return false;
1603
+ });
1604
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-hide', function () {
1605
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1606
+ var netCount = jQuery(this).attr('data-network-count');
1607
+ var netCountBevor = parseInt(netCount) - 1;
1608
+ var selectorInput = '[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]'
1609
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
1610
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1611
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1612
+ //clean all fields
1613
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
1614
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
1615
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).val('');
1616
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
1617
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('checked', false);
1618
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
1619
+ //since 4.9.0 custom content
1620
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput).prop('disabled', true);
1621
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput).removeClass('error');
1622
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
1623
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
1624
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
1625
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
1626
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
1627
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled', true);
1628
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).val("1");
1629
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
1630
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled', true);
1631
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).val("1");
1632
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
1633
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
1634
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled', true);
1635
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).val("1");
1636
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
1637
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled', true);
1638
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).val("1");
1639
+ return false;
1640
+ });
1641
+ jQuery(document).on("keyup", ".complete_network_url", function () {
1642
+ var url = jQuery(this).val();
1643
+ jQuery(this).removeClass("error");
1644
+ if (url.length != "0") {
1645
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
1646
+ url = "http://" + url;
1647
+ jQuery(this).val(url);
1648
+ }
1649
+ } else if (jQuery(this).hasClass("required_network_url")) {
1650
+ if (!((jQuery(this).attr('data-network-id') == 1 || jQuery(this).attr('data-network-id') == 3 || jQuery(this).attr('data-network-id') == 19) && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == 1)) { //Facebook & Linkedin Imagepost don't require Link
1651
+ url = jQuery("#b2sDefault_url").val();
1652
+ jQuery(this).val(url);
1653
+ }
1654
+ }
1655
+ });
1656
+ jQuery(document).on('click', '.scroll-to-top', function () {
1657
+ window.scrollTo(0, 0);
1658
+ return false;
1659
+ });
1660
+ jQuery(document).on('click', '.scroll-to-bottom', function () {
1661
+ window.scrollTo(0, document.body.scrollHeight);
1662
+ return false;
1663
+ });
1664
+ jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', function () {
1665
+ var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+(?:\.[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.ÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß]+$/);
1666
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1667
+ var url = jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val();
1668
+ if (re.test(url)) {
1669
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
1670
+ jQuery(this).addClass('glyphicon-refresh-animate');
1671
+ jQuery('.b2s-server-connection-fail').hide();
1672
+ jQuery.ajax({
1673
+ url: ajaxurl,
1674
+ type: "POST",
1675
+ dataType: "json",
1676
+ cache: false,
1677
+ data: {
1678
+ 'action': 'b2s_ship_item_reload_url',
1679
+ 'networkId': jQuery(this).attr('data-network-id'),
1680
+ 'networkAuthId': networkAuthId,
1681
+ 'postId': jQuery('#b2sPostId').val(),
1682
+ 'defaultUrl': jQuery('#b2sDefault_url').val(),
1683
+ 'url': url,
1684
+ 'postType': jQuery('#b2sPostType').val(),
1685
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1686
+ },
1687
+ error: function () {
1688
+ jQuery('.b2s-server-connection-fail').show();
1689
+ return false;
1690
+ },
1691
+ success: function (data) {
1692
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
1693
+ if (data.result == true) {
1694
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.title);
1695
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.description);
1696
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
1697
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1698
+ }
1699
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '1') {
1700
+ if (data.image != "") {
1701
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1702
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(data.image);
1703
+ } else {
1704
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1705
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1706
+ }
1707
+ checkGifAnimation(data.networkAuthId, data.networkId);
1708
+ }
1709
+ } else {
1710
+ if (data.error == 'nonce') {
1711
+ jQuery('.b2s-nonce-check-fail').show();
1712
+ }
1713
+ }
1714
+ }
1715
+
1716
+ });
1717
+ } else {
1718
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
1719
+ }
1720
+ });
1721
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
1722
+ jQuery('.b2s-upload-image-invalid-extension').hide();
1723
+ jQuery('.b2s-image-change-meta-network').hide();
1724
+ jQuery('.b2s-image-add-this-network').hide();
1725
+ jQuery('.b2s-image-change-this-network').show();
1726
+ var metaType = jQuery(this).attr('data-meta-type');
1727
+ var authId = jQuery(this).attr('data-network-auth-id');
1728
+ var countId = jQuery(this).attr('data-network-count');
1729
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').val();
1730
+ var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + authId + ']').attr("data-network-id");
1731
+ var isMetaChecked = false;
1732
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1733
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1734
+ isMetaChecked = true;
1735
+ }
1736
+ if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
1737
+ isMetaChecked = true;
1738
+ }
1739
+
1740
+ if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Facebook or Twitter
1741
+ jQuery('.meta-text').hide();
1742
+ if (!isMetaChecked) {
1743
+ if (networkId == "1") {
1744
+ jQuery('.isOgMetaChecked').show();
1745
+ } else {
1746
+ jQuery('.isCardMetaChecked').show();
1747
+ }
1748
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1749
+ return false;
1750
+ }
1751
+ }
1752
+
1753
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId);
1754
+ jQuery('.b2s-image-change-all-network').attr('data-network-count', countId).attr('data-network-id', networkId);
1755
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId).attr('data-network-count', countId);
1756
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
1757
+ jQuery('.b2s-selected-network-for-image-info').html(content);
1758
+ jQuery('#b2sInsertImageType').val("0");
1759
+ if (typeof metaType !== 'undefined') {
1760
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', metaType);
1761
+
1762
+ if (postFormat != "1") {
1763
+ var activeMetaNetworks = {};
1764
+ var inactiveMetaNetworks = {};
1765
+ jQuery('.b2s-network-select-btn[data-meta-type="' + metaType + '"]').each(function () {
1766
+ if (jQuery(this).find('.active').length > 0) {
1767
+ activeMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1768
+ } else {
1769
+ inactiveMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1770
+ }
1771
+ });
1772
+
1773
+ jQuery('.b2s-change-meta-image-networks').html('');
1774
+ jQuery.each(activeMetaNetworks, function (key, value) {
1775
+ jQuery('.b2s-change-meta-image-networks').append('<div style="display: inline-block;"><img class="b2s-meta-image-network-icon" src="' + jQuery('#b2sPortalImagePath').val() + value + '_flat.png' + '"> ' + jQuery('.b2s-network-select-btn[data-network-auth-id="' + key + '"]').attr('data-network-display-name').toUpperCase() + '</div>');
1776
+ });
1777
+ jQuery.each(inactiveMetaNetworks, function (key, value) {
1778
+ jQuery('.b2s-change-meta-image-networks').append('<div style="display: inline-block;"><img class="b2s-meta-image-network-icon b2s-btn-disabled" src="' + jQuery('#b2sPortalImagePath').val() + value + '_flat.png' + '"> ' + jQuery('.b2s-network-select-btn[data-network-auth-id="' + key + '"]').attr('data-network-display-name').toUpperCase() + '</div>');
1779
+ });
1780
+ jQuery('.b2s-change-meta-image-info').show();
1781
+
1782
+ jQuery('.b2s-image-change-meta-network').show();
1783
+ jQuery('.b2s-image-change-this-network').hide();
1784
+
1785
+ jQuery(document).on('click', '.b2s-image-change-meta-network', function () {
1786
+ currentOGImage = jQuery('input[name=image_url]:checked').val();
1787
+ changedOGImage = true;
1788
+ if (jQuery('.b2s-input-hidden[name="action"][value="b2s_edit_save_post"]').length > 0) { //sched or calender view
1789
+ jQuery('.b2s-image-change-this-network').trigger('click');
1790
+ } else { //ship view
1791
+ jQuery.each(activeMetaNetworks, function (networkAuthId, networkId) {
1792
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1793
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1794
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1795
+ checkGifAnimation(networkAuthId, networkId);
1796
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1797
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1798
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1799
+ }
1800
+ }
1801
+ });
1802
+ jQuery.each(inactiveMetaNetworks, function (networkAuthId, networkId) {
1803
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1804
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1805
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1806
+ checkGifAnimation(networkAuthId, networkId);
1807
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1808
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1809
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1810
+ }
1811
+ }
1812
+ });
1813
+ }
1814
+ jQuery('#b2s-network-select-image').modal('hide');
1815
+ });
1816
+ } else {
1817
+ jQuery('.b2s-change-meta-image-info').hide();
1818
+ }
1819
+
1820
+ } else {
1821
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', "");
1822
+ jQuery('.b2s-change-meta-image-info').hide();
1823
+ }
1824
+ //set selected image
1825
+ var selImageVal = jQuery('.b2s-post-item-details-url-image[data-network-count="' + countId + '"][data-network-auth-id="' + authId + '"]').attr('src');
1826
+ jQuery('#b2s-network-select-image').modal('show');
1827
+ jQuery('.checkNetworkImage[data-src="' + selImageVal + '"]').attr('checked', 'checked');
1828
+ imageSize();
1829
+ return false;
1830
+ });
1831
+ jQuery(document).on('click', '.b2s-image-remove-btn', function () {
1832
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1833
+ var networkCountId = jQuery(this).attr('data-network-count');
1834
+ var defaultImage = jQuery('#b2sDefaultNoImage').val();
1835
+ //default
1836
+ if (networkCountId == -1) {
1837
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1838
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1839
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1840
+ } else {
1841
+ //customize sched content
1842
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1843
+ jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
1844
+ jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').hide();
1845
+ }
1846
+
1847
+ //add check linkpost change meta tag image for this network
1848
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1849
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1850
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1851
+ if (postFormat == "0") { //if linkpost
1852
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1853
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1854
+ //override this image with current image
1855
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1856
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1857
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1858
+ }
1859
+ });
1860
+ if (jQuery('.b2s-select-image-modal-open[data-network-auth-id=' + networkAuthId + ']').attr('data-meta-type') == 'og') {
1861
+ jQuery('.b2s-select-image-modal-open[data-meta-type="og"]').each(function () {
1862
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == "0") {
1863
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1864
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1865
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1866
+ }
1867
+ });
1868
+ currentOGImage = '';
1869
+ changedOGImage = true;
1870
+ }
1871
+ //customize sched content
1872
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1873
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1874
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1875
+ }
1876
+ }
1877
+ return false;
1878
+ });
1879
+ jQuery(document).on('click', '.b2s-image-change-this-network', function () {
1880
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1881
+ var networkCountId = jQuery(this).attr('data-network-count');
1882
+ var networkId = jQuery(this).attr('data-network-id');
1883
+ var currentImage = jQuery('input[name=image_url]:checked').val();
1884
+ if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
1885
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
1886
+ sceditor.insert("<br /><img src='" + currentImage + "'/><br />");
1887
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage); //Torial
1888
+ } else {
1889
+ //default
1890
+ if (networkCountId == -1) {
1891
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1892
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1893
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1894
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1895
+ } else {
1896
+ //customize sched content
1897
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1898
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1899
+ jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1900
+ jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').show();
1901
+ }
1902
+
1903
+ if (jQuery(this).attr('data-meta-type') == "og") {
1904
+ jQuery('#b2sChangeOgMeta').val("1");
1905
+ }
1906
+ if (jQuery(this).attr('data-meta-type') == "card") {
1907
+ jQuery('#b2sChangeCardMeta').val("1");
1908
+ }
1909
+
1910
+ //add check linkpost change meta tag image for this network
1911
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1912
+ var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1913
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1914
+ if (networkId != 12) { // ignore for instagram
1915
+ if (postFormat == "0") { //if linkpost
1916
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1917
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1918
+ //override this image with current image
1919
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentImage);
1920
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
1921
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentImage);
1922
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1923
+ if (networkCountId >= 0) {
1924
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1925
+ }
1926
+ }
1927
+ });
1928
+ //customize sched content
1929
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1930
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1931
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1932
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1933
+ if (networkCountId >= 0) {
1934
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').hide();
1935
+ }
1936
+ }
1937
+ }
1938
+ }
1939
+ }
1940
+ jQuery('.b2s-upload-image-invalid-extension').hide();
1941
+ jQuery('.b2s-upload-image-no-permission').hide();
1942
+ jQuery('.b2s-upload-image-free-version-info').hide();
1943
+ jQuery('#b2s-network-select-image').modal('hide');
1944
+ checkGifAnimation(networkAuthId, networkId);
1945
+ return false;
1946
+ });
1947
+ jQuery(document).on('change', '.b2s-post-item-details-relay', function () {
1948
+ if (jQuery(this).attr('data-user-version') == 0) {
1949
+ jQuery(this).prop("checked", false);
1950
+ jQuery('#b2sInfoPostRelayModal').modal('show');
1951
+ return false;
1952
+ }
1953
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1954
+ if (jQuery(this).is(":checked")) {
1955
+
1956
+ if (jQuery('#b2sRelayAccountData').val() != "") {
1957
+ jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1958
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1959
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1960
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1961
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1962
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1963
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
1964
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').removeAttr('disabled');
1965
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
1966
+ //Relay Html Data
1967
+ if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').has('option').length == 0) {
1968
+ var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
1969
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').append(optionData);
1970
+ }
1971
+
1972
+ } else {
1973
+ jQuery(this).prop("checked", false);
1974
+ }
1975
+
1976
+ } else {
1977
+ jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1978
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1979
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1980
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1981
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1982
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
1983
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
1984
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1985
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1986
+ }
1987
+ return false;
1988
+ });
1989
+ jQuery(document).on('click', '.b2s-post-item-details-relay-input-add', function () {
1990
+ var netCount = jQuery(this).attr('data-network-count');
1991
+ var netCountNext = parseInt(netCount) + 1;
1992
+ jQuery(this).hide();
1993
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1994
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1995
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1996
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1997
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
1998
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1999
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
2000
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2001
+ jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2002
+ //Relay Html Data
2003
+ if (jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').has('option').length == 0) {
2004
+ var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2005
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').append(optionData);
2006
+ }
2007
+
2008
+ return false;
2009
+ });
2010
+ jQuery(document).on('click', '.b2s-post-item-details-relay-input-hide', function () {
2011
+ var netCount = jQuery(this).attr('data-network-count');
2012
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2013
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2014
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2015
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2016
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2017
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
2018
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').prop('disabled', true);
2019
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide()
2020
+ jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2021
+ if (netCount >= 1) {
2022
+ var before = netCount - 1;
2023
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + before + '"]').show();
2024
+ }
2025
+
2026
+ return false;
2027
+ });
2028
+ jQuery(document).on('click', '.b2s-image-change-all-network', function () {
2029
+ jQuery('.b2s-post-item-details-item-message-input-allow-html').each(function () {
2030
+ var sce = jQuery(this).sceditor('instance');
2031
+ if (typeof sce !== 'undefined' && typeof sce.insert !== 'undefined') {
2032
+ if (jQuery(sce.getBody().innerHTML).find(".b2s-post-item-details-image-html-src").length > 0) {
2033
+ var innerHtml = sce.getBody().innerHTML;
2034
+ innerHtml = innerHtml.replace(/class="b2s-post-item-details-image-html-src" src=".*"/, 'class="b2s-post-item-details-image-html-src" src="' + jQuery('input[name=image_url]:checked').val() + '"');
2035
+ innerHtml = innerHtml.replace(/src=".*" class="b2s-post-item-details-image-html-src"/, 'class="b2s-post-item-details-image-html-src" src="' + jQuery('input[name=image_url]:checked').val() + '"');
2036
+ jQuery('.b2s-post-ship-item-message-delete[data-network-auth-id="' + jQuery(this).data('network-auth-id') + '"]').trigger('click')
2037
+ var sce = jQuery(this).sceditor('instance');
2038
+ sce.insert(innerHtml);
2039
+ } else {
2040
+ sce.insert("<br /><img class='b2s-post-item-details-image-html-src' src='" + jQuery('input[name=image_url]:checked').val() + "'/><br />");
2041
+ }
2042
+ }
2043
+ });
2044
+ var noGifs = '';
2045
+ if (typeof jQuery('input[name=image_url]:checked').val() !== typeof undefined) {
2046
+ var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1).toLowerCase();
2047
+ if (attachmenUrlExt == 'gif') {
2048
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2049
+ jQuery.each(networkNotAllowGif, function (key, value) {
2050
+ noGifs += ':not([data-network-id="' + value + '"])';
2051
+ });
2052
+ }
2053
+ }
2054
+ jQuery('.b2s-post-item-details-url-image[data-network-image-change="1"]' + noGifs).attr('src', jQuery('input[name=image_url]:checked').val());
2055
+ jQuery('#b2s_blog_default_image').val(jQuery('input[name=image_url]:checked').val());
2056
+ jQuery('.b2s-post-item-details-url-image' + noGifs).removeClass('b2s-img-required');
2057
+ jQuery('.b2s-image-url-hidden-field' + noGifs).val(jQuery('input[name=image_url]:checked').val());
2058
+ jQuery('.b2s-image-remove-btn' + noGifs).show();
2059
+ jQuery('.b2s-post-item-details-release-input-date-select' + noGifs).each(function () {
2060
+ if (jQuery(this).val() == 1) {
2061
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]' + noGifs).hide();
2062
+ }
2063
+ });
2064
+
2065
+ jQuery('.b2s-upload-image-invalid-extension').hide();
2066
+ jQuery('.b2s-upload-image-no-permission').hide();
2067
+ jQuery('.b2s-upload-image-free-version-info').hide();
2068
+ jQuery('.b2sChangeOgMeta').val("1");
2069
+ jQuery('.b2sChangeCardMeta').val("1");
2070
+ jQuery('#b2s-network-select-image').modal('hide');
2071
+
2072
+ currentOGImage = jQuery('input[name=image_url]:checked').val();
2073
+ changedOGImage = true;
2074
+ if (typeof currentOGImage !== typeof undefined) {
2075
+ var attachmenUrlExt = currentOGImage.substr(currentOGImage.lastIndexOf('.') + 1);
2076
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
2077
+ if (attachmenUrlExt == 'gif') {
2078
+ jQuery('.b2s-image-url-hidden-field').each(function () {
2079
+ checkGifAnimation(jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-id'));
2080
+ });
2081
+ }
2082
+ }
2083
+ return false;
2084
+ });
2085
+ jQuery(document).on('click', '.b2s-upload-image', function () {
2086
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
2087
+ if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
2088
+ jQuery('#b2s-network-select-image').modal('hide');
2089
+ wpMedia = wp.media({
2090
+ title: jQuery('#b2s_wp_media_headline').val(),
2091
+ button: {
2092
+ text: jQuery('#b2s_wp_media_btn').val(),
2093
+ },
2094
+ multiple: false,
2095
+ library: {type: 'image'}
2096
+ });
2097
+ wpMedia.open();
2098
+ wpMedia.on('select', function () {
2099
+ var validExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
2100
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2101
+ var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2102
+ var attachment = wpMedia.state().get('selection').first().toJSON();
2103
+ var attachmenUrl = attachment.url;
2104
+ var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
2105
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
2106
+ if (jQuery.inArray(attachmenUrlExt, validExtensions) == -1 || (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1)) {
2107
+ jQuery('#b2s-network-select-image').modal('show');
2108
+ jQuery('.b2s-upload-image-invalid-extension').show();
2109
+ jQuery('#b2s-upload-image-invalid-extension-file-name').html('<span class="glyphicon glyphicon-ban-circle"></span> ' + attachment.name + '.' + attachmenUrlExt + '<br>');
2110
+ jQuery('.b2s-choose-image-no-image-info-text').hide();
2111
+ jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2112
+ return false;
2113
+ }
2114
+ var count = parseInt(jQuery('.b2s-choose-image-count').val());
2115
+ count = count + 1;
2116
+ jQuery('.b2s-choose-image-count').val(count);
2117
+ var content = '<div class="b2s-image-item">' +
2118
+ '<div class="b2s-image-item-thumb">' +
2119
+ '<label for="b2s-image-count-' + count + '">' +
2120
+ '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
2121
+ '</label>' +
2122
+ '</div>' +
2123
+ '<div class="b2s-image-item-caption text-center">' +
2124
+ '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
2125
+ '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
2126
+ '</div>' +
2127
+ '</div>';
2128
+ jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
2129
+ // jQuery('.b2s-image-change-btn-area').show();
2130
+ jQuery('.b2s-choose-image-no-image-info-text').hide();
2131
+ jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2132
+ jQuery('.b2s-upload-image-invalid-extension').hide();
2133
+ jQuery('input[name=image_url]:last').prop("checked", true);
2134
+ jQuery('#b2s-network-select-image').modal('show');
2135
+ imageSize();
2136
+ });
2137
+ wpMedia.on('close', function () {
2138
+ jQuery('#b2s-network-select-image').modal('show');
2139
+ });
2140
+ } else {
2141
+ jQuery('.b2s-upload-image-no-permission').show();
2142
+ }
2143
+ return false;
2144
+ });
2145
+ jQuery(document).on('change', '.checkNetworkImage', function () {
2146
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2147
+ var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1);
2148
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
2149
+ if (attachmenUrlExt == 'gif') {
2150
+ var networkAuthId = jQuery('.b2s-upload-image').attr('data-network-auth-id');
2151
+ var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2152
+ if (jQuery.inArray(networkId, networkNotAllowGif) != -1) {
2153
+ jQuery('.b2s-image-change-this-network').attr('disabled', true);
2154
+ jQuery('.b2s-image-change-all-network').attr('disabled', true);
2155
+ jQuery('.b2s-upload-image-invalid-extension').show();
2156
+ jQuery('#b2s-upload-image-invalid-extension-file-name').html();
2157
+ } else {
2158
+ jQuery('.b2s-image-change-this-network').attr('disabled', false);
2159
+ jQuery('.b2s-image-change-all-network').attr('disabled', false);
2160
+ }
2161
+ jQuery('.b2s-gif-support-info').show();
2162
+ } else {
2163
+ jQuery('.b2s-image-change-this-network').attr('disabled', false);
2164
+ jQuery('.b2s-image-change-all-network').attr('disabled', false);
2165
+ jQuery('.b2s-gif-support-info').hide();
2166
+ }
2167
+ });
2168
+ jQuery('#b2s-network-select-image').on('shown.bs.modal', function () {
2169
+ jQuery('.checkNetworkImage').trigger('change');
2170
+ });
2171
+ jQuery(document).on('click', '.b2s-upload-image-free-version', function () {
2172
+ jQuery('.b2s-upload-image-free-version-info').show();
2173
+ });
2174
+ jQuery("#b2sNetworkSent").keypress(function (e) {
2175
+ if (e.keyCode == 13 && e.target.tagName == "INPUT")
2176
+ return false;
2177
+ });
2178
+ jQuery.validator.addMethod("checkUrl", function (value, element, regexp) {
2179
+ var re = new RegExp(regexp);
2180
+ return this.optional(element) || re.test(value);
2181
+ }, "Invalid Url");
2182
+ jQuery.validator.addClassRules("b2s-post-item-details-item-url-input", {
2183
+ checkUrl: /^(https?:\/\/)+[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+(?:\.[a-zA-Z0-9\wÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.ÄÖÜÑÁÉÍÓÚÂÃÀÇÊÔÕÆÈËÎÏŒÙÛŸØÅöäüñáéíóúâãàçêôõæèëîïœùûÿøåß]+$/
2184
+ });
2185
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time ( by all connections)
2186
+ jQuery.validator.addMethod("unique", function (value, element, params) {
2187
+ var curNetworkAuthId = jQuery(element).attr('data-network-auth-id');
2188
+ var curNetworkId = jQuery(element).attr('data-network-id');
2189
+ var prefix = params;
2190
+ var selector = jQuery.validator.format("[name!='{0}'][unique='{1}'][data-network-id='" + curNetworkId + "']", element.name, prefix);
2191
+ var matches = new Array();
2192
+
2193
+ jQuery('.b2s-unique-content[data-network-id="' + curNetworkId + '"]').hide();
2194
+ jQuery('.tw-textarea-input').removeClass('error');
2195
+
2196
+ jQuery(selector).each(function (index, item) {
2197
+ //none disabled elements || ignore default content if curSchedMode=1
2198
+ if (!jQuery(item).is(':not(:disabled)') || !jQuery(item).is(':visible') || !jQuery('.b2s-post-item[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').is(':visible') || (jQuery(item).attr('data-network-count') == -1 && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"] option[value="1"]:selected').length > 0)) {
2199
+ return true;
2200
+ }
2201
+ if (jQuery.trim(value) == jQuery.trim(jQuery(item).val())) {
2202
+ jQuery('.b2s-unique-content[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').show();
2203
+ matches.push(item);
2204
+ }
2205
+ });
2206
+ if (matches.length != 0) {
2207
+ jQuery('.b2s-unique-content[data-network-auth-id="' + curNetworkAuthId + '"]').show();
2208
+ }
2209
+ return true;
2210
+ });
2211
+
2212
+
2213
+ jQuery.validator.classRuleSettings.unique = {
2214
+ unique: true
2215
+ };
2216
+ jQuery.validator.addMethod("checkTags", function (value, element, test) {
2217
+ var allowed_tags = ['p', 'h1', 'h2', 'br', 'i', 'em', 'b', 'a', 'img', 'span'];
2218
+ var tags = value.match(/(<([^>]+)>)/ig);
2219
+ if (tags !== null && tags.length > 0) {
2220
+ if (jQuery(element).hasClass('b2s-post-item-details-item-message-input-allow-html')) {
2221
+ for (var i = 0; i < tags.length; i++) {
2222
+ var allowed_count = 0;
2223
+ for (var e = 0; e < allowed_tags.length; e++) {
2224
+ var regex = new RegExp("<\s*(\/)?" + allowed_tags[e] + "(( [^>]*>)|[>])");
2225
+ if (tags[i].match(regex) != null) {
2226
+ allowed_count = 1;
2227
+ }
2228
+ }
2229
+ if (allowed_count == 0) {
2230
+ return false;
2231
+ }
2232
+ }
2233
+ } else {
2234
+ return false;
2235
+ }
2236
+ }
2237
+ return true;
2238
+ });
2239
+ jQuery.validator.addClassRules('b2s-post-item-details-item-message-input', {'checkTags': true});
2240
+ jQuery.validator.addClassRules('b2s-post-item-details-release-input-date-select', {'checkSched': true});
2241
+ jQuery.validator.addClassRules('b2s-post-item-details-item-title-input', {required: true});
2242
+ jQuery.validator.addMethod('checkSched', function (value, element, rest) {
2243
+ if (jQuery(element).is(':not(:disabled)') && jQuery(element).val() != 0) {
2244
+ var networkAuthId = jQuery(element).attr('data-network-auth-id');
2245
+ if (jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2246
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2247
+ return false;
2248
+ } else {
2249
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2250
+ }
2251
+ if (jQuery(element).val() == 1) {
2252
+ if (jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2253
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2254
+ return false;
2255
+ } else {
2256
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2257
+ }
2258
+
2259
+ } else {
2260
+ var maxCount = jQuery('.b2s-post-item-details-release-input-daySelect[data-network-auth-id="' + networkAuthId + '"]').length;
2261
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2262
+ var daySelect = false;
2263
+ var daySelectErrorCount = 0;
2264
+ for (var count = 0; count < maxCount; count++) {
2265
+ if (jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').is(':not(:disabled)')) {
2266
+ daySelect = false;
2267
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').each(function () {
2268
+ if (jQuery(this).is(':checked')) {
2269
+ daySelect = true;
2270
+ }
2271
+ });
2272
+ if (daySelect === false) {
2273
+ daySelectErrorCount += 1;
2274
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').addClass('error');
2275
+ }
2276
+ }
2277
+ }
2278
+ if (daySelectErrorCount != 0) {
2279
+ return false;
2280
+ }
2281
+ }
2282
+ }
2283
+ return true;
2284
+ });
2285
+ jQuery("#b2sNetworkSent").validate({
2286
+ ignore: "",
2287
+ errorPlacement: function () {
2288
+ return false;
2289
+ },
2290
+ submitHandler: function (form) {
2291
+ if (checkNetworkSelected() == false) {
2292
+ return false;
2293
+ }
2294
+ if (checkPostSchedOnBlog() == false) {
2295
+ return false;
2296
+ }
2297
+ if (checkImageByImageNetworks() == false) {
2298
+ return false;
2299
+ }
2300
+
2301
+ var userDate = new Date();
2302
+ var pubDate = userDate.getFullYear() + "-" + padDate(userDate.getMonth() + 1) + "-" + padDate(userDate.getDate()) + " " + padDate(userDate.getHours()) + ":" + padDate(userDate.getMinutes()) + ":" + padDate(userDate.getSeconds());
2303
+ jQuery('#publish_date').val(pubDate);
2304
+ jQuery(".b2s-loading-area").show();
2305
+ jQuery(".b2s-post-area").hide();
2306
+ jQuery(".b2s-settings-user-sched-time-area").hide();
2307
+ jQuery('#b2s-sidebar-wrapper').hide();
2308
+ jQuery('.b2s-post-item-info-area').hide();
2309
+ jQuery.xhrPool.abortAll();
2310
+ jQuery('.b2s-server-connection-fail').hide();
2311
+ jQuery.ajax({
2312
+ processData: false,
2313
+ url: ajaxurl,
2314
+ type: "POST",
2315
+ dataType: "json",
2316
+ cache: false,
2317
+ data: jQuery(form).serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
2318
+ error: function () {
2319
+ jQuery('.b2s-server-connection-fail').show();
2320
+ return false;
2321
+ },
2322
+ success: function (data) {
2323
+ if (data.error == 'nonce') {
2324
+ jQuery('.b2s-nonce-check-fail').show();
2325
+ return false;
2326
+ }
2327
+ var content = data.content;
2328
+ jQuery(".b2s-loading-area").hide();
2329
+ for (var i = 0; i < content.length; i++) {
2330
+ jQuery('.b2s-post-item-details-message-info[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2331
+ jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2332
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
2333
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
2334
+ jQuery('.b2s-content-info').hide();
2335
+ if (typeof content[i]['approve'] !== typeof undefined) {
2336
+ jQuery('.panel-group[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').addClass('b2s-border-color-warning');
2337
+ }
2338
+ }
2339
+ jQuery(".b2s-post-area").show();
2340
+ jQuery('.b2s-publish-area').hide();
2341
+ jQuery('.b2s-footer-menu').hide();
2342
+ window.scrollTo(0, 0);
2343
+ jQuery('.b2s-empty-area').hide();
2344
+ jQuery('.b2s-reporting-btn-area').show();
2345
+ wp.heartbeat.connectNow();
2346
+ }
2347
+ });
2348
+ return false;
2349
+ }
2350
+ });
2351
+ jQuery('#b2s-network-list-modal').on('show.bs.modal', function (e) {
2352
+ jQuery('.b2s-network-list-modal-mandant').html(jQuery(".b2s-network-details-mandant-select option:selected").text());
2353
+ });
2354
+ jQuery(window).on("load", function () {
2355
+ var showMeridian = true;
2356
+ if (jQuery('#b2sUserTimeFormat').val() == 0) {
2357
+ showMeridian = false;
2358
+ }
2359
+ jQuery('.b2s-settings-sched-item-input-time').timepicker({
2360
+ minuteStep: 30,
2361
+ appendWidgetTo: 'body',
2362
+ showSeconds: false,
2363
+ showMeridian: showMeridian,
2364
+ defaultTime: 'current'
2365
+ });
2366
+ });
2367
+
2368
+ jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
2369
+ var selectedAuth = new Array();
2370
+ jQuery('.b2s-network-list.active').each(function () {
2371
+ selectedAuth.push(jQuery(this).parents('.b2s-network-select-btn').attr('data-network-auth-id'));
2372
+ });
2373
+ jQuery('.b2s-server-connection-fail').hide();
2374
+ jQuery.ajax({
2375
+ url: ajaxurl,
2376
+ type: "POST",
2377
+ dataType: "json",
2378
+ cache: false,
2379
+ data: {
2380
+ 'action': 'b2s_ship_navbar_save_settings',
2381
+ 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
2382
+ 'selectedAuth': selectedAuth,
2383
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2384
+ },
2385
+ error: function () {
2386
+ jQuery('.b2s-server-connection-fail').show();
2387
+ return false;
2388
+ },
2389
+ success: function (data) {
2390
+ if (data.result == true) {
2391
+ jQuery('.b2s-ship-settings-save').show();
2392
+ window.scrollTo(0, 0);
2393
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2394
+ jQuery('.b2s-network-list').each(function () {
2395
+ var jsonMandantIds = jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
2396
+ if (jsonMandantIds !== undefined) {
2397
+ var jsonMandantIds = jQuery.parseJSON(jsonMandantIds);
2398
+ if (jsonMandantIds.indexOf(mandantId) !== -1 && !jQuery(this).hasClass('active')) {
2399
+ //remove
2400
+ var newMandant = new Array();
2401
+ jQuery(jsonMandantIds).each(function (index, item) {
2402
+ if (item !== mandantId) {
2403
+ newMandant.push(item);
2404
+ }
2405
+ });
2406
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(newMandant));
2407
+ } else if (jsonMandantIds.indexOf(mandantId) == -1 && jQuery(this).hasClass('active')) {
2408
+ //add
2409
+ jsonMandantIds.push(mandantId);
2410
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(jsonMandantIds));
2411
+ }
2412
+ }
2413
+ });
2414
+ } else {
2415
+ if (data.error == 'nonce') {
2416
+ jQuery('.b2s-nonce-check-fail').show();
2417
+ }
2418
+ }
2419
+ }
2420
+ });
2421
+ });
2422
+ window.addEventListener('message', function (e) {
2423
+ if (e.origin == jQuery('#b2sServerUrl').val()) {
2424
+ var data = JSON.parse(e.data);
2425
+ if (typeof data.action !== typeof undefined && data.action == 'approve') {
2426
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + data.networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2427
+ jQuery.ajax({
2428
+ url: ajaxurl,
2429
+ type: "POST",
2430
+ cache: false,
2431
+ async: false,
2432
+ data: {
2433
+ 'action': 'b2s_update_approve_post',
2434
+ 'post_id': data.post_id,
2435
+ 'publish_link': data.publish_link,
2436
+ 'publish_error_code': data.publish_error_code,
2437
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2438
+ },
2439
+ success: function (data) {
2440
+ }
2441
+ });
2442
+ } else {
2443
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId, data.instant_sharing);
2444
+ }
2445
+ }
2446
+ });
2447
+
2448
+ jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
2449
+ var postId = jQuery('#b2s-approve-post-id').val();
2450
+ var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
2451
+ if (postId > 0) {
2452
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + networkAuthId + '"]').html("<br><span class=\"text-success\"><i class=\"glyphicon glyphicon-ok-circle\"></i> " + jQuery("#b2sJsTextPublish").val() + " </span>");
2453
+ jQuery('.b2s-publish-approve-modal').modal('hide');
2454
+ jQuery.ajax({
2455
+ url: ajaxurl,
2456
+ type: "POST",
2457
+ cache: false,
2458
+ async: false,
2459
+ data: {
2460
+ 'action': 'b2s_update_approve_post',
2461
+ 'post_id': postId,
2462
+ 'publish_link': "",
2463
+ 'publish_error_code': "",
2464
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2465
+ },
2466
+ success: function (data) {
2467
+ }
2468
+ });
2469
+ }
2470
+ });
2471
+
2472
+
2473
+
2474
+ jQuery.xhrPool.abortAll = function () { // our abort function
2475
+ jQuery(this).each(function (idx, jqXHR) {
2476
+ jqXHR.abort();
2477
+ });
2478
+ jQuery.xhrPool.length = 0
2479
+ };
2480
+ function loadingDummyShow(networkAuthId, networkId) {
2481
+ jQuery('.b2s-post-item-connection-fail-dummy[data-network-auth-id="' + networkAuthId + '"]').remove();
2482
+ var html = '<div class="b2s-post-item b2s-post-item-loading-dummy" data-network-auth-id="' + networkAuthId + '">'
2483
+ + '<div class="panel panel-group">'
2484
+ + '<div class="panel-body">'
2485
+ + '<div class="b2s-post-item-area">'
2486
+ + '<div class="b2s-post-item-details">'
2487
+ + '<div class="b2s-loader-impulse b2s-loader-impulse-md b2s-post-item-loading-impulse-area">'
2488
+ + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2489
+ + '</div>'
2490
+ + '<div class="clearfix"></div>'
2491
+ + '<div class="text-center"><small>'
2492
+ + jQuery('#b2sJsTextLoading').val()
2493
+ + '</small></div>'
2494
+ + '</div>'
2495
+ + '</div>'
2496
+ + '</div>'
2497
+ + '</div>';
2498
+ var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
2499
+ var pos = order.indexOf(networkAuthId.toString());
2500
+ var add = false;
2501
+ for (var i = pos; i >= 0; i--) {
2502
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
2503
+ jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(html);
2504
+ i = -1;
2505
+ add = true;
2506
+ }
2507
+ }
2508
+ if (add == false) {
2509
+ jQuery('.b2s-post-list').prepend(html);
2510
+ }
2511
+ }
2512
+
2513
+ function loadingDummyConnectionFail(networkAuthId, networkId) {
2514
+ var html = '<div class="b2s-post-item b2s-post-item-connection-fail-dummy" data-network-auth-id="' + networkAuthId + '">'
2515
+ + '<div class="panel panel-group">'
2516
+ + '<div class="panel-body">'
2517
+ + '<div class="b2s-post-item-area">'
2518
+ + '<div class="b2s-post-item-details">'
2519
+ + '<div class="b2s-post-item-details-portal-img-area">'
2520
+ + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2521
+ + '</div>'
2522
+ + '<div class="clearfix"></div>'
2523
+ + '<div class="text-center"><small>'
2524
+ + jQuery('#b2sJsTextConnectionFail').val()
2525
+ + '</small>'
2526
+ + '<br/>'
2527
+ + '<a class="btn btn-link btn-sm" target="_blank" href="' + jQuery('#b2sJsTextConnectionFailLink').val() + '">' + jQuery('#b2sJsTextConnectionFailLinkText').val() + '</a>'
2528
+ + '</div>'
2529
+ + '</div>'
2530
+ + '</div>'
2531
+ + '</div>'
2532
+ + '</div>';
2533
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + networkAuthId + '"]').replaceWith(html);
2534
+ }
2535
+
2536
+ function init(firstrun) {
2537
+ var dateFormat = "yyyy-mm-dd";
2538
+ var language = "en";
2539
+ var showMeridian = true;
2540
+ if (jQuery('#b2sUserLang').val() == "de") {
2541
+ dateFormat = "dd.mm.yyyy";
2542
+ language = "de";
2543
+ }
2544
+ if (jQuery('#b2sUserTimeFormat').val() == 0) {
2545
+ showMeridian = false;
2546
+ }
2547
+ var today = new Date();
2548
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
2549
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
2550
+ }
2551
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
2552
+ format: dateFormat,
2553
+ language: language,
2554
+ maxViewMode: 2,
2555
+ todayHighlight: true,
2556
+ startDate: today,
2557
+ calendarWeeks: true,
2558
+ autoclose: true
2559
+ });
2560
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
2561
+ minuteStep: 15,
2562
+ appendWidgetTo: 'body',
2563
+ showSeconds: false,
2564
+ showMeridian: showMeridian,
2565
+ defaultTime: 'current',
2566
+ snapToStep: true
2567
+ });
2568
+ checkNetworkSelected();
2569
+ //imageCheck();
2570
+ if (firstrun == true) {
2571
+ jQuery(window).scroll(function () {
2572
+ submitArea();
2573
+ });
2574
+ jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
2575
+ releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), 0);
2576
+ });
2577
+
2578
+ //V5.0.0 Content Curation set selected Profile
2579
+ if (jQuery(".b2s-network-details-mandant-select option[value='" + jQuery('#selProfile').val() + "']").length > 0) {
2580
+ jQuery('.b2s-network-details-mandant-select').val(jQuery('#selProfile').val());
2581
+ }
2582
+ hideDuplicateAuths();
2583
+ chooseMandant();
2584
+ }
2585
+ }
2586
+
2587
+
2588
+
2589
+ function initSceditor(networkAuthId) {
2590
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2591
+ if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2592
+ sceditor.destroy();
2593
+ }
2594
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').data('network-id') == 14) {// Torial is only HTML Network that dose not support Emojis
2595
+ var toolbar = "h1,h2,bold,italic,link,unlink,custom-image|source";
2596
+ } else {
2597
+ var toolbar = "h1,h2,bold,italic,link,unlink,custom-image,custom-emoji|source";
2598
+ }
2599
+ jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor({
2600
+ plugins: 'xhtml',
2601
+ toolbar: toolbar,
2602
+ autoUpdate: true,
2603
+ emoticonsEnabled: false
2604
+ });
2605
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2606
+ if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2607
+ sceditor.height(500);
2608
+ sceditor.width(window.getComputedStyle(document.querySelector('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]')).width);
2609
+ sceditor.keyUp(function () {
2610
+ jQuery('.b2s-post-item-countChar[data-network-auth-id="' + networkAuthId + '"]').html(jQuery(this).prev('.b2s-post-item-details-item-message-input').prevObject[0].getBody().textContent.length);
2611
+ });
2612
+ jQuery('.b2s-post-item-countChar[data-network-auth-id="' + networkAuthId + '"]').html(jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').prev('.b2s-post-item-details-item-message-input').prevObject[0]._sceditor.getBody().textContent.length);
2613
+ }
2614
+
2615
+
2616
+ }
2617
+
2618
+ function submitArea() {
2619
+ if (jQuery('.b2s-publish-area').length > 0) {
2620
+ if (jQuery(window).scrollTop() + jQuery(window.top).height() >= jQuery('.b2s-publish-area').offset().top) {
2621
+ jQuery(".b2s-footer-menu").hide();
2622
+ } else {
2623
+ jQuery(".b2s-footer-menu").show();
2624
+ }
2625
+ }
2626
+ }
2627
+
2628
+ function imageSize() {
2629
+ jQuery('.networkImage').each(function () {
2630
+ var width = this.naturalWidth;
2631
+ var height = this.naturalHeight;
2632
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
2633
+ if (width == 0)
2634
+ {
2635
+ setTimeout(function () {
2636
+ imageSize();
2637
+ }, 50);
2638
+ }
2639
+ });
2640
+ }
2641
+
2642
+ function navbarDeactivatePortal(reason) {
2643
+ if (reason == "image") {
2644
+ var portale = Array(6, 7, 12);
2645
+ for (var i = 0; i <= portale.length; i++) {
2646
+ jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').addClass('b2s-network-select-btn-deactivate');
2647
+ jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').show();
2648
+ }
2649
+ }
2650
+ }
2651
+
2652
+ function navbarActivatePortal(reason) {
2653
+ if (reason == "image") {
2654
+ var portale = Array(6, 7, 12);
2655
+ for (var i = 0; i <= portale.length; i++) {
2656
+ jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').removeClass('b2s-network-select-btn-deactivate');
2657
+ jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').hide();
2658
+ }
2659
+ }
2660
+ }
2661
+
2662
+ function deactivatePortal(networkAuthId) {
2663
+ var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2664
+ jQuery(selector).hide();
2665
+ jQuery(selector).find('.form-control').each(function () {
2666
+ jQuery(this).attr("disabled", "disabled");
2667
+ });
2668
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
2669
+ checkNetworkSelected();
2670
+ submitArea();
2671
+ return true;
2672
+ }
2673
+
2674
+ function activatePortal(networkAuthId, check) {
2675
+ var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2676
+ jQuery(selector).show();
2677
+ jQuery(selector).find('.form-control').each(function () {
2678
+
2679
+ if (!jQuery(this).hasClass('b2s-post-item-details-item-message-input')) {
2680
+ jQuery(this).removeAttr("disabled", "disabled");
2681
+ }
2682
+
2683
+ if ((jQuery(this).hasClass('b2s-post-item-details-release-input-weeks')) ||
2684
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-date')) ||
2685
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-time')) ||
2686
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-days')) ||
2687
+ (jQuery(this).hasClass('b2s-post-item-details-relay-input-delay')) ||
2688
+ (jQuery(this).hasClass('b2s-post-item-details-relay-input-account'))) {
2689
+ if (!jQuery(this).is(':visible')) {
2690
+ jQuery(this).prop('disabled', true);
2691
+ }
2692
+ }
2693
+ });
2694
+ //Customize Content
2695
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
2696
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
2697
+ jQuery(selector).find('.b2s-post-item-details-item-message-input').each(function () {
2698
+ if (jQuery(this).is(':visible')) {
2699
+ jQuery(this).removeAttr("disabled", "disabled");
2700
+ }
2701
+ });
2702
+ } else {
2703
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').removeAttr("disabled", "disabled");
2704
+ }
2705
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().addClass('active').find('.b2s-network-hide').removeClass('b2s-network-hide');
2706
+ checkNetworkSelected();
2707
+ submitArea();
2708
+ }
2709
+
2710
+ function checkNetworkSelected() {
2711
+ //überprüfen ob mindestens ein PostItem vorhanden und sichtbar ist
2712
+ var visible = false;
2713
+ jQuery('.b2s-post-list').find('.b2s-post-item').each(function () {
2714
+ if (jQuery(this).is(":visible")) {
2715
+ visible = true;
2716
+ }
2717
+ });
2718
+ if (jQuery('.b2s-post-list').text().trim() == "" || visible == false) {
2719
+ jQuery('.b2s-publish-area').hide();
2720
+ jQuery('.b2s-footer-menu').hide();
2721
+ jQuery('.b2s-empty-area').show();
2722
+ return false;
2723
+ } else {
2724
+ jQuery('.b2s-publish-area').show();
2725
+ if (jQuery('.b2s-publish-area').length > 0) {
2726
+ if (jQuery(window).scrollTop() + jQuery(window.top).height() < jQuery('.b2s-publish-area').offset().top) {
2727
+ jQuery('.b2s-footer-menu').show();
2728
+ }
2729
+ }
2730
+ jQuery('.b2s-empty-area').hide();
2731
+ return true;
2732
+ }
2733
+ }
2734
+
2735
+ function checkPostSchedOnBlog() {
2736
+ if (jQuery('#b2sBlogPostSchedDate').length > 0 && jQuery('#b2sPostType').val() == "") {
2737
+ if (jQuery('#b2sSchedPostInfoIgnore').val() == "0") {
2738
+ if (jQuery('.b2s-post-item-details-release-input-date-select option[value="0"]:selected').length > 0) {
2739
+ jQuery('#b2s-network-sched-post-info').modal("show");
2740
+ return false;
2741
+ }
2742
+ }
2743
+ }
2744
+ return true;
2745
+ }
2746
+
2747
+ function checkImageByImageNetworks() {
2748
+ var result = true;
2749
+ jQuery('.b2sOnlyWithImage').each(function () {
2750
+ if (jQuery(this).is(":visible")) {
2751
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
2752
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]:visible').each(function () {
2753
+ if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + jQuery(this).attr('data-network-count') + '"]').val() == "") {
2754
+ if (!jQuery('#b2s-network-select-image').hasClass('in')) {
2755
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + jQuery(this).attr('data-network-count') + '"]').addClass('b2s-img-required');
2756
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
2757
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
2758
+ jQuery('#b2s-network-select-image').modal('show');
2759
+ imageSize();
2760
+ window.scrollTo(0, (jQuery(this).offset().top - 45));
2761
+ return false;
2762
+ }
2763
+ result = false;
2764
+ }
2765
+ });
2766
+ }
2767
+ });
2768
+ return result;
2769
+ }
2770
+
2771
+
2772
+ function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
2773
+ var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
2774
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2775
+ if (choose == 0) {
2776
+
2777
+ //since 4.8.0 customize content
2778
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2779
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2780
+ jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2781
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2782
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2783
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2784
+ jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2785
+ jQuery('.b2s-post-tool-area' + selectorInput).show();
2786
+ }
2787
+
2788
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2789
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2790
+ jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2791
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2792
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2793
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2794
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2795
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
2796
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2797
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2798
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2799
+ //monthly- duration month
2800
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2801
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2802
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2803
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2804
+ //monthly- publish day (select-day)
2805
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2806
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2807
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2808
+ //own period- duration times
2809
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2810
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2811
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2812
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2813
+ //own period- timespan
2814
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2815
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2816
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2817
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled');
2818
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2819
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).hide();
2820
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2821
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', true);
2822
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2823
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2824
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2825
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2826
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).hide();
2827
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).hide();
2828
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2829
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2830
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2831
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2832
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).hide();
2833
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2834
+ } else if (choose == 1) {
2835
+
2836
+ //since 4.8.0 customize content
2837
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2838
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').prop('disabled', true);
2839
+ jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').hide();
2840
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').hide();
2841
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').hide();
2842
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').hide();
2843
+ jQuery('.b2s-post-original-area' + selectorInput).removeClass('col-sm-7').removeClass('col-lg-9');
2844
+ jQuery('.b2s-post-tool-area' + selectorInput).hide();
2845
+ //TOS Network Twitter
2846
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-id') == "2") {
2847
+ jQuery('.b2s-post-ship-item-copy-original-text' + selectorInput + '[data-network-count="0"]').trigger('click');
2848
+ }
2849
+ }
2850
+
2851
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2852
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2853
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2854
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2855
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2856
+ for (var i = 0; i <= dataNetworkCount; i++) {
2857
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2858
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2859
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2860
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2861
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2862
+ //since 4.8.0 customize content
2863
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2864
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2865
+ }
2866
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2867
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled');
2868
+ //monthly- duration month
2869
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2870
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2871
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2872
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2873
+ //monthly- publish day (select-day)
2874
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2875
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2876
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2877
+ //own period- duration times
2878
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2879
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2880
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2881
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2882
+ //own period- timespan
2883
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2884
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2885
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2886
+ //new since v.4.5.0
2887
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2888
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2889
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2890
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2891
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2892
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
2893
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2894
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2895
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2896
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).show();
2897
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2898
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2899
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2900
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2901
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2902
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2903
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).show();
2904
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2905
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2906
+ } else if (choose == 2) {
2907
+
2908
+ //since 4.8.0 customize content
2909
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2910
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2911
+ jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2912
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2913
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2914
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2915
+ jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2916
+ jQuery('.b2s-post-tool-area' + selectorInput).show();
2917
+ }
2918
+
2919
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2920
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2921
+ jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2922
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2923
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2924
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2925
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2926
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2927
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).show();
2928
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2929
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2930
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2931
+ for (var i = 0; i <= dataNetworkCount; i++) {
2932
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2933
+ //new since v4.5.0
2934
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).show();
2935
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2936
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2937
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2938
+ jQuery('.b2s-post-item-details-release-input-daySelect[data-network-count="' + i + '"]' + selectorInput).show();
2939
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2940
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2941
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).show();
2942
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2943
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2944
+ }
2945
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).show();
2946
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).show();
2947
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2948
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2949
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).show();
2950
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).show();
2951
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).show();
2952
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2953
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2954
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).show();
2955
+ }
2956
+
2957
+ var showMeridian = true;
2958
+ if (jQuery('#b2sUserTimeFormat').val() == 0) {
2959
+ showMeridian = false;
2960
+ }
2961
+
2962
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
2963
+ minuteStep: 15,
2964
+ appendWidgetTo: 'body',
2965
+ showSeconds: false,
2966
+ showMeridian: showMeridian,
2967
+ defaultTime: 'current',
2968
+ snapToStep: true
2969
+ });
2970
+ }
2971
+
2972
+
2973
+ function releaseChooseInterval(interval, selectorInput, dataCount) {
2974
+ //change view
2975
+ if (interval == 0) { //weekly,default
2976
+ // show
2977
+ //select days
2978
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2979
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
2980
+ //duration weeks
2981
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2982
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
2983
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).show();
2984
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
2985
+ //hide
2986
+ //monthly- duration month
2987
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2988
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2989
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2990
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2991
+ //monthly- publish day (select-day)
2992
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2993
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
2994
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2995
+ //own period- duration times
2996
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2997
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2998
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
2999
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3000
+ //own period- timespan
3001
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3002
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3003
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3004
+ }
3005
+
3006
+ if (interval == 1) { //monthly
3007
+ // show
3008
+ //duration month
3009
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3010
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3011
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).show();
3012
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3013
+ //publish day (select-day)
3014
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3015
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3016
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3017
+ //hide
3018
+ //weekly - select days
3019
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3020
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3021
+ //weekly- duration weeks
3022
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3023
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3024
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3025
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3026
+ //own period- duration times
3027
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3028
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3029
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3030
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3031
+ //own period- timespan
3032
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3033
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3034
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3035
+ }
3036
+
3037
+ if (interval == 2) { //own period
3038
+ // show
3039
+ //duration times
3040
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3041
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3042
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).show(); //select
3043
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled'); //select
3044
+ //timespan
3045
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3046
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3047
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3048
+ //hide
3049
+ //weekly - select days
3050
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3051
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3052
+ //weekly- duration weeks
3053
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3054
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3055
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3056
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3057
+ //monthly- duration month
3058
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3059
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3060
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3061
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3062
+ //monthly- publish day (select-day)
3063
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3064
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3065
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3066
+ }
3067
+ }
3068
+
3069
+
3070
+
3071
+ function addTag(networkAuthId) {
3072
+ var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3073
+ jQuery(selector).last().after('<input class="form-control b2s-post-item-details-tag-input-elem" data-network-auth-id="' + networkAuthId + '" value="" name="b2s[' + networkAuthId + '][tags][]">');
3074
+ jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3075
+ var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3076
+ if (typeof limit !== typeof undefined && limit !== false) {
3077
+ if (jQuery(selector).length >= limit) {
3078
+ jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3079
+ }
3080
+ }
3081
+ }
3082
+
3083
+ function removeTag(networkAuthId) {
3084
+ var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3085
+ jQuery(selector).last().remove();
3086
+ if (jQuery(selector).length === 1) {
3087
+ jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3088
+ }
3089
+ var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3090
+ if (typeof limit !== typeof undefined && limit !== false) {
3091
+ if (jQuery(selector).length < limit) {
3092
+ jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3093
+ }
3094
+ }
3095
+ }
3096
+
3097
+ function networkLimitAll(networkAuthId, networkId, limit) {
3098
+
3099
+ var networkCountId = -1; //default;
3100
+ if (jQuery(':focus').length > 0) {
3101
+ var attr = jQuery(':focus').attr('data-network-count');
3102
+ if (typeof attr !== typeof undefined && attr !== false) {
3103
+ networkCountId = attr;
3104
+ }
3105
+ }
3106
+
3107
+ var regX = /(<([^>]+)>)/ig;
3108
+ var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3109
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3110
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3111
+ if (url.length != "0") {
3112
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3113
+ url = "http://" + url;
3114
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3115
+ }
3116
+ } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3117
+ if (!((jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 3 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 19) && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook & Linkedin Imagepost don't require Link
3118
+ url = jQuery("#b2sDefault_url").val();
3119
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3120
+ }
3121
+ }
3122
+
3123
+ var textLength = text.length;
3124
+ var newText = text;
3125
+ if (networkId == "2") { //twitter
3126
+ if (url.length != "0") {
3127
+ limit = limit - 26;
3128
+ }
3129
+ }
3130
+ if (networkId == "3") { //linkedin
3131
+ if (url.length != "0") {
3132
+ limit = limit - url.length;
3133
+ }
3134
+ }
3135
+ if (networkId == "19" && jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-type') == 0 && jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 1) { //xing
3136
+ if (url.length != "0") {
3137
+ limit = limit - url.length;
3138
+ }
3139
+ }
3140
+ if (networkId == "12") { //instagram
3141
+ var matches = text.match(/(#[^# ]{1,})/g);
3142
+ if (matches != null && matches.length > 30) {
3143
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').show();
3144
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").addClass("warning");
3145
+ } else {
3146
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').hide();
3147
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").removeClass("warning");
3148
+ }
3149
+ }
3150
+
3151
+ if (textLength >= limit) {
3152
+ newText = text.substring(0, limit);
3153
+ var pos = getCaretPos(this);
3154
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val(newText.replace(regX, ""));
3155
+ setCaretPos(this, pos);
3156
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3157
+ var textLength = text.length;
3158
+ }
3159
+ jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
3160
+ }
3161
+
3162
+ function networkCount(networkAuthId) {
3163
+
3164
+ var networkCountId = -1; //default;
3165
+ if (jQuery(':focus').length > 0) {
3166
+ var attr = jQuery(':focus').attr('data-network-count');
3167
+ if (typeof attr !== typeof undefined && attr !== false) {
3168
+ networkCountId = attr;
3169
+ }
3170
+ }
3171
+ var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3172
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3173
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3174
+ if (url.length != "0") {
3175
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3176
+ url = "http://" + url;
3177
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3178
+ }
3179
+ } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3180
+ if (!((jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 1 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 3 || jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == 19) && jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val() == 1)) { //Facebook & Linkedin Imagepost don't require Link
3181
+ url = jQuery("#b2sDefault_url").val();
3182
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3183
+ }
3184
+ }
3185
+ if (typeof text !== 'undefined' && jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3186
+ var textLength = text.length;
3187
+ jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
3188
+ }
3189
+ if (jQuery(".b2s-post-item-details-item-message-input[data-network-auth-id='" + networkAuthId + "']").attr('data-network-id') == "12") { //instagram
3190
+ var matches = text.match(/(#[^# ]{1,})/g);
3191
+ if (matches != null && matches.length > 30) {
3192
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').show();
3193
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").addClass("warning");
3194
+ } else {
3195
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').hide();
3196
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").removeClass("warning");
3197
+ }
3198
+ }
3199
+ }
3200
+
3201
+
3202
+ function getCaretPos(domElem) {
3203
+ var pos;
3204
+ if (document.selection) {
3205
+ domElem.focus();
3206
+ var sel = document.selection.createRange();
3207
+ sel.moveStart("character", -domElem.value.length);
3208
+ pos = sel.text.length;
3209
+ } else if (domElem.selectionStart || domElem.selectionStart == "0")
3210
+ pos = domElem.selectionStart;
3211
+ return pos;
3212
+ }
3213
+
3214
+ function setCaretPos(domElem, pos) {
3215
+ if (domElem.setSelectionRange) {
3216
+ domElem.focus();
3217
+ domElem.setSelectionRange(pos, pos);
3218
+ } else if (domElem.createTextRange) {
3219
+ var range = domElem.createTextRange();
3220
+ range.collapse(true);
3221
+ range.moveEnd("character", pos);
3222
+ range.moveStart("character", pos);
3223
+ range.select();
3224
+ }
3225
+ }
3226
+
3227
+ function ucfirst(str) {
3228
+ str += '';
3229
+ return str.charAt(0).toUpperCase() + str.substr(1);
3230
+ }
3231
+
3232
+
3233
+ function hideDuplicateAuths() {
3234
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3235
+ jQuery(this).show();
3236
+ });
3237
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3238
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3239
+ if (jQuery(this).is(":visible")) {
3240
+ var dataNetworkDisplayName = jQuery(this).children('.b2s-network-select-btn').attr('data-network-display-name');
3241
+ var dataNetworkId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-id');
3242
+ var dataNetworkType = jQuery(this).children('.b2s-network-select-btn').attr('data-network-type');
3243
+ var dataNetworkAuthId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-auth-id');
3244
+ jQuery('.b2s-network-select-btn[data-network-display-name="' + dataNetworkDisplayName + '"][data-network-id="' + dataNetworkId + '"][data-network-type="' + dataNetworkType + '"][data-network-auth-id!="' + dataNetworkAuthId + '"]').each(function () {
3245
+ var selectedDataMandantId = jQuery.parseJSON(jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id'));
3246
+ if (jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-default-id') != mandantId && selectedDataMandantId.indexOf(mandantId) == -1) {
3247
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').hide();
3248
+ }
3249
+ });
3250
+ }
3251
+ });
3252
+ }
3253
+
3254
+ function chooseMandant() {
3255
+ //Laden abbrechen und anzeige zurück setzten
3256
+ jQuery.xhrPool.abortAll();
3257
+ jQuery('.b2s-post-item-loading-dummy').remove();
3258
+ jQuery('.b2s-network-status-img-loading').hide();
3259
+ jQuery('.b2s-network-select-btn-deactivate').removeClass('b2s-network-select-btn-deactivate');
3260
+ //imageCheck();
3261
+ //TOS XING Groups
3262
+ b2sTosXingGroupCount = 0;
3263
+ //expiredDate wieder setzten
3264
+ jQuery('.b2s-network-status-expiredDate').each(function () {
3265
+ if (jQuery(this).is(':visible')) {
3266
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').addClass('b2s-network-select-btn-deactivate');
3267
+ }
3268
+ });
3269
+ jQuery('.b2s-network-select-btn-deactivate')
3270
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3271
+ jQuery('.b2s-post-item').hide();
3272
+ jQuery('.b2s-post-item').find('.form-control').each(function () {
3273
+ jQuery(this).attr("disabled", "disabled");
3274
+ jQuery(this).removeClass('error');
3275
+ });
3276
+ jQuery('.b2s-network-select-btn').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
3277
+ //Check IS RE-PUBLISH
3278
+ var isMultiSelectNetwork = false;
3279
+ if (typeof jQuery('#b2sMultiSelectedNetworkAuthId') != 'undefined' && typeof jQuery('#b2sMultiSelectedNetworkAuthId').val() != 'undefined' && jQuery('#b2sMultiSelectedNetworkAuthId').val() != '') { //exisits?
3280
+ var selectedNetworks = jQuery('#b2sMultiSelectedNetworkAuthId').val().split(',');
3281
+ var preventMutliClick = [];
3282
+ selectedNetworks.forEach(function (selectedAuthId) {
3283
+ if (!isMultiSelectNetwork && jQuery(".b2s-network-select-btn[data-network-auth-id='" + selectedAuthId + "']").length > 0) {
3284
+ isMultiSelectNetwork = true;
3285
+ var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + selectedAuthId + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
3286
+ jQuery('.b2s-network-details-mandant-select').val(mandantId);
3287
+ jQuery('#b2sSelectedMultiNetworkAuthId').val("0");
3288
+ }
3289
+ if (!preventMutliClick.includes(selectedAuthId)) {
3290
+ jQuery(".b2s-network-select-btn[data-network-auth-id='" + selectedAuthId + "']").trigger('click');
3291
+ preventMutliClick.push(selectedAuthId);
3292
+ }
3293
+ });
3294
+ }
3295
+ if (!isMultiSelectNetwork) {
3296
+ if (jQuery('#b2sSelectedNetworkAuthId').val() > 0 && jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").length > 0) { //exisits?
3297
+ jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").trigger('click');
3298
+ var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
3299
+ jQuery('.b2s-network-details-mandant-select').val(mandantId);
3300
+ jQuery('#b2sSelectedNetworkAuthId').val("0");
3301
+ } else {
3302
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3303
+ var mandantIds = jQuery.parseJSON(jQuery(this).attr('data-mandant-id'));
3304
+ if (mandantIds.indexOf(mandantId) != -1 && !jQuery(this).children('.b2s-network-select-btn').hasClass('b2s-network-select-btn-deactivate')) {
3305
+ jQuery(this).children('.b2s-network-select-btn').trigger('click');
3306
+ }
3307
+ });
3308
+ }
3309
+ }
3310
+
3311
+ checkNetworkSelected();
3312
+ }
3313
+
3314
+ function padDate(n) {
3315
+ return ("0" + n).slice(-2);
3316
+ }
3317
+
3318
+ function wop(url, name) {
3319
+ jQuery('.b2s-network-auth-success').hide();
3320
+ var location = window.location.protocol + '//' + window.location.hostname;
3321
+ url = encodeURI(url + '&mandant_id=' + jQuery('.b2s-network-details-mandant-select').val() + '&location=' + location);
3322
+ window.open(url, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3323
+ }
3324
+
3325
+
3326
+ function wopApprove(networkAuthId, postId, url, name) {
3327
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
3328
+ var win = window.open(url + '&location=' + location, name, "width=650,height=900,scrollbars=yes,toolbar=no,status=no,resizable=no,menubar=no,location=no,directories=no,top=20,left=20");
3329
+ if (postId > 0) {
3330
+ function checkIfWinClosed(intervalID) {
3331
+ if (win.closed) {
3332
+ clearInterval(intervalID);
3333
+ //Show Modal
3334
+ jQuery('.b2s-publish-approve-modal').modal('show');
3335
+ jQuery('#b2s-approve-post-id').val(postId);
3336
+ jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
3337
+ }
3338
+ }
3339
+ var interval = setInterval(function () {
3340
+ checkIfWinClosed(interval);
3341
+ }, 500);
3342
+ }
3343
+ }
3344
+
3345
+
3346
+ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId, instant_sharing) {
3347
+ jQuery('.b2s-network-auth-success').show();
3348
+ jQuery('#b2s-network-list-modal').modal('hide');
3349
+ jQuery('#b2s-network-list-modal').hide();
3350
+ jQuery('body').removeClass('modal-open');
3351
+ jQuery('body').removeAttr('style');
3352
+ if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3353
+ jQuery('.b2s-server-connection-fail').hide();
3354
+ jQuery.ajax({
3355
+ url: ajaxurl,
3356
+ type: "POST",
3357
+ dataType: "json",
3358
+ cache: false,
3359
+ data: {
3360
+ 'action': 'b2s_ship_navbar_item',
3361
+ 'networkId': networkId,
3362
+ 'networkType': networkType,
3363
+ 'displayName': displayName,
3364
+ 'networkAuthId': networkAuthId,
3365
+ 'instant_sharing': instant_sharing,
3366
+ 'mandandId': mandandId,
3367
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3368
+ },
3369
+ error: function () {
3370
+ jQuery('.b2s-server-connection-fail').show();
3371
+ return false;
3372
+ },
3373
+ success: function (data) {
3374
+ if (data.result == true) {
3375
+ jQuery(data.content).insertAfter('.b2s-sidbar-network-auth-btn');
3376
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
3377
+ } else {
3378
+ if (data.error == 'nonce') {
3379
+ jQuery('.b2s-nonce-check-fail').show();
3380
+ }
3381
+ }
3382
+ }
3383
+ });
3384
+ } else {
3385
+ jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + networkAuthId + '"]').remove();
3386
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
3387
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
3388
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-display-name', displayName);
3389
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"] > .b2s-network-list > .b2s-network-details > h4').text(displayName);
3390
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
3391
+ }
3392
+ jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-display-name="' + displayName.toLowerCase() + '"]').each(function () {
3393
+ jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
3394
+ jQuery(this).removeClass('b2s-network-select-btn-deactivate');
3395
+ jQuery(this).removeAttr('onclick');
3396
+ });
3397
+ }
3398
+
3399
+ //jQuery(this).attr('data-network-auth-id')
3400
+ function checkSchedDateTime(dataNetworkAuthId) {
3401
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
3402
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
3403
+ var dateStr = jQuery(dateElement).val();
3404
+ var minStr = jQuery(timeElement).val();
3405
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
3406
+ if (jQuery('#b2sUserLang').val() == 'de') {
3407
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
3408
+ } else {
3409
+ var minParts = minStr.split(' ');
3410
+ var minParts2 = minParts[0].split(':');
3411
+ if (minParts[1] == 'PM') {
3412
+ minParts2[0] = parseInt(minParts2[0]) + 12;
3413
+ }
3414
+ minStr = minParts2[0] + ':' + minParts2[1];
3415
+ }
3416
+
3417
+ var minParts3 = minStr.split(':');
3418
+ if (minParts3[0] < 10) {
3419
+ minParts3[0] = '0' + minParts3[0];
3420
+ }
3421
+ var dateParts = dateStr.split('-');
3422
+ //utc current time
3423
+ var now = new Date();
3424
+ //offset between utc und user
3425
+ var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
3426
+ //enter hour to user time
3427
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
3428
+ //calculate datetime in utc
3429
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
3430
+ //compare enter date time with allowed user time
3431
+ if (enter.getTime() < now.getTime()) {
3432
+ //enter set on next 15 minutes and calculate on user timezone
3433
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
3434
+ jQuery(dateElement).datepicker('update', enter);
3435
+ jQuery(timeElement).timepicker('setTime', enter);
3436
+ }
3437
+
3438
+ //network deprecated
3439
+ if (jQuery(dateElement).attr('data-network-id') == '8') {
3440
+ var deprecatedDate = new Date('2019-03-30T23:59:59');
3441
+ var count = jQuery(dateElement).attr('data-network-count');
3442
+ if (enter.getTime() > deprecatedDate.getTime()) {
3443
+ jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3444
+ jQuery(dateElement).datepicker('update', now);
3445
+ jQuery(timeElement).timepicker('setTime', now);
3446
+ }
3447
+ }
3448
+
3449
+ //network deprecated
3450
+ if (jQuery(dateElement).attr('data-network-id') == '10') {
3451
+ var deprecatedDate = new Date('2019-04-01T23:59:59');
3452
+ var count = jQuery(dateElement).attr('data-network-count');
3453
+ if (enter.getTime() > deprecatedDate.getTime()) {
3454
+ jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3455
+ jQuery(dateElement).datepicker('update', now);
3456
+ jQuery(timeElement).timepicker('setTime', now);
3457
+ }
3458
+ }
3459
+
3460
+ }
3461
+
3462
+ jQuery(document).on("click", ".b2s-draft-btn", function (event) {
3463
+ event.preventDefault();
3464
+ jQuery('.b2s-loader-btn-ship').css('display', 'inline-block');
3465
+ jQuery('.b2s-submit-btn').prop('disabled', true);
3466
+ jQuery('.b2s-submit-btn-scroll').prop('disabled', true);
3467
+ jQuery('.b2s-post-draft-saved-success').hide();
3468
+ jQuery('.b2s-post-draft-saved-fail').hide();
3469
+ jQuery('.b2s-server-connection-fail').hide();
3470
+
3471
+ jQuery.ajax({
3472
+ url: ajaxurl,
3473
+ type: "GET",
3474
+ cache: false,
3475
+ data: {
3476
+ action: 'b2s_check_draft_exists',
3477
+ postId: jQuery('#post_id').val(),
3478
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3479
+ },
3480
+ error: function () {
3481
+ saveDraft();
3482
+ return false;
3483
+ },
3484
+ success: function (data) {
3485
+ result = JSON.parse(data);
3486
+ if (result.result == true) {
3487
+ jQuery('#b2s-save-draft-modal').modal('show');
3488
+ return true;
3489
+ } else {
3490
+ if (result.error == 'nonce') {
3491
+ jQuery('.b2s-nonce-check-fail').show();
3492
+ }
3493
+ }
3494
+ saveDraft();
3495
+ return false;
3496
+ }
3497
+ });
3498
+
3499
+ });
3500
+
3501
+ jQuery(document).on('click', '.b2s-draft-btn-scroll', function () {
3502
+ jQuery('.b2s-draft-btn').trigger('click');
3503
+ });
3504
+
3505
+ function saveDraft() {
3506
+ jQuery('#action').val('b2s_save_draft_data');
3507
+ var data = jQuery('#b2sNetworkSent').serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
3508
+ jQuery('#action').val('b2s_save_ship_data');
3509
+ jQuery.ajax({
3510
+ url: ajaxurl,
3511
+ type: "POST",
3512
+ cache: false,
3513
+ data: data,
3514
+ error: function () {
3515
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3516
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3517
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3518
+ jQuery('.b2s-server-connection-fail').show();
3519
+ window.scrollTo(0, 0);
3520
+ return false;
3521
+ },
3522
+ success: function (data) {
3523
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3524
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3525
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3526
+ result = JSON.parse(data);
3527
+ if (result.result == true) {
3528
+ jQuery('.b2s-post-draft-saved-success').show();
3529
+ window.setTimeout(function () {
3530
+ jQuery('.b2s-post-draft-saved-success').fadeOut();
3531
+ }, 5000);
3532
+ } else {
3533
+ if (result.error == 'nonce') {
3534
+ jQuery('.b2s-nonce-check-fail').show();
3535
+ }
3536
+ jQuery('.b2s-post-draft-saved-fail').show();
3537
+ window.setTimeout(function () {
3538
+ jQuery('.b2s-post-draft-saved-fail').fadeOut();
3539
+ }, 5000);
3540
+ }
3541
+ window.scrollTo(0, 0);
3542
+ return true;
3543
+ }
3544
+ });
3545
+ }
3546
+
3547
+ jQuery('#b2s-save-draft-modal').on('hidden.bs.modal', function () {
3548
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3549
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3550
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3551
+ });
3552
+
3553
+ jQuery(document).on('click', '.b2s-save-draft-confirm-btn', function () {
3554
+ saveDraft();
3555
+ jQuery('#b2s-save-draft-modal').modal('hide');
3556
+ return true;
3557
+ });
3558
+
3559
+ jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3560
+ jQuery('body').addClass('modal-open');
3561
+ });
3562
+
3563
+ // START Pinterest
3564
+ jQuery(document).on('click', '.b2s-auth-network-6-login-btn', function () {
3565
+ jQuery('#b2s-auth-network-6-username').removeClass('error');
3566
+ jQuery('#b2s-auth-network-6-password').removeClass('error');
3567
+ var loginDataCheck = true;
3568
+ if (jQuery('#b2s-auth-network-6-username').val() == '') {
3569
+ jQuery('#b2s-auth-network-6-username').addClass('error');
3570
+ loginDataCheck = false;
3571
+ }
3572
+ if (jQuery('#b2s-auth-network-6-password').val() == '') {
3573
+ jQuery('#b2s-auth-network-6-password').addClass('error');
3574
+ loginDataCheck = false;
3575
+ }
3576
+ if (!loginDataCheck) {
3577
+ return false;
3578
+ }
3579
+ jQuery('.b2s-loading-area').show();
3580
+ jQuery('.b2s-auth-network-6-login-area').hide();
3581
+ jQuery('.b2s-auth-network-6-login-btn').hide();
3582
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
3583
+ jQuery('.b2s-auth-network-6-info').hide();
3584
+ jQuery.ajax({
3585
+ url: ajaxurl,
3586
+ type: "POST",
3587
+ dataType: "json",
3588
+ cache: false,
3589
+ data: {
3590
+ 'action': 'b2s_auth_network_login',
3591
+ 'username': jQuery('#b2s-auth-network-6-username').val(),
3592
+ 'password': jQuery('#b2s-auth-network-6-password').val(),
3593
+ 'location': jQuery('#b2s-auth-network-6-location').val(),
3594
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3595
+ },
3596
+ error: function (jqXHR) {
3597
+ jQuery('.b2s-loading-area').hide();
3598
+ jQuery('.b2s-auth-network-6-login-area').show();
3599
+ jQuery('.b2s-auth-network-6-login-btn').show();
3600
+ if (jqXHR.status == 403) {
3601
+ jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3602
+ } else {
3603
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3604
+ }
3605
+ return false;
3606
+ },
3607
+ success: function (data) {
3608
+ jQuery('.b2s-loading-area').hide();
3609
+ if (data.result == true) {
3610
+ jQuery('#b2s-auth-network-6-board').html(data.boards);
3611
+ jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
3612
+ jQuery('.b2s-auth-network-6-board-area').show();
3613
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
3614
+ jQuery('.b2s-auth-network-6-info[data-info="success"]').show();
3615
+ } else {
3616
+ if (data.error == 'nonce') {
3617
+ jQuery('.b2s-nonce-check-fail').show();
3618
+ } else if (data.error == 'invalid' || data.error == 'login' || data.error == 'access' || data.error == 'http_request_failed' || data.error == 'error_code_403') {
3619
+ jQuery('.b2s-auth-network-6-extension-info-area').show();
3620
+ jQuery('.b2s-auth-network-6-go-to-network-btn').show();
3621
+ var messageData = {action: 'BWEC', type: 'BWECT'};
3622
+ window.postMessage(messageData, '*');
3623
+ return false;
3624
+ }
3625
+ if (typeof data.error != 'undefined' && data.error != '') {
3626
+ jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3627
+ } else {
3628
+ jQuery('.b2s-auth-network-6-info[data-info="login"]').show();
3629
+ }
3630
+ jQuery('.b2s-auth-network-6-login-btn').show();
3631
+ }
3632
+ jQuery('.b2s-auth-network-6-login-area').show();
3633
+ }
3634
+ });
3635
+ });
3636
+
3637
+ jQuery(document).on('click', '.b2s-auth-network-6-confirm-btn', function () {
3638
+ jQuery('.b2s-loading-area').show();
3639
+ jQuery('.b2s-auth-network-6-login-area').hide();
3640
+ jQuery('.b2s-auth-network-6-login-btn').hide();
3641
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
3642
+ jQuery.ajax({
3643
+ url: ajaxurl,
3644
+ type: "POST",
3645
+ dataType: "json",
3646
+ cache: false,
3647
+ data: {
3648
+ 'action': 'b2s_auth_network_confirm',
3649
+ 'username': jQuery('#b2s-auth-network-6-username').val(),
3650
+ 'password': jQuery('#b2s-auth-network-6-password').val(),
3651
+ 'boardId': jQuery('#b2s-auth-network-6-board').val(),
3652
+ 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
3653
+ 'mandantId': jQuery('#b2s-auth-network-6-mandant-id').val(),
3654
+ 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
3655
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3656
+ },
3657
+ error: function (jqXHR) {
3658
+ jQuery('.b2s-loading-area').hide();
3659
+ jQuery('.b2s-auth-network-6-login-area').show();
3660
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
3661
+ if (jqXHR.status == 403) {
3662
+ jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3663
+ } else {
3664
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3665
+ }
3666
+ return false;
3667
+ },
3668
+ success: function (data) {
3669
+ jQuery('.b2s-loading-area').hide();
3670
+ jQuery('.b2s-auth-network-6-login-area').show();
3671
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
3672
+ if (data.result == true) {
3673
+ jQuery('#b2sAuthNetwork6Modal').modal('hide');
3674
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
3675
+ } else {
3676
+ if (data.error == 'nonce') {
3677
+ jQuery('.b2s-nonce-check-fail').show();
3678
+ }
3679
+ if (typeof data.error != 'undefined' && data.error != '') {
3680
+ jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3681
+ return false;
3682
+ }
3683
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3684
+ }
3685
+ }
3686
+ });
3687
+ });
3688
+
3689
+ jQuery(document).on('click', '.b2s-network-list-add-btn[data-auth-method="client"]', function () {
3690
+ jQuery('#b2sAuthNetwork6Modal').modal('show');
3691
+ });
3692
+
3693
+ jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3694
+ jQuery('.b2s-loading-area').hide();
3695
+ jQuery('.b2s-auth-network-6-login-area').show();
3696
+ jQuery('#b2s-auth-network-6-auth-id').val('');
3697
+ jQuery('#b2s-auth-network-6-board').html('');
3698
+ jQuery('#b2s-auth-network-6-ident-data').val('');
3699
+ jQuery('.b2s-auth-network-6-info').hide();
3700
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
3701
+ jQuery('.b2s-auth-network-6-login-btn').show();
3702
+ jQuery('.b2s-auth-network-6-board-area').hide();
3703
+ jQuery('#b2s-auth-network-6-username').val('');
3704
+ jQuery('#b2s-auth-network-6-password').val('');
3705
+ });
3706
+
3707
+ jQuery(".b2s-auth-network-6-reveal").mousedown(function () {
3708
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'text'));
3709
+ });
3710
+ jQuery(".b2s-auth-network-6-reveal").mouseup(function () {
3711
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3712
+ });
3713
+ jQuery(".b2s-auth-network-6-reveal").mouseout(function () {
3714
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3715
+ });
3716
+ // END Pinterest
3717
+
3718
+ jQuery(document).on('click', '.b2sInfoPostRelayModalBtn', function () {
3719
+ jQuery('#b2sInfoPostRelayModal').modal('show');
3720
+ });
3721
+ jQuery(document).on('click', '.b2sInfoSchedTimesModalBtn', function () {
3722
+ jQuery('#b2sInfoSchedTimesModal').modal('show');
3723
+ });
3724
+ jQuery(document).on('click', '.b2s-network-setting-save-btn', function () {
3725
+ jQuery('#b2s-network-setting-save').modal('show');
3726
+ });
3727
+ jQuery(document).on('click', '.b2s-network-list-modal-btn', function () {
3728
+ jQuery('#b2s-network-list-modal').modal('show');
3729
+ });
3730
+ jQuery(document).on('click', '.b2s-re-share-info-btn', function () {
3731
+ jQuery('#b2s-re-share-info').modal('show');
3732
+ });
3733
+
3734
+ function checkGifAnimation(networkAuthId, networkId) {
3735
+ if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').length >= 1 && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != '') {
3736
+ var attachmenUrlExt = jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val().substr(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val().lastIndexOf('.') + 1);
3737
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
3738
+ if (attachmenUrlExt == 'gif') {
3739
+ var postFormat = 0;
3740
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').length > 0) {
3741
+ postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val();
3742
+ }
3743
+ var animatedGif = JSON.parse(jQuery('#b2sAnimateGif').val());
3744
+ if (typeof animatedGif[networkId] != "undefined" && animatedGif[networkId][postFormat] == true) {
3745
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val());
3746
+ } else {
3747
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').each(function () {
3748
+ var imgItem = this;
3749
+ window.setTimeout(function () {
3750
+ freeze_gif(imgItem);
3751
+ }, 1);
3752
+ });
3753
+ }
3754
+ } else {
3755
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src') != jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val()) {
3756
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val());
3757
+ }
3758
+ }
3759
+ }
3760
+ return false;
3761
+ }
3762
+
3763
+ function freeze_gif(i) {
3764
+ var c = document.createElement('canvas');
3765
+ var w = c.width = i.width;
3766
+ var h = c.height = i.height;
3767
+ c.getContext('2d').drawImage(i, 0, 0, w, h);
3768
+ try {
3769
+ i.src = c.toDataURL("image/gif"); // if possible, retain all css aspects
3770
+ } catch (e) { // cross-domain -- mimic original with all its tag attributes
3771
+ for (var j = 0, a; a = i.attributes[j]; j++)
3772
+ c.setAttribute(a.name, a.value);
3773
+ i.parentNode.replaceChild(c, i);
3774
+ }
3775
+ return false;
3776
+ }
3777
+
3778
+ var currentEmojiNetworkAuthId = 0;
3779
+ var currentEmojiNetworkCount = -1;
3780
+ var emojiTranslation = JSON.parse(jQuery('#b2sEmojiTranslation').val());
3781
+ var picker = new EmojiButton({
3782
+ position: 'auto',
3783
+ autoHide: false,
3784
+ i18n: {
3785
+ search: emojiTranslation['search'],
3786
+ categories: {
3787
+ recents: emojiTranslation['recents'],
3788
+ smileys: emojiTranslation['smileys'],
3789
+ animals: emojiTranslation['animals'],
3790
+ food: emojiTranslation['food'],
3791
+ activities: emojiTranslation['activities'],
3792
+ travel: emojiTranslation['travel'],
3793
+ objects: emojiTranslation['objects'],
3794
+ symbols: emojiTranslation['symbols'],
3795
+ flags: emojiTranslation['flags']
3796
+ },
3797
+ notFound: emojiTranslation['notFound']
3798
+ }
3799
+ });
3800
+ picker.on('emoji', function (emoji) {
3801
+ if (currentEmojiNetworkAuthId > 0) {
3802
+ var text = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val();
3803
+ var start = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionStart');
3804
+ var end = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionEnd');
3805
+ if (typeof start == 'undefined' || typeof end == 'undefined') {
3806
+ start = text.length;
3807
+ end = text.length;
3808
+ }
3809
+ var newText = text.slice(0, start) + emoji + text.slice(end);
3810
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val(newText);
3811
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').focus();
3812
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionStart", parseInt(start) + emoji.length);
3813
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionEnd", parseInt(start) + emoji.length);
3814
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').trigger('keyup');
3815
+ }
3816
+ });
3817
+
3818
+ jQuery(document).on('click', '.b2s-post-item-details-item-message-emoji-btn', function () {
3819
+ if (picker.pickerVisible) {
3820
+ picker.hidePicker();
3821
+ } else {
3822
+ currentEmojiNetworkAuthId = jQuery(this).attr('data-network-auth-id');
3823
+ currentEmojiNetworkCount = jQuery(this).attr('data-network-count');
3824
+ picker.showPicker(jQuery(this));
3825
+ }
3826
+ });
3827
+
3828
+ jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-post-item-details-item-message-input', function () {
3829
+ var tb = jQuery(this).get(0);
3830
+ jQuery(this).attr('selectionStart', tb.selectionStart);
3831
+ jQuery(this).attr('selectionEnd', tb.selectionEnd);
3832
+ });
3833
+
3834
+ var pickerHTML = new EmojiButton({
3835
+ position: 'auto',
3836
+ autoHide: false,
3837
+ i18n: {
3838
+ search: emojiTranslation['search'],
3839
+ categories: {
3840
+ recents: emojiTranslation['recents'],
3841
+ smileys: emojiTranslation['smileys'],
3842
+ animals: emojiTranslation['animals'],
3843
+ food: emojiTranslation['food'],
3844
+ activities: emojiTranslation['activities'],
3845
+ travel: emojiTranslation['travel'],
3846
+ objects: emojiTranslation['objects'],
3847
+ symbols: emojiTranslation['symbols'],
3848
+ flags: emojiTranslation['flags']
3849
+ },
3850
+ notFound: emojiTranslation['notFound']
3851
+ }
3852
+ });
3853
+ var currentPickerHTMLContent;
3854
+ pickerHTML.on('emoji', function (emoji) {
3855
+ currentPickerHTMLContent.insert(emoji);
3856
+ });
3857
+
3858
+ jQuery(document).on('click', '.b2s-add-multi-image', function () {
3859
+ var imageCount = jQuery(this).attr('data-image-count');
3860
+ var authId = jQuery(this).attr('data-network-auth-id');
3861
+ var countId = jQuery(this).attr('data-network-count');
3862
+ var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + authId + ']').attr("data-network-id");
3863
+ jQuery('.b2s-image-change-all-network').hide();
3864
+ jQuery('.b2s-image-change-meta-network').hide();
3865
+ jQuery('.b2s-image-change-this-network').hide();
3866
+ jQuery('.b2s-image-add-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId).attr('data-image-count', imageCount);
3867
+ jQuery('.b2s-image-add-this-network').show();
3868
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
3869
+ jQuery('.b2s-selected-network-for-image-info').html(content);
3870
+ jQuery('.b2s-multi-image-info-text').show();
3871
+ jQuery('.b2s-default-image-info-text').hide();
3872
+ jQuery('#b2s-network-select-image').modal('show');
3873
+ return false;
3874
+ });
3875
+
3876
+ jQuery(document).on('hidden.bs.modal', '#b2s-network-select-image', function () {
3877
+ jQuery('.b2s-multi-image-info-text').hide();
3878
+ jQuery('.b2s-default-image-info-text').show();
3879
+ return false;
3880
+ });
3881
+
3882
+ jQuery(document).on('click', '.b2s-image-add-this-network', function () {
3883
+ var currentImage = jQuery('input[name=image_url]:checked').val();
3884
+ var imageCount = jQuery(this).attr('data-image-count');
3885
+ var authId = jQuery(this).attr('data-network-auth-id');
3886
+ var countId = jQuery(this).attr('data-network-count');
3887
+ if (countId == -1) {
3888
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').attr('src', currentImage);
3889
+ jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').val(currentImage);
3890
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').show();
3891
+ jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').show();
3892
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').hide();
3893
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + (parseInt(imageCount) + 1) + '"]').show();
3894
+ jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"]').show();
3895
+ } else {
3896
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').attr('src', currentImage);
3897
+ jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').val(currentImage);
3898
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3899
+ jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3900
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3901
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + (parseInt(imageCount) + 1) + '"][data-network-count="' + countId + '"]').show();
3902
+ jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3903
+ }
3904
+ jQuery('#b2s-network-select-image').modal('hide');
3905
+ return false;
3906
+ });
3907
+
3908
+ jQuery(document).on('click', '.b2s-multi-image-remove-btn', function () {
3909
+ var imageCount = jQuery(this).attr('data-image-count');
3910
+ var authId = jQuery(this).attr('data-network-auth-id');
3911
+ var countId = jQuery(this).attr('data-network-count');
3912
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').attr('src', '');
3913
+ jQuery('.b2s-add-multi-image-hidden-field[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').val('');
3914
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3915
+ jQuery('.b2s-multi-image-remove-btn[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3916
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').show();
3917
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + (parseInt(imageCount) + 1) + '"][data-network-count="' + countId + '"]').hide();
3918
+ jQuery('.b2s-select-multi-image-modal-open[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').hide();
3919
+ return false;
3920
+ });
3921
+
3922
+ jQuery(document).on('click', '.b2s-post-item-details-url-image-multi', function () {
3923
+ var imageCount = jQuery(this).attr('data-image-count');
3924
+ var authId = jQuery(this).attr('data-network-auth-id');
3925
+ var countId = jQuery(this).attr('data-network-count');
3926
+ jQuery('.b2s-add-multi-image[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').trigger('click');
3927
+ return false;
3928
+ });
3929
+
3930
+ jQuery(document).on('click', '.b2s-select-multi-image-modal-open', function () {
3931
+ var imageCount = jQuery(this).attr('data-image-count');
3932
+ var authId = jQuery(this).attr('data-network-auth-id');
3933
+ var countId = jQuery(this).attr('data-network-count');
3934
+ jQuery('.b2s-post-item-details-url-image-multi[data-network-auth-id="' + authId + '"][data-image-count="' + imageCount + '"][data-network-count="' + countId + '"]').trigger('click');
3935
+ return false;
3936
+ });
3937
+
3938
+ jQuery(document).on('click', '.b2s-auth-network-6-extension-auth-btn', function () {
3939
+ jQuery('.b2s-auth-network-6-extension-info-area').hide();
3940
+ jQuery('.b2s-auth-network-6-extension-start-area').hide();
3941
+ jQuery('.b2s-auth-network-6-extension-auth-btn').hide();
3942
+ jQuery('.b2s-auth-network-6-go-to-network-btn').hide();
3943
+ jQuery('.b2s-loading-area').show();
3944
+ var messageData = {action: 'BWESP', type: 'BWECT', data: [
3945
+ 'pinterest.com',
3946
+ 'pinterest.de',
3947
+ 'accounts.pinterest.com',
3948
+ 'www.pinterest.com',
3949
+ 'www.pinterest.de',
3950
+ '.www.pinterest.com',
3951
+ '.www.pinterest.de',
3952
+ 'gr.pinterest.com', 'in.pinterest.com', 'www.pinterest.ie', 'www.pinterest.it', 'www.pinterest.ch', 'cz.pinterest.com', 'id.pinterest.com', 'www.pinterest.es', 'www.pinterest.ca', 'www.pinterest.co.uk', 'www.pinterest.ru', 'nl.pinterest.com', 'br.pinterest.com', 'no.pinterest.com', 'tr.pinterest.com', 'www.pinterest.com.au', 'www.pinterest.at', 'pl.pinterest.com', 'www.pinterest.fr', 'ro.pinterest.com', 'www.pinterest.de', 'www.pinterest.dk', 'www.pinterest.nz', 'fi.pinterest.com', 'hu.pinterest.com', 'www.pinterest.jp', 'www.pinterest.pt', 'ar.pinterest.com', 'www.pinterest.co.kr', 'www.pinterest.se', 'www.pinterest.com.mx', 'sk.pinterest.com', 'www.pinterest.cl', 'co.pinterest.com', 'za.pinterest.com', 'www.pinterest.ph']};
3953
+ window.postMessage(messageData, '*');
3954
+ return false;
3955
+ });
3956
+
3957
+ window.addEventListener("message", function (event) {
3958
+ if (typeof event.data == "string") {
3959
+ var result = JSON.parse(event.data);
3960
+ if (result.type == 'BWECR' && result.version >= '1.5.5' && result.inkognito == false && result.enabled == true) {
3961
+ jQuery('.b2s-auth-network-6-extension-info-area').hide();
3962
+ jQuery('.b2s-auth-network-6-extension-continue-btn').hide();
3963
+ jQuery('.b2s-auth-network-6-go-to-network-btn').hide();
3964
+ jQuery('.b2s-auth-network-6-extension-start-area').show();
3965
+ jQuery('.b2s-auth-network-6-extension-auth-btn').show();
3966
+ }
3967
+ if (result.type == 'BWEPR') {
3968
+ jQuery.ajax({
3969
+ url: ajaxurl,
3970
+ type: "POST",
3971
+ dataType: "json",
3972
+ cache: false,
3973
+ data: {
3974
+ 'action': 'b2s_network_check_user_data',
3975
+ 'networkUserData': result.data,
3976
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3977
+ },
3978
+ error: function () {
3979
+ jQuery('.b2s-server-connection-fail').show();
3980
+ return false;
3981
+ },
3982
+ success: function (data) {
3983
+ jQuery('#b2sAuthNetwork6Modal').modal('show');
3984
+ jQuery('.b2s-loading-area').hide();
3985
+ if (data.result == true) {
3986
+ jQuery('.b2s-auth-network-6-extension-success-area').show();
3987
+ jQuery('#b2s-auth-network-6-board-extension').html(data.boards);
3988
+ jQuery('#b2s-auth-network-6-username-extension').val(data.username);
3989
+ jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
3990
+ jQuery('.b2s-auth-network-6-extension-success-area').show();
3991
+ jQuery('.b2s-auth-network-6-confirm-extension-btn').show();
3992
+ jQuery('.b2s-auth-network-6-extension-start-area').hide();
3993
+ } else {
3994
+ jQuery('.b2s-auth-network-6-extension-info-area').show();
3995
+ jQuery('.b2s-auth-network-6-extension-continue-btn').show();
3996
+ if (data.error == 'nonce') {
3997
+ jQuery('.b2s-nonce-check-fail').show();
3998
+ }
3999
+ jQuery('.b2s-auth-network-6-extension-error').show();
4000
+ }
4001
+ }
4002
+ });
4003
+ return false;
4004
+ }
4005
+ }
4006
+ });
4007
+
4008
+ jQuery(document).on('click', '.b2s-auth-network-6-confirm-extension-btn', function () {
4009
+ jQuery('.b2s-loading-area').show();
4010
+ jQuery('.b2s-auth-network-6-extension-success-area').hide();
4011
+ jQuery('.b2s-auth-network-6-confirm-extension-btn').hide();
4012
+ jQuery.ajax({
4013
+ url: ajaxurl,
4014
+ type: "POST",
4015
+ dataType: "json",
4016
+ cache: false,
4017
+ data: {
4018
+ 'action': 'b2s_auth_network_confirm',
4019
+ 'username': jQuery('#b2s-auth-network-6-username-extension').val(),
4020
+ 'boardId': jQuery('#b2s-auth-network-6-board-extension').val(),
4021
+ 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
4022
+ 'mandantId': jQuery('#b2s-auth-network-6-mandant-id').val(),
4023
+ 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
4024
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
4025
+ },
4026
+ error: function (jqXHR) {
4027
+ jQuery('.b2s-loading-area').hide();
4028
+ jQuery('.b2s-auth-network-6-extension-success-area').show();
4029
+ jQuery('.b2s-auth-network-6-confirm-extension-btn').show();
4030
+ jQuery('.b2s-auth-network-6-extension-error').show();
4031
+ return false;
4032
+ },
4033
+ success: function (data) {
4034
+ jQuery('.b2s-loading-area').hide();
4035
+ jQuery('.b2s-auth-network-6-extension-success-area').show();
4036
+ jQuery('.b2s-auth-network-6-confirm-extension-btn').show();
4037
+ if (data.result == true) {
4038
+ jQuery('#b2sAuthNetwork6Modal').modal('hide');
4039
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
4040
+ } else {
4041
+ if (data.error == 'nonce') {
4042
+ jQuery('.b2s-nonce-check-fail').show();
4043
+ }
4044
+ jQuery('.b2s-auth-network-6-extension-error').show();
4045
+ }
4046
+ }
4047
+ });
4048
+ });
4049
+
4050
+
4051
+ function updateNetworkAuth6(networkId) {
4052
+ jQuery('#b2s-auth-network-6-auth-id').val(networkId);
4053
+ jQuery('#b2s-auth-network-6-mandant-id').val(jQuery('.b2s-network-details-mandant-select').val());
4054
+ jQuery('#b2sAuthNetwork6Modal').modal('show');
4055
+ }
4056
+ ;
4057
+ //reset
4058
+ jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
4059
+ jQuery('.b2s-loading-area').hide();
4060
+ jQuery('.b2s-auth-network-6-extension-info-area').hide();
4061
+ jQuery('.b2s-auth-network-6-extension-success-area').hide();
4062
+ jQuery('.b2s-auth-network-6-extension-start-area').hide();
4063
+ jQuery('.b2s-auth-network-6-confirm-extension-btn').hide();
4064
+ jQuery('.b2s-auth-network-6-go-to-network-btn').hide();
4065
+ jQuery('.b2s-auth-network-6-extension-auth-btn').hide();
4066
+ jQuery('.b2s-auth-network-6-login-area').show();
4067
+ jQuery('#b2s-auth-network-6-auth-id').val('');
4068
+ jQuery('#b2s-auth-network-6-board').html('');
4069
+ jQuery('#b2s-auth-network-6-ident-data').val('');
4070
+ jQuery('.b2s-auth-network-6-info').hide();
4071
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
4072
+ jQuery('.b2s-auth-network-6-login-btn').show();
4073
+ jQuery('.b2s-auth-network-6-board-area').hide();
4074
+ jQuery('#b2s-auth-network-6-username').val('');
4075
+ jQuery('#b2s-auth-network-6-password').val('');
4076
+ });
4077
+
4078
+ jQuery(document).on('click', '.b2s-auth-network-6-go-to-network-btn', function () {
4079
+ var add = '';
4080
+ if (jQuery('#b2s-auth-network-6-auth-id').val() != "") {
4081
+ add += '&authId=' + jQuery('#b2s-auth-network-6-auth-id').val();
4082
+ }
4083
+ if (jQuery('#b2s-auth-network-6-mandant-id').val() != "") {
4084
+ add += '&mandantId=' + jQuery('#b2s-auth-network-6-mandant-id').val();
4085
+ }
4086
+ window.location.href = window.location.href.split('?')[0] + '?page=blog2social-network#b2s-add-network-6' + add;
4087
+ });
4088
+
4089
+ jQuery(document).on('click', '.b2s-network-add-page-info-btn', function () {
4090
+ jQuery('#b2sNetworkAddPageInfoModal').modal('show');
4091
+ var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4092
+ jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4093
+ jQuery('#b2sNetworkAddPageInfoModal').modal('hide');
4094
+ wop(b2sAuthUrl + '&choose=page', 'Blog2Social Network');
4095
+ return false;
4096
+ });
4097
+ return false;
4098
+ });
4099
+
4100
+ jQuery(document).on('click', '.b2s-network-add-group-info-btn', function () {
4101
+ jQuery('#b2sNetworkAddGroupInfoModal').modal('show');
4102
+ var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4103
+ jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4104
+ jQuery('#b2sNetworkAddGroupInfoModal').modal('hide');
4105
+ wop(b2sAuthUrl + '&choose=group', 'Blog2Social Network');
4106
+ return false;
4107
+ });
4108
+ return false;
4109
+ });
4110
+
4111
+ jQuery(document).on('click', '.b2s-network-add-instagram-info-btn', function () {
4112
+ jQuery('#b2sNetworkAddInstagramInfoModal').modal('show');
4113
+ var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4114
+ jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4115
+ jQuery('#b2sNetworkAddInstagramInfoModal').modal('hide');
4116
+ wop(b2sAuthUrl + '&choose=profile', 'Blog2Social Network');
4117
+ return false;
4118
+ });
4119
+ return false;
4120
+ });
4121
+
4122
+ jQuery(document).on('click', '.b2s-network-add-instagram-business-info-btn', function () {
4123
+ jQuery('#b2sNetworkAddInstagramBusinessInfoModal').modal('show');
4124
+ var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
4125
+ jQuery(document).on('click', '.b2s-add-network-continue-btn', function () {
4126
+ jQuery('#b2sNetworkAddInstagramBusinessInfoModal').modal('hide');
4127
+ wop(b2sAuthUrl + '&choose=page', 'Blog2Social Network');
4128
+ return false;
4129
+ });
4130
+ return false;
4131
+ });
4132
+
4133
+ function openPostFormat(networkId, networkType, networkAuthId, wpType, showModal) {
4134
+ if (jQuery('#user_version').val() >= 1) {
4135
+ jQuery('.b2s-user-network-settings-post-format-area').hide();
4136
+ jQuery('.b2s-user-network-settings-post-format-area[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').show();
4137
+ jQuery('#b2s-post-ship-item-post-format-network-title').html(jQuery('.b2s-user-network-settings-post-format-area[data-network-id="' + networkId + '"]').attr('data-network-title'));
4138
+ if (jQuery('#user_version').val() >= 2) {
4139
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
4140
+ var currentPostFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val();
4141
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"][data-post-format="' + currentPostFormat + '"]').addClass('b2s-settings-checked');
4142
+ jQuery('#b2s-post-ship-item-post-format-network-display-name').html(jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + networkAuthId + '"]').text().toUpperCase());
4143
+ }
4144
+ jQuery('.b2s-post-format-settings-info').hide();
4145
+ jQuery('.b2s-post-format-settings-info[data-network-id="' + networkId + '"]').show();
4146
+ if (showModal) {
4147
+ jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
4148
+ }
4149
+ jQuery('.b2s-user-network-settings-post-format').attr('data-network-auth-id', networkAuthId);
4150
+ jQuery('.b2s-user-network-settings-post-format').attr('data-post-wp-type', wpType);
4151
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == "1" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != currentOGImage && jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-meta-type') == 'og') {
4152
+ jQuery('.b2s-select-link-chang-image').show();
4153
+ } else {
4154
+ jQuery('.b2s-select-link-chang-image').hide();
4155
+ }
4156
+ } else {
4157
+ if (showModal) {
4158
+ jQuery('#b2sInfoFormatModal').modal('show');
4159
+ }
4160
+ }
4161
+ return false;
4162
+ }
4163
+
4164
+ function changePostFormat(networkId, networkType, postFormat, networkAuthId, postFormatType, postType, closeModal) {
4165
+ jQuery('.b2s-settings-user-success').hide();
4166
+ jQuery('.b2s-settings-user-error').hide();
4167
+ jQuery('.b2s-server-connection-fail').hide();
4168
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
4169
+ //PostFormat
4170
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
4171
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
4172
+ if (jQuery('#user_version').val() >= 2) {
4173
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][postFormat]);
4174
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(postFormat);
4175
+ } else {
4176
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][postFormat]);
4177
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
4178
+ }
4179
+ if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-meta-type') == 'og' && postType != "ex") {
4180
+ if (currentOGImage == '' && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != '') {
4181
+ currentOGImage = jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val();
4182
+ if (postFormat == "0") {
4183
+ jQuery('.b2s-network-select-btn[data-meta-type="og"]').each(function () {
4184
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentOGImage);
4185
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentOGImage);
4186
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
4187
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
4188
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
4189
+ }
4190
+ });
4191
+ }
4192
+ }
4193
+ if (postFormat == "0" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != currentOGImage) {
4194
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
4195
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
4196
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
4197
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
4198
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4199
+ }
4200
+ }
4201
+ }
4202
+ }
4203
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').attr('data-network-text-limit');
4204
+ if (textLimit != "0") {
4205
+ networkLimitAll(networkAuthId, networkId, textLimit);
4206
+ } else {
4207
+ networkCount(networkAuthId);
4208
+ }
4209
+
4210
+ //Edit Meta Tags
4211
+ var isMetaChecked = false;
4212
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
4213
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
4214
+ isMetaChecked = true;
4215
+ }
4216
+ if ((networkId == "2" || networkId == "24") && jQuery('#isCardMetaChecked').val() == "1") {
4217
+ isMetaChecked = true;
4218
+ }
4219
+ if (isMetaChecked && postFormat == '0' && jQuery('#user_version').val() > 0) { //If linkpost
4220
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
4221
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
4222
+ var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
4223
+ if (dataMetaType == "og") {
4224
+ jQuery('#b2sChangeOgMeta').val("1");
4225
+ } else {
4226
+ jQuery('#b2sChangeCardMeta').val("1");
4227
+ }
4228
+
4229
+ //Copy from further item meta tags by same network
4230
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
4231
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
4232
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
4233
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
4234
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
4235
+ if (jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]:visible').length == 1) {
4236
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
4237
+ } else {
4238
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
4239
+ }
4240
+
4241
+ return true;
4242
+ }
4243
+ });
4244
+
4245
+ //Set & Check Link
4246
+ if (typeof jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]') !== undefined) {
4247
+ //Facebook + Twitter && Linkpost
4248
+ if (networkId == 1 || networkId == 2 && postFormat == 0) {
4249
+ if (jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
4250
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefault_url').val());
4251
+ }
4252
+ }
4253
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
4254
+ if (jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hasClass('disabled')) {
4255
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').removeClass('disabled');
4256
+ }
4257
+ }
4258
+
4259
+ } else {
4260
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4261
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4262
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
4263
+ }
4264
+
4265
+ //Content Curation V5.0.0
4266
+ if (postType == "ex") {
4267
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4268
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
4269
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
4270
+ if (postFormat == '0') {
4271
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
4272
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
4273
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
4274
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
4275
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
4276
+ } else {
4277
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
4278
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
4279
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
4280
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
4281
+ }
4282
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
4283
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4284
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4285
+ }
4286
+ }
4287
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
4288
+ jQuery('.b2s-user-network-settings-post-format[data-network-auth-id="' + networkAuthId + '"][data-post-format="' + postFormat + '"]').addClass('b2s-settings-checked');
4289
+ if (closeModal) {
4290
+ jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
4291
+ }
4292
+ checkGifAnimation(networkAuthId, networkId);
4293
+
4294
+ //Multi Image
4295
+ if (postFormat == 1 && ((networkId == 1 && (networkType == 1 || networkType == 2)) || (networkId == 2)) && jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != 1) {
4296
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').show();
4297
+ } else {
4298
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
4299
+ }
4300
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="0"]').show();
4301
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="1"]').show();
4302
+ jQuery('.b2s-multi-image-area[data-network-auth-id="' + networkAuthId + '"][data-network-count="2"]').show();
4303
+
4304
+ if (postFormat == 0 && networkId == 1) {
4305
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('required_network_url');
4306
+ }
4307
+
4308
+ if (networkId == 2) {
4309
+ if (postFormat == 0) {
4310
+ jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').show();
4311
+ } else {
4312
+ jQuery('.b2s-alert-twitter-card[data-network-auth-id="' + networkAuthId + '"]').hide();
4313
+ }
4314
+ }
4315
+ return false;
4316
+ }
4317
+
4318
+ //Network: Tumblr post format
4319
+ jQuery(document).on('change', '.b2s-post-item-details-post-format[data-network-id="4"]', function () {
4320
+ var type = jQuery(this).val();
4321
+ var networkAuthId = jQuery(this).data('network-auth-id');
4322
+ if (type == 2) {
4323
+ jQuery('.b2s-format-area-tumblr-image[data-network-auth-id="' + networkAuthId + '"]').hide();
4324
+ jQuery('.b2s-format-area-tumblr-link[data-network-auth-id="' + networkAuthId + '"]').show();
4325
+ jQuery('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]').show();
4326
+ }
4327
+ if (type == 1) {
4328
+ jQuery('.b2s-format-area-tumblr-link[data-network-auth-id="' + networkAuthId + '"]').show();
4329
+ jQuery('.b2s-format-area-tumblr-image[data-network-auth-id="' + networkAuthId + '"]').show();
4330
+ jQuery('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]').hide();
4331
+ }
4332
+ if (type == 0) {
4333
+ jQuery('.b2s-format-area-tumblr-link[data-network-auth-id="' + networkAuthId + '"]').hide();
4334
+ jQuery('.b2s-format-area-tumblr-image[data-network-auth-id="' + networkAuthId + '"]').hide();
4335
+ jQuery('.b2s-post-item-details-item-message-area[data-network-auth-id="' + networkAuthId + '"]').show();
4336
+ }
4337
  });
assets/js/b2s/start.js CHANGED
@@ -1,6 +1,9 @@
1
  jQuery.noConflict();
2
 
3
- /* Calendar-Widget */
 
 
 
4
  jQuery(document).ready(function () {
5
  jQuery('.b2s-widget-calendar').fullCalendar({
6
  editable: false,
@@ -21,7 +24,7 @@ jQuery(document).ready(function () {
21
  center: '',
22
  right: 'showall today prev,next'
23
  },
24
- eventSources: ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=all' + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
25
  eventRender: function (event, element) {
26
  show = true;
27
  $header = jQuery("<div>").addClass("b2s-calendar-header");
@@ -288,3 +291,68 @@ function isMail(mail) {
288
  return regex.test(mail);
289
  }
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  jQuery.noConflict();
2
 
3
+ var curSource = new Array();
4
+ curSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=all&filter_status=0&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
5
+ var newSource = new Array();
6
+
7
  jQuery(document).ready(function () {
8
  jQuery('.b2s-widget-calendar').fullCalendar({
9
  editable: false,
24
  center: '',
25
  right: 'showall today prev,next'
26
  },
27
+ eventSources: curSource[0],
28
  eventRender: function (event, element) {
29
  show = true;
30
  $header = jQuery("<div>").addClass("b2s-calendar-header");
291
  return regex.test(mail);
292
  }
293
 
294
+ jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
295
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
296
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
297
+ jQuery('.b2s-widget-calendar').fullCalendar('removeEventSources');
298
+ jQuery('.b2s-widget-calendar').fullCalendar('addEventSource', newSource[0]);
299
+ curSource[0] = newSource[0];
300
+
301
+ jQuery('.b2s-calendar-filter-network-account-list').html("");
302
+ jQuery('.b2s-calendar-filter-network-account-list').hide();
303
+ if (jQuery(this).val() != 'all') {
304
+ jQuery.ajax({
305
+ url: ajaxurl,
306
+ type: "POST",
307
+ dataType: "json",
308
+ cache: false,
309
+ async: false,
310
+ data: {
311
+ 'action': 'b2s_get_calendar_filter_network_auth',
312
+ 'network_id': jQuery(this).val(),
313
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
314
+ },
315
+ success: function (data) {
316
+ if (data.result == true) {
317
+ jQuery(".b2s-calendar-filter-network-account-list").show();
318
+ jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
319
+ } else {
320
+ if (data.error == 'nonce') {
321
+ jQuery('.b2s-nonce-check-fail').show();
322
+ }
323
+ }
324
+ }
325
+ });
326
+ }
327
+ return false;
328
+ });
329
+
330
+
331
+ jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
332
+ var filter_network_details_auth_id = jQuery(this).val();
333
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
334
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
335
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
336
+ jQuery('.b2s-widget-calendar').fullCalendar('removeEventSources');
337
+ jQuery('.b2s-widget-calendar').fullCalendar('addEventSource', newSource[0]);
338
+ curSource[0] = newSource[0];
339
+
340
+ return false;
341
+
342
+ });
343
+
344
+ jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
345
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
346
+ var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
347
+ if (typeof filter_network_details_auth_id == 'undefined') {
348
+ filter_network_details_auth_id = 'all';
349
+ }
350
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
351
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=' + filter_network_details_auth_id + '&filter_network=' + filter_network_id + '&filter_status=' + filter_status + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
352
+ jQuery('.b2s-widget-calendar').fullCalendar('removeEventSources');
353
+ jQuery('.b2s-widget-calendar').fullCalendar('addEventSource', newSource[0]);
354
+ curSource[0] = newSource[0];
355
+
356
+ return false;
357
+
358
+ });
assets/lib/coloris/coloris.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .clr-picker{display:none;flex-wrap:wrap;position:absolute;width:200px;z-index:1000;border-radius:10px;background-color:#fff;justify-content:space-between;box-shadow:0 0 5px rgba(0,0,0,.05),0 5px 20px rgba(0,0,0,.1);-moz-user-select:none;-webkit-user-select:none;user-select:none}.clr-picker.clr-open{display:flex}.clr-gradient{position:relative;width:100%;height:100px;margin-bottom:15px;border-radius:3px 3px 0 0;background-image:linear-gradient(rgba(0,0,0,0),#000),linear-gradient(90deg,#fff,currentColor);cursor:pointer}.clr-marker{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border:1px solid #fff;border-radius:50%;background-color:currentColor;cursor:pointer}.clr-picker input[type=range]::-webkit-slider-runnable-track{width:100%;height:8px}.clr-picker input[type=range]::-webkit-slider-thumb{width:8px;height:8px;-webkit-appearance:none}.clr-picker input[type=range]::-moz-range-track{width:100%;height:8px;border:0}.clr-picker input[type=range]::-moz-range-thumb{width:8px;height:8px;border:0}.clr-hue{background-image:linear-gradient(to right,red 0,#ff0 16.66%,#0f0 33.33%,#0ff 50%,#00f 66.66%,#f0f 83.33%,red 100%)}.clr-alpha,.clr-hue{position:relative;width:calc(100% - 40px);height:8px;margin:5px 20px;border-radius:4px}.clr-alpha span{display:block;height:100%;width:100%;border-radius:inherit;background-image:linear-gradient(90deg,rgba(0,0,0,0),currentColor)}.clr-alpha input,.clr-hue input{position:absolute;width:calc(100% + 16px);height:16px;left:-8px;top:-4px;margin:0;background-color:transparent;opacity:0;cursor:pointer;appearance:none;-webkit-appearance:none}.clr-alpha div,.clr-hue div{position:absolute;width:16px;height:16px;left:0;top:50%;margin-left:-8px;transform:translateY(-50%);border:2px solid #fff;border-radius:50%;background-color:currentColor;box-shadow:0 0 1px #888;pointer-events:none}.clr-alpha div:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border-radius:50%;background-color:currentColor}.clr-format{display:none;order:1;width:calc(100% - 40px);margin:0 20px 20px}.clr-segmented{display:flex;position:relative;width:100%;margin:0;padding:0;border:1px solid #ddd;border-radius:15px;box-sizing:border-box;color:#999;font-size:12px}.clr-segmented input,.clr-segmented legend{position:absolute;width:100%;height:100%;margin:0;padding:0;border:0;left:0;top:0;opacity:0;pointer-events:none}.clr-segmented label{flex-grow:1;padding:4px 0;text-align:center;cursor:pointer}.clr-segmented label:first-of-type{border-radius:10px 0 0 10px}.clr-segmented label:last-of-type{border-radius:0 10px 10px 0}.clr-segmented input:checked+label{color:#fff;background-color:#666}.clr-swatches{order:2;width:calc(100% - 32px);margin:0 16px}.clr-swatches div{display:flex;flex-wrap:wrap;padding-bottom:12px;justify-content:center}.clr-swatches button{position:relative;width:20px;height:20px;margin:0 4px 6px 4px;border:0;border-radius:50%;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;cursor:pointer}.clr-swatches button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}input.clr-color{order:1;width:calc(100% - 80px);height:32px;margin:15px 20px 20px 0;padding:0 10px;border:1px solid #ddd;border-radius:16px;color:#444;background-color:#fff;font-family:sans-serif;font-size:14px;text-align:center;box-shadow:none}input.clr-color:focus{outline:0;border:1px solid #1e90ff}.clr-clear{display:none;order:2;height:24px;margin:0 20px 20px auto;padding:0 20px;border:0;border-radius:12px;color:#fff;background-color:#666;font-family:inherit;font-size:12px;font-weight:400;cursor:pointer}.clr-preview{position:relative;width:32px;height:32px;margin:15px 0 20px 20px;border:0;border-radius:50%;overflow:hidden;cursor:pointer}.clr-preview:after,.clr-preview:before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;border:1px solid #fff;border-radius:50%}.clr-preview:after{border:0;background-color:currentColor;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.clr-alpha div,.clr-color,.clr-hue div,.clr-marker{box-sizing:border-box}.clr-field{display:inline-block;position:relative;color:transparent}.clr-field button{position:absolute;width:30px;height:100%;right:0;top:50%;transform:translateY(-50%);border:0;color:inherit;text-indent:-1000px;white-space:nowrap;overflow:hidden;pointer-events:none}.clr-field button:after{content:'';display:block;position:absolute;width:100%;height:100%;left:0;top:0;border-radius:inherit;background-color:currentColor;box-shadow:inset 0 0 1px rgba(0,0,0,.5)}.clr-alpha,.clr-alpha div,.clr-field button,.clr-preview:before,.clr-swatches button{background-image:repeating-linear-gradient(45deg,#aaa 25%,transparent 25%,transparent 75%,#aaa 75%,#aaa),repeating-linear-gradient(45deg,#aaa 25%,#fff 25%,#fff 75%,#aaa 75%,#aaa);background-position:0 0,4px 4px;background-size:8px 8px}.clr-marker:focus{outline:0}.clr-keyboard-nav .clr-alpha input:focus+div,.clr-keyboard-nav .clr-hue input:focus+div,.clr-keyboard-nav .clr-marker:focus,.clr-keyboard-nav .clr-segmented input:focus+label{outline:0;box-shadow:0 0 0 2px #1e90ff,0 0 2px 2px #fff}.clr-picker[data-alpha=false] .clr-alpha{display:none}.clr-picker[data-minimal=true]{padding-top:16px}.clr-picker[data-minimal=true] .clr-alpha,.clr-picker[data-minimal=true] .clr-color,.clr-picker[data-minimal=true] .clr-gradient,.clr-picker[data-minimal=true] .clr-hue,.clr-picker[data-minimal=true] .clr-preview{display:none}.clr-dark{background-color:#444}.clr-dark .clr-segmented{border-color:#777}.clr-dark .clr-swatches button:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.3)}.clr-dark input.clr-color{color:#fff;border-color:#777;background-color:#555}.clr-dark input.clr-color:focus{border-color:#1e90ff}.clr-dark .clr-preview:after{box-shadow:inset 0 0 0 1px rgba(255,255,255,.5)}.clr-dark .clr-alpha,.clr-dark .clr-alpha div,.clr-dark .clr-preview:before,.clr-dark .clr-swatches button{background-image:repeating-linear-gradient(45deg,#666 25%,transparent 25%,transparent 75%,#888 75%,#888),repeating-linear-gradient(45deg,#888 25%,#444 25%,#444 75%,#888 75%,#888)}.clr-picker.clr-polaroid{border-radius:6px;box-shadow:0 0 5px rgba(0,0,0,.1),0 5px 30px rgba(0,0,0,.2)}.clr-picker.clr-polaroid:before{content:'';display:block;position:absolute;width:16px;height:10px;left:20px;top:-10px;border:solid transparent;border-width:0 8px 10px 8px;border-bottom-color:currentColor;box-sizing:border-box;color:#fff;filter:drop-shadow(0 -4px 3px rgba(0,0,0,.1));pointer-events:none}.clr-picker.clr-polaroid.clr-dark:before{color:#444}.clr-picker.clr-polaroid.clr-left:before{left:auto;right:20px}.clr-picker.clr-polaroid.clr-top:before{top:auto;bottom:-10px;transform:rotateZ(180deg)}.clr-polaroid .clr-gradient{width:calc(100% - 20px);height:120px;margin:10px;border-radius:3px}.clr-polaroid .clr-alpha,.clr-polaroid .clr-hue{width:calc(100% - 30px);height:10px;margin:6px 15px;border-radius:5px}.clr-polaroid .clr-alpha div,.clr-polaroid .clr-hue div{box-shadow:0 0 5px rgba(0,0,0,.2)}.clr-polaroid .clr-format{width:calc(100% - 20px);margin:0 10px 15px}.clr-polaroid .clr-swatches{width:calc(100% - 12px);margin:0 6px}.clr-polaroid .clr-swatches div{padding-bottom:10px}.clr-polaroid .clr-swatches button{width:22px;height:22px}.clr-polaroid input.clr-color{width:calc(100% - 60px);margin:10px 10px 15px 0}.clr-polaroid .clr-clear{margin:0 10px 15px auto}.clr-polaroid .clr-preview{margin:10px 0 15px 10px}.clr-picker.clr-large{width:275px}.clr-large .clr-gradient{height:150px}.clr-large .clr-swatches button{width:22px;height:22px}
assets/lib/coloris/coloris.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /*!
2
+ * Copyright (c) 2021 Momo Bassit.
3
+ * Licensed under the MIT License (MIT)
4
+ * https://github.com/mdbassit/Coloris
5
+ */
6
+ !function(d,p,s){var h,f,v,c,u,y,i,b,l,g,m,w,k,x,a=p.createElement("canvas").getContext("2d"),E={r:0,g:0,b:0,h:0,s:0,v:0,a:1},L={el:"[data-coloris]",parent:null,theme:"default",themeMode:"light",wrap:!0,margin:2,format:"hex",formatToggle:!1,swatches:[],swatchesOnly:!1,alpha:!0,focusInput:!0,autoClose:!1,clearButton:{show:!1,label:"Clear"},a11y:{open:"Open color picker",close:"Close color picker",marker:"Saturation: {s}. Brightness: {v}.",hueSlider:"Hue slider",alphaSlider:"Opacity slider",input:"Color value field",format:"Color format",swatch:"Color swatch",instruction:"Saturation and brightness selector. Use up, down, left and right arrow keys to select."}};function o(e){if("object"==typeof e)for(var t in e)switch(t){case"el":S(e.el),!1!==e.wrap&&T(e.el);break;case"parent":L.parent=p.querySelector(e.parent),L.parent&&L.parent.appendChild(h);break;case"themeMode":L.themeMode=e.themeMode,"auto"===e.themeMode&&d.matchMedia&&d.matchMedia("(prefers-color-scheme: dark)").matches&&(L.themeMode="dark");case"theme":e.theme&&(L.theme=e.theme),h.className="clr-picker clr-"+L.theme+" clr-"+L.themeMode;break;case"margin":e.margin*=1,L.margin=(isNaN(e.margin)?L:e).margin;break;case"wrap":e.el&&e.wrap&&T(e.el);break;case"formatToggle":N("clr-format").style.display=e.formatToggle?"block":"none",e.formatToggle&&(L.format="auto");break;case"swatches":Array.isArray(e.swatches)&&function(){var a=[];e.swatches.forEach(function(e,t){a.push('<button id="clr-swatch-'+t+'" aria-labelledby="clr-swatch-label clr-swatch-'+t+'" style="color: '+e+';">'+e+"</button>")}),a.length&&(N("clr-swatches").innerHTML="<div>"+a.join("")+"</div>")}();break;case"swatchesOnly":L.swatchesOnly=!!e.swatchesOnly,h.setAttribute("data-minimal",L.swatchesOnly),L.swatchesOnly&&(L.autoClose=!0);break;case"alpha":L.alpha=!!e.alpha,h.setAttribute("data-alpha",L.alpha);break;case"clearButton":var a="none";e.clearButton.show&&(a="block"),e.clearButton.label&&(i.innerHTML=e.clearButton.label),i.style.display=a;break;case"a11y":var l,r=e.a11y,o=!1;if("object"==typeof r)for(var n in r)r[n]&&L.a11y[n]&&(L.a11y[n]=r[n],o=!0);o&&(l=N("clr-open-label"),a=N("clr-swatch-label"),l.innerHTML=L.a11y.open,a.innerHTML=L.a11y.swatch,u.setAttribute("aria-label",L.a11y.close),b.setAttribute("aria-label",L.a11y.hueSlider),g.setAttribute("aria-label",L.a11y.alphaSlider),y.setAttribute("aria-label",L.a11y.input),f.setAttribute("aria-label",L.a11y.instruction));default:L[t]=e[t]}}function S(e){O(p,"click",e,function(e){var t=L.parent,a=e.target.getBoundingClientRect(),l=d.scrollY,r={left:!1,top:!1},o={x:0,y:0},n=a.x,i=l+a.y+a.height+L.margin;w=e.target,x=w.value,k=function(e){e=e.substring(0,3).toLowerCase();return"rgb"!==e&&"hsl"!==e?"hex":e}(x),h.classList.add("clr-open");var c,s=h.offsetWidth,u=h.offsetHeight;t?(c=d.getComputedStyle(t),e=parseFloat(c.marginTop),c=parseFloat(c.borderTopWidth),(o=t.getBoundingClientRect()).y+=c+l,n-=o.x,i-=o.y,n+s>t.clientWidth&&(n+=a.width-s,r.left=!0),i+u>t.clientHeight-e&&(i-=a.height+u+2*L.margin,r.top=!0),i+=t.scrollTop):(n+s>p.documentElement.clientWidth&&(n+=a.width-s,r.left=!0),i+u-l>p.documentElement.clientHeight&&(i=l+a.y-u-L.margin,r.top=!0)),h.classList.toggle("clr-left",r.left),h.classList.toggle("clr-top",r.top),h.style.left=n+"px",h.style.top=i+"px",v={width:f.offsetWidth,height:f.offsetHeight,x:h.offsetLeft+f.offsetLeft+o.x,y:h.offsetTop+f.offsetTop+o.y},A(x),L.focusInput&&y.focus({preventScroll:!0})}),O(p,"input",e,function(e){var t=e.target.parentNode;t.classList.contains("clr-field")&&(t.style.color=e.target.value)})}function T(e){p.querySelectorAll(e).forEach(function(e){var t,a=e.parentNode;a.classList.contains("clr-field")||((t=p.createElement("div")).innerHTML='<button aria-labelledby="clr-open-label"></button>',a.insertBefore(t,e),t.setAttribute("class","clr-field"),t.style.color=e.value,t.appendChild(e))})}function n(e){w&&(e&&x!==w.value&&(w.value=x,w.dispatchEvent(new Event("input",{bubbles:!0}))),x!==w.value&&w.dispatchEvent(new Event("change",{bubbles:!0})),h.classList.remove("clr-open"),L.focusInput&&w.focus({preventScroll:!0}),w=null)}function A(e){var t=function(e){a.fillStyle="#000",a.fillStyle=e,e=(e=/^((rgba)|rgb)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i.exec(a.fillStyle))?{r:+e[3],g:+e[4],b:+e[5],a:+e[6]}:(e=a.fillStyle.replace("#","").match(/.{2}/g).map(function(e){return parseInt(e,16)}),{r:e[0],g:e[1],b:e[2],a:1});return e}(e),e=function(e){var t=e.r/255,a=e.g/255,l=e.b/255,r=s.max(t,a,l),o=s.min(t,a,l),n=r-o,i=r,c=0,o=0;n&&(r===t&&(c=(a-l)/n),r===a&&(c=2+(l-t)/n),r===l&&(c=4+(t-a)/n),r&&(o=n/r));return{h:(c=s.floor(60*c))<0?c+360:c,s:s.round(100*o),v:s.round(100*i),a:e.a}}(t);M(e.s,e.v),H(t,e),b.value=e.h,h.style.color="hsl("+e.h+", 100%, 50%)",l.style.left=e.h/360*100+"%",c.style.left=v.width*e.s/100+"px",c.style.top=v.height-v.height*e.v/100+"px",g.value=100*e.a,m.style.left=100*e.a+"%"}function r(e){w&&(w.value=void 0!==e?e:y.value,w.dispatchEvent(new Event("input",{bubbles:!0})))}function C(e,t){e={h:+b.value,s:e/v.width*100,v:100-t/v.height*100,a:g.value/100},t=function(e){var t=e.s/100,a=e.v/100,l=t*a,r=e.h/60,o=l*(1-s.abs(r%2-1)),n=a-l;l+=n,o+=n;t=s.floor(r)%6,a=[l,o,n,n,o,l][t],r=[o,l,l,o,n,n][t],t=[n,n,o,l,l,o][t];return{r:s.round(255*a),g:s.round(255*r),b:s.round(255*t),a:e.a}}(e);M(e.s,e.v),H(t,e),r()}function M(e,t){var a=L.a11y.marker;e=+e.toFixed(1),t=+t.toFixed(1),a=(a=a.replace("{s}",e)).replace("{v}",t),c.setAttribute("aria-label",a)}function t(e){var t={pageX:((a=e).changedTouches?a.changedTouches[0]:a).pageX,pageY:(a.changedTouches?a.changedTouches[0]:a).pageY},a=t.pageX-v.x,t=t.pageY-v.y;L.parent&&(t+=L.parent.scrollTop),a=a<0?0:a>v.width?v.width:a,t=t<0?0:t>v.height?v.height:t,c.style.left=a+"px",c.style.top=t+"px",C(a,t),e.preventDefault(),e.stopPropagation()}function H(e,t){void 0===t&&(t={});var a,l,r=L.format;for(a in e=void 0===e?{}:e)E[a]=e[a];for(l in t)E[l]=t[l];var o,n=function(e){var t=e.r.toString(16),a=e.g.toString(16),l=e.b.toString(16),r="";e.r<16&&(t="0"+t);e.g<16&&(a="0"+a);e.b<16&&(l="0"+l);L.alpha&&e.a<1&&(e=255*e.a|0,r=e.toString(16),e<16&&(r="0"+r));return"#"+t+a+l+r}(E),i=n.substring(0,7);switch(c.style.color=i,m.parentNode.style.color=i,m.style.color=n,u.style.color=n,f.style.display="none",f.offsetHeight,f.style.display="",m.nextElementSibling.style.display="none",m.nextElementSibling.offsetHeight,m.nextElementSibling.style.display="","mixed"===r?r=1===E.a?"hex":"rgb":"auto"===r&&(r=k),r){case"hex":y.value=n;break;case"rgb":y.value=(o=E,L.alpha&&1!==o.a?"rgba("+o.r+", "+o.g+", "+o.b+", "+o.a+")":"rgb("+o.r+", "+o.g+", "+o.b+")");break;case"hsl":y.value=(o=function(e){var t,a=e.v/100,l=a*(1-e.s/100/2);0<l&&l<1&&(t=s.round((a-l)/s.min(l,1-l)*100));return{h:e.h,s:t||0,l:s.round(100*l),a:e.a}}(E),L.alpha&&1!==o.a?"hsla("+o.h+", "+o.s+"%, "+o.l+"%, "+o.a+")":"hsl("+o.h+", "+o.s+"%, "+o.l+"%)")}p.querySelector('.clr-format [value="'+r+'"]').checked=!0}function e(){var e=+b.value,t=+c.style.left.replace("px",""),a=+c.style.top.replace("px","");h.style.color="hsl("+e+", 100%, 50%)",l.style.left=e/360*100+"%",C(t,a)}function B(){var e=g.value/100;m.style.left=100*e+"%",H({a:e}),r()}function N(e){return p.getElementById(e)}function O(e,t,a,l){var r=Element.prototype.matches||Element.prototype.msMatchesSelector;"string"==typeof a?e.addEventListener(t,function(e){r.call(e.target,a)&&l.call(e.target,e)}):(l=a,e.addEventListener(t,l))}function D(e,t){t=void 0!==t?t:[],"loading"!==p.readyState?e.apply(void 0,t):p.addEventListener("DOMContentLoaded",function(){e.apply(void 0,t)})}void 0!==NodeList&&NodeList.prototype&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),d.Coloris=function(){var r={set:o,wrap:T,close:n};function e(e){D(function(){e&&("string"==typeof e?S:o)(e)})}for(var t in r)!function(l){e[l]=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];D(r[l],t)}}(t);return e}(),D(function(){(h=p.createElement("div")).setAttribute("id","clr-picker"),h.className="clr-picker",h.innerHTML='<input id="clr-color-value" class="clr-color" type="text" value="" aria-label="'+L.a11y.input+'"><div id="clr-color-area" class="clr-gradient" role="application" aria-label="'+L.a11y.instruction+'"><div id="clr-color-marker" class="clr-marker" tabindex="0"></div></div><div class="clr-hue"><input id="clr-hue-slider" type="range" min="0" max="360" step="1" aria-label="'+L.a11y.hueSlider+'"><div id="clr-hue-marker"></div></div><div class="clr-alpha"><input id="clr-alpha-slider" type="range" min="0" max="100" step="1" aria-label="'+L.a11y.alphaSlider+'"><div id="clr-alpha-marker"></div><span></span></div><div id="clr-format" class="clr-format"><fieldset class="clr-segmented"><legend>'+L.a11y.format+'</legend><input id="clr-f1" type="radio" name="clr-format" value="hex"><label for="clr-f1">Hex</label><input id="clr-f2" type="radio" name="clr-format" value="rgb"><label for="clr-f2">RGB</label><input id="clr-f3" type="radio" name="clr-format" value="hsl"><label for="clr-f3">HSL</label><span></span></fieldset></div><div id="clr-swatches" class="clr-swatches"></div><button id="clr-clear" class="clr-clear">'+L.clearButton.label+'</button><button id="clr-color-preview" class="clr-preview" aria-label="'+L.a11y.close+'"></button><span id="clr-open-label" hidden>'+L.a11y.open+'</span><span id="clr-swatch-label" hidden>'+L.a11y.swatch+"</span>",p.body.appendChild(h),f=N("clr-color-area"),c=N("clr-color-marker"),i=N("clr-clear"),u=N("clr-color-preview"),y=N("clr-color-value"),b=N("clr-hue-slider"),l=N("clr-hue-marker"),g=N("clr-alpha-slider"),m=N("clr-alpha-marker"),S(L.el),T(L.el),O(h,"mousedown",function(e){h.classList.remove("clr-keyboard-nav"),e.stopPropagation()}),O(f,"mousedown",function(e){O(p,"mousemove",t)}),O(f,"touchstart",function(e){p.addEventListener("touchmove",t,{passive:!1})}),O(c,"mousedown",function(e){O(p,"mousemove",t)}),O(c,"touchstart",function(e){p.addEventListener("touchmove",t,{passive:!1})}),O(y,"change",function(e){A(y.value),r()}),O(i,"click",function(e){r(""),n()}),O(u,"click",function(e){r(),n()}),O(p,"click",".clr-format input",function(e){k=e.target.value,H(),r()}),O(h,"click",".clr-swatches button",function(e){A(e.target.textContent),r(),L.autoClose&&n()}),O(p,"mouseup",function(e){p.removeEventListener("mousemove",t)}),O(p,"touchend",function(e){p.removeEventListener("touchmove",t)}),O(p,"mousedown",function(e){h.classList.remove("clr-keyboard-nav"),n()}),O(p,"keydown",function(e){"Escape"===e.key?n(!0):"Tab"===e.key&&h.classList.add("clr-keyboard-nav")}),O(p,"click",".clr-field button",function(e){e.target.nextElementSibling.dispatchEvent(new Event("click",{bubbles:!0}))}),O(c,"keydown",function(e){var t={ArrowUp:[0,-1],ArrowDown:[0,1],ArrowLeft:[-1,0],ArrowRight:[1,0]};-1!==Object.keys(t).indexOf(e.key)&&(!function(e,t){e=+c.style.left.replace("px","")+e,t=+c.style.top.replace("px","")+t,c.style.left=e+"px",c.style.top=t+"px",C(e,t)}.apply(void 0,t[e.key]),e.preventDefault())}),O(f,"click",t),O(b,"input",e),O(g,"input",B)})}(window,document,Math);
assets/lib/wysiwyg/square.min.css CHANGED
@@ -1,5 +1,5 @@
1
- /*! SCEditor | (C) 2011-2016, Sam Clarke | sceditor.com/license */.sceditor-button div,div.sceditor-grip{background-image:url(famfamfam.png);background-repeat:no-repeat;width:16px;height:16px}.sceditor-button-youtube div{background-position:0 0}.sceditor-button-link div{background-position:0 -16px}.sceditor-button-unlink div{background-position:0 -32px}.sceditor-button-underline div{background-position:0 -48px}.sceditor-button-time div{background-position:0 -64px}.sceditor-button-table div{background-position:0 -80px}.sceditor-button-superscript div{background-position:0 -96px}.sceditor-button-subscript div{background-position:0 -112px}.sceditor-button-strike div{background-position:0 -128px}.sceditor-button-source div{background-position:0 -144px}.sceditor-button-size div{background-position:0 -160px}.sceditor-button-rtl div{background-position:0 -176px}.sceditor-button-right div{background-position:0 -192px}.sceditor-button-removeformat div{background-position:0 -208px}.sceditor-button-quote div{background-position:0 -224px}.sceditor-button-print div{background-position:0 -240px}.sceditor-button-pastetext div{background-position:0 -256px}.sceditor-button-paste div{background-position:0 -272px}.sceditor-button-outdent div{background-position:0 -288px}.sceditor-button-orderedlist div{background-position:0 -304px}.sceditor-button-maximize div{background-position:0 -320px}.sceditor-button-ltr div{background-position:0 -336px}.sceditor-button-left div{background-position:0 -352px}.sceditor-button-justify div{background-position:0 -368px}.sceditor-button-italic div{background-position:0 -384px}.sceditor-button-indent div{background-position:0 -400px}.sceditor-button-image div{background-position:0 -416px}.sceditor-button-horizontalrule div{background-position:0 -432px}.sceditor-button-format div{background-position:0 -448px}.sceditor-button-font div{background-position:0 -464px}.sceditor-button-emoticon div{background-position:0 -480px}.sceditor-button-email div{background-position:0 -496px}.sceditor-button-date div{background-position:0 -512px}.sceditor-button-cut div{background-position:0 -528px}.sceditor-button-copy div{background-position:0 -544px}.sceditor-button-color div{background-position:0 -560px}.sceditor-button-code div{background-position:0 -576px}.sceditor-button-center div{background-position:0 -592px}.sceditor-button-bulletlist div{background-position:0 -608px}.sceditor-button-bold div{background-position:0 -624px}div.sceditor-grip{background-position:0 -640px}.rtl div.sceditor-grip{background-position:0 -650px}.sceditor-container{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;position:relative;background:#fff;border:1px solid #d9d9d9;font-size:13px;font-family:Arial,Helvetica Neue,Helvetica,sans-serif;color:#333;line-height:1;font-weight:700;height:250px;border-radius:4px}.sceditor-container *,.sceditor-container :after,.sceditor-container :before{-webkit-box-sizing:content-box;box-sizing:content-box}.sceditor-container,.sceditor-container div,div.sceditor-dropdown,div.sceditor-dropdown div{padding:0;margin:0;z-index:3}.sceditor-container iframe,.sceditor-container textarea{display:block;-ms-flex:1 1 0%;-webkit-box-flex:1;flex:1 1 0%;line-height:1.25;border:0;outline:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;color:#111;padding:0;margin:5px;resize:none;background:#fff;height:auto!important;width:auto!important;width:calc(100% - 10px)!important;min-height:1px}.sceditor-container textarea{margin:7px 5px}div.sceditor-dnd-cover{position:absolute;top:0;left:0;bottom:0;right:0;background:hsla(0,0%,100%,.2);border:5px dashed #aaa;z-index:200;font-size:2em;text-align:center;color:#aaa}div.sceditor-dnd-cover p{position:relative;top:45%;pointer-events:none}div.sceditor-resize-cover{position:absolute;top:0;left:0;background:#000;width:100%;height:100%;z-index:10;opacity:.3}div.sceditor-grip{overflow:hidden;width:10px;height:10px;cursor:pointer;position:absolute;bottom:0;right:0;z-index:3;line-height:0}div.sceditor-grip.has-icon{background-image:none}.sceditor-maximize{position:fixed;top:0;left:0;height:100%!important;width:100%!important;border-radius:0;background-clip:padding-box;z-index:2000}body.sceditor-maximize,html.sceditor-maximize{height:100%;width:100%;padding:0;margin:0;overflow:hidden}.sceditor-maximize div.sceditor-grip{display:none}.sceditor-maximize div.sceditor-toolbar{border-radius:0;background-clip:padding-box}div.sceditor-dropdown{position:absolute;border:1px solid #ccc;background:#fff;z-index:4000;padding:10px;font-weight:400;font-size:15px;border-radius:2px;background-clip:padding-box;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);box-shadow:1px 2px 4px rgba(0,0,0,.2)}div.sceditor-dropdown *,div.sceditor-dropdown :after,div.sceditor-dropdown :before{-webkit-box-sizing:border-box;box-sizing:border-box}div.sceditor-dropdown a,div.sceditor-dropdown a:link{color:#333}div.sceditor-dropdown form{margin:0}div.sceditor-dropdown label{display:block;font-weight:700;color:#3c3c3c;padding:4px 0}div.sceditor-dropdown input,div.sceditor-dropdown textarea{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;outline:0;padding:4px;border:1px solid #ccc;border-top-color:#888;margin:0 0 .75em;border-radius:1px;background-clip:padding-box}div.sceditor-dropdown textarea{padding:6px}div.sceditor-dropdown input:focus,div.sceditor-dropdown textarea:focus{border-color:#666 #aaa #aaa;-webkit-box-shadow:inset 0 1px 5px rgba(0,0,0,.1);box-shadow:inset 0 1px 5px rgba(0,0,0,.1)}div.sceditor-dropdown .button{font-weight:700;color:#444;padding:6px 12px;background:#ececec;border:1px solid #ccc;border-radius:2px;background-clip:padding-box;cursor:pointer;margin:.3em 0 0}div.sceditor-dropdown .button:hover{background:#f3f3f3;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.15);box-shadow:0 1px 1px rgba(0,0,0,.15)}div.sceditor-font-picker,div.sceditor-fontsize-picker,div.sceditor-format{padding:6px 0}div.sceditor-color-picker{padding:4px}div.sceditor-emoticons,div.sceditor-more-emoticons{padding:0}.sceditor-pastetext textarea{border:1px solid #bbb;width:20em}.sceditor-emoticons img,.sceditor-more-emoticons img{padding:0;cursor:pointer;margin:2px}.sceditor-more{border-top:1px solid #bbb;display:block;text-align:center;cursor:pointer;font-weight:700;padding:6px 0}.sceditor-dropdown a:hover{background:#eee}.sceditor-font-option,.sceditor-fontsize-option,.sceditor-format a{display:block;padding:7px 10px;cursor:pointer;text-decoration:none;color:#222}.sceditor-fontsize-option{padding:7px 13px}.sceditor-color-column{float:left}.sceditor-color-option{display:block;border:2px solid #fff;height:18px;width:18px;overflow:hidden}.sceditor-color-option:hover{border:1px solid #aaa}div.sceditor-toolbar{-ms-flex-negative:0;flex-shrink:0;overflow:hidden;padding:3px 5px 2px;background:#f7f7f7;border-bottom:1px solid silver;line-height:0;text-align:left;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:3px 3px 0 0;background-clip:padding-box}div.sceditor-group{display:inline-block;background:#ddd;margin:1px 5px 1px 0;padding:1px;border-bottom:1px solid #aaa;border-radius:3px}.sceditor-button{float:left;cursor:pointer;padding:3px 5px;width:16px;height:20px;border-radius:3px}.sceditor-button.active,.sceditor-button:active,.sceditor-button:hover{background:#fff;-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2)}.sceditor-button:active{background:#fff;-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3)}.sceditor-button.disabled:hover{background:inherit;cursor:default;-webkit-box-shadow:none;box-shadow:none}.sceditor-button,.sceditor-button div{display:block}.sceditor-button svg{display:inline-block;height:16px;width:16px;margin:2px 0;fill:#111;text-decoration:none;pointer-events:none;line-height:1}.sceditor-button.disabled svg{fill:#888}.sceditor-button div{display:inline-block;margin:2px 0;padding:0;overflow:hidden;line-height:0;font-size:0;color:rgba(0,0,0,0)}.sceditor-button.has-icon div{display:none}.sceditor-button.disabled div{opacity:.3}.sceditor-button.text,.sceditor-button.text-icon,.sceditor-button.text-icon div,.sceditor-button.text div,.text-icon .sceditor-button,.text-icon .sceditor-button div,.text .sceditor-button,.text .sceditor-button div{display:inline-block;width:auto;line-height:16px;font-size:1em;color:inherit;text-indent:0}.sceditor-button.has-icon div,.sceditor-button.text div,.text-icon .sceditor-button.has-icon div,.text .sceditor-button div{padding:0 2px;background:none}.sceditor-button.text svg,.text .sceditor-button svg{display:none}.sceditor-button.text-icon div,.text-icon .sceditor-button div{padding:0 2px 0 20px}.rtl div.sceditor-toolbar{text-align:right}.rtl .sceditor-button{float:right}.rtl div.sceditor-grip{right:auto;left:0}.sceditor-container{border:1px solid #d6d6d6;border-radius:0;background-clip:padding-box}.sceditor-container textarea{font-family:Consolas,Bitstream Vera Sans Mono,Andale Mono,Monaco,DejaVu Sans Mono,Lucida Console,monospace;background:#2e3436;color:#fff;margin:0;padding:5px}div.sceditor-group,div.sceditor-toolbar{background:#f2f2f2;background:-webkit-gradient(linear,left top, left bottom,color-stop(0, #f2f2f2),color-stop(89%, #ddd));background:-o-linear-gradient(top,#f2f2f2 0,#ddd 89%);background:linear-gradient(180deg,#f2f2f2 0,#ddd 89%)}div.sceditor-toolbar{padding:0;border-bottom:1px solid #bbb;background-size:100% 32px}div.sceditor-group{margin:0;padding:2px 4px;border:0;border-right:1px solid #ccc;border-left:1px solid #eaeaea;border-radius:0;background-clip:padding-box}div.sceditor-group:last-child{border-right:0}div.sceditor-group:first-child{border-left:0}.sceditor-button{height:16px;padding:5px;margin:1px;border-radius:0;background-clip:padding-box}.sceditor-button div,.sceditor-button svg{margin:0}.sceditor-button.active,.sceditor-button.active:hover,.sceditor-button:active,.sceditor-button:hover{margin:0;-webkit-box-shadow:none;box-shadow:none}.sceditor-button.active{background:#f4f4f4;border:1px solid #ccc}.sceditor-button:hover{background:#fefefe;border:1px solid #ddd}.sceditor-button.disabled:hover{margin:1px;border:0}.sceditor-button:active{background:#eee;border:1px solid #ccc}.sceditor-button.active:hover{background:#f8f8f8;border:1px solid #ddd}
2
- .sceditor-button-h1 div { background: url('h1-button.png'); }
3
- .sceditor-button-h2 div { background: url('h2-button.png'); }
4
- .sceditor-button-custom-image div { background-position:0 -416px }
5
  .sceditor-button-custom-emoji div { background-position:0 -480px }
1
+ /*! SCEditor | (C) 2011-2016, Sam Clarke | sceditor.com/license */.sceditor-button div,div.sceditor-grip{background-image:url(famfamfam.png);background-repeat:no-repeat;width:16px;height:16px}.sceditor-button-youtube div{background-position:0 0}.sceditor-button-link div{background-position:0 -16px}.sceditor-button-unlink div{background-position:0 -32px}.sceditor-button-underline div{background-position:0 -48px}.sceditor-button-time div{background-position:0 -64px}.sceditor-button-table div{background-position:0 -80px}.sceditor-button-superscript div{background-position:0 -96px}.sceditor-button-subscript div{background-position:0 -112px}.sceditor-button-strike div{background-position:0 -128px}.sceditor-button-source div{background-position:0 -144px}.sceditor-button-size div{background-position:0 -160px}.sceditor-button-rtl div{background-position:0 -176px}.sceditor-button-right div{background-position:0 -192px}.sceditor-button-removeformat div{background-position:0 -208px}.sceditor-button-quote div{background-position:0 -224px}.sceditor-button-print div{background-position:0 -240px}.sceditor-button-pastetext div{background-position:0 -256px}.sceditor-button-paste div{background-position:0 -272px}.sceditor-button-outdent div{background-position:0 -288px}.sceditor-button-orderedlist div{background-position:0 -304px}.sceditor-button-maximize div{background-position:0 -320px}.sceditor-button-ltr div{background-position:0 -336px}.sceditor-button-left div{background-position:0 -352px}.sceditor-button-justify div{background-position:0 -368px}.sceditor-button-italic div{background-position:0 -384px}.sceditor-button-indent div{background-position:0 -400px}.sceditor-button-image div{background-position:0 -416px}.sceditor-button-horizontalrule div{background-position:0 -432px}.sceditor-button-format div{background-position:0 -448px}.sceditor-button-font div{background-position:0 -464px}.sceditor-button-emoticon div{background-position:0 -480px}.sceditor-button-email div{background-position:0 -496px}.sceditor-button-date div{background-position:0 -512px}.sceditor-button-cut div{background-position:0 -528px}.sceditor-button-copy div{background-position:0 -544px}.sceditor-button-color div{background-position:0 -560px}.sceditor-button-code div{background-position:0 -576px}.sceditor-button-center div{background-position:0 -592px}.sceditor-button-bulletlist div{background-position:0 -608px}.sceditor-button-bold div{background-position:0 -624px}div.sceditor-grip{background-position:0 -640px}.rtl div.sceditor-grip{background-position:0 -650px}.sceditor-container{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;position:relative;background:#fff;border:1px solid #d9d9d9;font-size:13px;font-family:Arial,Helvetica Neue,Helvetica,sans-serif;color:#333;line-height:1;font-weight:700;height:250px;border-radius:4px}.sceditor-container *,.sceditor-container :after,.sceditor-container :before{-webkit-box-sizing:content-box;box-sizing:content-box}.sceditor-container,.sceditor-container div,div.sceditor-dropdown,div.sceditor-dropdown div{padding:0;margin:0;z-index:3}.sceditor-container iframe,.sceditor-container textarea{display:block;-ms-flex:1 1 0%;-webkit-box-flex:1;flex:1 1 0%;line-height:1.25;border:0;outline:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;color:#111;padding:0;margin:5px;resize:none;background:#fff;height:auto!important;width:auto!important;width:calc(100% - 10px)!important;min-height:1px}.sceditor-container textarea{margin:7px 5px}div.sceditor-dnd-cover{position:absolute;top:0;left:0;bottom:0;right:0;background:hsla(0,0%,100%,.2);border:5px dashed #aaa;z-index:200;font-size:2em;text-align:center;color:#aaa}div.sceditor-dnd-cover p{position:relative;top:45%;pointer-events:none}div.sceditor-resize-cover{position:absolute;top:0;left:0;background:#000;width:100%;height:100%;z-index:10;opacity:.3}div.sceditor-grip{overflow:hidden;width:10px;height:10px;cursor:pointer;position:absolute;bottom:0;right:0;z-index:3;line-height:0}div.sceditor-grip.has-icon{background-image:none}.sceditor-maximize{position:fixed;top:0;left:0;height:100%!important;width:100%!important;border-radius:0;background-clip:padding-box;z-index:2000}body.sceditor-maximize,html.sceditor-maximize{height:100%;width:100%;padding:0;margin:0;overflow:hidden}.sceditor-maximize div.sceditor-grip{display:none}.sceditor-maximize div.sceditor-toolbar{border-radius:0;background-clip:padding-box}div.sceditor-dropdown{position:absolute;border:1px solid #ccc;background:#fff;z-index:4000;padding:10px;font-weight:400;font-size:15px;border-radius:2px;background-clip:padding-box;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);box-shadow:1px 2px 4px rgba(0,0,0,.2)}div.sceditor-dropdown *,div.sceditor-dropdown :after,div.sceditor-dropdown :before{-webkit-box-sizing:border-box;box-sizing:border-box}div.sceditor-dropdown a,div.sceditor-dropdown a:link{color:#333}div.sceditor-dropdown form{margin:0}div.sceditor-dropdown label{display:block;font-weight:700;color:#3c3c3c;padding:4px 0}div.sceditor-dropdown input,div.sceditor-dropdown textarea{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;outline:0;padding:4px;border:1px solid #ccc;border-top-color:#888;margin:0 0 .75em;border-radius:1px;background-clip:padding-box}div.sceditor-dropdown textarea{padding:6px}div.sceditor-dropdown input:focus,div.sceditor-dropdown textarea:focus{border-color:#666 #aaa #aaa;-webkit-box-shadow:inset 0 1px 5px rgba(0,0,0,.1);box-shadow:inset 0 1px 5px rgba(0,0,0,.1)}div.sceditor-dropdown .button{font-weight:700;color:#444;padding:6px 12px;background:#ececec;border:1px solid #ccc;border-radius:2px;background-clip:padding-box;cursor:pointer;margin:.3em 0 0}div.sceditor-dropdown .button:hover{background:#f3f3f3;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.15);box-shadow:0 1px 1px rgba(0,0,0,.15)}div.sceditor-font-picker,div.sceditor-fontsize-picker,div.sceditor-format{padding:6px 0}div.sceditor-color-picker{padding:4px}div.sceditor-emoticons,div.sceditor-more-emoticons{padding:0}.sceditor-pastetext textarea{border:1px solid #bbb;width:20em}.sceditor-emoticons img,.sceditor-more-emoticons img{padding:0;cursor:pointer;margin:2px}.sceditor-more{border-top:1px solid #bbb;display:block;text-align:center;cursor:pointer;font-weight:700;padding:6px 0}.sceditor-dropdown a:hover{background:#eee}.sceditor-font-option,.sceditor-fontsize-option,.sceditor-format a{display:block;padding:7px 10px;cursor:pointer;text-decoration:none;color:#222}.sceditor-fontsize-option{padding:7px 13px}.sceditor-color-column{float:left}.sceditor-color-option{display:block;border:2px solid #fff;height:18px;width:18px;overflow:hidden}.sceditor-color-option:hover{border:1px solid #aaa}div.sceditor-toolbar{-ms-flex-negative:0;flex-shrink:0;overflow:hidden;padding:3px 5px 2px;background:#f7f7f7;border-bottom:1px solid silver;line-height:0;text-align:left;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:3px 3px 0 0;background-clip:padding-box}div.sceditor-group{display:inline-block;background:#ddd;margin:1px 5px 1px 0;padding:1px;border-bottom:1px solid #aaa;border-radius:3px}.sceditor-button{float:left;cursor:pointer;padding:3px 5px;width:16px;height:20px;border-radius:3px}.sceditor-button.active,.sceditor-button:active,.sceditor-button:hover{background:#fff;-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2)}.sceditor-button:active{background:#fff;-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3)}.sceditor-button.disabled:hover{background:inherit;cursor:default;-webkit-box-shadow:none;box-shadow:none}.sceditor-button,.sceditor-button div{display:block}.sceditor-button svg{display:inline-block;height:16px;width:16px;margin:2px 0;fill:#111;text-decoration:none;pointer-events:none;line-height:1}.sceditor-button.disabled svg{fill:#888}.sceditor-button div{display:inline-block;margin:2px 0;padding:0;overflow:hidden;line-height:0;font-size:0;color:rgba(0,0,0,0)}.sceditor-button.has-icon div{display:none}.sceditor-button.disabled div{opacity:.3}.sceditor-button.text,.sceditor-button.text-icon,.sceditor-button.text-icon div,.sceditor-button.text div,.text-icon .sceditor-button,.text-icon .sceditor-button div,.text .sceditor-button,.text .sceditor-button div{display:inline-block;width:auto;line-height:16px;font-size:1em;color:inherit;text-indent:0}.sceditor-button.has-icon div,.sceditor-button.text div,.text-icon .sceditor-button.has-icon div,.text .sceditor-button div{padding:0 2px;background:none}.sceditor-button.text svg,.text .sceditor-button svg{display:none}.sceditor-button.text-icon div,.text-icon .sceditor-button div{padding:0 2px 0 20px}.rtl div.sceditor-toolbar{text-align:right}.rtl .sceditor-button{float:right}.rtl div.sceditor-grip{right:auto;left:0}.sceditor-container{border:1px solid #d6d6d6;border-radius:0;background-clip:padding-box}.sceditor-container textarea{font-family:Consolas,Bitstream Vera Sans Mono,Andale Mono,Monaco,DejaVu Sans Mono,Lucida Console,monospace;background:#2e3436;color:#fff;margin:0;padding:5px}div.sceditor-group,div.sceditor-toolbar{background:#f2f2f2;background:-webkit-gradient(linear,left top, left bottom,color-stop(0, #f2f2f2),color-stop(89%, #ddd));background:-o-linear-gradient(top,#f2f2f2 0,#ddd 89%);background:linear-gradient(180deg,#f2f2f2 0,#ddd 89%)}div.sceditor-toolbar{padding:0;border-bottom:1px solid #bbb;background-size:100% 32px}div.sceditor-group{margin:0;padding:2px 4px;border:0;border-right:1px solid #ccc;border-left:1px solid #eaeaea;border-radius:0;background-clip:padding-box}div.sceditor-group:last-child{border-right:0}div.sceditor-group:first-child{border-left:0}.sceditor-button{height:16px;padding:5px;margin:1px;border-radius:0;background-clip:padding-box}.sceditor-button div,.sceditor-button svg{margin:0}.sceditor-button.active,.sceditor-button.active:hover,.sceditor-button:active,.sceditor-button:hover{margin:0;-webkit-box-shadow:none;box-shadow:none}.sceditor-button.active{background:#f4f4f4;border:1px solid #ccc}.sceditor-button:hover{background:#fefefe;border:1px solid #ddd}.sceditor-button.disabled:hover{margin:1px;border:0}.sceditor-button:active{background:#eee;border:1px solid #ccc}.sceditor-button.active:hover{background:#f8f8f8;border:1px solid #ddd}
2
+ .sceditor-button-h1 div { background: url('h1-button.png'); }
3
+ .sceditor-button-h2 div { background: url('h2-button.png'); }
4
+ .sceditor-button-custom-image div { background-position:0 -416px }
5
  .sceditor-button-custom-emoji div { background-position:0 -480px }
blog2social.php CHANGED
@@ -1,99 +1,99 @@
1
- <?php
2
- /*
3
- * Plugin Name:Blog2Social: Social Media Auto Post & Scheduler
4
- * Plugin URI: https://www.blog2social.com
5
- * Description:Auto publish, schedule & share posts on social media: Facebook, Twitter, XING, LinkedIn, Instagram, ... crosspost to pages & groups
6
- * Author: Blog2Social, Adenion
7
- * Text Domain: blog2social
8
- * Domain Path: /languages
9
- * Version: 6.8.7
10
- * Author URI: https://www.blog2social.com
11
- * License: GPL2+
12
- */
13
-
14
- define('B2S_PLUGIN_VERSION', '687');
15
- define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
16
- define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
17
- define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
18
- define('B2S_PLUGIN_HOOK', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
19
- define('B2S_PLUGIN_FILE', __FILE__);
20
- define('B2S_PLUGIN_LANGUAGE_PATH', dirname(plugin_basename(__FILE__)) . '/languages/');
21
- $language = (!in_array(get_locale(), unserialize(B2S_PLUGIN_LANGUAGE))) ? 'en_US' : get_locale();
22
- define('B2S_LANGUAGE', $language);
23
- define('B2S_PLUGIN_BASENAME', plugin_basename(__FILE__));
24
- define('B2S_PLUGIN_API_ENDPOINT', 'https://developer.blog2social.com/wp/v3/');
25
- define('B2S_PLUGIN_API_ENDPOINT_AUTH', 'https://developer.blog2social.com/wp/v3/network/auth.php');
26
- define('B2S_PLUGIN_API_ENDPOINT_AUTH_SHORTENER', 'https://developer.blog2social.com/wp/v3/network/shortener.php');
27
- define('B2S_PLUGIN_PRG_API_ENDPOINT', 'http://developer.pr-gateway.de/wp/v3/');
28
- define('B2S_PLUGIN_SERVER_URL', 'https://developer.blog2social.com');
29
-
30
- //B2SLoader
31
- require_once(B2S_PLUGIN_DIR . 'includes/Loader.php');
32
- require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
33
- require_once(B2S_PLUGIN_DIR . 'includes/System.php');
34
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
35
-
36
- $b2sLoad = new B2S_Loader();
37
- register_uninstall_hook(B2S_PLUGIN_FILE, 'uninstallPlugin');
38
- register_activation_hook(B2S_PLUGIN_FILE, array($b2sLoad, 'activatePlugin'));
39
- register_deactivation_hook(B2S_PLUGIN_FILE, array($b2sLoad, 'deactivatePlugin'));
40
-
41
- $b2sCheck = new B2S_System();
42
- if ($b2sCheck->check() === true) {
43
- add_action('init', array($b2sLoad, 'load'));
44
- } else {
45
- require_once(B2S_PLUGIN_DIR . 'includes/Notice.php');
46
- add_action('admin_notices', array('B2S_Notice', 'sytemNotice'));
47
- }
48
-
49
- function uninstallPlugin() {
50
- require_once(plugin_dir_path(__FILE__) . 'includes/Tools.php');
51
- require_once(plugin_dir_path(__FILE__) . 'includes/System.php');
52
- $b2sCheck = new B2S_System();
53
- if ($b2sCheck->check() === true) {
54
- global $wpdb;
55
- if (is_multisite()) {
56
- $sql = "SELECT blog_id FROM {$wpdb->base_prefix}blogs";
57
- $blog_ids = $wpdb->get_results($sql, ARRAY_A);
58
- if (is_array($blog_ids) && !empty($blog_ids)) {
59
- $union = "";
60
- foreach ($blog_ids as $key => $blog_data) {
61
- $blog_prefix = $wpdb->get_blog_prefix($blog_data['blog_id']);
62
- if (!empty($blog_prefix)) {
63
- $existsTable = $wpdb->get_results('SHOW TABLES LIKE "' . $blog_prefix . 'b2s_user"');
64
- if (is_array($existsTable) && !empty($existsTable)) {
65
- if (!empty($union)) {
66
- $union .= " UNION ALL ";
67
- }
68
- $union .= " SELECT token,blog_user_id FROM {$blog_prefix}b2s_user ";
69
- }
70
- }
71
- }
72
- if (!empty($union)) {
73
- $sql = "SELECT * FROM ( " . $union . " ) as all_tokens";
74
- $data = $wpdb->get_results($sql, ARRAY_A);
75
- if (!empty($data) && is_array($data)) {
76
- require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php');
77
- B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => true));
78
- }
79
- }
80
- }
81
- } else {
82
- $sql = "SELECT token,blog_user_id FROM `{$wpdb->prefix}b2s_user`";
83
- $data = $wpdb->get_results($sql, ARRAY_A);
84
- if (!empty($data) && is_array($data)) {
85
- require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php');
86
- B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => false));
87
- }
88
- }
89
- }
90
- //global $wpdb;
91
- //update_option('b2s_plugin_version', '0');
92
- //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts`');
93
- //$wpdb->query('DROP TABLE IF EXISTS `b2s_user`');
94
- //$wpdb->query('DROP TABLE IF EXISTS `b2s_filter`');
95
- //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_network_details`');
96
- //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_sched_details`');
97
- //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_network_settings`');
98
- //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_contact`');
99
- }
1
+ <?php
2
+ /*
3
+ * Plugin Name:Blog2Social: Social Media Auto Post & Scheduler
4
+ * Plugin URI: https://www.blog2social.com
5
+ * Description:Auto publish, schedule & share posts on social media: Facebook, Twitter, XING, LinkedIn, Instagram, ... crosspost to pages & groups
6
+ * Author: Blog2Social, Adenion
7
+ * Text Domain: blog2social
8
+ * Domain Path: /languages
9
+ * Version: 6.9.0
10
+ * Author URI: https://www.blog2social.com
11
+ * License: GPL2+
12
+ */
13
+
14
+ define('B2S_PLUGIN_VERSION', '690');
15
+ define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
16
+ define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
17
+ define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
18
+ define('B2S_PLUGIN_HOOK', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
19
+ define('B2S_PLUGIN_FILE', __FILE__);
20
+ define('B2S_PLUGIN_LANGUAGE_PATH', dirname(plugin_basename(__FILE__)) . '/languages/');
21
+ $language = (!in_array(get_locale(), unserialize(B2S_PLUGIN_LANGUAGE))) ? 'en_US' : get_locale();
22
+ define('B2S_LANGUAGE', $language);
23
+ define('B2S_PLUGIN_BASENAME', plugin_basename(__FILE__));
24
+ define('B2S_PLUGIN_API_ENDPOINT', 'https://developer.blog2social.com/wp/v3/');
25
+ define('B2S_PLUGIN_API_ENDPOINT_AUTH', 'https://developer.blog2social.com/wp/v3/network/auth.php');
26
+ define('B2S_PLUGIN_API_ENDPOINT_AUTH_SHORTENER', 'https://developer.blog2social.com/wp/v3/network/shortener.php');
27
+ define('B2S_PLUGIN_PRG_API_ENDPOINT', 'http://developer.pr-gateway.de/wp/v3/');
28
+ define('B2S_PLUGIN_SERVER_URL', 'https://developer.blog2social.com');
29
+
30
+ //B2SLoader
31
+ require_once(B2S_PLUGIN_DIR . 'includes/Loader.php');
32
+ require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
33
+ require_once(B2S_PLUGIN_DIR . 'includes/System.php');
34
+ require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
35
+
36
+ $b2sLoad = new B2S_Loader();
37
+ register_uninstall_hook(B2S_PLUGIN_FILE, 'uninstallPlugin');
38
+ register_activation_hook(B2S_PLUGIN_FILE, array($b2sLoad, 'activatePlugin'));
39
+ register_deactivation_hook(B2S_PLUGIN_FILE, array($b2sLoad, 'deactivatePlugin'));
40
+
41
+ $b2sCheck = new B2S_System();
42
+ if ($b2sCheck->check() === true) {
43
+ add_action('init', array($b2sLoad, 'load'));
44
+ } else {
45
+ require_once(B2S_PLUGIN_DIR . 'includes/Notice.php');
46
+ add_action('admin_notices', array('B2S_Notice', 'sytemNotice'));
47
+ }
48
+
49
+ function uninstallPlugin() {
50
+ require_once(plugin_dir_path(__FILE__) . 'includes/Tools.php');
51
+ require_once(plugin_dir_path(__FILE__) . 'includes/System.php');
52
+ $b2sCheck = new B2S_System();
53
+ if ($b2sCheck->check() === true) {
54
+ global $wpdb;
55
+ if (is_multisite()) {
56
+ $sql = "SELECT blog_id FROM {$wpdb->base_prefix}blogs";
57
+ $blog_ids = $wpdb->get_results($sql, ARRAY_A);
58
+ if (is_array($blog_ids) && !empty($blog_ids)) {
59
+ $union = "";
60
+ foreach ($blog_ids as $key => $blog_data) {
61
+ $blog_prefix = $wpdb->get_blog_prefix($blog_data['blog_id']);
62
+ if (!empty($blog_prefix)) {
63
+ $existsTable = $wpdb->get_results('SHOW TABLES LIKE "' . $blog_prefix . 'b2s_user"');
64
+ if (is_array($existsTable) && !empty($existsTable)) {
65
+ if (!empty($union)) {
66
+ $union .= " UNION ALL ";
67
+ }
68
+ $union .= " SELECT token,blog_user_id FROM {$blog_prefix}b2s_user ";
69
+ }
70
+ }
71
+ }
72
+ if (!empty($union)) {
73
+ $sql = "SELECT * FROM ( " . $union . " ) as all_tokens";
74
+ $data = $wpdb->get_results($sql, ARRAY_A);
75
+ if (!empty($data) && is_array($data)) {
76
+ require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php');
77
+ B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => true));
78
+ }
79
+ }
80
+ }
81
+ } else {
82
+ $sql = "SELECT token,blog_user_id FROM `{$wpdb->prefix}b2s_user`";
83
+ $data = $wpdb->get_results($sql, ARRAY_A);
84
+ if (!empty($data) && is_array($data)) {
85
+ require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php');
86
+ B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => false));
87
+ }
88
+ }
89
+ }
90
+ //global $wpdb;
91
+ //update_option('b2s_plugin_version', '0');
92
+ //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts`');
93
+ //$wpdb->query('DROP TABLE IF EXISTS `b2s_user`');
94
+ //$wpdb->query('DROP TABLE IF EXISTS `b2s_filter`');
95
+ //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_network_details`');
96
+ //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_sched_details`');
97
+ //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_network_settings`');
98
+ //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_contact`');
99
+ }
includes/Ajax/Get.php CHANGED
@@ -42,6 +42,7 @@ class Ajax_Get {
42
  add_action('wp_ajax_b2s_get_network_auth_settings', array($this, 'getNetworkAuthSettings'));
43
  add_action('wp_ajax_b2s_update_post_box', array($this, 'updatePostBox'));
44
  add_action('wp_ajax_b2s_get_image_caption', array($this, 'getImageCaption'));
 
45
  }
46
 
47
  public function getBlogPostStatus() {
@@ -266,9 +267,10 @@ class Ajax_Get {
266
  require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
267
  $postData = new B2S_Post_Item();
268
  $showByDate = isset($_POST['showByDate']) ? (preg_match("#^[0-9\-.\]]+$#", trim($_POST['showByDate'])) ? trim($_POST['showByDate']) : "") : "";
269
- $type = (isset($_POST['type']) && in_array($_POST['type'], array('publish', 'notice'))) ? $_POST['type'] : 'publish';
270
  $sharedByUser = (isset($_POST['sharedByUser']) && (int) $_POST['sharedByUser'] > 0) ? (int) $_POST['sharedByUser'] : 0;
271
- $result = $postData->getPublishPostDataHtml((int) $_POST['postId'], $type, $showByDate, $sharedByUser);
 
272
  if ($result !== false) {
273
  echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
274
  wp_die();
@@ -802,5 +804,20 @@ class Ajax_Get {
802
  wp_die();
803
  }
804
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805
 
806
  }
42
  add_action('wp_ajax_b2s_get_network_auth_settings', array($this, 'getNetworkAuthSettings'));
43
  add_action('wp_ajax_b2s_update_post_box', array($this, 'updatePostBox'));
44
  add_action('wp_ajax_b2s_get_image_caption', array($this, 'getImageCaption'));
45
+ add_action('wp_ajax_b2s_load_insights', array($this, 'loadInsights'));
46
  }
47
 
48
  public function getBlogPostStatus() {
267
  require_once (B2S_PLUGIN_DIR . 'includes/Util.php');
268
  $postData = new B2S_Post_Item();
269
  $showByDate = isset($_POST['showByDate']) ? (preg_match("#^[0-9\-.\]]+$#", trim($_POST['showByDate'])) ? trim($_POST['showByDate']) : "") : "";
270
+ $type = (isset($_POST['type']) && in_array($_POST['type'], array('publish', 'notice', 'metrics'))) ? $_POST['type'] : 'publish';
271
  $sharedByUser = (isset($_POST['sharedByUser']) && (int) $_POST['sharedByUser'] > 0) ? (int) $_POST['sharedByUser'] : 0;
272
+ $sharedOnNetwork = (isset($_POST['sharedOnNetwork']) && (int) $_POST['sharedOnNetwork'] > 0) ? (int) $_POST['sharedOnNetwork'] : 0;
273
+ $result = $postData->getPublishPostDataHtml((int) $_POST['postId'], $type, $showByDate, $sharedByUser, $sharedOnNetwork);
274
  if ($result !== false) {
275
  echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId'], 'content' => $result));
276
  wp_die();
804
  wp_die();
805
  }
806
  }
807
+
808
+ public function loadInsights() {
809
+ if (isset($_GET['b2s_security_nonce']) && (int) wp_verify_nonce($_GET['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
810
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Metrics/Item.php');
811
+ $metrics = new B2S_Metrics_Item();
812
+ $filterNetwork = ((isset($_GET['filter_network']) && $_GET['filter_network'] !== 'all' && (int) $_GET['filter_network'] > 0) ? (int) $_GET['filter_network'] : 0);
813
+ $filterDates = ((isset($_GET['filter_dates']) && is_array($_GET['filter_dates']) && !empty($_GET['filter_dates'])) ? $_GET['filter_dates'] : array());
814
+ $data = $metrics->getInsightsData($filterNetwork, $filterDates);
815
+ echo json_encode(array('result' => true, 'data' => $data));
816
+ wp_die();
817
+ } else {
818
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
819
+ wp_die();
820
+ }
821
+ }
822
 
823
  }
includes/Ajax/Post.php CHANGED
@@ -1,2586 +1,2608 @@
1
- <?php
2
-
3
- class Ajax_Post {
4
-
5
- static private $instance = null;
6
-
7
- static public function getInstance() {
8
- if (null === self::$instance) {
9
- self::$instance = new self;
10
- }
11
- return self::$instance;
12
- }
13
-
14
- public function __construct() {
15
- add_action('wp_ajax_b2s_save_ship_data', array($this, 'saveShipData'));
16
- add_action('wp_ajax_b2s_save_user_mandant', array($this, 'saveUserMandant'));
17
- add_action('wp_ajax_b2s_delete_mandant', array($this, 'deleteUserMandant'));
18
- add_action('wp_ajax_b2s_lock_auto_post_import', array($this, 'lockAutoPostImport'));
19
- add_action('wp_ajax_b2s_delete_user_auth', array($this, 'deleteUserAuth'));
20
- add_action('wp_ajax_b2s_update_user_version', array($this, 'updateUserVersion'));
21
- add_action('wp_ajax_b2s_accept_privacy_policy', array($this, 'acceptPrivacyPolicy'));
22
- add_action('wp_ajax_b2s_create_trail', array($this, 'createTrail'));
23
- add_action('wp_ajax_b2s_save_network_board_and_group', array($this, 'saveNetworkBoardAndGroup'));
24
- add_action('wp_ajax_b2s_delete_user_sched_post', array($this, 'deleteUserSchedPost'));
25
- add_action('wp_ajax_b2s_delete_user_publish_post', array($this, 'deleteUserPublishPost'));
26
- add_action('wp_ajax_b2s_delete_user_approve_post', array($this, 'deleteUserApprovePost'));
27
- add_action('wp_ajax_b2s_delete_user_cc_draft_post', array($this, 'deleteUserCcDraftPost'));
28
- add_action('wp_ajax_b2s_user_network_settings', array($this, 'saveUserNetworkSettings'));
29
- add_action('wp_ajax_b2s_auto_post_settings', array($this, 'saveAutoPostSettings'));
30
- add_action('wp_ajax_b2s_save_social_meta_tags', array($this, 'saveSocialMetaTags'));
31
- add_action('wp_ajax_b2s_reset_social_meta_tags', array($this, 'resetSocialMetaTags'));
32
- add_action('wp_ajax_b2s_save_user_time_settings', array($this, 'saveUserTimeSettings'));
33
- add_action('wp_ajax_b2s_network_save_auth_to_settings', array($this, 'saveAuthToSettings'));
34
- add_action('wp_ajax_b2s_prg_login', array($this, 'prgLogin'));
35
- add_action('wp_ajax_b2s_prg_logout', array($this, 'prgLogout'));
36
- add_action('wp_ajax_b2s_prg_ship', array($this, 'prgShip'));
37
- add_action('wp_ajax_b2s_ship_navbar_save_settings', array($this, 'b2sShipNavbarSaveSettings'));
38
- add_action('wp_ajax_b2s_post_mail_update', array($this, 'b2sPostMailUpdate'));
39
- add_action('wp_ajax_b2s_calendar_move_post', array($this, 'b2sCalendarMovePost'));
40
- add_action('wp_ajax_b2s_delete_post', array($this, 'b2sDeletePost'));
41
- add_action('wp_ajax_b2s_edit_save_post', array($this, 'b2sEditSavePost'));
42
- add_action("wp_ajax_b2s_get_calendar_release_locks", array($this, 'releaseLocks'));
43
- add_action("wp_ajax_b2s_update_approve_post", array($this, 'updateApprovePost'));
44
- add_action("wp_ajax_b2s_hide_rating", array($this, 'hideRating'));
45
- add_action("wp_ajax_b2s_hide_premium_message", array($this, 'hidePremiumMessage'));
46
- add_action("wp_ajax_b2s_hide_trail_message", array($this, 'hideTrailMessage'));
47
- add_action("wp_ajax_b2s_hide_trail_ended_message", array($this, 'hideTrailEndedMessage'));
48
- add_action("wp_ajax_b2s_plugin_deactivate_delete_sched_post", array($this, 'b2sPluginDeactivate'));
49
- add_action("wp_ajax_b2s_curation_share", array($this, 'curationShare'));
50
- add_action("wp_ajax_b2s_curation_customize", array($this, 'curationCustomize'));
51
- add_action("wp_ajax_b2s_curation_draft", array($this, 'curationDraft'));
52
- add_action("wp_ajax_b2s_move_user_auth_to_profile", array($this, 'moveUserAuthToProfile'));
53
- add_action("wp_ajax_b2s_assign_network_user_auth", array($this, 'assignNetworkUserAuth'));
54
- add_action("wp_ajax_b2s_save_post_template", array($this, 'savePostTemplate'));
55
- add_action("wp_ajax_b2s_load_default_post_template", array($this, 'loadDefaultPostTemplate'));
56
- add_action('wp_ajax_b2s_save_draft_data', array($this, 'saveDraftData'));
57
- add_action('wp_ajax_b2s_delete_user_draft', array($this, 'deleteDraft'));
58
- add_action('wp_ajax_b2s_auth_network_login', array($this, 'authNetworkLogin'));
59
- add_action('wp_ajax_b2s_auth_network_confirm', array($this, 'authNetworkConfirm'));
60
- add_action('wp_ajax_b2s_change_favorite_status', array($this, 'changeFavoriteStatus'));
61
- add_action('wp_ajax_b2s_save_url_parameter', array($this, 'saveUrlParameter'));
62
- add_action('wp_ajax_b2s_re_post_submit', array($this, 'rePostSubmit'));
63
- add_action('wp_ajax_b2s_delete_re_post_sched', array($this, 'deleteRePostSched'));
64
- add_action('wp_ajax_b2s_community_register', array($this, 'communityRegister'));
65
- add_action('wp_ajax_b2s_auto_post_assign_by_disconnect', array($this, 'autoPostAssignByDisconnect'));
66
- add_action('wp_ajax_b2s_network_check_user_data', array($this, 'networkCheckUserData'));
67
- }
68
-
69
- public function curationDraft() {
70
- //save as blog post
71
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) { //0-24hours lifetime
72
- if (isset($_POST['postFormat'])) {
73
- if ((int) $_POST['postFormat'] == 1) { //Imagepost
74
- if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
75
- $data = array('title' => sanitize_text_field($_POST['comment_image']), 'content' => $_POST['comment_image'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
76
- } else {
77
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
78
- wp_die();
79
- }
80
- } else if ((int) $_POST['postFormat'] == 0) { //Linkpost
81
- if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
82
- $data = array('title' => sanitize_text_field($_POST['title']), 'url' => esc_url($_POST['url']), 'content' => (isset($_POST['comment']) ? sanitize_textarea_field($_POST['comment']) : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
83
- } else {
84
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
85
- wp_die();
86
- }
87
- } else {
88
- if (isset($_POST['comment_text']) && !empty($_POST['comment_text'])) {
89
- $data = array('title' => sanitize_text_field($_POST['comment_text']), 'content' => sanitize_textarea_field($_POST['comment_text']), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
90
- } else {
91
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
92
- wp_die();
93
- }
94
- }
95
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
96
- if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) {
97
- $data = array_merge($data, array('ID' => (int) $_POST['b2s-draft-id']));
98
- $curation = new B2S_Curation_Save($data);
99
- $source = (get_post_meta((int) $_POST['b2s-draft-id'], "b2s_source", true));
100
- $postId = $curation->updateContent($source);
101
- } else {
102
- $curation = new B2S_Curation_Save($data);
103
- $postId = $curation->insertContent();
104
- }
105
- if ($postId !== false) {
106
- if (isset($_POST['ship_type']) && isset($_POST['profile_select'])) {
107
- $draft_data = array(
108
- 'ship_type' => $_POST['ship_type'],
109
- 'profile_select' => $_POST['profile_select']
110
- );
111
- if ((int) $_POST['ship_type'] > 0 && isset($_POST['ship_date'])) {
112
- $draft_data['ship_date'] = $_POST['ship_date'];
113
- }
114
- if (isset($_POST['twitter_select'])) {
115
- $draft_data['twitter_select'] = $_POST['twitter_select'];
116
- }
117
- global $wpdb;
118
- if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}b2s_posts_drafts'") == $wpdb->prefix . 'b2s_posts_drafts') {
119
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
120
- $optionUserTimeZone = $options->_getOption('user_time_zone');
121
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
122
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
123
- $date = B2S_Util::getCustomLocaleDateTime($userTimeZoneOffset);
124
-
125
- $sqlCheckDraft = $wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}b2s_posts_drafts` WHERE `blog_user_id` = %d AND `post_id` = %d AND `save_origin` = 1", B2S_PLUGIN_BLOG_USER_ID, (int) $postId);
126
- $draftEntry = $wpdb->get_var($sqlCheckDraft);
127
- if ($draftEntry !== NULL && (int) $draftEntry > 0) {
128
- $wpdb->update($wpdb->prefix . 'b2s_posts_drafts', array('data' => serialize($draft_data), 'last_save_date' => $date), array('id' => (int) $draftEntry));
129
- } else {
130
- $wpdb->insert($wpdb->prefix . 'b2s_posts_drafts', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'post_id' => (int) $postId, 'data' => serialize($draft_data), 'last_save_date' => $date, 'save_origin' => 1));
131
- }
132
- }
133
- }
134
- echo json_encode(array('result' => true, 'postId' => $postId));
135
- wp_die();
136
- }
137
- }
138
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
139
- wp_die();
140
- } else {
141
- echo json_encode(array('result' => false, 'error' => 'nonce'));
142
- wp_die();
143
- }
144
- }
145
-
146
- public function curationShare() {
147
- //save as blog post
148
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
149
- if (isset($_POST['postFormat'])) {
150
- if ((int) $_POST['postFormat'] == 1) { //Imagepost
151
- if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
152
- $data = array('title' => sanitize_text_field($_POST['comment_image']), 'content' => $_POST['comment_image'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
153
- } else {
154
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
155
- wp_die();
156
- }
157
- } else if ((int) $_POST['postFormat'] == 0) { //Linkpost
158
- if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
159
- $data = array('title' => sanitize_text_field($_POST['title']), 'url' => esc_url($_POST['url']), 'content' => (isset($_POST['comment']) ? sanitize_textarea_field($_POST['comment']) : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
160
- } else {
161
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
162
- wp_die();
163
- }
164
- } else {
165
- if (isset($_POST['comment_text']) && !empty($_POST['comment_text'])) {
166
- $data = array('title' => sanitize_text_field($_POST['comment_text']), 'content' => $_POST['comment_text'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
167
- } else {
168
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
169
- wp_die();
170
- }
171
- }
172
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
173
- $curation = new B2S_Curation_Save($data);
174
- $postId = (isset($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) ? (int) $_POST['b2s-draft-id'] : $curation->insertContent();
175
- if ($postId !== false) {
176
- //check Data
177
- if (isset($_POST['profile_select'])) {
178
- $profilId = (int) $_POST['profile_select'];
179
- if (isset($_POST['profile_data_' . $profilId]) && !empty($_POST['profile_data_' . $profilId])) {
180
- $networkData = json_decode(base64_decode($_POST['profile_data_' . $profilId]));
181
- if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
182
- $notAllowNetwork = array(11);
183
- $tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
184
- $allowNetworkOnlyImage = array(6, 7, 12, 21);
185
- $allowNetworkOnlyLink = array(9, 15);
186
- //TOS Twitter 032018 - none multiple Accounts - User select once
187
- $selectedTwitterProfile = (isset($_POST['twitter_select']) && !empty($_POST['twitter_select'])) ? (int) $_POST['twitter_select'] : '';
188
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/QuickPost.php');
189
- $quickPost = new B2S_QuickPost($data['content'], $data['title']);
190
- $defaultShareData = array('default_titel' => sanitize_text_field($data['title']),
191
- 'image_url' => (!empty($_POST['image_url'])) ? esc_url(trim(urldecode($_POST['image_url']))) : ((!empty($_POST['link_image_url']) ? esc_url(trim(urldecode($_POST['link_image_url']))) : '')),
192
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
193
- 'board' => '',
194
- 'group' => '',
195
- 'post_id' => $postId,
196
- 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
197
- 'tags' => array(),
198
- 'url' => ((isset($_POST['url']) && !empty($_POST['url'])) ? esc_url($_POST['url']) : ''),
199
- 'no_cache' => 0,
200
- 'token' => B2S_PLUGIN_TOKEN,
201
- 'user_timezone' => (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 ),
202
- 'publish_date' => isset($_POST['publish_date']) ? date('Y-m-d H:i:s', strtotime($_POST['publish_date'])) : date('Y-m-d H:i:s', current_time('timestamp')));
203
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Save.php');
204
- $b2sShipSend = new B2S_Ship_Save();
205
- $content = array();
206
- foreach ($networkData as $k => $value) {
207
- if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
208
- //TOS Twitter 032018 - none multiple Accounts - User select once
209
- if ((int) $value->networkId != 2 || ((int) $value->networkId == 2 && (empty($selectedTwitterProfile) || ((int) $selectedTwitterProfile == (int) $value->networkAuthId)))) {
210
- //Filter: image network
211
- if ((int) $_POST['postFormat'] == 0) {
212
- if (in_array($value->networkId, $allowNetworkOnlyImage)) {
213
- if (empty($defaultShareData['image_url'])) {
214
- array_push($content, array('networkDisplayName' => $value->networkUserName, 'networkAuthId' => $value->networkAuthId, 'networkId' => $value->networkId, 'networkType' => $value->networkType, 'html' => $b2sShipSend->getItemHtml($value->networkId, 'IMAGE_FOR_CURATION')));
215
- continue;
216
- }
217
- }
218
- } else if ((int) $_POST['postFormat'] == 1) {
219
- if (in_array($value->networkId, $allowNetworkOnlyLink)) {
220
- array_push($content, array('networkDisplayName' => $value->networkUserName, 'networkAuthId' => $value->networkAuthId, 'networkId' => $value->networkId, 'networkType' => $value->networkType, 'html' => $b2sShipSend->getItemHtml($value->networkId, 'LINK_FOR_CURATION')));
221
- continue;
222
- }
223
- }
224
- //Filter: Blog network
225
- if (in_array($value->networkId, $notAllowNetwork)) {
226
- continue;
227
- }
228
-
229
- //Filter: TOS Crossposting ignore
230
- if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
231
- continue;
232
- }
233
-
234
- //Filter: DeprecatedNetwork-8 31 march
235
- if ($value->networkId == 8) {
236
- if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date']) && strtotime($_POST['ship_date']) !== false) {
237
- if (date('Y-m-d', strtotime($_POST['ship_date'])) >= '2019-03-31') {
238
- //special case xing groups contains network_display_name
239
- global $wpdb;
240
- $networkDetailsId = 0;
241
- if ($value->networkType == 2) {
242
- $networkDetailsIdSelect = $wpdb->get_col($wpdb->prepare("SELECT postNetworkDetails.id FROM {$wpdb->prefix}b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s AND postNetworkDetails.network_display_name = %s", $value->networkAuthId, trim($value->networkUserName)));
243
- } else {
244
- $networkDetailsIdSelect = $wpdb->get_col($wpdb->prepare("SELECT postNetworkDetails.id FROM {$wpdb->prefix}b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $value->networkAuthId));
245
- }
246
- if (isset($networkDetailsIdSelect[0])) {
247
- $networkDetailsId = (int) $networkDetailsIdSelect[0];
248
- } else {
249
- $wpdb->insert($wpdb->prefix . 'b2s_posts_network_details', array(
250
- 'network_id' => (int) $value->networkId,
251
- 'network_type' => (int) $value->networkType,
252
- 'network_auth_id' => (int) $value->networkAuthId,
253
- 'network_display_name' => $value->networkUserName), array('%d', '%d', '%d', '%s'));
254
- $networkDetailsId = $wpdb->insert_id;
255
- }
256
- $timeZone = (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 );
257
- $wpdb->insert($wpdb->prefix . 'b2s_posts', array(
258
- 'post_id' => $postId,
259
- 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
260
- 'user_timezone' => $timeZone,
261
- 'publish_date' => date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate(gmdate('Y-m-d H:i:s'), $timeZone * (-1)))),
262
- 'publish_error_code' => 'DEPRECATED_NETWORK_8',
263
- 'network_details_id' => $networkDetailsId), array('%d', '%d', '%s', '%s', '%s', '%d'));
264
- continue;
265
- }
266
- }
267
- }
268
- $_POST['postFormat'] = ((int) $_POST['postFormat'] == 2) ? '1' : $_POST['postFormat'];
269
- $shareData = $quickPost->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType, $_POST['postFormat']);
270
- if ($shareData !== false) {
271
- $shareData['network_id'] = $value->networkId;
272
- $shareData['network_type'] = $value->networkType;
273
- $shareData['instant_sharing'] = ((isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0);
274
- $shareData['network_display_name'] = $value->networkUserName;
275
- $shareData['network_auth_id'] = $value->networkAuthId;
276
- $shareData = array_merge($shareData, $defaultShareData);
277
- //Type schedule
278
- if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date']) && strtotime($_POST['ship_date']) !== false) {
279
- $shipDateTime = array('date' => array(date('Y-m-d', strtotime($_POST['ship_date']))), 'time' => array(date('H:i', strtotime($_POST['ship_date']))));
280
- $schedData = array(
281
- 'date' => $shipDateTime['date'],
282
- 'time' => $shipDateTime['time'],
283
- 'releaseSelect' => 1,
284
- 'user_timezone' => (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 ),
285
- 'saveSetting' => false);
286
- $schedRes = $b2sShipSend->saveSchedDetails($shareData, $schedData, array());
287
- $schedResult = array_merge($schedRes, array('networkDisplayName' => $value->networkUserName, 'networkId' => $value->networkId, 'networkType' => $value->networkType));
288
- $content = array_merge($content, array($schedResult));
289
- } else {
290
- //TYPE direct share
291
- $b2sShipSend->savePublishDetails($shareData, array(), true);
292
- }
293
- }
294
- }
295
- }
296
- }
297
- if (!empty($b2sShipSend->postDataApprove)) {
298
- $sendResult = $b2sShipSend->getShareApproveDetails(true);
299
- $content = array_merge($content, $sendResult);
300
- }
301
- if (!empty($b2sShipSend->postData)) {
302
- $sendResult = $b2sShipSend->postPublish(true);
303
- $content = array_merge($content, $sendResult);
304
- }
305
- //Render Ouput
306
- if (is_array($content) && !empty($content)) {
307
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/View.php');
308
- $view = new B2S_Curation_View();
309
- echo json_encode(array('result' => true, 'content' => $view->getResultListHtml($content)));
310
- wp_die();
311
- }
312
- }
313
- echo json_encode(array('result' => false, 'error' => 'NO_AUTH'));
314
- wp_die();
315
- }
316
- echo json_encode(array('result' => false, 'error' => 'NO_AUTH'));
317
- wp_die();
318
- }
319
- }
320
- }
321
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
322
- wp_die();
323
- } else {
324
- echo json_encode(array('result' => false, 'error' => 'nonce'));
325
- wp_die();
326
- }
327
- }
328
-
329
- public function curationCustomize() {
330
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
331
- if (isset($_POST['postFormat'])) {
332
- if ((int) $_POST['postFormat'] == 1) { //Imagepost
333
- if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
334
- $data = array('title' => sanitize_text_field($_POST['comment_image']), 'content' => $_POST['comment_image'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
335
- $imgUrl = (isset($_POST['image_url']) && !empty($_POST['image_url'])) ? $_POST['image_url'] : '';
336
- } else {
337
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
338
- wp_die();
339
- }
340
- } else if ((int) $_POST['postFormat'] == 0) { //Linkpost
341
- if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
342
- $data = array('title' => sanitize_text_field($_POST['title']), 'url' => esc_url($_POST['url']), 'content' => (isset($_POST['comment']) ? sanitize_textarea_field($_POST['comment']) : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
343
- $imgUrl = (isset($_POST['link_image_url']) && !empty($_POST['link_image_url'])) ? $_POST['link_image_url'] : '';
344
- } else {
345
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
346
- wp_die();
347
- }
348
- } else if ((int) $_POST['postFormat'] == 2) {//Textpost
349
- if (isset($_POST['comment_text']) && !empty($_POST['comment_text'])) {
350
- $data = array('title' => sanitize_text_field($_POST['comment_text']), 'content' => $_POST['comment_text'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
351
- } else {
352
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
353
- wp_die();
354
- }
355
- }
356
- if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) {
357
- $data = array_merge($data, array('ID' => (int) $_POST['b2s-draft-id']));
358
- }
359
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
360
- $curation = new B2S_Curation_Save($data);
361
- if (isset($data['ID']) && (int) $data['ID'] > 0) {
362
- $postId = $curation->updateContent();
363
- } else {
364
- $postId = $curation->insertContent();
365
- }
366
- if ($postId !== false) {
367
- $redirect_url = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=blog2social-ship&b2sPostType=ex&postId=' . $postId;
368
- if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date'])) {
369
- $sched_date_time = date('Y-m-d H:i:s', strtotime($_POST['ship_date']));
370
- if ($sched_date_time !== false) {
371
- $redirect_url .= '&schedDateTime=' . $sched_date_time;
372
- }
373
- }
374
- if (isset($_POST['profile_select']) && (int) $_POST['profile_select'] > 0) {
375
- $redirect_url .= '&profile=' . $_POST['profile_select'];
376
- }
377
- if (isset($imgUrl) && !empty($imgUrl)) {
378
- $redirect_url .= '&img=' . base64_encode($imgUrl);
379
- }
380
- if (isset($_POST['postFormat'])) {
381
- if ($_POST['postFormat'] == '0') {
382
- $redirect_url .= '&postFormat=0';
383
- } else {
384
- $redirect_url .= '&postFormat=1';
385
- }
386
- }
387
- echo json_encode(array('result' => true, 'redirect' => $redirect_url));
388
- wp_die();
389
- }
390
- }
391
- echo json_encode(array('result' => false));
392
- wp_die();
393
- } else {
394
- echo json_encode(array('result' => false, 'error' => 'nonce'));
395
- wp_die();
396
- }
397
- }
398
-
399
- public function b2sPluginDeactivate() {
400
- if (isset($_POST['b2s_deactivate_nonce']) && (int) wp_verify_nonce($_POST['b2s_deactivate_nonce'], 'b2s_deactivate_nonce') > 0) {
401
- if (isset($_POST['delete_sched_post']) && (int) $_POST['delete_sched_post'] == 1) {
402
- update_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST", 1, false);
403
- } else {
404
- delete_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST");
405
- }
406
- echo json_encode(array('result' => true));
407
- wp_die();
408
- } else {
409
- echo json_encode(array('result' => false, 'error' => 'nonce'));
410
- wp_die();
411
- }
412
- }
413
-
414
- public function prgShip() {
415
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
416
- if (!empty($_POST) && isset($_POST['token']) && !empty($_POST['token']) && isset($_POST['prg_id']) && (int) $_POST['prg_id'] > 0 && isset($_POST['blog_user_id']) && (int) $_POST['blog_user_id'] > 0 && isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
417
- $dataPost = $_POST;
418
- $type = $dataPost['publish'];
419
- $dataPost['status'] = ((int) $type == 1) ? 'hold' : 'open';
420
- unset($dataPost['confirm']);
421
- unset($dataPost['blog_user_id']);
422
- unset($dataPost['post_id']);
423
- unset($dataPost['publish']);
424
- unset($dataPost['b2s_security_nonce']);
425
- $result = json_decode(trim(PRG_Api_Post::post(B2S_PLUGIN_PRG_API_ENDPOINT . 'post.php', $dataPost)));
426
- if (is_object($result) && !empty($result) && isset($result->result) && (int) $result->result == 1 && isset($result->create) && (int) $result->create == 1) {
427
- //Contact
428
- global $wpdb;
429
- $sqlCheckUser = $wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}b2s_user_contact` WHERE `blog_user_id` = %d", (int) $_POST['blog_user_id']);
430
- $userEntry = $wpdb->get_var($sqlCheckUser);
431
- $userContact = array('name_mandant' => sanitize_text_field($_POST['name_mandant']),
432
- 'created' => date('Y-m-d H:i;s'),
433
- 'name_presse' => sanitize_text_field($_POST['name_presse']),
434
- 'anrede_presse' => sanitize_text_field($_POST['anrede_presse']),
435
- 'vorname_presse' => sanitize_text_field($_POST['vorname_presse']),
436
- 'nachname_presse' => sanitize_text_field($_POST['nachname_presse']),
437
- 'strasse_presse' => sanitize_text_field($_POST['strasse_presse']),
438
- 'nummer_presse' => sanitize_text_field($_POST['nummer_presse']),
439
- 'plz_presse' => sanitize_text_field($_POST['plz_presse']),
440
- 'ort_presse' => sanitize_text_field($_POST['ort_presse']),
441
- 'land_presse' => sanitize_text_field($_POST['land_presse']),
442
- 'email_presse' => sanitize_text_field($_POST['email_presse']),
443
- 'telefon_presse' => sanitize_text_field($_POST['telefon_presse']),
444
- 'fax_presse' => isset($_POST['fax_presse']) ? sanitize_text_field($_POST['fax_presse']) : '',
445
- 'url_presse' => esc_url($_POST['url_presse'])
446
- );
447
-
448
- if (!$userEntry) {
449
- $insertData = array_merge(array('blog_user_id' => (int) $_POST['blog_user_id']), $userContact);
450
- $wpdb->insert($wpdb->prefix . 'b2s_user_contact', $insertData);
451
- } else {
452
- $wpdb->update($wpdb->prefix . 'b2s_user_contact', $userContact, array('blog_user_id' => (int) $_POST['blog_user_id']));
453
- }
454
- echo json_encode(array('result' => true, 'error' => 0, 'type' => $type));
455
- wp_die();
456
- }
457
- echo json_encode(array('result' => false, 'error' => 2, 'type' => $type)); //NOTSHIP
458
- wp_die();
459
- }
460
- echo json_encode(array('result' => false, 'error' => 1, 'type' => $type)); //INVALIDDATA
461
- wp_die();
462
- } else {
463
- echo json_encode(array('result' => false, 'error' => 'nonce'));
464
- wp_die();
465
- }
466
- }
467
-
468
- public function lockAutoPostImport() {
469
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
470
- if (isset($_POST['userId']) && (int) $_POST['userId'] > 0) {
471
- update_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $_POST['userId'], 1, false);
472
- }
473
- echo json_encode(array('result' => true));
474
- wp_die();
475
- } else {
476
- echo json_encode(array('result' => false, 'error' => 'nonce'));
477
- wp_die();
478
- }
479
- }
480
-
481
- public function prgLogin() {
482
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
483
- if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
484
- $pubKey = json_decode(PRG_Api_Get::get(B2S_PLUGIN_PRG_API_ENDPOINT . 'auth.php?publicKey=true', array()));
485
- if (!empty($pubKey) && is_object($pubKey) && isset($pubKey->publicKey) && !empty($pubKey->publicKey) && function_exists('openssl_public_encrypt')) {
486
- $usernameCrypted = '';
487
- $passwordCrypted = '';
488
- openssl_public_encrypt(trim($_POST['username']), $usernameCrypted, $pubKey->publicKey);
489
- openssl_public_encrypt(trim($_POST['password']), $passwordCrypted, $pubKey->publicKey);
490
- $datas = array(
491
- 'action' => 'loginPRG',
492
- 'username' => base64_encode($usernameCrypted),
493
- 'password' => base64_encode($passwordCrypted),
494
- );
495
- $result = json_decode(trim(PRG_Api_Post::post(B2S_PLUGIN_PRG_API_ENDPOINT . 'auth.php', $datas)));
496
- if (!empty($result) && is_object($result) && isset($result->prg_token) && !empty($result->prg_token) && isset($result->prg_id) && !empty($result->prg_id)) {
497
- if ((int) $result->prg_id > 0) {
498
- $prgInfo = array('B2S_PRG_ID' => $result->prg_id,
499
- 'B2S_PRG_TOKEN' => $result->prg_token);
500
-
501
- update_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID, $prgInfo, false);
502
- echo json_encode(array('result' => true, 'error' => 0));
503
- wp_die();
504
- }
505
- }
506
- echo json_encode(array('result' => false, 'error' => 1));
507
- wp_die();
508
- }
509
- echo json_encode(array('result' => false, 'error' => 2)); //SSL ERRROR
510
- wp_die();
511
- }
512
- echo json_encode(array('result' => false, 'error' => 1));
513
- wp_die();
514
- } else {
515
- echo json_encode(array('result' => false, 'error' => 'nonce'));
516
- wp_die();
517
- }
518
- }
519
-
520
- public function prgLogout() {
521
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
522
- delete_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID);
523
- echo json_encode(array('result' => true));
524
- wp_die();
525
- } else {
526
- echo json_encode(array('result' => false, 'error' => 'nonce'));
527
- wp_die();
528
- }
529
- }
530
-
531
- public function saveShipData() {
532
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
533
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Save.php');
534
- $post = $_POST;
535
- $metaOg = false;
536
- $metaCard = false;
537
-
538
- if (!isset($post['b2s']) || !is_array($post['b2s']) || !isset($post['post_id']) || (int) $post['post_id'] == 0) {
539
- echo json_encode(array('result' => false));
540
- wp_die();
541
- }
542
-
543
- $b2sShipSend = new B2S_Ship_Save();
544
-
545
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $post['post_id']);
546
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $post['post_id']);
547
-
548
- $content = array();
549
- $schedResult = array();
550
- $defaultPostData = array('token' => B2S_PLUGIN_TOKEN,
551
- 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
552
- 'post_id' => (int) $post['post_id'],
553
- 'default_titel' => isset($post['default_titel']) ? sanitize_text_field($post['default_titel']) : '',
554
- 'no_cache' => 0, //default inactive , 1=active 0=not
555
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))));
556
-
557
- foreach ($post['b2s'] as $networkAuthId => $data) {
558
- if (!isset($data['url']) || !isset($data['network_id'])) {
559
- continue;
560
- }
561
-
562
- if ((int) $data['network_id'] == 1 || (int) $data['network_id'] == 3 || (int) $data['network_id'] == 19) {
563
- $linkNoCache = B2S_Tools::getNoCacheData(B2S_PLUGIN_BLOG_USER_ID);
564
- if (is_array($linkNoCache) && isset($linkNoCache[$data['network_id']]) && (int) $linkNoCache[$data['network_id']] > 0) {
565
- $defaultPostData['no_cache'] = $linkNoCache[$data['network_id']];
566
- }
567
- }
568
-
569
- //Change/Set MetaTags
570
- if (in_array((int) $data['network_id'], json_decode(B2S_PLUGIN_NETWORK_META_TAGS, true)['og']) && $metaOg == false && (int) $post['post_id'] > 0 && isset($data['post_format']) && (int) $data['post_format'] == 0 && isset($post['change_og_meta']) && (int) $post['change_og_meta'] == 1) { //LinkPost
571
- $metaOg = true;
572
- $meta = B2S_Meta::getInstance();
573
- $meta->getMeta((int) $post['post_id']);
574
- if (isset($data['og_title']) && !empty($data['og_title'])) {
575
- $meta->setMeta('og_title', sanitize_text_field($data['og_title']));
576
- }
577
- if (isset($data['og_desc']) && !empty($data['og_desc'])) {
578
- $meta->setMeta('og_desc', sanitize_text_field($data['og_desc']));
579
- }
580
- if (isset($data['image_url']) && !empty($data['image_url'])) {
581
- $meta->setMeta('og_image', trim(esc_url($data['image_url'])));
582
- $meta->setMeta('og_image_alt', '');
583
- }
584
- $meta->updateMeta((int) $post['post_id']);
585
- //TODO update scheds
586
- global $wpdb;
587
- $res = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}b2s_posts LEFT JOIN {$wpdb->prefix}b2s_posts_sched_details ON {$wpdb->prefix}b2s_posts.sched_details_id = {$wpdb->prefix}b2s_posts_sched_details.id LEFT JOIN {$wpdb->prefix}b2s_posts_network_details ON {$wpdb->prefix}b2s_posts.network_details_id = {$wpdb->prefix}b2s_posts_network_details.id WHERE {$wpdb->prefix}b2s_posts.sched_details_id > 0 AND {$wpdb->prefix}b2s_posts.post_id = %d AND {$wpdb->prefix}b2s_posts_network_details.network_id IN (" . implode(',', json_decode(B2S_PLUGIN_NETWORK_META_TAGS, true)['og']) . ") AND sched_date_utc > %s", $post['post_id'], gmdate('Y-m-d H:i:s')));
588
- foreach ($res as $key => $sched) {
589
- $schedData = unserialize($sched->sched_data);
590
- if ((isset($schedData['post_format']) && (int) $schedData['post_format'] == 0) || (!isset($schedData['post_format']) && isset($schedData['image_url']) && !empty($schedData['image_url']))) {
591
- $schedData['image_url'] = $data['image_url'];
592
- $wpdb->update($wpdb->prefix . 'b2s_posts_sched_details', array(
593
- 'sched_data' => serialize($schedData),
594
- 'image_url' => $data['image_url']
595
- ), array("id" => $sched->sched_details_id), array('%s', '%s', '%d'));
596
- }
597
- }
598
- }
599
-
600
- //Change/Set MetaTags
601
- if (((int) $data['network_id'] == 2 || (int) $data['network_id'] == 24) && $metaCard == false && (int) $post['post_id'] > 0 && isset($data['post_format']) && (int) $data['post_format'] == 0 && isset($post['change_card_meta']) && (int) $post['change_card_meta'] == 1) { //LinkPost
602
- $metaCard = true;
603
- $meta = B2S_Meta::getInstance();
604
- $meta->getMeta((int) $post['post_id']);
605
- if (isset($data['card_title']) && !empty($data['card_title'])) {
606
- $meta->setMeta('card_title', sanitize_text_field($data['card_title']));
607
- }
608
- if (isset($data['card_desc']) && !empty($data['card_desc'])) {
609
- $meta->setMeta('card_desc', sanitize_text_field($data['card_desc']));
610
- }
611
- if (isset($data['image_url']) && !empty($data['image_url'])) {
612
- $meta->setMeta('card_image', trim(esc_url($data['image_url'])));
613
- }
614
- $meta->updateMeta((int) $post['post_id']);
615
- }
616
-
617
- //TOS XING Group
618
- if (isset($data['network_tos_group_id']) && !empty($data['network_tos_group_id'])) {
619
- $options = new B2S_Options(0, 'B2S_PLUGIN_TOS_XING_GROUP_CROSSPOSTING');
620
- $options->_setOption((int) $post['post_id'], $data['network_tos_group_id'], true);
621
- }
622
-
623
- $sendData = array("board" => isset($data['board']) ? sanitize_text_field($data['board']) : '',
624
- "group" => isset($data['group']) ? sanitize_text_field($data['group']) : '',
625
- "custom_title" => isset($data['custom_title']) ? sanitize_text_field($data['custom_title']) : '',
626
- "content" => (isset($data['content']) && !empty($data['content'])) ? strip_tags(preg_replace("/(<[\/]*)em(>)/", "$1i$2", html_entity_decode($data['content'])), '<p><h1><h2><br><i><b><a><img>') : '',
627
- 'url' => isset($data['url']) ? htmlspecialchars_decode(esc_url($data['url'])) : '',
628
- 'image_url' => isset($data['image_url']) ? trim(esc_url($data['image_url'])) : '',
629
- 'tags' => isset($data['tags']) ? $data['tags'] : array(),
630
- 'network_id' => isset($data['network_id']) ? (int) $data['network_id'] : 0,
631
- 'instant_sharing' => isset($data['instant_sharing']) ? (int) $data['instant_sharing'] : 0,
632
- 'network_tos_group_id' => (isset($data['network_tos_group_id']) && !empty($data['network_tos_group_id'])) ? trim(sanitize_text_field($data['network_tos_group_id'])) : '',
633
- 'network_type' => isset($data['network_type']) ? (int) $data['network_type'] : '',
634
- 'network_kind' => isset($data['network_kind']) ? (int) $data['network_kind'] : 0,
635
- 'marketplace_category' => isset($data['marketplace_category']) ? (int) $data['marketplace_category'] : 0,
636
- 'marketplace_type' => isset($data['marketplace_type']) ? (int) $data['marketplace_type'] : 0,
637
- 'network_display_name' => isset($data['network_display_name']) ? sanitize_text_field($data['network_display_name']) : '',
638
- 'network_auth_id' => $networkAuthId,
639
- 'post_format' => isset($data['post_format']) ? (int) $data['post_format'] : '',
640
- 'user_timezone' => isset($post['user_timezone']) ? (int) $post['user_timezone'] : 0,
641
- 'publish_date' => isset($post['publish_date']) ? date('Y-m-d H:i:s', strtotime($post['publish_date'])) : date('Y-m-d H:i:s', current_time('timestamp'))
642
- );
643
-
644
- if (isset($data['post_format']) && (int) $data['post_format'] == 1) {
645
- $multi_images = array();
646
- if (isset($data['multi_image_1']) && !empty($data['multi_image_1'])) {
647
- array_push($multi_images, $data['multi_image_1']);
648
- }
649
- if (isset($data['multi_image_2']) && !empty($data['multi_image_2'])) {
650
- array_push($multi_images, $data['multi_image_2']);
651
- }
652
- if (isset($data['multi_image_3']) && !empty($data['multi_image_3'])) {
653
- array_push($multi_images, $data['multi_image_3']);
654
- }
655
- if (!empty($multi_images)) {
656
- $sendData['multi_images'] = json_encode($multi_images);
657
- }
658
- }
659
-
660
- //since V4.8.0 Check Relay and prepare Data
661
- $relayData = array();
662
- if ((int) $data['network_id'] == 2 && isset($data['post_relay_account'][0]) && !empty($data['post_relay_account'][0]) && isset($data['post_relay_delay'][0]) && !empty($data['post_relay_delay'][0])) {
663
- $relayData = array('auth' => $data['post_relay_account'], 'delay' => $data['post_relay_delay']);
664
- }
665
-
666
- //mode: share now
667
- $schedData = array();
668
- if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 0) {
669
- $b2sShipSend->savePublishDetails(array_merge($defaultPostData, $sendData), $relayData);
670
- //mode: schedule custom once times
671
- } else if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 1 && isset($data['date'][0]) && isset($data['time'][0])) {
672
- $schedData = array(
673
- 'date' => isset($data['date']) ? $data['date'] : array(),
674
- 'time' => isset($data['time']) ? $data['time'] : array(),
675
- 'sched_content' => isset($data['sched_content']) ? $data['sched_content'] : array(),
676
- 'sched_image_url' => isset($data['sched_image_url']) ? $data['sched_image_url'] : array(),
677
- 'sched_multi_image_1' => isset($data['sched_multi_image_1']) ? $data['sched_multi_image_1'] : array(),
678
- 'sched_multi_image_2' => isset($data['sched_multi_image_2']) ? $data['sched_multi_image_2'] : array(),
679
- 'sched_multi_image_3' => isset($data['sched_multi_image_3']) ? $data['sched_multi_image_3'] : array(),
680
- 'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
681
- 'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
682
- 'saveSetting' => isset($data['saveSchedSetting']) ? true : false);
683
- $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
684
- $content = array_merge($content, $schedResult);
685
- //mode: recurrently schedule
686
- } else {
687
- $schedData = array(
688
- 'interval_select' => isset($data['intervalSelect']) ? $data['intervalSelect'] : array(),
689
- 'duration_month' => isset($data['duration_month']) ? $data['duration_month'] : array(),
690
- 'select_day' => isset($data['select_day']) ? $data['select_day'] : array(),
691
- 'duration_time' => isset($data['duration_time']) ? $data['duration_time'] : array(),
692
- 'select_timespan' => isset($data['select_timespan']) ? $data['select_timespan'] : array(),
693
- 'weeks' => isset($data['weeks']) ? $data['weeks'] : 0,
694
- 'date' => isset($data['date']) ? $data['date'] : array(),
695
- 'time' => isset($data['time']) ? $data['time'] : array(),
696
- 'mo' => isset($data['mo']) ? $data['mo'] : array(),
697
- 'di' => isset($data['di']) ? $data['di'] : array(),
698
- 'mi' => isset($data['mi']) ? $data['mi'] : array(),
699
- 'do' => isset($data['do']) ? $data['do'] : array(),
700
- 'fr' => isset($data['fr']) ? $data['fr'] : array(),
701
- 'sa' => isset($data['sa']) ? $data['sa'] : array(),
702
- 'so' => isset($data['so']) ? $data['so'] : array(),
703
- 'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
704
- 'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
705
- 'saveSetting' => isset($data['saveSchedSetting']) ? true : false
706
- );
707
-
708
- $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
709
- $content = array_merge($content, $schedResult);
710
- }
711
- }
712
-
713
- if (!empty($b2sShipSend->postDataApprove)) {
714
- $sendResult = $b2sShipSend->getShareApproveDetails();
715
- $content = array_merge($content, $sendResult);
716
- }
717
-
718
- if (!empty($b2sShipSend->postData)) {
719
- $sendResult = $b2sShipSend->postPublish();
720
- $content = array_merge($content, $sendResult);
721
- }
722
-
723
- echo json_encode(array('result' => true, 'content' => $content));
724
- wp_die();
725
- } else {
726
- echo json_encode(array('result' => false, 'error' => 'nonce'));
727
- wp_die();
728
- }
729
- }
730
-
731
- public function saveSocialMetaTags() {
732
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
733
- $result = array('result' => true);
734
- if (isset($_POST['is_admin']) && (int) $_POST['is_admin'] == 1) {
735
-
736
- $options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
737
-
738
- $og_active = (!isset($_POST['b2s_og_active'])) ? 0 : 1;
739
- $options->_setOption('og_active', $og_active);
740
- $options->_setOption('og_default_title', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_og_default_title']) : ''));
741
- $options->_setOption('og_default_desc', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_og_default_desc']) : ''));
742
- $options->_setOption('og_default_image', ((B2S_PLUGIN_USER_VERSION >= 1) ? esc_url($_POST['b2s_og_default_image']) : ''));
743
- $options->_setOption('og_imagedata_active', ((B2S_PLUGIN_USER_VERSION >= 1) ? (int) $_POST['b2s_og_imagedata_active'] : 1));
744
- $options->_setOption('og_objecttype_active', ((B2S_PLUGIN_USER_VERSION >= 1) ? (int) $_POST['b2s_og_objecttype_active'] : 1));
745
- $options->_setOption('og_locale_active', ((B2S_PLUGIN_USER_VERSION >= 1) ? (int) $_POST['b2s_og_locale_active'] : 1));
746
- $options->_setOption('og_locale', ((B2S_PLUGIN_USER_VERSION >= 1) ? esc_html($_POST['b2s_og_locale']) : ''));
747
-
748
- $card_active = (!isset($_POST['b2s_card_active'])) ? 0 : 1;
749
- $options->_setOption('card_active', $card_active);
750
- $options->_setOption('card_default_type', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_card_default_type']) : 0));
751
- $options->_setOption('card_default_title', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_card_default_title']) : ''));
752
- $options->_setOption('card_default_desc', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_card_default_desc']) : ''));
753
- $options->_setOption('card_default_image', ((B2S_PLUGIN_USER_VERSION >= 1) ? esc_url($_POST['b2s_card_default_image']) : ''));
754
-
755
- $oembed_active = (!isset($_POST['b2s_oembed_active'])) ? 0 : 1;
756
- $options->_setOption('oembed_active', $oembed_active);
757
-
758
- $meta = B2S_Meta::getInstance();
759
- $result['b2s'] = ($card_active == 1 || $og_active == 1) ? true : false;
760
- $result['yoast'] = $meta->is_yoast_seo_active();
761
- $result['aioseop'] = $meta->is_aioseop_active();
762
- $result['webdados'] = $meta->is_webdados_active();
763
- }
764
-
765
- echo json_encode($result);
766
- wp_die();
767
- } else {
768
- echo json_encode(array('result' => false, 'error' => 'nonce'));
769
- wp_die();
770
- }
771
- }
772
-
773
- public function resetSocialMetaTags() {
774
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
775
- global $wpdb;
776
- $sql = "DELETE FROM " . $wpdb->postmeta . " WHERE meta_key = %s";
777
- $sql = $wpdb->prepare($sql, "_b2s_post_meta");
778
- $wpdb->query($sql);
779
- echo json_encode(array('result' => true));
780
- wp_die();
781
- } else {
782
- echo json_encode(array('result' => false, 'error' => 'nonce'));
783
- wp_die();
784
- }
785
- }
786
-
787
- public function saveNetworkBoardAndGroup() {
788
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
789
- if (isset($_POST['networkAuthId']) && !empty($_POST['networkAuthId']) && isset($_POST['networkType']) && isset($_POST['boardAndGroup']) && !empty($_POST['boardAndGroup']) && isset($_POST['networkId']) && !empty($_POST['networkId']) && isset($_POST['lang']) && !empty($_POST['lang'])) {
790
- $post = array('token' => B2S_PLUGIN_TOKEN,
791
- 'action' => 'saveNetworkBoardAndGroup',
792
- 'networkAuthId' => (int) $_POST['networkAuthId'],
793
- 'networkType' => (int) $_POST['networkType'],
794
- 'networkId' => (int) $_POST['networkId'],
795
- 'boardAndGroup' => sanitize_text_field($_POST['boardAndGroup']),
796
- 'boardAndGroupName' => (isset($_POST['boardAndGroupName']) && !empty($_POST['boardAndGroupName'])) ? trim(sanitize_text_field($_POST['boardAndGroupName'])) : '',
797
- 'lang' => $_POST['lang']);
798
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
799
- if ($result->result == true) {
800
- echo json_encode(array('result' => true));
801
- wp_die();
802
- }
803
- }
804
- echo json_encode(array('result' => false));
805
- wp_die();
806
- } else {
807
- echo json_encode(array('result' => false, 'error' => 'nonce'));
808
- wp_die();
809
- }
810
- }
811
-
812
- public function saveUserNetworkSettings() {
813
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
814
- if (isset($_POST['short_url'])) {
815
- $post = array('token' => B2S_PLUGIN_TOKEN,
816
- 'action' => 'saveSettings',
817
- 'short_url' => (int) $_POST['short_url']);
818
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
819
- if ($result->result == true) {
820
- echo json_encode(array('result' => true, 'content' => (((int) $_POST['short_url'] >= 1) ? 0 : 1)));
821
- wp_die();
822
- }
823
-
824
- echo json_encode(array('result' => true, 'content' => (isset($_POST['short_url']) ? (int) $_POST['short_url'] : 0)));
825
- wp_die();
826
- }
827
-
828
-
829
- if (isset($_POST['shortener_account_auth_delete'])) {
830
- $post = array('token' => B2S_PLUGIN_TOKEN,
831
- 'action' => 'saveSettings',
832
- 'shortener_account_auth_delete' => (int) $_POST['shortener_account_auth_delete']);
833
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
834
- if ($result->result == true) {
835
- echo json_encode(array('result' => true));
836
- wp_die();
837
- }
838
- echo json_encode(array('result' => true));
839
- wp_die();
840
- }
841
-
842
- if (isset($_POST['allow_shortcode'])) {
843
- if ((int) $_POST['allow_shortcode'] == 1) {
844
- delete_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID);
845
- } else {
846
- update_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID, 1, false);
847
- }
848
- echo json_encode(array('result' => true, 'content' => (((int) $_POST['allow_shortcode'] == 1) ? 0 : 1)));
849
- wp_die();
850
- }
851
-
852
- if (isset($_POST['user_time_zone']) && !empty($_POST['user_time_zone'])) {
853
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
854
- $options->_setOption('user_time_zone', sanitize_text_field($_POST['user_time_zone']));
855
- echo json_encode(array('result' => true));
856
- wp_die();
857
- }
858
-
859
- if (isset($_POST['user_time_format']) && (int) $_POST['user_time_format'] >= 0) {
860
- $user_time_format = 0;
861
- if ((int) $_POST['user_time_format'] > 0) {
862
- $user_time_format = 1;
863
- }
864
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
865
- $options->_setOption('user_time_format', (int) $user_time_format);
866
- echo json_encode(array('result' => true));
867
- wp_die();
868
- }
869
-
870
- if (isset($_POST['legacy_mode'])) {
871
- $options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
872
- $options->_setOption('legacy_mode', (int) $_POST['legacy_mode']);
873
- echo json_encode(array('result' => true, 'content' => (((int) $_POST['legacy_mode'] == 1) ? 0 : 1)));
874
- wp_die();
875
- }
876
- echo json_encode(array('result' => false));
877
- wp_die();
878
- } else {
879
- echo json_encode(array('result' => false, 'error' => 'nonce'));
880
- wp_die();
881
- }
882
- }
883
-
884
- public function saveAutoPostSettings() {
885
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
886
- if (isset($_POST['b2s-import-auto-post']) && (int) $_POST['b2s-import-auto-post'] == 1 && !isset($_POST['b2s-import-auto-post-network-auth-id'])) {
887
- echo json_encode(array('result' => false, 'type' => 'no-auth-selected'));
888
- wp_die();
889
- }
890
-
891
-
892
- //Auto-Poster A
893
- $network_auth_id = isset($_POST['b2s-import-auto-post-network-auth-id']) && is_array($_POST['b2s-import-auto-post-network-auth-id']) ? $_POST['b2s-import-auto-post-network-auth-id'] : array();
894
- $post_type = isset($_POST['b2s-import-auto-post-type-data']) && is_array($_POST['b2s-import-auto-post-type-data']) ? $_POST['b2s-import-auto-post-type-data'] : array();
895
- $post_categories = isset($_POST['b2s-import-auto-post-categories-data']) && is_array($_POST['b2s-import-auto-post-categories-data']) ? $_POST['b2s-import-auto-post-categories-data'] : array();
896
-
897
- $auto_post_import = array('active' => ((isset($_POST['b2s-import-auto-post']) && (int) $_POST['b2s-import-auto-post'] == 1) ? 1 : 0),
898
- 'network_auth_id' => $network_auth_id,
899
- 'ship_state' => ((isset($_POST['b2s-import-auto-post-time-state']) && (int) $_POST['b2s-import-auto-post-time-state'] == 1) ? 1 : 0),
900
- 'ship_delay_time' => (int) $_POST['b2s-import-auto-post-time-data'],
901
- 'post_filter' => ((isset($_POST['b2s-import-auto-post-filter']) && (int) $_POST['b2s-import-auto-post-filter'] == 1) ? 1 : 0),
902
- 'post_type_state' => ((isset($_POST['b2s-import-auto-post-type-state']) && (int) $_POST['b2s-import-auto-post-type-state'] == 1) ? 1 : 0),
903
- 'post_type' => $post_type,
904
- 'post_categories_state' => ((isset($_POST['b2s-import-auto-post-categories-state']) && (int) $_POST['b2s-import-auto-post-categories-state'] == 1) ? 1 : 0),
905
- 'post_categories' => $post_categories);
906
-
907
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
908
- $options->_setOption('auto_post_import', $auto_post_import);
909
-
910
- //Auto-Poster M
911
- $active = ((isset($_POST['b2s-manuell-auto-post']) && (int) $_POST['b2s-manuell-auto-post'] == 1) ? 1 : 0);
912
- $best_times = ((isset($_POST['b2s-auto-post-best-times']) && (int) $_POST['b2s-auto-post-best-times'] == 1) ? 1 : 0);
913
- $profile = ((isset($_POST['b2s-auto-post-profil-dropdown']) && (int) $_POST['b2s-auto-post-profil-dropdown'] > 0) ? (int) $_POST['b2s-auto-post-profil-dropdown'] : 0);
914
- $twitter = ((isset($_POST['b2s-auto-post-profil-dropdown-twitter']) && (int) $_POST['b2s-auto-post-profil-dropdown-twitter'] > 0) ? (int) $_POST['b2s-auto-post-profil-dropdown-twitter'] : 0);
915
- $publish = isset($_POST['b2s-settings-auto-post-publish']) && is_array($_POST['b2s-settings-auto-post-publish']) ? $_POST['b2s-settings-auto-post-publish'] : array();
916
- $update = isset($_POST['b2s-settings-auto-post-update']) && is_array($_POST['b2s-settings-auto-post-update']) ? $_POST['b2s-settings-auto-post-update'] : array();
917
-
918
- $assignUser = isset($_POST['b2s-auto-post-assign-user-data']) && is_array($_POST['b2s-auto-post-assign-user-data']) ? $_POST['b2s-auto-post-assign-user-data'] : array();
919
- $oldOptions = $options->_getOption('auto_post');
920
- if (isset($oldOptions['assignUser'])) {
921
- global $wpdb;
922
- foreach ($oldOptions['assignUser'] as $k => $userId) {
923
- if (!in_array($userId, $assignUser)) {
924
- //delete assignment
925
- $assignOptions = new B2S_Options($userId);
926
- $assignAutoPostOptions = $assignOptions->_getOption('auto_post');
927
-
928
- //delete $assignAutoPostOptions['assignProfile']
929
- if (isset($assignAutoPostOptions['assignProfile']) && (int) $assignAutoPostOptions['assignProfile'] > 0) {
930
- $assignToken = B2S_Tools::getTokenById($userId);
931
- $post = array('token' => $assignToken,
932
- 'action' => 'deleteUserMandant',
933
- 'mandantId' => (int) $assignAutoPostOptions['assignProfile'],
934
- 'allow_delete' => true);
935
- $deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
936
- if ($deleteResult->result == true) {
937
- $wpdb->delete($wpdb->prefix . 'b2s_user_network_settings', array('mandant_id' => (int) $assignAutoPostOptions['assignProfile'], 'blog_user_id' => $userId), array('%d', '%d'));
938
- }
939
- }
940
-
941
-
942
- $assignAutoPostOptions['assignBy'] = 0;
943
- $assignAutoPostOptions['assignProfile'] = 0;
944
- $assignAutoPostOptions['assignTwitter'] = 0;
945
- $assignOptions->_setOption('auto_post', $assignAutoPostOptions);
946
- }
947
- }
948
- }
949
- foreach ($assignUser as $k => $userId) {
950
- if (!isset($oldOptions['assignUser']) || !in_array($userId, $oldOptions['assignUser'])) {
951
- //assign Networkollektion and Networks
952
- $assignProfile = 0;
953
- $assignTwitter = 0;
954
- $getProfileUserAuth = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, array('action' => 'getProfileUserAuth', 'token' => B2S_PLUGIN_TOKEN)));
955
- if (isset($getProfileUserAuth->result) && (int) $getProfileUserAuth->result == 1 && isset($getProfileUserAuth->data) && !empty($getProfileUserAuth->data) && isset($getProfileUserAuth->data->mandant) && isset($getProfileUserAuth->data->auth) && !empty($getProfileUserAuth->data->mandant) && !empty($getProfileUserAuth->data->auth)) {
956
- $mandant = $getProfileUserAuth->data->mandant;
957
- $auth = $getProfileUserAuth->data->auth;
958
- foreach ($mandant as $k => $m) {
959
- if ((int) $m->id == (int) $profile) {
960
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Save.php');
961
- $assignToken = B2S_Tools::getTokenById($userId);
962
- $mandantResult = B2S_Network_Save::saveUserMandant(esc_html((($m->id == 0) ? __($m->name, 'blog2social') : $m->name)), false, $assignToken);
963
- if ($mandantResult['result'] == true && (int) $mandantResult['mandantId'] > 0) {
964
- $assignProfile = $mandantResult['mandantId'];
965
- }
966
- if ((int) $assignProfile > 0) {
967
- $profilData = (isset($auth->{$m->id}) && isset($auth->{$m->id}[0]) && !empty($auth->{$m->id}[0])) ? $auth->{$m->id} : array();
968
- foreach ($profilData as $k => $networkAuth) {
969
- if (isset($networkAuth->networkAuthId) && (int) $networkAuth->networkAuthId > 0) {
970
- $data = array('action' => 'approveUserAuth', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => (int) $networkAuth->networkAuthId, 'assignToken' => $assignToken, 'tokenBlogUserId' => B2S_PLUGIN_BLOG_USER_ID, 'assignTokenBlogUserId' => $userId, 'allow_delete' => false, 'mandantId' => $assignProfile);
971
- $assignUserAuth = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30), true);
972
- if (isset($assignUserAuth['result']) && $assignUserAuth['result'] == true && isset($assignUserAuth['assign_network_auth_id']) && (int) $assignUserAuth['assign_network_auth_id'] > 0) {
973
- global $wpdb;
974
- $sql = $wpdb->prepare("SELECT * FROM `{$wpdb->prefix}b2s_posts_network_details` WHERE `network_auth_id` = %d", (int) $assignUserAuth['assign_network_auth_id']);
975
- $networkAuthIdExist = $wpdb->get_row($sql);
976
- if (empty($networkAuthIdExist) || !isset($networkAuthIdExist->id)) {
977
- //Insert
978
- $sqlInsertNetworkAuthId = $wpdb->prepare("INSERT INTO `{$wpdb->prefix}b2s_posts_network_details` (`network_id`, `network_type`,`network_auth_id`,`network_display_name`) VALUES (%d,%d,%d,%s);", (int) $assignUserAuth['assign_network_id'], $assignUserAuth['assign_network_type'], (int) $assignUserAuth['assign_network_auth_id'], $assignUserAuth['assign_network_display_name']);
979
- $wpdb->query($sqlInsertNetworkAuthId);
980
- } else {
981
- //Update
982
- $sqlUpdateNetworkAuthId = $wpdb->prepare("UPDATE `{$wpdb->prefix}b2s_posts_network_details` SET `network_id` = %d, `network_type` = %d, `network_auth_id` = %d, `network_display_name` = %s WHERE `network_auth_id` = %d;", (int) $assignUserAuth['assign_network_id'], $assignUserAuth['assign_network_type'], (int) $assignUserAuth['assign_network_auth_id'], $assignUserAuth['assign_network_display_name'], (int) $assignUserAuth['assign_network_auth_id']);
983
- $wpdb->query($sqlUpdateNetworkAuthId);
984
- }
985
- $wpdb->insert($wpdb->prefix . 'b2s_user_network_settings', array('blog_user_id' => (int) $userId, 'mandant_id' => $assignProfile, 'network_auth_id' => (int) $assignUserAuth['assign_network_auth_id']), array('%d', '%d', '%d'));
986
- }
987
- if ((int) $networkAuth->networkAuthId == (int) $twitter && isset($assignUserAuth['assign_network_auth_id']) && (int) $assignUserAuth['assign_network_auth_id'] > 0) {
988
- $assignTwitter = (int) $assignUserAuth['assign_network_auth_id'];
989
- }
990
- }
991
- }
992
- }
993
- }
994
- }
995
- }
996
-
997
- if ((int) $assignProfile > 0) {
998
- //save flag in user autopost options
999
- $assignOptions = new B2S_Options($userId);
1000
- $assignAutoPostOptions = $assignOptions->_getOption('auto_post');
1001
- $assignAutoPostOptions['assignBy'] = B2S_PLUGIN_BLOG_USER_ID;
1002
- $assignAutoPostOptions['assignProfile'] = $assignProfile;
1003
- $assignAutoPostOptions['assignTwitter'] = $assignTwitter;
1004
- $assignOptions->_setOption('auto_post', $assignAutoPostOptions);
1005
- } else {
1006
- unset($assignUser[$k]);
1007
- }
1008
- }
1009
- }
1010
-
1011
- $auto_post = array('active' => $active, 'profile' => $profile, 'twitter' => $twitter, 'publish' => $publish, 'update' => $update, 'best_times' => $best_times, 'assignUser' => $assignUser);
1012
- $options->_setOption('auto_post', $auto_post);
1013
- echo json_encode(array('result' => true));
1014
- wp_die();
1015
- } else {
1016
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1017
- wp_die();
1018
- }
1019
- }
1020
-
1021
- public function autoPostAssignByDisconnect() {
1022
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1023
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
1024
- $auto_post_options = $options->_getOption('auto_post');
1025
-
1026
- //delete assignProfile
1027
- if (isset($auto_post_options['assignProfile']) && (int) $auto_post_options['assignProfile'] > 0) {
1028
- $post = array('token' => B2S_PLUGIN_TOKEN,
1029
- 'action' => 'deleteUserMandant',
1030
- 'mandantId' => (int) $auto_post_options['assignProfile'],
1031
- 'allow_delete' => true);
1032
- $deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1033
- if ($deleteResult->result == true) {
1034
- global $wpdb;
1035
- $wpdb->delete($wpdb->prefix . 'b2s_user_network_settings', array('mandant_id' => (int) $auto_post_options['assignProfile'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
1036
- }
1037
- }
1038
-
1039
- $assignById = $auto_post_options['assignBy'];
1040
- $auto_post_options['assignBy'] = 0;
1041
- $auto_post_options['assignProfile'] = 0;
1042
- $auto_post_options['assignTwitter'] = 0;
1043
- $options->_setOption('auto_post', $auto_post_options);
1044
-
1045
- $assignByoptions = new B2S_Options($assignById);
1046
- $assign_by_auto_post_options = $assignByoptions->_getOption('auto_post');
1047
- $assignUserArray = $assign_by_auto_post_options['assignUser'];
1048
- foreach ($assignUserArray as $k => $userId) {
1049
- if ($userId == B2S_PLUGIN_BLOG_USER_ID) {
1050
- unset($assignUserArray[$k]);
1051
- }
1052
- }
1053
- $assign_by_auto_post_options['assignUser'] = $assignUserArray;
1054
- $assignByoptions->_setOption('auto_post', $assign_by_auto_post_options);
1055
- echo json_encode(array('result' => true));
1056
- wp_die();
1057
- } else {
1058
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1059
- wp_die();
1060
- }
1061
- }
1062
-
1063
- public function saveUserMandant() {
1064
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1065
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Save.php');
1066
- $mandant = (isset($_POST['mandant']) && !empty($_POST['mandant'])) ? sanitize_text_field($_POST['mandant']) : '';
1067
- if (empty($mandant)) {
1068
- echo json_encode(array('result' => false, 'content' => ""));
1069
- wp_die();
1070
- }
1071
- $mandantResult = B2S_Network_Save::saveUserMandant($mandant);
1072
- echo json_encode(array('result' => $mandantResult['result'], 'mandantId' => $mandantResult['mandantId'], 'mandantName' => $mandantResult['mandantName'], 'content' => $mandantResult['content']));
1073
- wp_die();
1074
- } else {
1075
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1076
- wp_die();
1077
- }
1078
- }
1079
-
1080
- public function deleteUserMandant() {
1081
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1082
- if (isset($_POST['mandantId'])) {
1083
- $post = array('token' => B2S_PLUGIN_TOKEN,
1084
- 'action' => 'deleteUserMandant',
1085
- 'mandantId' => (int) $_POST['mandantId']);
1086
- $deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1087
- if ($deleteResult->result == true) {
1088
- global $wpdb;
1089
- $wpdb->delete($wpdb->prefix . 'b2s_user_network_settings', array('mandant_id' => (int) $_POST['mandantId'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
1090
- echo json_encode(array('result' => true, 'mandantId' => (int) $_POST['mandantId']));
1091
- wp_die();
1092
- }
1093
- }
1094
- echo json_encode(array('result' => false, 'mandantId' => ''));
1095
- wp_die();
1096
- } else {
1097
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1098
- wp_die();
1099
- }
1100
- }
1101
-
1102
- public function deleteUserAuth() {
1103
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1104
- $assignList = array();
1105
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Tools.php');
1106
- if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType'])) {
1107
- global $wpdb;
1108
- if (isset($_POST['deleteSchedPost']) && (int) $_POST['deleteSchedPost'] == 1) {
1109
- $res = $wpdb->get_results($wpdb->prepare("SELECT b.id, b.post_id, b.post_for_approve, b.post_for_relay FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE d.network_auth_id= %d AND b.hide = %d AND b.publish_date =%s", ((isset($_POST['assignNetworkAuthId']) && (int) $_POST['assignNetworkAuthId'] > 0) ? (int) $_POST['assignNetworkAuthId'] : (int) $_POST['networkAuthId']), 0, '0000-00-00 00:00:00'));
1110
- if (is_array($res) && !empty($res)) {
1111
- foreach ($res as $k => $row) {
1112
- if (isset($row->id) && (int) $row->id > 0) {
1113
- $hookAction = (isset($row->post_for_approve) && (int) $row->post_for_approve == 0) ? 3 : 0; //since 4.9.1 Facebook Instant Sharing
1114
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => $hookAction, 'hide' => 1), array('id' => (int) $row->id));
1115
- //is post for relay
1116
- if ((int) $row->post_for_relay == 1) {
1117
- $relay = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
1118
- if (is_array($relay) && !empty($relay)) {
1119
- foreach ($relay as $item) {
1120
- if (isset($item->id) && (int) $item->id > 0) {
1121
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $item->id));
1122
- }
1123
- }
1124
- }
1125
- }
1126
- }
1127
- }
1128
- }
1129
- //V5.5.0 Approve User > Business Version
1130
- if (isset($_POST['assignList']) && !empty($_POST['assignList'])) {
1131
- $assignList = unserialize($_POST['assignList']);
1132
- if (is_array($assignList) && !empty($assignList)) {
1133
- foreach ($assignList as $i => $assignAuthId) {
1134
- $res = $wpdb->get_results($wpdb->prepare("SELECT b.id, b.post_id, b.post_for_approve, b.post_for_relay FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE d.network_auth_id= %d AND b.hide = %d AND b.publish_date =%s", $assignAuthId, 0, '0000-00-00 00:00:00'));
1135
- if (is_array($res) && !empty($res)) {
1136
- foreach ($res as $k => $row) {
1137
- if (isset($row->id) && (int) $row->id > 0) {
1138
- $hookAction = (isset($row->post_for_approve) && (int) $row->post_for_approve == 0) ? 3 : 0; //since 4.9.1 Facebook Instant Sharing
1139
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => $hookAction, 'hide' => 1), array('id' => (int) $row->id));
1140
- //is post for relay
1141
- if ((int) $row->post_for_relay == 1) {
1142
- $relay = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
1143
- if (is_array($relay) && !empty($relay)) {
1144
- foreach ($relay as $item) {
1145
- if (isset($item->id) && (int) $item->id > 0) {
1146
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $item->id));
1147
- }
1148
- }
1149
- }
1150
- }
1151
- }
1152
- }
1153
- }
1154
- }
1155
- }
1156
- }
1157
- B2S_Heartbeat::getInstance()->deleteSchedPost();
1158
- sleep(2);
1159
- }
1160
- $post = array('token' => B2S_PLUGIN_TOKEN,
1161
- 'action' => 'deleteUserAuth',
1162
- 'networkAuthId' => (int) $_POST['networkAuthId'],
1163
- 'assignNetworkAuthId' => (isset($_POST['deleteAssignment']) && $_POST['deleteAssignment'] == 'all') ? $_POST['deleteAssignment'] : ((isset($_POST['assignNetworkAuthId']) && (int) $_POST['assignNetworkAuthId'] > 0) ? (int) $_POST['assignNetworkAuthId'] : 0));
1164
- $deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1165
- if ($deleteResult->result == true) {
1166
- $wpdb->delete($wpdb->prefix . 'b2s_user_network_settings', array('network_auth_id' => ((isset($_POST['assignNetworkAuthId']) && $_POST['assignNetworkAuthId'] != "all" && (int) $_POST['assignNetworkAuthId'] > 0) ? (int) $_POST['assignNetworkAuthId'] : (int) $_POST['networkAuthId']), 'blog_user_id' => ((isset($_POST['blogUserId']) && (int) $_POST['blogUserId'] > 0) ? (int) $_POST['blogUserId'] : B2S_PLUGIN_BLOG_USER_ID)), array('%d', '%d'));
1167
- if (is_array($assignList) && !empty($assignList)) {
1168
- foreach ($assignList as $blogUserId => $assignAuthId) {
1169
- $wpdb->delete($wpdb->prefix . 'b2s_user_network_settings', array('network_auth_id' => $assignAuthId, 'blog_user_id' => $blogUserId), array('%d', '%d'));
1170
- }
1171
- }
1172
- echo json_encode(array('result' => true, 'networkId' => (int) $_POST['networkId'], 'networkAuthId' => ((isset($_POST['assignNetworkAuthId']) && $_POST['assignNetworkAuthId'] != "all" && (int) $_POST['assignNetworkAuthId'] > 0) ? (int) $_POST['assignNetworkAuthId'] : (int) $_POST['networkAuthId'])));
1173
- wp_die();
1174
- }
1175
- }
1176
- echo json_encode(array('result' => false, 'networkId' => 0, 'networkAuthId' => 0));
1177
- wp_die();
1178
- } else {
1179
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1180
- wp_die();
1181
- }
1182
- }
1183
-
1184
- public function updateUserVersion() {
1185
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1186
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1187
- if (isset($_POST['key']) && !empty($_POST['key'])) {
1188
- $isCurrentUser = true;
1189
- if (isset($_POST['user_id']) && !empty($_POST['user_id']) && (int) $_POST['user_id'] != B2S_PLUGIN_BLOG_USER_ID) {
1190
- $user_id = (int) $_POST['user_id'];
1191
- $user_token = B2S_Tools::getTokenById($user_id);
1192
- $isCurrentUser = false;
1193
- } else {
1194
- $user_id = B2S_PLUGIN_BLOG_USER_ID;
1195
- $user_token = B2S_PLUGIN_TOKEN;
1196
- }
1197
- if ($user_token != false) {
1198
- $post = array('token' => $user_token,
1199
- 'action' => 'updateUserVersion',
1200
- 'version' => B2S_PLUGIN_VERSION,
1201
- 'key' => sanitize_text_field($_POST['key']));
1202
- $keyResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1203
- if (isset($keyResult->result) && $keyResult->result == true) {
1204
- if ($isCurrentUser) {
1205
- $option = get_option('B2S_PLUGIN_USER_VERSION_' . $user_id);
1206
- $option['B2S_PLUGIN_USER_VERSION'] = $keyResult->version;
1207
- update_option('B2S_PLUGIN_USER_VERSION_' . $user_id, $option, false);
1208
- $licenseName = unserialize(B2S_PLUGIN_VERSION_TYPE);
1209
- $printName = (isset($keyResult->trail) && $keyResult->trail == true) ? 'FREE-TRIAL' : $licenseName[$keyResult->version];
1210
- } else {
1211
- $tokenInfo['B2S_PLUGIN_USER_VERSION'] = (isset($keyResult->version) ? $keyResult->version : 0);
1212
- $tokenInfo['B2S_PLUGIN_VERSION'] = B2S_PLUGIN_VERSION;
1213
- if (isset($keyResult->trail) && $keyResult->trail == true && isset($keyResult->trailEndDate) && $keyResult->trailEndDate != "") {
1214
- $tokenInfo['B2S_PLUGIN_TRAIL_END'] = $keyResult->trailEndDate;
1215
- }
1216
- if (!isset($keyResult->version)) {
1217
- define('B2S_PLUGIN_NOTICE', 'CONNECTION');
1218
- } else {
1219
- $tokenInfo['B2S_PLUGIN_USER_VERSION_NEXT_REQUEST'] = time() + 3600;
1220
- update_option('B2S_PLUGIN_USER_VERSION_' . $user_id, $tokenInfo, false);
1221
- }
1222
- $printName = false;
1223
- }
1224
- echo json_encode(array('result' => true, 'licenseName' => $printName));
1225
- wp_die();
1226
- } else if (isset($keyResult->reason)) {
1227
- echo json_encode(array('result' => false, 'reason' => $keyResult->reason));
1228
- wp_die();
1229
- }
1230
- } else {
1231
- echo json_encode(array('result' => false, 'reason' => 2));
1232
- wp_die();
1233
- }
1234
- }
1235
- echo json_encode(array('result' => false, 'reason' => 0));
1236
- wp_die();
1237
- } else {
1238
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1239
- wp_die();
1240
- }
1241
- }
1242
-
1243
- public function acceptPrivacyPolicy() {
1244
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1245
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1246
- if (isset($_POST['accept'])) {
1247
- $post = array('token' => B2S_PLUGIN_TOKEN,
1248
- 'action' => 'updatePrivacyPolicy',
1249
- 'version' => B2S_PLUGIN_VERSION);
1250
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1251
- if ($result->result == true) {
1252
- echo json_encode(array('result' => true));
1253
- delete_option('B2S_PLUGIN_PRIVACY_POLICY_USER_ACCEPT_' . B2S_PLUGIN_BLOG_USER_ID);
1254
- wp_die();
1255
- }
1256
- }
1257
- echo json_encode(array('result' => false));
1258
- wp_die();
1259
- } else {
1260
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1261
- wp_die();
1262
- }
1263
- }
1264
-
1265
- public function createTrail() {
1266
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1267
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1268
- if (isset($_POST['vorname']) && !empty($_POST['vorname']) && isset($_POST['nachname']) && !empty($_POST['nachname']) && isset($_POST['email']) && !empty($_POST['email']) && isset($_POST['url']) && !empty($_POST['url'])) {
1269
- $data = array('token' => B2S_PLUGIN_TOKEN,
1270
- 'action' => 'createTrail',
1271
- 'vorname' => sanitize_text_field($_POST['vorname']),
1272
- 'nachname' => sanitize_text_field($_POST['nachname']),
1273
- 'email' => sanitize_text_field($_POST['email']),
1274
- 'url' => esc_url($_POST['url']),
1275
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))));
1276
- $trailResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data));
1277
- if ($trailResult->result == true) {
1278
- B2S_Tools::setUserDetails();
1279
- $lizenzName = unserialize(B2S_PLUGIN_VERSION_TYPE);
1280
- $printName = 'FREE-TRIAL (' . $lizenzName[$trailResult->version] . ')';
1281
- echo json_encode(array('result' => true, 'lizenzName' => esc_html($printName)));
1282
- wp_die();
1283
- }
1284
- }
1285
- echo json_encode(array('result' => false));
1286
- wp_die();
1287
- } else {
1288
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1289
- wp_die();
1290
- }
1291
- }
1292
-
1293
- public function deleteUserPublishPost() {
1294
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1295
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1296
- if (isset($_POST['postId']) && !empty($_POST['postId'])) {
1297
- $postIds = explode(',', $_POST['postId']);
1298
- if (is_array($postIds) && !empty($postIds)) {
1299
- echo json_encode(B2S_Post_Tools::deleteUserPublishPost($postIds));
1300
- wp_die();
1301
- }
1302
- }
1303
- echo json_encode(array('result' => false));
1304
- wp_die();
1305
- } else {
1306
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1307
- wp_die();
1308
- }
1309
- }
1310
-
1311
- public function deleteUserApprovePost() {
1312
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1313
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1314
- if (isset($_POST['postId']) && !empty($_POST['postId'])) {
1315
- $postIds = explode(',', $_POST['postId']);
1316
- if (is_array($postIds) && !empty($postIds)) {
1317
- echo json_encode(B2S_Post_Tools::deleteUserApprovePost($postIds));
1318
- wp_die();
1319
- }
1320
- }
1321
- echo json_encode(array('result' => false));
1322
- wp_die();
1323
- } else {
1324
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1325
- wp_die();
1326
- }
1327
- }
1328
-
1329
- public function deleteUserCcDraftPost() {
1330
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1331
- if (isset($_POST['postId']) && !empty($_POST['postId']) && (int) $_POST['postId'] > 0) {
1332
- $res = wp_update_post(array('ID' => (int) $_POST['postId'], 'post_status' => 'trash'), true);
1333
- if ((int) $res > 0) {
1334
- echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId']));
1335
- wp_die();
1336
- }
1337
- }
1338
- echo json_encode(array('result' => false));
1339
- wp_die();
1340
- } else {
1341
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1342
- wp_die();
1343
- }
1344
- }
1345
-
1346
- public function sendTrailFeedback() {
1347
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1348
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1349
- if (isset($_POST['feedback']) && !empty($_POST['feedback'])) {
1350
- $post = array('token' => B2S_PLUGIN_TOKEN,
1351
- 'action' => 'sendTrailFeedback',
1352
- 'feedback' => sanitize_textarea_field($_POST['feedback']));
1353
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1354
- if ($result->result == true) {
1355
- echo json_encode(array('result' => true));
1356
- wp_die();
1357
- }
1358
- }
1359
- echo json_encode(array('result' => false));
1360
- wp_die();
1361
- } else {
1362
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1363
- wp_die();
1364
- }
1365
- }
1366
-
1367
- //NEW V5.1.0
1368
- public function saveUserTimeSettings() {
1369
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1370
- if (isset($_POST['b2s-user-sched-data']) && !empty($_POST['b2s-user-sched-data']) && isset($_POST['b2s-user-sched-data']['time']) && isset($_POST['b2s-user-sched-data']['delay_day'])) {
1371
- foreach ($_POST['b2s-user-sched-data']['time'] as $k => $v) {
1372
- $_POST['b2s-user-sched-data']['time'][$k] = date('H:i', strtotime(date('Y-m-d') . ' ' . $v));
1373
- }
1374
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
1375
- $options->_setOption('auth_sched_time', array('delay_day' => $_POST['b2s-user-sched-data']['delay_day'], 'time' => $_POST['b2s-user-sched-data']['time']));
1376
- echo json_encode(array('result' => true));
1377
- wp_die();
1378
- }
1379
- echo json_encode(array('result' => false));
1380
- wp_die();
1381
- } else {
1382
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1383
- wp_die();
1384
- }
1385
- }
1386
-
1387
- public function b2sShipNavbarSaveSettings() {
1388
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1389
- if (isset($_POST['mandantId'])) {
1390
- global $wpdb;
1391
-
1392
- $wpdb->delete($wpdb->prefix . 'b2s_user_network_settings', array('mandant_id' => (int) $_POST['mandantId'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
1393
- if (isset($_POST['selectedAuth']) && is_array($_POST['selectedAuth'])) {
1394
- foreach ($_POST['selectedAuth'] as $k => $networkAuthId) {
1395
- $wpdb->insert($wpdb->prefix . 'b2s_user_network_settings', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'mandant_id' => (int) $_POST['mandantId'], 'network_auth_id' => $networkAuthId), array('%d', '%d', '%d'));
1396
- }
1397
- }
1398
- echo json_encode(array('result' => true));
1399
- wp_die();
1400
- }
1401
- echo json_encode(array('result' => false));
1402
- wp_die();
1403
- } else {
1404
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1405
- wp_die();
1406
- }
1407
- }
1408
-
1409
- public function saveAuthToSettings() {
1410
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1411
- if (isset($_POST['mandandId']) && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType']) && isset($_POST['displayName']) && !empty($_POST['displayName'])) {
1412
- global $wpdb;
1413
- $networkDetailsIdSelect = $wpdb->get_col($wpdb->prepare("SELECT postNetworkDetails.id FROM {$wpdb->prefix}b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $_POST['networkAuthId']));
1414
- if (!isset($networkDetailsIdSelect[0])) {
1415
- $wpdb->insert($wpdb->prefix . 'b2s_posts_network_details', array(
1416
- 'network_id' => (int) $_POST['networkId'],
1417
- 'network_type' => (int) $_POST['networkType'],
1418
- 'network_auth_id' => (int) $_POST['networkAuthId'],
1419
- 'network_display_name' => $_POST['displayName']), array('%d', '%d', '%d', '%s'));
1420
- }
1421
- $mandantCount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(mandant_id)FROM {$wpdb->prefix}b2s_user_network_settings WHERE mandant_id =%d AND blog_user_id=%d ", (int) $_POST['mandandId'], B2S_PLUGIN_BLOG_USER_ID));
1422
- if ($mandantCount > 0) {
1423
- $wpdb->insert($wpdb->prefix . 'b2s_user_network_settings', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'mandant_id' => (int) $_POST['mandandId'], 'network_auth_id' => (int) $_POST['networkAuthId']), array('%d', '%d', '%d'));
1424
- }
1425
- echo json_encode(array('result' => true));
1426
- wp_die();
1427
- }
1428
- echo json_encode(array('result' => false));
1429
- wp_die();
1430
- } else {
1431
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1432
- wp_die();
1433
- }
1434
- }
1435
-
1436
- public function b2sPostMailUpdate() {
1437
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1438
- if (isset($_POST['email']) && !empty($_POST['email'])) {
1439
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1440
- $post = array('action' => 'updateMail',
1441
- 'email' => sanitize_text_field($_POST['email']),
1442
- 'lang' => $_POST['lang']);
1443
- B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post);
1444
- update_option('B2S_UPDATE_MAIL_' . B2S_PLUGIN_BLOG_USER_ID, sanitize_text_field($post['email']), false);
1445
- }
1446
- echo json_encode(array('result' => true));
1447
- wp_die();
1448
- } else {
1449
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1450
- wp_die();
1451
- }
1452
- }
1453
-
1454
- public function updateApprovePost() {
1455
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1456
- //post_id
1457
- if (is_numeric($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
1458
- global $wpdb;
1459
- require_once (B2S_PLUGIN_DIR . '/includes/Options.php');
1460
- require_once (B2S_PLUGIN_DIR . '/includes/Util.php');
1461
- $option = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
1462
- $optionUserTimeZone = $option->_getOption('user_time_zone');
1463
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
1464
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
1465
-
1466
- $sql = "UPDATE {$wpdb->prefix}b2s_posts "
1467
- . "SET sched_date = '0000-00-00 00:00:00', "
1468
- . "sched_date_utc = '0000-00-00 00:00:00', "
1469
- . "publish_date = '" . B2S_Util::getbyIdentLocalDate($userTimeZoneOffset) . "', "
1470
- . "publish_link = '" . ((isset($_POST['publish_link']) && !empty($_POST['publish_link'])) ? esc_url($_POST['publish_link']) : '') . "', "
1471
- . "publish_error_code = '" . ((isset($_POST['publish_error_code']) && !empty($_POST['publish_error_code'])) ? addslashes(sanitize_text_field($_POST['publish_error_code'])) : '') . "', "
1472
- . "post_for_approve = 0 "
1473
- . "WHERE id = " . (int) $_POST['post_id'];
1474
- $wpdb->query($sql);
1475
- echo json_encode(array('result' => true));
1476
- wp_die();
1477
- }
1478
- } else {
1479
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1480
- wp_die();
1481
- }
1482
- }
1483
-
1484
- public function b2sCalendarMovePost() {
1485
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1486
- global $wpdb;
1487
- if (is_numeric($_POST['b2s_id']) && is_string($_POST['sched_date']) && isset($_POST['user_timezone'])) {
1488
-
1489
- //since V4.9.1 Instant Share Approve - Facebook Profile
1490
- $shareApprove = (isset($_POST['post_for_approve']) && (int) $_POST['post_for_approve'] == 1) ? 1 : 0;
1491
- $sql = "UPDATE {$wpdb->prefix}b2s_posts "
1492
- . "SET sched_date = '" . date('Y-m-d H:i:s', strtotime($_POST['sched_date'])) . "', "
1493
- . "user_timezone = '" . (int) $_POST['user_timezone'] . "', "
1494
- . "publish_date = '0000-00-00 00:00:00' ,"
1495
- . "sched_date_utc = '" . B2S_Util::getUTCForDate($_POST['sched_date'], (int) $_POST['user_timezone'] * -1) . "', "
1496
- . "hook_action = " . (($shareApprove == 0) ? 2 : 0)
1497
- . " WHERE id = " . $_POST['b2s_id'];
1498
-
1499
- $wpdb->query($sql);
1500
-
1501
- //is post for relay?
1502
- if (isset($_POST['post_for_relay']) && (int) $_POST['post_for_relay'] == 1) {
1503
- $res = $this->getAllRelayByPrimaryPostId($_POST['b2s_id']);
1504
- if (is_array($res) && !empty($res)) {
1505
- foreach ($res as $item) {
1506
- if (isset($item->id) && (int) $item->id > 0 && isset($item->relay_delay_min) && (int) $item->relay_delay_min > 0) {
1507
- $relay_sched_date = date('Y-m-d H:i:00', strtotime("+" . $item->relay_delay_min . " minutes", strtotime($_POST['sched_date'])));
1508
- $relay_sched_date_utc = date('Y-m-d H:i:00', strtotime(B2S_Util::getUTCForDate($relay_sched_date, (int) $_POST['user_timezone'] * (-1))));
1509
- $wpdb->update($wpdb->prefix . 'b2s_posts', array(
1510
- 'user_timezone' => (int) $_POST['user_timezone'],
1511
- 'publish_date' => "0000-00-00 00:00:00",
1512
- 'sched_date' => $relay_sched_date,
1513
- 'sched_date_utc' => $relay_sched_date_utc,
1514
- 'hook_action' => 2
1515
- ), array("id" => $item->id), array('%s', '%s', '%s', '%s', '%d'));
1516
- }
1517
- }
1518
- }
1519
- }
1520
- }
1521
- echo json_encode(array('result' => true));
1522
- wp_die();
1523
- } else {
1524
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1525
- wp_die();
1526
- }
1527
- }
1528
-
1529
- public function deleteUserSchedPost() {
1530
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1531
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1532
-
1533
- if (isset($_POST['postId']) && !empty($_POST['postId'])) {
1534
- $postIds = explode(',', $_POST['postId']);
1535
- if (is_array($postIds) && !empty($postIds)) {
1536
- echo json_encode(B2S_Post_Tools::deleteUserSchedPost($postIds));
1537
- wp_die();
1538
- }
1539
- }
1540
- echo json_encode(array('result' => false));
1541
- wp_die();
1542
- } else {
1543
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1544
- wp_die();
1545
- }
1546
- }
1547
-
1548
- public function b2sDeletePost() {
1549
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1550
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1551
-
1552
- if (isset($_POST['b2s_id']) && !empty($_POST['b2s_id']) && isset($_POST['post_id']) && !empty($_POST['post_id'])) {
1553
- $postIds = array($_POST['b2s_id']);
1554
- if (is_array($postIds) && !empty($postIds)) {
1555
- echo json_encode(B2S_Post_Tools::deleteUserSchedPost($postIds));
1556
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . (int) $_POST['b2s_id']);
1557
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $_POST['post_id']);
1558
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $_POST['post_id']);
1559
- wp_die();
1560
- }
1561
- }
1562
- echo json_encode(array('result' => false));
1563
- wp_die();
1564
- } else {
1565
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1566
- wp_die();
1567
- }
1568
- }
1569
-
1570
- public function b2sEditSavePost() {
1571
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1572
- global $wpdb;
1573
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Save.php');
1574
-
1575
- $post = $_POST;
1576
- $metaOg = false;
1577
- $metaCard = false;
1578
- $sched_date = '';
1579
-
1580
- if (!isset($post['post_id']) || (int) $post['post_id'] == 0) {
1581
- echo json_encode(array('result' => false));
1582
- wp_die();
1583
- }
1584
-
1585
- $b2sids = array($post['b2s_id']);
1586
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $post['post_id']);
1587
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $post['post_id']);
1588
-
1589
- foreach ($b2sids as $b2s_id) {
1590
- $b2sShipSend = new B2S_Calendar_Save();
1591
-
1592
- $defaultPostData = array(
1593
- 'original_blog_user_id' => (int) $post['original_blog_user_id'],
1594
- 'last_edit_blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
1595
- 'post_id' => (int) $post['post_id'],
1596
- 'b2s_id' => (int) $b2s_id,
1597
- 'default_titel' => isset($post['default_titel']) ? sanitize_text_field($post['default_titel']) : '',
1598
- 'no_cache' => 0, //default inactive , 1=active 0=not
1599
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))));
1600
-
1601
- //is relay post?
1602
- if (isset($post['relay_primary_post_id']) && (int) $post['relay_primary_post_id'] > 0 && (int) $b2s_id > 0) {
1603
- if (isset($post['relay_primary_sched_date']) && !empty($post['relay_primary_sched_date']) && isset($post['network_auth_id']) && (int) $post['network_auth_id'] > 0) {
1604
- if (isset($post['b2s'][$post['network_auth_id']]['post_relay_delay'][0]) && (int) $post['b2s'][$post['network_auth_id']]['post_relay_delay'][0] > 0) {
1605
- $sched_date = date('Y-m-d H:i:00', strtotime("+" . $post['b2s'][$post['network_auth_id']]['post_relay_delay'][0] . " minutes", strtotime($post['relay_primary_sched_date'])));
1606
- $sched_date_utc = date('Y-m-d H:i:00', strtotime(B2S_Util::getUTCForDate($sched_date, (int) $post['user_timezone'] * (-1))));
1607
- $wpdb->update($wpdb->prefix . 'b2s_posts', array(
1608
- 'user_timezone' => (int) $post['user_timezone'],
1609
- 'publish_date' => "0000-00-00 00:00:00",
1610
- 'sched_date' => $sched_date,
1611
- 'sched_date_utc' => $sched_date_utc,
1612
- 'hook_action' => 2
1613
- ), array("id" => $b2s_id), array('%s', '%s', '%s', '%s', '%d'));
1614
- $sched_date = B2S_Util::getCustomDateFormat(date('Y-m-d H:i:00', strtotime($sched_date)), substr(B2S_LANGUAGE, 0, 2));
1615
- }
1616
- }
1617
- } else {
1618
-
1619
- foreach ($post['b2s'] as $networkAuthId => $data) {
1620
- if (!isset($data['url']) || !isset($data['content']) || !isset($data['network_id'])) {
1621
- continue;
1622
- }
1623
-
1624
- if ((int) $data['network_id'] == 1 || (int) $data['network_id'] == 3 || (int) $data['network_id'] == 19) {
1625
- $linkNoCache = B2S_Tools::getNoCacheData(B2S_PLUGIN_BLOG_USER_ID);
1626
- if (is_array($linkNoCache) && isset($linkNoCache[$data['network_id']]) && (int) $linkNoCache[$data['network_id']] > 0) {
1627
- $defaultPostData['no_cache'] = $linkNoCache[$data['network_id']];
1628
- }
1629
- }
1630
-
1631
- //Change/Set MetaTags
1632
- if (in_array((int) $data['network_id'], json_decode(B2S_PLUGIN_NETWORK_META_TAGS, true)['og']) && $metaOg == false && (int) $post['post_id'] > 0 && isset($data['post_format']) && (int) $data['post_format'] == 0 && isset($post['change_og_meta']) && (int) $post['change_og_meta'] == 1) { //LinkPost
1633
- $metaOg = true;
1634
- $meta = B2S_Meta::getInstance();
1635
- $res = $meta->getMeta((int) $post['post_id']);
1636
- if (isset($data['og_title']) && !empty($data['og_title'])) {
1637
- $meta->setMeta('og_title', sanitize_text_field($data['og_title']));
1638
- }
1639
- if (isset($data['og_desc']) && !empty($data['og_desc'])) {
1640
- $meta->setMeta('og_desc', sanitize_text_field($data['og_desc']));
1641
- }
1642
- if (isset($data['image_url']) && !empty($data['image_url'])) {
1643
- $meta->setMeta('og_image', trim(esc_url($data['image_url'])));
1644
- $meta->setMeta('og_image_alt', '');
1645
- }
1646
- $meta->updateMeta((int) $post['post_id']);
1647
- //TODO Update scheds
1648
- global $wpdb;
1649
- $res = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}b2s_posts LEFT JOIN {$wpdb->prefix}b2s_posts_sched_details ON {$wpdb->prefix}b2s_posts.sched_details_id = {$wpdb->prefix}b2s_posts_sched_details.id LEFT JOIN {$wpdb->prefix}b2s_posts_network_details ON {$wpdb->prefix}b2s_posts.network_details_id = {$wpdb->prefix}b2s_posts_network_details.id WHERE {$wpdb->prefix}b2s_posts.sched_details_id > 0 AND {$wpdb->prefix}b2s_posts.post_id = %d AND {$wpdb->prefix}b2s_posts_network_details.network_id IN (" . implode(',', json_decode(B2S_PLUGIN_NETWORK_META_TAGS, true)['og']) . ") AND sched_date_utc > %s", $post['post_id'], gmdate('Y-m-d H:i:s')));
1650
- foreach ($res as $key => $sched) {
1651
- $schedData = unserialize($sched->sched_data);
1652
- if ((isset($schedData['post_format']) && (int) $schedData['post_format'] == 0) || (!isset($schedData['post_format']) && isset($schedData['image_url']) && !empty($schedData['image_url']))) {
1653
- $schedData['image_url'] = $data['image_url'];
1654
- $wpdb->update($wpdb->prefix . 'b2s_posts_sched_details', array(
1655
- 'sched_data' => serialize($schedData),
1656
- 'image_url' => $data['image_url']
1657
- ), array("id" => $sched->sched_details_id), array('%s', '%s', '%d'));
1658
- }
1659
- }
1660
- }
1661
-
1662
- //Change/Set MetaTags
1663
- if (((int) $data['network_id'] == 2 || (int) $data['network_id'] == 24) && $metaCard == false && (int) $post['post_id'] > 0 && isset($data['post_format']) && (int) $data['post_format'] == 0 && isset($post['change_card_meta']) && (int) $post['change_card_meta'] == 1) { //LinkPost
1664
- $metaCard = true;
1665
- $meta = B2S_Meta::getInstance();
1666
- $meta->getMeta((int) $post['post_id']);
1667
- if (isset($data['card_title']) && !empty($data['card_title'])) {
1668
- $meta->setMeta('card_title', sanitize_text_field($data['card_title']));
1669
- }
1670
- if (isset($data['card_desc']) && !empty($data['card_desc'])) {
1671
- $meta->setMeta('card_desc', sanitize_text_field($data['card_desc']));
1672
- }
1673
- if (isset($data['image_url']) && !empty($data['image_url'])) {
1674
- $meta->setMeta('card_image', trim(esc_url($data['image_url'])));
1675
- }
1676
- $meta->updateMeta((int) $post['post_id']);
1677
- }
1678
-
1679
- $sendData = array("board" => isset($data['board']) ? sanitize_text_field($data['board']) : '',
1680
- "group" => isset($data['group']) ? sanitize_text_field($data['group']) : '',
1681
- "custom_title" => isset($data['custom_title']) ? sanitize_text_field($data['custom_title']) : '',
1682
- "content" => (isset($data['content']) && !empty($data['content'])) ? strip_tags(preg_replace("/(<[\/]*)em(>)/", "$1i$2", html_entity_decode($data['content'])), '<p><h1><h2><br><i><b><a><img>') : '',
1683
- 'url' => isset($data['url']) ? htmlspecialchars_decode(esc_url($data['url'])) : '',
1684
- 'image_url' => isset($data['image_url']) ? trim(esc_url($data['image_url'])) : '',
1685
- 'tags' => isset($data['tags']) ? $data['tags'] : array(),
1686
- 'network_id' => isset($data['network_id']) ? (int) $data['network_id'] : '',
1687
- 'network_type' => isset($data['network_type']) ? (int) $data['network_type'] : '',
1688
- 'network_tos_group_id' => (isset($data['network_tos_group_id']) && !empty($data['network_tos_group_id'])) ? sanitize_text_field($data['network_tos_group_id']) : '',
1689
- 'network_kind' => isset($data['network_kind']) ? (int) $data['network_kind'] : 0,
1690
- 'marketplace_category' => isset($data['marketplace_category']) ? (int) $data['marketplace_category'] : 0,
1691
- 'marketplace_type' => isset($data['marketplace_type']) ? (int) $data['marketplace_type'] : 0,
1692
- 'network_display_name' => isset($data['network_display_name']) ? sanitize_text_field($data['network_display_name']) : '',
1693
- 'network_auth_id' => (int) $networkAuthId,
1694
- 'post_format' => isset($data['post_format']) ? (int) $data['post_format'] : '',
1695
- 'post_for_approve' => isset($post['post_for_approve']) ? (int) $post['post_for_approve'] : 0,
1696
- 'user_timezone' => isset($post['user_timezone']) ? (int) $post['user_timezone'] : 0,
1697
- 'sched_details_id' => isset($post['sched_details_id']) ? (int) $post['sched_details_id'] : null,
1698
- 'publish_date' => isset($post['publish_date']) ? date('Y-m-d H:i:s', strtotime($post['publish_date'])) : date('Y-m-d H:i:s', current_time('timestamp'))
1699
- );
1700
-
1701
- if (isset($data['date'][0]) && isset($data['time'][0])) {
1702
- $sched_date = B2S_Util::getCustomDateFormat(date('Y-m-d H:i:00', strtotime($data['date'][0] . ' ' . $data['time'][0])), substr(B2S_LANGUAGE, 0, 2));
1703
- $schedData = array(
1704
- 'date' => isset($data['date']) ? $data['date'] : array(),
1705
- 'time' => isset($data['time']) ? $data['time'] : array(),
1706
- 'releaseSelect' => ((isset($post['sched_type']) && (int) $post['sched_type'] > 0) ? (int) $post['sched_type'] : 1),
1707
- 'user_timezone' => isset($post['user_timezone']) ? (int) $post['user_timezone'] : 0,
1708
- 'saveSetting' => isset($data['saveSchedSetting']) ? true : false
1709
- );
1710
-
1711
- //Multi Image
1712
- if (isset($data['multi_image_1']) && !empty($data['multi_image_1'])) {
1713
- $schedData['sched_multi_image_1'][0] = $data['multi_image_1'];
1714
- }
1715
- if (isset($data['multi_image_2']) && !empty($data['multi_image_2'])) {
1716
- $schedData['sched_multi_image_2'][0] = $data['multi_image_2'];
1717
- }
1718
- if (isset($data['multi_image_3']) && !empty($data['multi_image_3'])) {
1719
- $schedData['sched_multi_image_3'][0] = $data['multi_image_3'];
1720
- }
1721
-
1722
- $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, array());
1723
-
1724
- //is post for relay ?
1725
- //get all relays in primary post id by b2s id & change sched_date + utc
1726
- if (isset($post['post_for_relay']) && (int) $post['post_for_relay'] == 1 && isset($data['date'][0]) && isset($data['time'][0]) && (int) $b2s_id > 0) {
1727
- $res = $this->getAllRelayByPrimaryPostId($b2s_id);
1728
- if (is_array($res) && !empty($res)) {
1729
- foreach ($res as $item) {
1730
- if (isset($item->id) && (int) $item->id > 0 && isset($item->relay_delay_min) && (int) $item->relay_delay_min > 0) {
1731
- $relay_sched_date = date('Y-m-d H:i:00', strtotime("+" . $item->relay_delay_min . " minutes", strtotime($data['date'][0] . ' ' . $data['time'][0])));
1732
- $relay_sched_date_utc = date('Y-m-d H:i:00', strtotime(B2S_Util::getUTCForDate($relay_sched_date, (int) $post['user_timezone'] * (-1))));
1733
- $wpdb->update($wpdb->prefix . 'b2s_posts', array(
1734
- 'user_timezone' => (int) $post['user_timezone'],
1735
- 'publish_date' => "0000-00-00 00:00:00",
1736
- 'sched_date' => $relay_sched_date,
1737
- 'sched_date_utc' => $relay_sched_date_utc,
1738
- 'hook_action' => 2
1739
- ), array("id" => $item->id), array('%s', '%s', '%s', '%s', '%d'));
1740
- }
1741
- }
1742
- }
1743
- }
1744
- }
1745
- }
1746
-
1747
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $b2s_id);
1748
- }
1749
- }
1750
- echo json_encode(array('result' => true, 'date' => $sched_date));
1751
- wp_die();
1752
- } else {
1753
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1754
- wp_die();
1755
- }
1756
- }
1757
-
1758
- public function getAllRelayByPrimaryPostId($primary_post_id = 0) {
1759
- global $wpdb;
1760
- $sqlData = $wpdb->prepare("SELECT `id`, `relay_delay_min` FROM `{$wpdb->prefix}b2s_posts` WHERE `hide` = 0 AND `sched_type` = 4 AND `{$wpdb->prefix}b2s_posts`.`publish_date` = '0000-00-00 00:00:00' AND `relay_primary_post_id` = %d ", $primary_post_id);
1761
- return $wpdb->get_results($sqlData);
1762
- }
1763
-
1764
- public function releaseLocks() {
1765
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1766
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1767
- $options = new B2S_Options(get_current_user_id());
1768
- $lock = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
1769
-
1770
- if (isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
1771
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $_POST['post_id']);
1772
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $_POST['post_id']);
1773
- }
1774
- if ($lock) {
1775
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $lock);
1776
- $options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", false);
1777
- }
1778
- } else {
1779
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1780
- wp_die();
1781
- }
1782
- }
1783
-
1784
- public function hideRating() {
1785
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1786
- $forever = (isset($_POST['forever']) && $_POST['forever'] === true) ? true : false;
1787
- B2S_Rating::hide($forever);
1788
- } else {
1789
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1790
- wp_die();
1791
- }
1792
- }
1793
-
1794
- public function hidePremiumMessage() {
1795
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1796
- update_option("B2S_HIDE_PREMIUM_MESSAGE", true, false);
1797
- } else {
1798
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1799
- wp_die();
1800
- }
1801
- }
1802
-
1803
- public function hideTrailMessage() {
1804
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1805
- update_option("B2S_HIDE_TRAIL_MESSAGE", true, false);
1806
- } else {
1807
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1808
- wp_die();
1809
- }
1810
- }
1811
-
1812
- public function hideTrailEndedMessage() {
1813
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1814
- update_option("B2S_HIDE_TRAIL_ENDED", true, false);
1815
- } else {
1816
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1817
- wp_die();
1818
- }
1819
- }
1820
-
1821
- public function moveUserAuthToProfile() {
1822
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1823
- if (isset($_POST['mandantId']) && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
1824
- $data = array('action' => 'moveUserAuthToProfile', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => (int) $_POST['networkAuthId'], 'mandantId' => (int) $_POST['mandantId']);
1825
- $moveUserAuth = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30));
1826
- if ($moveUserAuth->result == true) {
1827
- global $wpdb;
1828
- $sql = $wpdb->prepare("SELECT * FROM `{$wpdb->prefix}b2s_user_network_settings` WHERE `blog_user_id` = %d AND `network_auth_id` = %d", (int) B2S_PLUGIN_BLOG_USER_ID, (int) $_POST['networkAuthId']);
1829
- $networkAuthIdExist = $wpdb->get_row($sql);
1830
- if (!empty($networkAuthIdExist) && isset($networkAuthIdExist->id)) {
1831
- $sqlUpdateNetworkAuthId = $wpdb->prepare("UPDATE `{$wpdb->prefix}b2s_user_network_settings` SET `mandant_id` = %d WHERE `blog_user_id` = %d AND `network_auth_id` = %d;", (int) $_POST['mandantId'], (int) B2S_PLUGIN_BLOG_USER_ID, (int) $_POST['networkAuthId']);
1832
- $wpdb->query($sqlUpdateNetworkAuthId);
1833
- }
1834
- echo json_encode(array('result' => true));
1835
- wp_die();
1836
- }
1837
- }
1838
- echo json_encode(array('result' => false));
1839
- wp_die();
1840
- } else {
1841
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1842
- wp_die();
1843
- }
1844
- }
1845
-
1846
- public function assignNetworkUserAuth() {
1847
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1848
- if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['assignBlogUserId']) && (int) $_POST['assignBlogUserId'] > 0) {
1849
- $assignToken = B2S_Tools::getTokenById($_POST['assignBlogUserId']);
1850
- $data = array('action' => 'approveUserAuth', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => (int) $_POST['networkAuthId'], 'assignToken' => $assignToken, 'tokenBlogUserId' => B2S_PLUGIN_BLOG_USER_ID, 'assignTokenBlogUserId' => $_POST['assignBlogUserId']);
1851
- $assignUserAuth = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30), true);
1852
- if (isset($assignUserAuth['result']) && $assignUserAuth['result'] == true && isset($assignUserAuth['assign_network_auth_id']) && (int) $assignUserAuth['assign_network_auth_id'] > 0) {
1853
- global $wpdb;
1854
- $sql = $wpdb->prepare("SELECT * FROM `{$wpdb->prefix}b2s_posts_network_details` WHERE `network_auth_id` = %d", (int) $assignUserAuth['assign_network_auth_id']);
1855
- $networkAuthIdExist = $wpdb->get_row($sql);
1856
- if (empty($networkAuthIdExist) || !isset($networkAuthIdExist->id)) {
1857
- //Insert
1858
- $sqlInsertNetworkAuthId = $wpdb->prepare("INSERT INTO `{$wpdb->prefix}b2s_posts_network_details` (`network_id`, `network_type`,`network_auth_id`,`network_display_name`) VALUES (%d,%d,%d,%s);", (int) $assignUserAuth['assign_network_id'], $assignUserAuth['assign_network_type'], (int) $assignUserAuth['assign_network_auth_id'], $assignUserAuth['assign_network_display_name']);
1859
- $wpdb->query($sqlInsertNetworkAuthId);
1860
- } else {
1861
- //Update
1862
- $sqlUpdateNetworkAuthId = $wpdb->prepare("UPDATE `{$wpdb->prefix}b2s_posts_network_details` SET `network_id` = %d, `network_type` = %d, `network_auth_id` = %d, `network_display_name` = %s WHERE `network_auth_id` = %d;", (int) $assignUserAuth['assign_network_id'], $assignUserAuth['assign_network_type'], (int) $assignUserAuth['assign_network_auth_id'], $assignUserAuth['assign_network_display_name'], (int) $assignUserAuth['assign_network_auth_id']);
1863
- $wpdb->query($sqlUpdateNetworkAuthId);
1864
- }
1865
- $wpdb->insert($wpdb->prefix . 'b2s_user_network_settings', array('blog_user_id' => (int) $_POST['assignBlogUserId'], 'mandant_id' => 0, 'network_auth_id' => (int) $assignUserAuth['assign_network_auth_id']), array('%d', '%d', '%d'));
1866
-
1867
- $options = new B2S_Options((int) B2S_PLUGIN_BLOG_USER_ID);
1868
-
1869
- $optionUserTimeZone = $options->_getOption('user_time_zone');
1870
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
1871
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
1872
- $current_user_date = date((strtolower(substr(B2S_LANGUAGE, 0, 2)) == 'de') ? 'd.m.Y' : 'Y-m-d', strtotime(B2S_Util::getUTCForDate(date('Y-m-d H:i:s'), $userTimeZoneOffset)));
1873
-
1874
- if (isset($_POST['optionBestTimes']) && filter_var($_POST['optionBestTimes'], FILTER_VALIDATE_BOOLEAN) == true) {
1875
- $userSchedData = $options->_getOption('auth_sched_time');
1876
- if (isset($userSchedData['delay_day'][$_POST['networkAuthId']]) && isset($userSchedData['time'][$_POST['networkAuthId']])) {
1877
- $assignUserOptions = new B2S_Options((int) $_POST['assignBlogUserId']);
1878
- $assignUserSchedData = $assignUserOptions->_getOption('auth_sched_time');
1879
- if ($assignUserSchedData != false && isset($assignUserSchedData['delay_day']) && isset($assignUserSchedData['time'])) {
1880
- $assignUserSchedData['delay_day'][$assignUserAuth['assign_network_auth_id']] = $userSchedData['delay_day'][$_POST['networkAuthId']];
1881
- $assignUserSchedData['time'][$assignUserAuth['assign_network_auth_id']] = $userSchedData['time'][$_POST['networkAuthId']];
1882
- } else {
1883
- $assignUserSchedData = array(
1884
- 'delay_day' => array($assignUserAuth['assign_network_auth_id'] => $userSchedData['delay_day'][$_POST['networkAuthId']]),
1885
- 'time' => array($assignUserAuth['assign_network_auth_id'] => $userSchedData['time'][$_POST['networkAuthId']])
1886
- );
1887
- }
1888
- $assignUserOptions->_setOption('auth_sched_time', $assignUserSchedData);
1889
- }
1890
- } else {
1891
- $assignUserOptions = new B2S_Options((int) $_POST['assignBlogUserId']);
1892
- $assignUserSchedData = $assignUserOptions->_getOption('auth_sched_time');
1893
- $current_user_time = new DateTime(date('H:i', strtotime(B2S_Util::getUTCForDate(date('Y-m-d H:i:s'), $userTimeZoneOffset))));
1894
- if ((int) $current_user_time->format('i') >= 30) {
1895
- $current_user_time->setTime((int) $current_user_time->format('H') + 1, 0);
1896
- } else {
1897
- $current_user_time->setTime((int) $current_user_time->format('H'), 30);
1898
- }
1899
- if ($assignUserSchedData != false && isset($assignUserSchedData['delay_day']) && isset($assignUserSchedData['time'])) {
1900
- $assignUserSchedData['delay_day'][$assignUserAuth['assign_network_auth_id']] = 0;
1901
- $assignUserSchedData['time'][$assignUserAuth['assign_network_auth_id']] = $current_user_time->format('H:i');
1902
- } else {
1903
- $assignUserSchedData = array(
1904
- 'delay_day' => array($assignUserAuth['assign_network_auth_id'] => 0),
1905
- 'time' => array($assignUserAuth['assign_network_auth_id'] => $current_user_time->format('H:i'))
1906
- );
1907
- }
1908
- $assignUserOptions->_setOption('auth_sched_time', $assignUserSchedData);
1909
- }
1910
-
1911
- if (isset($_POST['optionPostingTemplate']) && filter_var($_POST['optionPostingTemplate'], FILTER_VALIDATE_BOOLEAN) == true) {
1912
- $userTemplateData = $options->_getOption('post_template');
1913
- if (isset($userTemplateData[$assignUserAuth['assign_network_id']][$assignUserAuth['assign_network_type']])) {
1914
- $assignUserOptions = new B2S_Options((int) $_POST['assignBlogUserId']);
1915
- $assignUserTemplateData = $assignUserOptions->_getOption('post_template');
1916
- if ($assignUserTemplateData == false || !isset($assignUserTemplateData[$assignUserAuth['assign_network_id']])) {
1917
- $defaultTemplate = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
1918
- if (isset($defaultTemplate[$assignUserAuth['assign_network_id']])) {
1919
- $assignUserTemplateData = array($assignUserAuth['assign_network_id'] => $defaultTemplate[$assignUserAuth['assign_network_id']]);
1920
- } else {
1921
- $assignUserTemplateData[$assignUserAuth['assign_network_id']] = $userTemplateData[$assignUserAuth['assign_network_id']];
1922
- }
1923
- }
1924
- $assignUserTemplateData[$assignUserAuth['assign_network_id']][$assignUserAuth['assign_network_type']] = $userTemplateData[$assignUserAuth['assign_network_id']][$assignUserAuth['assign_network_type']];
1925
- $assignUserOptions->_setOption('post_template', $assignUserTemplateData);
1926
- }
1927
- }
1928
-
1929
- if (isset($_POST['optionUrlParameter']) && filter_var($_POST['optionUrlParameter'], FILTER_VALIDATE_BOOLEAN) == true) {
1930
- $sql = $wpdb->prepare("SELECT data FROM `{$wpdb->prefix}b2s_posts_network_details` WHERE `network_auth_id` = %d", (int) $_POST['networkAuthId']);
1931
- $rawOriginalData = $wpdb->get_row($sql);
1932
- $originalData = unserialize($rawOriginalData->data);
1933
- if ($originalData != false && $originalData != NULL && is_array($originalData) && isset($originalData) && !empty($originalData) && isset($originalData['url_parameter'])) {
1934
- $sqlUpdateNetworkAuthId = $wpdb->prepare("UPDATE `{$wpdb->prefix}b2s_posts_network_details` SET `data` = %s WHERE `network_auth_id` = %d;", serialize(array('url_parameter' => $originalData['url_parameter'])), (int) $assignUserAuth['assign_network_auth_id']);
1935
- $wpdb->query($sqlUpdateNetworkAuthId);
1936
- }
1937
- }
1938
-
1939
- $displayName = stripslashes(get_user_by('id', $_POST['assignBlogUserId'])->display_name);
1940
- $newListEntry = '<li class="b2s-network-item-auth-list-li">';
1941
- $newListEntry .= '<div class="pull-left" style="padding-top: 5px;"><span>' . esc_html(((empty($displayName) || $displayName == false) ? __("Unknown username", "blog2social") : $displayName)) . '</span></div>';
1942
- $newListEntry .= '<div class="pull-right"><span style="margin-right: 10px;">' . esc_html($current_user_date) . '</span> <button class="b2s-network-item-auth-list-btn-delete btn btn-danger btn-sm" data-network-auth-id="' . esc_attr($_POST['networkAuthId']) . '" data-assign-network-auth-id="' . esc_attr($assignUserAuth['assign_network_auth_id']) . '" data-network-id="' . esc_attr($assignUserAuth['assign_network_id']) . '" data-network-type="' . esc_attr($assignUserAuth['assign_network_type']) . '" data-blog-user-id="' . esc_attr($_POST['assignBlogUserId']) . '">' . esc_html__('delete', 'blog2social') . '</button></div>';
1943
- $newListEntry .= '<div class="clearfix"></div></li>';
1944
- echo json_encode(array('result' => true, 'newListEntry' => $newListEntry));
1945
- wp_die();
1946
- } else if (isset($assignUserAuth['error_reason'])) {
1947
- echo json_encode(array('result' => false, 'error_reason' => $assignUserAuth['error_reason']));
1948
- wp_die();
1949
- } else {
1950
- echo json_encode(array('result' => false, 'error_reason' => 'invalid_data'));
1951
- wp_die();
1952
- }
1953
- }
1954
- echo json_encode(array('result' => false, 'error_reason' => 'default'));
1955
- wp_die();
1956
- } else {
1957
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1958
- wp_die();
1959
- }
1960
- }
1961
-
1962
- public function savePostTemplate() {
1963
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1964
- if (isset($_POST['template_data']) && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0) {
1965
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1966
- $options = new B2S_Options(get_current_user_id());
1967
-
1968
- $post_template_result = false;
1969
- $link_no_cache_option = false;
1970
-
1971
- if (B2S_PLUGIN_USER_VERSION >= 1) {
1972
- $post_template = $options->_getOption("post_template");
1973
-
1974
- if ($post_template == false) {
1975
- $post_template = array();
1976
- }
1977
-
1978
- $new_template = array();
1979
- $default_template = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
1980
- foreach ($_POST['template_data'] as $type => $data) {
1981
- if (isset($data['multi_kind']) && (int) $data['multi_kind'] == 1) {
1982
- $short_text = array();
1983
- foreach ($data['type_kind'] as $kind_id => $kind_data) {
1984
- $limit = ((isset($default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['limit'])) ? $default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['limit'] : 0);
1985
- $range_max = ((int) $limit != 0 && (int) $kind_data['range_max'] > (int) $limit) ? (int) $limit : (int) $kind_data['range_max'];
1986
- $excerpt_range_max = ((int) $limit != 0 && (int) $kind_data['excerpt_range_max'] > (int) $limit) ? (int) $limit : (int) $kind_data['excerpt_range_max'];
1987
- $short_text[$kind_id] = array(
1988
- 'active' => 0,
1989
- 'range_min' => ((isset($default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['range_max']) && $range_max >= (int) $default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['range_max']) ? (int) $default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['range_min'] : ($range_max / 2)),
1990
- 'range_max' => $range_max,
1991
- 'excerpt_range_min' => ((isset($default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['excerpt_range_max']) && $excerpt_range_max >= (int) $default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['excerpt_range_max']) ? (int) $default_template[$_POST['networkId']][$type]['short_text'][$kind_id]['excerpt_range_min'] : ($range_max / 2)),
1992
- 'excerpt_range_max' => $excerpt_range_max,
1993
- 'limit' => $limit
1994
- );
1995
- }
1996
- $new_template[$type] = array(
1997
- 'format' => (isset($data['format'])) ? $data['format'] : false,
1998
- 'content' => (isset($data['content'])) ? sanitize_textarea_field($data['content']) : $default_template[$_POST['networkId']][$type]['content'],
1999
- 'short_text' => $short_text
2000
- );
2001
- } else {
2002
- $limit = ((isset($default_template[$_POST['networkId']][$type]['short_text']['limit'])) ? $default_template[$_POST['networkId']][$type]['short_text']['limit'] : 0);
2003
- $range_max = ((int) $limit != 0 && (int) $data['range_max'] > (int) $limit) ? (int) $limit : (int) $data['range_max'];
2004
- $excerpt_range_max = ((int) $limit != 0 && (int) $data['excerpt_range_max'] > (int) $limit) ? (int) $limit : (int) $data['excerpt_range_max'];
2005
- $new_template[$type] = array(
2006
- 'format' => (isset($data['format'])) ? $data['format'] : false,
2007
- 'content' => (isset($data['content'])) ? sanitize_textarea_field($data['content']) : $default_template[$_POST['networkId']][$type]['content'],
2008
- 'short_text' => array(
2009
- 'active' => 0,
2010
- 'range_min' => ((isset($default_template[$_POST['networkId']][$type]['short_text']['range_max']) && $range_max >= (int) $default_template[$_POST['networkId']][$type]['short_text']['range_max']) ? (int) $default_template[$_POST['networkId']][$type]['short_text']['range_min'] : ($range_max / 2)),
2011
- 'range_max' => $range_max,
2012
- 'excerpt_range_min' => ((isset($default_template[$_POST['networkId']][$type]['short_text']['excerpt_range_max']) && $excerpt_range_max >= (int) $default_template[$_POST['networkId']][$type]['short_text']['excerpt_range_max']) ? (int) $default_template[$_POST['networkId']][$type]['short_text']['excerpt_range_min'] : ($range_max / 2)),
2013
- 'excerpt_range_max' => $excerpt_range_max,
2014
- 'limit' => $limit
2015
- )
2016
- );
2017
- }
2018
- if ((int) $_POST['networkId'] == 24 || (int) $_POST['networkId'] == 12 || (int) $_POST['networkId'] == 1 || (int) $_POST['networkId'] == 2) {
2019
- $new_template[$type]['addLink'] = ((isset($data['addLink']) && $data['addLink'] == 'false') ? false : true);
2020
- }
2021
- if ((int) $_POST['networkId'] == 12) {
2022
- $new_template[$type]['shuffleHashtags'] = ((isset($data['shuffleHashtags']) && $data['shuffleHashtags'] == 'true') ? true : false);
2023
- }
2024
- }
2025
-
2026
- $post_template[$_POST['networkId']] = $new_template;
2027
- $post_template_result = $options->_setOption("post_template", $post_template);
2028
- }
2029
-
2030
- if (((int) $_POST['networkId'] == 1 || (int) $_POST['networkId'] == 3 || (int) $_POST['networkId'] == 19) && isset($_POST['link_no_cache'])) {
2031
- $linkNoCache = B2S_Tools::getNoCacheData(B2S_PLUGIN_BLOG_USER_ID);
2032
- if (is_array($linkNoCache) && !empty($linkNoCache)) {
2033
- $linkNoCache[(int) $_POST['networkId']] = (int) $_POST['link_no_cache'];
2034
- $options->_setOption('link_no_cache', $linkNoCache);
2035
- $link_no_cache_option = true;
2036
- }
2037
- }
2038
-
2039
- if ($post_template_result == true || $link_no_cache_option == true) {
2040
- echo json_encode(array('result' => true));
2041
- wp_die();
2042
- } else {
2043
- echo json_encode(array('result' => false));
2044
- wp_die();
2045
- }
2046
- }
2047
-
2048
- echo json_encode(array('result' => false));
2049
- wp_die();
2050
- } else {
2051
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2052
- wp_die();
2053
- }
2054
- }
2055
-
2056
- public function loadDefaultPostTemplate() {
2057
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2058
- if (isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType']) && isset(unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']])) {
2059
- $default = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']];
2060
- require_once B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php';
2061
- $networkItem = new B2S_Network_Item();
2062
- $html = $networkItem->getEditTemplateFormContent($_POST['networkId'], $_POST['networkType'], $default);
2063
- echo json_encode(array('result' => true, 'html' => $html));
2064
- wp_die();
2065
- }
2066
- echo json_encode(array('result' => false));
2067
- wp_die();
2068
- } else {
2069
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2070
- wp_die();
2071
- }
2072
- }
2073
-
2074
- public function saveDraftData() {
2075
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2076
- if (isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
2077
- global $wpdb;
2078
- if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}b2s_posts_drafts'") == $wpdb->prefix . 'b2s_posts_drafts') {
2079
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
2080
- $optionUserTimeZone = $options->_getOption('user_time_zone');
2081
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
2082
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
2083
- $date = B2S_Util::getCustomLocaleDateTime($userTimeZoneOffset);
2084
-
2085
- $sqlCheckDraft = $wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}b2s_posts_drafts` WHERE `blog_user_id` = %d AND `post_id` = %d AND `save_origin` = 0", B2S_PLUGIN_BLOG_USER_ID, (int) $_POST['post_id']);
2086
- $draftEntry = $wpdb->get_var($sqlCheckDraft);
2087
- if ($draftEntry !== NULL && (int) $draftEntry > 0) {
2088
- $wpdb->update($wpdb->prefix . 'b2s_posts_drafts', array('data' => serialize($_POST), 'last_save_date' => $date), array('id' => (int) $draftEntry));
2089
- } else {
2090
- $wpdb->insert($wpdb->prefix . 'b2s_posts_drafts', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'post_id' => (int) $_POST['post_id'], 'data' => serialize($_POST), 'last_save_date' => $date));
2091
- }
2092
-
2093
- echo json_encode(array('result' => true));
2094
- wp_die();
2095
- }
2096
- }
2097
- echo json_encode(array('result' => false));
2098
- wp_die();
2099
- } else {
2100
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2101
- wp_die();
2102
- }
2103
- }
2104
-
2105
- public function deleteDraft() {
2106
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2107
- if (isset($_POST['draftId']) && (int) $_POST['draftId'] > 0) {
2108
- global $wpdb;
2109
- $wpdb->delete($wpdb->prefix . 'b2s_posts_drafts', array('id' => (int) $_POST['draftId'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
2110
- echo json_encode(array('result' => true));
2111
- wp_die();
2112
- }
2113
- echo json_encode(array('result' => false));
2114
- wp_die();
2115
- } else {
2116
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2117
- wp_die();
2118
- }
2119
- }
2120
-
2121
- public function authNetworkLogin() {
2122
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2123
- if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
2124
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Network/Pinterest.php');
2125
- $location = 'en';
2126
- if (isset($_POST['location']) && !empty($_POST['location'])) {
2127
- $location = $_POST['location'];
2128
- }
2129
- $pt = new B2S_Api_Network_Pinterest($location);
2130
- $authorize = $pt->authorize(sanitize_text_field($_POST['username']), sanitize_text_field($_POST['password']));
2131
- if (isset($authorize['error']) && (int) $authorize['error'] == 0 && isset($authorize['identData']) && !empty($authorize['identData'])) {
2132
- $getBoards = $pt->getPinBoards();
2133
- if (isset($getBoards['error']) && (int) $getBoards['error'] == 0 && isset($getBoards['data']) && !empty($getBoards['data'])) {
2134
- $html = '';
2135
- foreach ($getBoards['data'] as $k => $v) {
2136
- $html .= '<option value="' . esc_attr($v['board_id']) . '">' . esc_html($v['name']) . '</option>';
2137
- }
2138
- echo json_encode(array('result' => true, 'boards' => $html, 'identData' => base64_encode($authorize['identData'])));
2139
- wp_die();
2140
- }
2141
- if (isset($getBoards['error']) && (int) $getBoards['error'] == 3) {
2142
- echo json_encode(array('result' => false, 'error' => 'board'));
2143
- wp_die();
2144
- } elseif (isset($getBoards['error']) && (int) $getBoards['error'] == 2) {
2145
- echo json_encode(array('result' => false, 'error' => 'access'));
2146
- wp_die();
2147
- } else {
2148
- echo json_encode(array('result' => false, 'error' => ((isset($getBoards['error_code'])) ? $getBoards['error_code'] : '')));
2149
- wp_die();
2150
- }
2151
- } else {
2152
- echo json_encode(array('result' => false, 'error' => ((isset($authorize['error_code'])) ? $authorize['error_code'] : '')));
2153
- wp_die();
2154
- }
2155
- }
2156
- echo json_encode(array('result' => false));
2157
- wp_die();
2158
- } else {
2159
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2160
- wp_die();
2161
- }
2162
- }
2163
-
2164
- public function authNetworkConfirm() {
2165
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2166
- if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['boardId']) && !empty($_POST['boardId']) && isset($_POST['identData']) && !empty($_POST['identData'])) {
2167
- $mandantId = ((isset($_POST['mandantId']) && (int) $_POST['mandantId'] >= 0) ? $_POST['mandantId'] : 0);
2168
- $publicKey = B2S_PLUGIN_DIR . '/includes/B2S/Api/Network/public_key.pem';
2169
- if (function_exists('openssl_public_encrypt') && file_exists($publicKey)) {
2170
- $getPublicKey = file_get_contents($publicKey);
2171
- openssl_public_encrypt(sanitize_text_field($_POST['username']), $username, $getPublicKey);
2172
- openssl_public_encrypt(sanitize_text_field($_POST['boardId']), $boardId, $getPublicKey);
2173
- if (isset($_POST['password']) && !empty($_POST['password'])) {
2174
- openssl_public_encrypt(sanitize_text_field($_POST['password']), $password, $getPublicKey);
2175
- } else {
2176
- $password = "extension_login";
2177
- }
2178
- $data = array('username' => base64_encode($username), 'password' => base64_encode($password), 'boardId' => base64_encode($boardId), 'identData' => sanitize_text_field(base64_decode($_POST['identData'])));
2179
- $postData = array('action' => 'authorizeNetwork', 'token' => B2S_PLUGIN_TOKEN, 'networkId' => 6, 'networkType' => 'profile', 'mandantId' => sanitize_text_field($mandantId), 'version' => B2S_PLUGIN_VERSION, 'data' => $data);
2180
- if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
2181
- $postData = array_merge($postData, array('networkAuthId' => sanitize_text_field($_POST['networkAuthId'])));
2182
- }
2183
- $repsonse = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $postData, 15), true);
2184
- if (isset($repsonse['result']) && $repsonse['result'] != false && isset($repsonse['networkAuthId']) && (int) $repsonse['networkAuthId'] > 0) {
2185
- echo json_encode(array('result' => true, 'networkId' => 6, 'networkType' => 0, 'displayName' => sanitize_text_field($_POST['username']), 'networkAuthId' => sanitize_text_field($repsonse['networkAuthId']), 'mandandId' => sanitize_text_field($mandantId)));
2186
- wp_die();
2187
- } else {
2188
- if (isset($repsonse['error_reason']) && !empty($repsonse['error_reason'])) {
2189
- echo json_encode(array('result' => false, 'error' => $repsonse['error_reason']));
2190
- wp_die();
2191
- }
2192
- echo json_encode(array('result' => false));
2193
- wp_die();
2194
- }
2195
- }
2196
- }
2197
- echo json_encode(array('result' => false));
2198
- wp_die();
2199
- } else {
2200
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2201
- wp_die();
2202
- }
2203
- }
2204
-
2205
- public function changeFavoriteStatus() {
2206
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2207
- if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['setStatus']) && (int) $_POST['setStatus'] >= 0) {
2208
- global $wpdb;
2209
- if ((int) $_POST['setStatus'] == 1) {
2210
- $sqlCheckFavorite = $wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}b2s_posts_favorites` WHERE `blog_user_id` = %d AND `post_id` = %d", B2S_PLUGIN_BLOG_USER_ID, (int) $_POST['postId']);
2211
- $favoriteEntry = $wpdb->get_var($sqlCheckFavorite);
2212
- if ($favoriteEntry == NULL) {
2213
- $wpdb->insert($wpdb->prefix . 'b2s_posts_favorites', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'post_id' => (int) $_POST['postId'], 'save_date' => gmdate('Y-m-d H:i:s')));
2214
- }
2215
- } else {
2216
- $wpdb->delete($wpdb->prefix . 'b2s_posts_favorites', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'post_id' => (int) $_POST['postId']), array('%d', '%d'));
2217
- }
2218
- echo json_encode(array('result' => true));
2219
- wp_die();
2220
- }
2221
- echo json_encode(array('result' => false));
2222
- wp_die();
2223
- } else {
2224
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2225
- wp_die();
2226
- }
2227
- }
2228
-
2229
- public function saveUrlParameter() {
2230
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2231
- if (isset($_POST['originNetworkAuthId']) && (int) $_POST['originNetworkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networks']) && !empty($_POST['networks']) && isset($_POST['urlParameter'])) {
2232
- $inputParams = json_decode(stripslashes_deep($_POST['urlParameter']), true);
2233
- if ($inputParams === false) {
2234
- echo json_encode(array('result' => false));
2235
- wp_die();
2236
- }
2237
- $newParams = array();
2238
- foreach ($inputParams as $key => $value) {
2239
- $key = urlencode(str_replace(" ", "", $key));
2240
- $value = urlencode($value);
2241
- $newParams[$key] = $value;
2242
- }
2243
- global $wpdb;
2244
- if (is_array($_POST['networks'])) {
2245
- foreach ($_POST['networks'] as $network) {
2246
- if (isset($network['networkAuthId']) && (int) $network['networkAuthId'] > 0) {
2247
- $sqlGetData = $wpdb->prepare("SELECT `id`, `data` FROM `{$wpdb->prefix}b2s_posts_network_details` WHERE `network_auth_id` = %d", (int) $network['networkAuthId']);
2248
- $result = $wpdb->get_results($sqlGetData);
2249
- if (!empty($result) && isset($result[0])) {
2250
- if ($result[0]->data !== NULL && !empty($result[0]->data)) {
2251
- $data = unserialize($result[0]->data);
2252
- if ($data != false && is_array($data)) {
2253
- $data['url_parameter'][0]['name'] = 'default';
2254
- $data['url_parameter'][0]['querys'] = $newParams;
2255
- } else {
2256
- $data = array('url_parameter' => array(0 => array('name' => 'default', 'querys' => $newParams)));
2257
- }
2258
- } else {
2259
- $data = array('url_parameter' => array(0 => array('name' => 'default', 'querys' => $newParams)));
2260
- }
2261
- $wpdb->update($wpdb->prefix . 'b2s_posts_network_details', array('data' => serialize($data)), array('network_auth_id' => (int) $network['networkAuthId']));
2262
- } else {
2263
- if (isset($network['networkId']) && isset($network['networkType']) && isset($network['networkAuthId']) && isset($network['displayName'])) {
2264
- $data = array('url_parameter' => array(0 => array('name' => 'default', 'querys' => $newParams)));
2265
- $wpdb->insert($wpdb->prefix . 'b2s_posts_network_details', array(
2266
- 'network_id' => (int) $network['networkId'],
2267
- 'network_type' => (int) $network['networkType'],
2268
- 'network_auth_id' => (int) $network['networkAuthId'],
2269
- 'network_display_name' => $network['displayName'],
2270
- 'data' => serialize($data)), array('%d', '%d', '%d', '%s', '%s')
2271
- );
2272
- }
2273
- }
2274
- }
2275
- }
2276
- }
2277
-
2278
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
2279
- $networkItem = new B2S_Network_Item();
2280
- $newHtml = $networkItem->getUrlParameterSettings((int) $_POST['originNetworkAuthId'], (int) $_POST['networkId']);
2281
- echo json_encode(array('result' => true, 'html' => $newHtml));
2282
- wp_die();
2283
- }
2284
- echo json_encode(array('result' => false));
2285
- wp_die();
2286
- } else {
2287
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2288
- wp_die();
2289
- }
2290
- }
2291
-
2292
- public function rePostSubmit() {
2293
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2294
- if (isset($_POST['b2s-re-post-profil-dropdown']) && (int) $_POST['b2s-re-post-profil-dropdown'] >= 0 && isset($_POST['b2s-re-post-profil-data-' . $_POST['b2s-re-post-profil-dropdown']]) && !empty($_POST['b2s-re-post-profil-data-' . $_POST['b2s-re-post-profil-dropdown']])) {
2295
- $networkData = json_decode(base64_decode($_POST['b2s-re-post-profil-data-' . $_POST['b2s-re-post-profil-dropdown']]));
2296
- if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
2297
-
2298
- //Select Posts for Queue
2299
- $limit = 5;
2300
- $versionLimit = unserialize(B2S_PLUGIN_RE_POST_LIMIT);
2301
- if (isset($_POST['b2s-re-post-limit']) && (int) $_POST['b2s-re-post-limit'] >= 1) {
2302
- $limit = ((int) $_POST['b2s-re-post-limit'] > (int) $versionLimit[B2S_PLUGIN_USER_VERSION]) ? (int) $versionLimit[B2S_PLUGIN_USER_VERSION] : (int) $_POST['b2s-re-post-limit'];
2303
- if (isset($_POST['b2s-re-post-queue-count']) && (int) $_POST['b2s-re-post-queue-count'] >= 1) {
2304
- if ((int) $_POST['b2s-re-post-queue-count'] + (int) $_POST['b2s-re-post-limit'] > (int) $versionLimit[B2S_PLUGIN_USER_VERSION]) {
2305
- $limit = (int) $versionLimit[B2S_PLUGIN_USER_VERSION] - (int) $_POST['b2s-re-post-queue-count'];
2306
- }
2307
- }
2308
- }
2309
- if ($limit <= 0) {
2310
- echo json_encode(array('result' => false, 'error' => 'limit'));
2311
- wp_die();
2312
- }
2313
- global $wpdb;
2314
- $where = "";
2315
- $join = "";
2316
- if (isset($_POST['b2s-re-post-settings-option']) && (int) $_POST['b2s-re-post-settings-option'] == 1) {
2317
- //custom settings
2318
- //posttypes
2319
- if (isset($_POST['b2s-re-post-type-active']) && (int) $_POST['b2s-re-post-type-active'] == 1 && isset($_POST['b2s-re-post-type-data']) && !empty($_POST['b2s-re-post-type-data']) && is_array($_POST['b2s-re-post-type-data'])) {
2320
- $where .= " AND post_type " . ((isset($_POST['b2s-re-post-type-state']) && !empty($_POST['b2s-re-post-type-state']) && (int) $_POST['b2s-re-post-type-state'] == 1) ? 'NOT' : '') . " IN ('" . implode("','", $_POST['b2s-re-post-type-data']) . "') ";
2321
- }
2322
- //author
2323
- if (isset($_POST['b2s-re-post-author-active']) && (int) $_POST['b2s-re-post-author-active'] == 1 && isset($_POST['b2s-re-post-author-data']) && !empty($_POST['b2s-re-post-author-data']) && is_array($_POST['b2s-re-post-author-data'])) {
2324
- $where .= " AND post_author " . ((isset($_POST['b2s-re-post-author-state']) && !empty($_POST['b2s-re-post-author-state']) && (int) $_POST['b2s-re-post-author-state'] == 1) ? 'NOT' : '') . " IN ('" . implode("','", $_POST['b2s-re-post-author-data']) . "') ";
2325
- }
2326
- //Start/End Date
2327
- if (isset($_POST['b2s-re-post-date-active']) && (int) $_POST['b2s-re-post-date-active'] == 1 && isset($_POST['b2s-re-post-date-start']) && !empty($_POST['b2s-re-post-date-start']) && isset($_POST['b2s-re-post-date-end']) && !empty($_POST['b2s-re-post-date-end'])) {
2328
- //Case Startdate higher then Enddate => Switch Dates
2329
- if ($_POST['b2s-re-post-date-start'] > $_POST['b2s-re-post-date-end']) {
2330
- $start = date('Y-m-d', strtotime($_POST['b2s-re-post-date-end']));
2331
- $end = date('Y-m-d', strtotime($_POST['b2s-re-post-date-start']));
2332
- } else {
2333
- $start = date('Y-m-d', strtotime($_POST['b2s-re-post-date-start']));
2334
- $end = date('Y-m-d', strtotime($_POST['b2s-re-post-date-end']));
2335
- }
2336
- $where .= " AND (post_date " . ((isset($_POST['b2s-re-post-date-state']) && !empty($_POST['b2s-re-post-date-state']) && (int) $_POST['b2s-re-post-date-state'] == 1) ? '<' : '>=') . " '" . $start . " 00:00:00' ";
2337
- $where .= ((isset($_POST['b2s-re-post-date-state']) && !empty($_POST['b2s-re-post-date-state']) && (int) $_POST['b2s-re-post-date-state'] == 1) ? ' OR ' : ' AND ');
2338
- $where .= " post_date " . ((isset($_POST['b2s-re-post-date-state']) && !empty($_POST['b2s-re-post-date-state']) && (int) $_POST['b2s-re-post-date-state'] == 1) ? '>' : '<=') . " '" . $end . " 23:59:59') ";
2339
- }
2340
- //only posted x times - Posts (1 post to 1 auth) within 5 minutes counts as posted one time
2341
- if (isset($_POST['b2s-re-post-already-planed-active']) && (int) $_POST['b2s-re-post-already-planed-active'] == 1 && isset($_POST['b2s-re-post-already-planed-count']) && (int) $_POST['b2s-re-post-already-planed-count'] >= 0) {
2342
- $where .= " AND posts.ID NOT IN (SELECT post_id FROM (SELECT post_id FROM wp_b2s_posts WHERE blog_user_id = " . (int) B2S_PLUGIN_BLOG_USER_ID . " AND publish_date != '0000-00-00 00:00:00' AND publish_error_code = '' AND hide = 0 GROUP BY UNIX_TIMESTAMP(publish_date) DIV 300 ORDER BY `wp_b2s_posts`.`post_id` ASC) AS b2s_post_results GROUP BY post_id HAVING count(*) > " . (int) $_POST['b2s-re-post-already-planed-count'] . ") ";
2343
- }
2344
- //categories
2345
- if (isset($_POST['b2s-re-post-categories-active']) && (int) $_POST['b2s-re-post-categories-active'] == 1 && isset($_POST['b2s-re-post-categories-data']) && !empty($_POST['b2s-re-post-categories-data']) && is_array($_POST['b2s-re-post-categories-data'])) {
2346
- $join .= " LEFT JOIN (SELECT * FROM $wpdb->term_relationships WHERE term_taxonomy_id IN ('" . implode("','", $_POST['b2s-re-post-categories-data']) . "')) AS tr ON tr.object_id = posts.ID";
2347
- $where .= " AND term_taxonomy_id IS " . ((isset($_POST['b2s-re-post-categories-state']) && !empty($_POST['b2s-re-post-categories-state']) && (int) $_POST['b2s-re-post-categories-state'] == 1) ? '' : 'NOT') . " NULL ";
2348
- }
2349
- //include only favorites
2350
- if (isset($_POST['b2s-re-post-favorites-active']) && (int) $_POST['b2s-re-post-favorites-active'] == 1) {
2351
- $join .= " LEFT JOIN (SELECT post_id FROM {$wpdb->prefix}b2s_posts_favorites WHERE blog_user_id = '" . B2S_PLUGIN_BLOG_USER_ID . "')AS favorites ON favorites.post_id = posts.ID ";
2352
- $where .= " AND favorites.post_id IS NOT NULL ";
2353
- }
2354
- }
2355
-
2356
- $allowedPostTypes = get_post_types(array('public' => true));
2357
- $postTypeIn = "(";
2358
- foreach ($allowedPostTypes as $k => $v) {
2359
- $postTypeIn .= "'" . $v . "',";
2360
- }
2361
- $postTypeIn = substr($postTypeIn, 0, -1) . ")";
2362
-
2363
- $sql = "SELECT ID FROM $wpdb->posts as posts " . $join . " WHERE post_status = 'publish' AND post_type IN " . $postTypeIn . " " . $where;
2364
- $sql .= " ORDER BY post_date ASC ";
2365
- $sql .= " LIMIT " . $limit;
2366
- $result = $wpdb->get_results($sql);
2367
- if (!is_array($result) || empty($result)) {
2368
- echo json_encode(array('result' => false, 'error' => 'no_content'));
2369
- wp_die();
2370
- } else {
2371
- //check if posts already in queue
2372
- $hook_filter = new B2S_Hook_Filter();
2373
- $postIds = array();
2374
- for ($i = 0; $i < count($result); $i++) {
2375
- array_push($postIds, (int) $result[$i]->ID);
2376
- }
2377
- $sql = "SELECT DISTINCT post_id FROM {$wpdb->prefix}b2s_posts WHERE sched_type = '5' AND hide = '0' AND publish_date = '0000-00-00 00:00:00' AND blog_user_id = " . B2S_PLUGIN_BLOG_USER_ID . " AND post_id IN (" . implode(",", $postIds) . ")";
2378
- $result = $wpdb->get_results($sql);
2379
- if (is_array($result) && !empty($result)) {
2380
- foreach ($result as $k => $v) {
2381
- $key = array_search($v->post_id, $postIds);
2382
- if ($key !== false) {
2383
- unset($postIds[$key]);
2384
- }
2385
- }
2386
- }
2387
- if (empty($postIds)) {
2388
- echo json_encode(array('result' => false, 'error' => 'content_in_queue'));
2389
- wp_die();
2390
- } else {
2391
- //Time Settings
2392
- if (isset($_POST['b2s-re-post-share-option'])) {
2393
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
2394
- $bestTimes = array();
2395
- if (isset($_POST['b2s-re-post-best-times-active']) && (int) $_POST['b2s-re-post-best-times-active'] > 0) {
2396
- $bestTimes = $options->_getOption('auth_sched_time');
2397
- }
2398
- $optionUserTimeZone = $options->_getOption('user_time_zone');
2399
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
2400
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
2401
- $userLang = (isset($_POST['b2s-user-lang']) && $_POST['b2s-user-lang'] != 'en') ? $_POST['b2s-user-lang'] : 'en';
2402
- $selectedTwitterProfile = (isset($_POST['b2s-re-post-profil-dropdown-twitter']) && !empty($_POST['b2s-re-post-profil-dropdown-twitter'])) ? (int) $_POST['b2s-re-post-profil-dropdown-twitter'] : '';
2403
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/RePost/Save.php');
2404
-
2405
- if ((int) $_POST['b2s-re-post-share-option'] < 1) {
2406
- //share every x days at [Mo][Thu]...
2407
- $shareOptionType = 0;
2408
- $interval = (isset($_POST['b2s-re-post-day-0']) && (int) $_POST['b2s-re-post-day-0'] > 0 && (int) $_POST['b2s-re-post-day-0'] <= 30) ? (int) $_POST['b2s-re-post-day-0'] : (((int) $_POST['b2s-re-post-day-0'] > 30) ? 30 : 1);
2409
- $weekday = array(
2410
- 0 => ((isset($_POST['b2s-re-post-weekday-0']) && (int) $_POST['b2s-re-post-weekday-0'] >= 1) ? true : false), //Sun
2411
- 1 => ((isset($_POST['b2s-re-post-weekday-1']) && (int) $_POST['b2s-re-post-weekday-1'] >= 1) ? true : false), //Mon
2412
- 2 => ((isset($_POST['b2s-re-post-weekday-2']) && (int) $_POST['b2s-re-post-weekday-2'] >= 1) ? true : false), //Tue
2413
- 3 => ((isset($_POST['b2s-re-post-weekday-3']) && (int) $_POST['b2s-re-post-weekday-3'] >= 1) ? true : false), //Wed
2414
- 4 => ((isset($_POST['b2s-re-post-weekday-4']) && (int) $_POST['b2s-re-post-weekday-4'] >= 1) ? true : false), //Thu
2415
- 5 => ((isset($_POST['b2s-re-post-weekday-5']) && (int) $_POST['b2s-re-post-weekday-5'] >= 1) ? true : false), //Fri
2416
- 6 => ((isset($_POST['b2s-re-post-weekday-6']) && (int) $_POST['b2s-re-post-weekday-6'] >= 1) ? true : false) //Sat
2417
- );
2418
- $timeInput = (isset($_POST['b2s-re-post-input-time-0']) && !empty($_POST['b2s-re-post-input-time-0'])) ? $_POST['b2s-re-post-input-time-0'] : '';
2419
- } else {
2420
- //share every x [Monday]
2421
- $shareOptionType = 1;
2422
- $interval = (isset($_POST['b2s-re-post-day-1']) && (int) $_POST['b2s-re-post-day-1'] > 0 && (int) $_POST['b2s-re-post-day-1'] <= 10) ? (int) $_POST['b2s-re-post-day-1'] : (((int) $_POST['b2s-re-post-day-1'] > 10) ? 10 : 1);
2423
- $weekday = (isset($_POST['b2s-re-post-weekday-select']) && !empty($_POST['b2s-re-post-weekday-select'])) ? $_POST['b2s-re-post-weekday-select'] : 'monday';
2424
- $timeInput = (isset($_POST['b2s-re-post-input-time-1']) && !empty($_POST['b2s-re-post-input-time-1'])) ? $_POST['b2s-re-post-input-time-1'] : '';
2425
- }
2426
-
2427
- $date = new DateTime();
2428
- $optionPostFormat = $options->_getOption('post_template');
2429
- $rePost = new B2S_RePost_Save(B2S_PLUGIN_BLOG_USER_ID, $userLang, $userTimeZoneOffset, $optionPostFormat, true, $bestTimes);
2430
- $countPosts = 0;
2431
- foreach ($postIds as $k => $postId) {
2432
- //get Postdata
2433
- $postData = get_post((int) $postId);
2434
- $title = isset($postData->post_title) ? B2S_Util::getTitleByLanguage(strip_tags($postData->post_title), strtolower($userLang)) : '';
2435
- $content = (isset($postData->post_content) && !empty($postData->post_content)) ? trim($postData->post_content) : '';
2436
- $excerpt = (isset($postData->post_excerpt) && !empty($postData->post_excerpt)) ? trim($postData->post_excerpt) : '';
2437
- $url = get_permalink((int) $postId);
2438
- $postImages = $hook_filter->get_wp_post_image($postId, true, $content);
2439
- $imageUrl = '';
2440
- if ($postImages != false && !empty($postImages)) {
2441
- foreach ($postImages as $key => $value) {
2442
- if (isset($value[0]) && !empty($value[0])) {
2443
- $imageUrl = $value[0];
2444
- break;
2445
- }
2446
- }
2447
- }
2448
- if (empty($imageUrl) && isset($_POST['b2s-re-post-images-active']) && (int) $_POST['b2s-re-post-images-active'] == 1) {
2449
- continue;
2450
- }
2451
- $keywords = $hook_filter->get_wp_post_hashtag((int) $postId, get_post_type((int) $postId));
2452
- $rePost->setPostData($postId, $title, $content, $excerpt, $url, $imageUrl, $keywords);
2453
-
2454
- //calculate Post Start Date
2455
- if ($shareOptionType == 0) {
2456
- $date->modify('+' . $interval . ' days');
2457
- } else {
2458
- for ($daycount = 0; $daycount < $interval; $daycount++) {
2459
- $date->modify('next ' . $weekday);
2460
- }
2461
- }
2462
- $startDate = $date->format("Y-m-d");
2463
- if ($shareOptionType == 0) {
2464
- $settings = array('type' => 0, 'bestTimes' => ((!empty($bestTimes)) ? true : false), 'interval' => $interval, 'weekday' => $weekday, 'time' => $timeInput);
2465
- } else {
2466
- $settings = array('type' => 1, 'bestTimes' => ((!empty($bestTimes)) ? true : false), 'interval' => $interval, 'weekday' => $weekday, 'time' => $timeInput);
2467
- }
2468
- $nextPosibleDate = $rePost->getPostDateTime($startDate, $settings);
2469
- $date->setDate(substr($nextPosibleDate, 0, 4), substr($nextPosibleDate, 5, 2), substr($nextPosibleDate, 8, 2));
2470
- $rePost->generatePosts($startDate, $settings, $networkData, $selectedTwitterProfile);
2471
- $countPosts++;
2472
- }
2473
- if ($countPosts == 0) {
2474
- echo json_encode(array('result' => false, 'error' => 'no_content'));
2475
- wp_die();
2476
- }
2477
- B2S_Heartbeat::getInstance()->postToServer();
2478
- }
2479
- }
2480
- }
2481
-
2482
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/RePost/Item.php');
2483
- $rePostItem = new B2S_RePost_Item();
2484
- $queue = $rePostItem->getRePostQueueHtml();
2485
- echo json_encode(array('result' => true, 'queue' => $queue));
2486
- wp_die();
2487
- }
2488
- }
2489
- } else {
2490
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2491
- wp_die();
2492
- }
2493
- }
2494
-
2495
- public function deleteRePostSched() {
2496
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2497
- if (isset($_POST['postId']) && !empty($_POST['postId'])) {
2498
- $postIds = explode(',', $_POST['postId']);
2499
- if (is_array($postIds) && !empty($postIds)) {
2500
- $postIdsString = '';
2501
- foreach ($postIds as $postId) {
2502
- $postIdsString .= (int) $postId . ',';
2503
- }
2504
- $postIdsString = substr($postIdsString, 0, -1);
2505
- global $wpdb;
2506
- $sql = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}b2s_posts WHERE sched_type = %d AND hide = %d AND publish_date = %s AND blog_user_id = %d AND post_id IN ($postIdsString)", 5, 0, '0000-00-00 00:00:00', B2S_PLUGIN_BLOG_USER_ID);
2507
- $result = $wpdb->get_results($sql);
2508
- if (is_array($result) && !empty($result)) {
2509
- $b2sPostIds = array();
2510
- foreach ($result as $k => $v) {
2511
- array_push($b2sPostIds, $v->id);
2512
- }
2513
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
2514
- $delete = B2S_Post_Tools::deleteUserSchedPost($b2sPostIds);
2515
- if ($delete['result'] == true) {
2516
- echo json_encode(array('result' => true, 'postIds' => $postIds));
2517
- wp_die();
2518
- }
2519
- }
2520
- }
2521
- }
2522
- echo json_encode(array('result' => false));
2523
- wp_die();
2524
- } else {
2525
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2526
- wp_die();
2527
- }
2528
- }
2529
-
2530
- public function communityRegister() {
2531
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2532
- if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password']) && isset($_POST['email']) && !empty($_POST['email'])) {
2533
- $postData = array('action' => 'registerCommunity', 'token' => B2S_PLUGIN_TOKEN, 'username' => $_POST['username'], 'email' => $_POST['email'], 'password' => $_POST['password']);
2534
- $repsonse = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $postData, 15), true);
2535
- if (is_array($repsonse) && !empty($repsonse) && isset($repsonse['result'])) {
2536
- if ($repsonse['result'] == true) {
2537
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
2538
- $options->_setOption('registered_community', true);
2539
- }
2540
- echo json_encode($repsonse);
2541
- wp_die();
2542
- }
2543
- }
2544
- echo json_encode(array('result' => false));
2545
- wp_die();
2546
- } else {
2547
- echo json_encode(array('result' => false, 'error_reason' => 'nonce'));
2548
- wp_die();
2549
- }
2550
- }
2551
-
2552
- public function networkCheckUserData() {
2553
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2554
- $wpCookie = array();
2555
- $tempCookies = array();
2556
- foreach ($_POST['networkUserData']['accData'] as $key => $value) {
2557
- $entry = (array) $value;
2558
- $entry['expires'] = isset($value->expirationDate) ? (int) $value->expirationDate : null;
2559
- if (!in_array($entry['name'], $tempCookies)) {
2560
- $tempCookies[] = $entry['name'];
2561
- $entry['value'] = str_replace('\\"', '"', $entry['value']);
2562
- $wpCookie[] = new WP_Http_Cookie($entry);
2563
- }
2564
- }
2565
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Network/Pinterest.php');
2566
- $pt = new B2S_Api_Network_Pinterest();
2567
- $pt->cookie = $wpCookie;
2568
- $getBoards = $pt->getPinBoards();
2569
- if (isset($getBoards['error']) && (int) $getBoards['error'] == 0 && isset($getBoards['data']) && !empty($getBoards['data'])) {
2570
- $html = '';
2571
- foreach ($getBoards['data'] as $k => $v) {
2572
- $html .= '<option value="' . esc_attr($v['board_id']) . '">' . esc_html($v['name']) . '</option>';
2573
- }
2574
- $identData = serialize($wpCookie);
2575
- echo json_encode(array('result' => true, 'username' => $_POST['networkUserData']['acc']['email'], 'boards' => $html, 'identData' => base64_encode($identData)));
2576
- wp_die();
2577
- }
2578
- echo json_encode(array('result' => false));
2579
- wp_die();
2580
- } else {
2581
- echo json_encode(array('result' => false, 'error_reason' => 'nonce'));
2582
- wp_die();
2583
- }
2584
- }
2585
-
2586
- }
1
+ <?php
2
+
3
+ class Ajax_Post {
4
+
5
+ static private $instance = null;
6
+
7
+ static public function getInstance() {
8
+ if (null === self::$instance) {
9
+ self::$instance = new self;
10
+ }
11
+ return self::$instance;
12
+ }
13
+
14
+ public function __construct() {
15
+ add_action('wp_ajax_b2s_save_ship_data', array($this, 'saveShipData'));
16
+ add_action('wp_ajax_b2s_save_user_mandant', array($this, 'saveUserMandant'));
17
+ add_action('wp_ajax_b2s_delete_mandant', array($this, 'deleteUserMandant'));
18
+ add_action('wp_ajax_b2s_lock_auto_post_import', array($this, 'lockAutoPostImport'));
19
+ add_action('wp_ajax_b2s_delete_user_auth', array($this, 'deleteUserAuth'));
20
+ add_action('wp_ajax_b2s_update_user_version', array($this, 'updateUserVersion'));
21
+ add_action('wp_ajax_b2s_accept_privacy_policy', array($this, 'acceptPrivacyPolicy'));
22
+ add_action('wp_ajax_b2s_create_trail', array($this, 'createTrail'));
23
+ add_action('wp_ajax_b2s_save_network_board_and_group', array($this, 'saveNetworkBoardAndGroup'));
24
+ add_action('wp_ajax_b2s_delete_user_sched_post', array($this, 'deleteUserSchedPost'));
25
+ add_action('wp_ajax_b2s_delete_user_publish_post', array($this, 'deleteUserPublishPost'));
26
+ add_action('wp_ajax_b2s_delete_user_approve_post', array($this, 'deleteUserApprovePost'));
27
+ add_action('wp_ajax_b2s_delete_user_cc_draft_post', array($this, 'deleteUserCcDraftPost'));
28
+ add_action('wp_ajax_b2s_user_network_settings', array($this, 'saveUserNetworkSettings'));
29
+ add_action('wp_ajax_b2s_auto_post_settings', array($this, 'saveAutoPostSettings'));
30
+ add_action('wp_ajax_b2s_save_social_meta_tags', array($this, 'saveSocialMetaTags'));
31
+ add_action('wp_ajax_b2s_reset_social_meta_tags', array($this, 'resetSocialMetaTags'));
32
+ add_action('wp_ajax_b2s_save_user_time_settings', array($this, 'saveUserTimeSettings'));
33
+ add_action('wp_ajax_b2s_network_save_auth_to_settings', array($this, 'saveAuthToSettings'));
34
+ add_action('wp_ajax_b2s_prg_login', array($this, 'prgLogin'));
35
+ add_action('wp_ajax_b2s_prg_logout', array($this, 'prgLogout'));
36
+ add_action('wp_ajax_b2s_prg_ship', array($this, 'prgShip'));
37
+ add_action('wp_ajax_b2s_ship_navbar_save_settings', array($this, 'b2sShipNavbarSaveSettings'));
38
+ add_action('wp_ajax_b2s_post_mail_update', array($this, 'b2sPostMailUpdate'));
39
+ add_action('wp_ajax_b2s_calendar_move_post', array($this, 'b2sCalendarMovePost'));
40
+ add_action('wp_ajax_b2s_delete_post', array($this, 'b2sDeletePost'));
41
+ add_action('wp_ajax_b2s_edit_save_post', array($this, 'b2sEditSavePost'));
42
+ add_action("wp_ajax_b2s_get_calendar_release_locks", array($this, 'releaseLocks'));
43
+ add_action("wp_ajax_b2s_update_approve_post", array($this, 'updateApprovePost'));
44
+ add_action("wp_ajax_b2s_hide_rating", array($this, 'hideRating'));
45
+ add_action("wp_ajax_b2s_hide_premium_message", array($this, 'hidePremiumMessage'));
46
+ add_action("wp_ajax_b2s_hide_trail_message", array($this, 'hideTrailMessage'));
47
+ add_action("wp_ajax_b2s_hide_trail_ended_message", array($this, 'hideTrailEndedMessage'));
48
+ add_action("wp_ajax_b2s_plugin_deactivate_delete_sched_post", array($this, 'b2sPluginDeactivate'));
49
+ add_action("wp_ajax_b2s_curation_share", array($this, 'curationShare'));
50
+ add_action("wp_ajax_b2s_curation_customize", array($this, 'curationCustomize'));
51
+ add_action("wp_ajax_b2s_curation_draft", array($this, 'curationDraft'));
52
+ add_action("wp_ajax_b2s_move_user_auth_to_profile", array($this, 'moveUserAuthToProfile'));
53
+ add_action("wp_ajax_b2s_assign_network_user_auth", array($this, 'assignNetworkUserAuth'));
54
+ add_action("wp_ajax_b2s_save_post_template", array($this, 'savePostTemplate'));
55
+ add_action("wp_ajax_b2s_load_default_post_template", array($this, 'loadDefaultPostTemplate'));
56
+ add_action('wp_ajax_b2s_save_draft_data', array($this, 'saveDraftData'));
57
+ add_action('wp_ajax_b2s_delete_user_draft', array($this, 'deleteDraft'));
58
+ add_action('wp_ajax_b2s_auth_network_login', array($this, 'authNetworkLogin'));
59
+ add_action('wp_ajax_b2s_auth_network_confirm', array($this, 'authNetworkConfirm'));
60
+ add_action('wp_ajax_b2s_change_favorite_status', array($this, 'changeFavoriteStatus'));
61
+ add_action('wp_ajax_b2s_save_url_parameter', array($this, 'saveUrlParameter'));
62
+ add_action('wp_ajax_b2s_re_post_submit', array($this, 'rePostSubmit'));
63
+ add_action('wp_ajax_b2s_delete_re_post_sched', array($this, 'deleteRePostSched'));
64
+ add_action('wp_ajax_b2s_community_register', array($this, 'communityRegister'));
65
+ add_action('wp_ajax_b2s_auto_post_assign_by_disconnect', array($this, 'autoPostAssignByDisconnect'));
66
+ add_action('wp_ajax_b2s_network_check_user_data', array($this, 'networkCheckUserData'));
67
+ add_action('wp_ajax_b2s_metrics_starting_confirm', array($this, 'metricsStartingConfirm'));
68
+ }
69
+
70
+ public function curationDraft() {
71
+ //save as blog post
72
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) { //0-24hours lifetime
73
+ if (isset($_POST['postFormat'])) {
74
+ if ((int) $_POST['postFormat'] == 1) { //Imagepost
75
+ if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
76
+ $data = array('title' => sanitize_text_field($_POST['comment_image']), 'content' => $_POST['comment_image'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
77
+ } else {
78
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
79
+ wp_die();
80
+ }
81
+ } else if ((int) $_POST['postFormat'] == 0) { //Linkpost
82
+ if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
83
+ $data = array('title' => sanitize_text_field($_POST['title']), 'url' => esc_url($_POST['url']), 'content' => (isset($_POST['comment']) ? sanitize_textarea_field($_POST['comment']) : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
84
+ } else {
85
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
86
+ wp_die();
87
+ }
88
+ } else {
89
+ if (isset($_POST['comment_text']) && !empty($_POST['comment_text'])) {
90
+ $data = array('title' => sanitize_text_field($_POST['comment_text']), 'content' => sanitize_textarea_field($_POST['comment_text']), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
91
+ } else {
92
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
93
+ wp_die();
94
+ }
95
+ }
96
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
97
+ if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) {
98
+ $data = array_merge($data, array('ID' => (int) $_POST['b2s-draft-id']));
99
+ $curation = new B2S_Curation_Save($data);
100
+ $source = (get_post_meta((int) $_POST['b2s-draft-id'], "b2s_source", true));
101
+ $postId = $curation->updateContent($source);
102
+ } else {
103
+ $curation = new B2S_Curation_Save($data);
104
+ $postId = $curation->insertContent();
105
+ }
106
+ if ($postId !== false) {
107
+ if (isset($_POST['ship_type']) && isset($_POST['profile_select'])) {
108
+ $draft_data = array(
109
+ 'ship_type' => $_POST['ship_type'],
110
+ 'profile_select' => $_POST['profile_select']
111
+ );
112
+ if ((int) $_POST['ship_type'] > 0 && isset($_POST['ship_date'])) {
113
+ $draft_data['ship_date'] = $_POST['ship_date'];
114
+ }
115
+ if (isset($_POST['twitter_select'])) {
116
+ $draft_data['twitter_select'] = $_POST['twitter_select'];
117
+ }
118
+ global $wpdb;
119
+ if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}b2s_posts_drafts'") == $wpdb->prefix . 'b2s_posts_drafts') {
120
+ $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
121
+ $optionUserTimeZone = $options->_getOption('user_time_zone');
122
+ $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
123
+ $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
124
+ $date = B2S_Util::getCustomLocaleDateTime($userTimeZoneOffset);
125
+
126
+ $sqlCheckDraft = $wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}b2s_posts_drafts` WHERE `blog_user_id` = %d AND `post_id` = %d AND `save_origin` = 1", B2S_PLUGIN_BLOG_USER_ID, (int) $postId);
127
+ $draftEntry = $wpdb->get_var($sqlCheckDraft);
128
+ if ($draftEntry !== NULL && (int) $draftEntry > 0) {
129
+ $wpdb->update($wpdb->prefix . 'b2s_posts_drafts', array('data' => serialize($draft_data), 'last_save_date' => $date), array('id' => (int) $draftEntry));
130
+ } else {
131
+ $wpdb->insert($wpdb->prefix . 'b2s_posts_drafts', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'post_id' => (int) $postId, 'data' => serialize($draft_data), 'last_save_date' => $date, 'save_origin' => 1));
132
+ }
133
+ }
134
+ }
135
+ echo json_encode(array('result' => true, 'postId' => $postId));
136
+ wp_die();
137
+ }
138
+ }
139
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
140
+ wp_die();
141
+ } else {
142
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
143
+ wp_die();
144
+ }
145
+ }
146
+
147
+ public function curationShare() {
148
+ //save as blog post
149
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
150
+ if (isset($_POST['postFormat'])) {
151
+ if ((int) $_POST['postFormat'] == 1) { //Imagepost
152
+ if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
153
+ $data = array('title' => sanitize_text_field($_POST['comment_image']), 'content' => $_POST['comment_image'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
154
+ } else {
155
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
156
+ wp_die();
157
+ }
158
+ } else if ((int) $_POST['postFormat'] == 0) { //Linkpost
159
+ if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
160
+ $data = array('title' => sanitize_text_field($_POST['title']), 'url' => esc_url($_POST['url']), 'content' => (isset($_POST['comment']) ? sanitize_textarea_field($_POST['comment']) : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
161
+ } else {
162
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
163
+ wp_die();
164
+ }
165
+ } else {
166
+ if (isset($_POST['comment_text']) && !empty($_POST['comment_text'])) {
167
+ $data = array('title' => sanitize_text_field($_POST['comment_text']), 'content' => $_POST['comment_text'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
168
+ } else {
169
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
170
+ wp_die();
171
+ }
172
+ }
173
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
174
+ $curation = new B2S_Curation_Save($data);
175
+ $postId = (isset($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) ? (int) $_POST['b2s-draft-id'] : $curation->insertContent();
176
+ if ($postId !== false) {
177
+ //check Data
178
+ if (isset($_POST['profile_select'])) {
179
+ $profilId = (int) $_POST['profile_select'];
180
+ if (isset($_POST['profile_data_' . $profilId]) && !empty($_POST['profile_data_' . $profilId])) {
181
+ $networkData = json_decode(base64_decode($_POST['profile_data_' . $profilId]));
182
+ if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
183
+ $notAllowNetwork = array(11);
184
+ $tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
185
+ $allowNetworkOnlyImage = array(6, 7, 12, 21);
186
+ $allowNetworkOnlyLink = array(9, 15);
187
+ //TOS Twitter 032018 - none multiple Accounts - User select once
188
+ $selectedTwitterProfile = (isset($_POST['twitter_select']) && !empty($_POST['twitter_select'])) ? (int) $_POST['twitter_select'] : '';
189
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/QuickPost.php');
190
+ $quickPost = new B2S_QuickPost($data['content'], $data['title']);
191
+ $defaultShareData = array('default_titel' => sanitize_text_field($data['title']),
192
+ 'image_url' => (!empty($_POST['image_url'])) ? esc_url(trim(urldecode($_POST['image_url']))) : ((!empty($_POST['link_image_url']) ? esc_url(trim(urldecode($_POST['link_image_url']))) : '')),
193
+ 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
194
+ 'board' => '',
195
+ 'group' => '',
196
+ 'post_id' => $postId,
197
+ 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
198
+ 'tags' => array(),
199
+ 'url' => ((isset($_POST['url']) && !empty($_POST['url'])) ? esc_url($_POST['url']) : ''),
200
+ 'no_cache' => 0,
201
+ 'token' => B2S_PLUGIN_TOKEN,
202
+ 'user_timezone' => (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 ),
203
+ 'publish_date' => isset($_POST['publish_date']) ? date('Y-m-d H:i:s', strtotime($_POST['publish_date'])) : date('Y-m-d H:i:s', current_time('timestamp')));
204
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Save.php');
205
+ $b2sShipSend = new B2S_Ship_Save();
206
+ $content = array();
207
+ foreach ($networkData as $k => $value) {
208
+ if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
209
+ //TOS Twitter 032018 - none multiple Accounts - User select once
210
+ if ((int) $value->networkId != 2 || ((int) $value->networkId == 2 && (empty($selectedTwitterProfile) || ((int) $selectedTwitterProfile == (int) $value->networkAuthId)))) {
211
+ //Filter: image network
212
+ if ((int) $_POST['postFormat'] == 0) {
213
+ if (in_array($value->networkId, $allowNetworkOnlyImage)) {
214
+ if (empty($defaultShareData['image_url'])) {
215
+ array_push($content, array('networkDisplayName' => $value->networkUserName, 'networkAuthId' => $value->networkAuthId, 'networkId' => $value->networkId, 'networkType' => $value->networkType, 'html' => $b2sShipSend->getItemHtml($value->networkId, 'IMAGE_FOR_CURATION')));
216
+ continue;
217
+ }
218
+ }
219
+ } else if ((int) $_POST['postFormat'] == 1) {
220
+ if (in_array($value->networkId, $allowNetworkOnlyLink)) {
221
+ array_push($content, array('networkDisplayName' => $value->networkUserName, 'networkAuthId' => $value->networkAuthId, 'networkId' => $value->networkId, 'networkType' => $value->networkType, 'html' => $b2sShipSend->getItemHtml($value->networkId, 'LINK_FOR_CURATION')));
222
+ continue;
223
+ }
224
+ }
225
+ //Filter: Blog network
226
+ if (in_array($value->networkId, $notAllowNetwork)) {
227
+ continue;
228
+ }
229
+
230
+ //Filter: TOS Crossposting ignore
231
+ if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
232
+ continue;
233
+ }
234
+
235
+ //Filter: DeprecatedNetwork-8 31 march
236
+ if ($value->networkId == 8) {
237
+ if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date']) && strtotime($_POST['ship_date']) !== false) {
238
+ if (date('Y-m-d', strtotime($_POST['ship_date'])) >= '2019-03-31') {
239
+ //special case xing groups contains network_display_name
240
+ global $wpdb;
241
+ $networkDetailsId = 0;
242
+ if ($value->networkType == 2) {
243
+ $networkDetailsIdSelect = $wpdb->get_col($wpdb->prepare("SELECT postNetworkDetails.id FROM {$wpdb->prefix}b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s AND postNetworkDetails.network_display_name = %s", $value->networkAuthId, trim($value->networkUserName)));
244
+ } else {
245
+ $networkDetailsIdSelect = $wpdb->get_col($wpdb->prepare("SELECT postNetworkDetails.id FROM {$wpdb->prefix}b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $value->networkAuthId));
246
+ }
247
+ if (isset($networkDetailsIdSelect[0])) {
248
+ $networkDetailsId = (int) $networkDetailsIdSelect[0];
249
+ } else {
250
+ $wpdb->insert($wpdb->prefix . 'b2s_posts_network_details', array(
251
+ 'network_id' => (int) $value->networkId,
252
+ 'network_type' => (int) $value->networkType,
253
+ 'network_auth_id' => (int) $value->networkAuthId,
254
+ 'network_display_name' => $value->networkUserName), array('%d', '%d', '%d', '%s'));
255
+ $networkDetailsId = $wpdb->insert_id;
256
+ }
257
+ $timeZone = (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 );
258
+ $wpdb->insert($wpdb->prefix . 'b2s_posts', array(
259
+ 'post_id' => $postId,
260
+ 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
261
+ 'user_timezone' => $timeZone,
262
+ 'publish_date' => date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate(gmdate('Y-m-d H:i:s'), $timeZone * (-1)))),
263
+ 'publish_error_code' => 'DEPRECATED_NETWORK_8',
264
+ 'network_details_id' => $networkDetailsId), array('%d', '%d', '%s', '%s', '%s', '%d'));
265
+ continue;
266
+ }
267
+ }
268
+ }
269
+ $_POST['postFormat'] = ((int) $_POST['postFormat'] == 2) ? '1' : $_POST['postFormat'];
270
+ $shareData = $quickPost->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType, $_POST['postFormat']);
271
+ if ($shareData !== false) {
272
+ $shareData['network_id'] = $value->networkId;
273
+ $shareData['network_type'] = $value->networkType;
274
+ $shareData['instant_sharing'] = ((isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0);
275
+ $shareData['network_display_name'] = $value->networkUserName;
276
+ $shareData['network_auth_id'] = $value->networkAuthId;
277
+ $shareData = array_merge($shareData, $defaultShareData);
278
+ //Type schedule
279
+ if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date']) && strtotime($_POST['ship_date']) !== false) {
280
+ $shipDateTime = array('date' => array(date('Y-m-d', strtotime($_POST['ship_date']))), 'time' => array(date('H:i', strtotime($_POST['ship_date']))));
281
+ $schedData = array(
282
+ 'date' => $shipDateTime['date'],
283
+ 'time' => $shipDateTime['time'],
284
+ 'releaseSelect' => 1,
285
+ 'user_timezone' => (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 ),
286
+ 'saveSetting' => false);
287
+ $schedRes = $b2sShipSend->saveSchedDetails($shareData, $schedData, array());
288
+ $schedResult = array_merge($schedRes, array('networkDisplayName' => $value->networkUserName, 'networkId' => $value->networkId, 'networkType' => $value->networkType));
289
+ $content = array_merge($content, array($schedResult));
290
+ } else {
291
+ //TYPE direct share
292
+ $b2sShipSend->savePublishDetails($shareData, array(), true);
293
+ }
294
+ }
295
+ }
296
+ }
297
+ }
298
+ if (!empty($b2sShipSend->postDataApprove)) {
299
+ $sendResult = $b2sShipSend->getShareApproveDetails(true);
300
+ $content = array_merge($content, $sendResult);
301
+ }
302
+ if (!empty($b2sShipSend->postData)) {
303
+ $sendResult = $b2sShipSend->postPublish(true);
304
+ $content = array_merge($content, $sendResult);
305
+ }
306
+ //Render Ouput
307
+ if (is_array($content) && !empty($content)) {
308
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/View.php');
309
+ $view = new B2S_Curation_View();
310
+ echo json_encode(array('result' => true, 'content' => $view->getResultListHtml($content)));
311
+ wp_die();
312
+ }
313
+ }
314
+ echo json_encode(array('result' => false, 'error' => 'NO_AUTH'));
315
+ wp_die();
316
+ }
317
+ echo json_encode(array('result' => false, 'error' => 'NO_AUTH'));
318
+ wp_die();
319
+ }
320
+ }
321
+ }
322
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
323
+ wp_die();
324
+ } else {
325
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
326
+ wp_die();
327
+ }
328
+ }
329
+
330
+ public function curationCustomize() {
331
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
332
+ if (isset($_POST['postFormat'])) {
333
+ if ((int) $_POST['postFormat'] == 1) { //Imagepost
334
+ if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
335
+ $data = array('title' => sanitize_text_field($_POST['comment_image']), 'content' => $_POST['comment_image'], 'image_id' => $_POST['image_id'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
336
+ $imgUrl = (isset($_POST['image_url']) && !empty($_POST['image_url'])) ? $_POST['image_url'] : '';
337
+ } else {
338
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
339
+ wp_die();
340
+ }
341
+ } else if ((int) $_POST['postFormat'] == 0) { //Linkpost
342
+ if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
343
+ $data = array('title' => sanitize_text_field($_POST['title']), 'url' => esc_url($_POST['url']), 'content' => (isset($_POST['comment']) ? sanitize_textarea_field($_POST['comment']) : ''), 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
344
+ $imgUrl = (isset($_POST['link_image_url']) && !empty($_POST['link_image_url'])) ? $_POST['link_image_url'] : '';
345
+ } else {
346
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
347
+ wp_die();
348
+ }
349
+ } else if ((int) $_POST['postFormat'] == 2) {//Textpost
350
+ if (isset($_POST['comment_text']) && !empty($_POST['comment_text'])) {
351
+ $data = array('title' => sanitize_text_field($_POST['comment_text']), 'content' => $_POST['comment_text'], 'author_id' => B2S_PLUGIN_BLOG_USER_ID);
352
+ } else {
353
+ echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
354
+ wp_die();
355
+ }
356
+ }
357
+ if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) {
358
+ $data = array_merge($data, array('ID' => (int) $_POST['b2s-draft-id']));
359
+ }
360
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
361
+ $curation = new B2S_Curation_Save($data);
362
+ if (isset($data['ID']) && (int) $data['ID'] > 0) {
363
+ $postId = $curation->updateContent();
364
+ } else {
365
+ $postId = $curation->insertContent();
366
+ }
367
+ if ($postId !== false) {
368
+ $redirect_url = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=blog2social-ship&b2sPostType=ex&postId=' . $postId;
369
+ if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date'])) {
370
+ $sched_date_time = date('Y-m-d H:i:s', strtotime($_POST['ship_date']));
371
+ if ($sched_date_time !== false) {
372
+ $redirect_url .= '&schedDateTime=' . $sched_date_time;
373
+ }
374
+ }
375
+ if (isset($_POST['profile_select']) && (int) $_POST['profile_select'] > 0) {
376
+ $redirect_url .= '&profile=' . $_POST['profile_select'];
377
+ }
378
+ if (isset($imgUrl) && !empty($imgUrl)) {
379
+ $redirect_url .= '&img=' . base64_encode($imgUrl);
380
+ }
381
+ if (isset($_POST['postFormat'])) {
382
+ if ($_POST['postFormat'] == '0') {
383
+ $redirect_url .= '&postFormat=0';
384
+ } else {
385
+ $redirect_url .= '&postFormat=1';
386
+ }
387
+ }
388
+ echo json_encode(array('result' => true, 'redirect' => $redirect_url));
389
+ wp_die();
390
+ }
391
+ }
392
+ echo json_encode(array('result' => false));
393
+ wp_die();
394
+ } else {
395
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
396
+ wp_die();
397
+ }
398
+ }
399
+
400
+ public function b2sPluginDeactivate() {
401
+ if (isset($_POST['b2s_deactivate_nonce']) && (int) wp_verify_nonce($_POST['b2s_deactivate_nonce'], 'b2s_deactivate_nonce') > 0) {
402
+ if (isset($_POST['delete_sched_post']) && (int) $_POST['delete_sched_post'] == 1) {
403
+ update_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST", 1, false);
404
+ } else {
405
+ delete_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST");
406
+ }
407
+ echo json_encode(array('result' => true));
408
+ wp_die();
409
+ } else {
410
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
411
+ wp_die();
412
+ }
413
+ }
414
+
415
+ public function prgShip() {
416
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
417
+ if (!empty($_POST) && isset($_POST['token']) && !empty($_POST['token']) && isset($_POST['prg_id']) && (int) $_POST['prg_id'] > 0 && isset($_POST['blog_user_id']) && (int) $_POST['blog_user_id'] > 0 && isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
418
+ $dataPost = $_POST;
419
+ $type = $dataPost['publish'];
420
+ $dataPost['status'] = ((int) $type == 1) ? 'hold' : 'open';
421
+ unset($dataPost['confirm']);
422
+ unset($dataPost['blog_user_id']);
423
+ unset($dataPost['post_id']);
424
+ unset($dataPost['publish']);
425
+ unset($dataPost['b2s_security_nonce']);
426
+ $result = json_decode(trim(PRG_Api_Post::post(B2S_PLUGIN_PRG_API_ENDPOINT . 'post.php', $dataPost)));
427
+ if (is_object($result) && !empty($result) && isset($result->result) && (int) $result->result == 1 && isset($result->create) && (int) $result->create == 1) {
428
+ //Contact
429
+ global $wpdb;
430
+ $sqlCheckUser = $wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}b2s_user_contact` WHERE `blog_user_id` = %d", (int) $_POST['blog_user_id']);
431
+ $userEntry = $wpdb->get_var($sqlCheckUser);
432
+ $userContact = array('name_mandant' => sanitize_text_field($_POST['name_mandant']),
433
+ 'created' => date('Y-m-d H:i;s'),
434
+ 'name_presse' => sanitize_text_field($_POST['name_presse']),
435
+ 'anrede_presse' => sanitize_text_field($_POST['anrede_presse']),
436
+ 'vorname_presse' => sanitize_text_field($_POST['vorname_presse']),
437
+ 'nachname_presse' => sanitize_text_field($_POST['nachname_presse']),
438
+ 'strasse_presse' => sanitize_text_field($_POST['strasse_presse']),
439
+ 'nummer_presse' => sanitize_text_field($_POST['nummer_presse']),
440
+ 'plz_presse' => sanitize_text_field($_POST['plz_presse']),
441
+ 'ort_presse' => sanitize_text_field($_POST['ort_presse']),
442
+ 'land_presse' => sanitize_text_field($_POST['land_presse']),
443
+ 'email_presse' => sanitize_text_field($_POST['email_presse']),
444
+ 'telefon_presse' => sanitize_text_field($_POST['telefon_presse']),
445
+ 'fax_presse' => isset($_POST['fax_presse']) ? sanitize_text_field($_POST['fax_presse']) : '',
446
+ 'url_presse' => esc_url($_POST['url_presse'])
447
+ );
448
+
449
+ if (!$userEntry) {
450
+ $insertData = array_merge(array('blog_user_id' => (int) $_POST['blog_user_id']), $userContact);
451
+ $wpdb->insert($wpdb->prefix . 'b2s_user_contact', $insertData);
452
+ } else {
453
+ $wpdb->update($wpdb->prefix . 'b2s_user_contact', $userContact, array('blog_user_id' => (int) $_POST['blog_user_id']));
454
+ }
455
+ echo json_encode(array('result' => true, 'error' => 0, 'type' => $type));
456
+ wp_die();
457
+ }
458
+ echo json_encode(array('result' => false, 'error' => 2, 'type' => $type)); //NOTSHIP
459
+ wp_die();
460
+ }
461
+ echo json_encode(array('result' => false, 'error' => 1, 'type' => $type)); //INVALIDDATA
462
+ wp_die();
463
+ } else {
464
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
465
+ wp_die();
466
+ }
467
+ }
468
+
469
+ public function lockAutoPostImport() {
470
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
471
+ if (isset($_POST['userId']) && (int) $_POST['userId'] > 0) {
472
+ update_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $_POST['userId'], 1, false);
473
+ }
474
+ echo json_encode(array('result' => true));
475
+ wp_die();
476
+ } else {
477
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
478
+ wp_die();
479
+ }
480
+ }
481
+
482
+ public function prgLogin() {
483
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
484
+ if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
485
+ $pubKey = json_decode(PRG_Api_Get::get(B2S_PLUGIN_PRG_API_ENDPOINT . 'auth.php?publicKey=true', array()));
486
+ if (!empty($pubKey) && is_object($pubKey) && isset($pubKey->publicKey) && !empty($pubKey->publicKey) && function_exists('openssl_public_encrypt')) {
487
+ $usernameCrypted = '';
488
+ $passwordCrypted = '';
489
+ openssl_public_encrypt(trim($_POST['username']), $usernameCrypted, $pubKey->publicKey);
490
+ openssl_public_encrypt(trim($_POST['password']), $passwordCrypted, $pubKey->publicKey);
491
+ $datas = array(
492
+ 'action' => 'loginPRG',
493
+ 'username' => base64_encode($usernameCrypted),
494
+ 'password' => base64_encode($passwordCrypted),
495
+ );
496
+ $result = json_decode(trim(PRG_Api_Post::post(B2S_PLUGIN_PRG_API_ENDPOINT . 'auth.php', $datas)));
497
+ if (!empty($result) && is_object($result) && isset($result->prg_token) && !empty($result->prg_token) && isset($result->prg_id) && !empty($result->prg_id)) {
498
+ if ((int) $result->prg_id > 0) {
499
+ $prgInfo = array('B2S_PRG_ID' => $result->prg_id,
500
+ 'B2S_PRG_TOKEN' => $result->prg_token);
501
+
502
+ update_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID, $prgInfo, false);
503
+ echo json_encode(array('result' => true, 'error' => 0));
504
+ wp_die();
505
+ }
506
+ }
507
+ echo json_encode(array('result' => false, 'error' => 1));
508
+ wp_die();
509
+ }
510
+ echo json_encode(array('result' => false, 'error' => 2)); //SSL ERRROR
511
+ wp_die();
512
+ }
513
+ echo json_encode(array('result' => false, 'error' => 1));
514
+ wp_die();
515
+ } else {
516
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
517
+ wp_die();
518
+ }
519
+ }
520
+
521
+ public function prgLogout() {
522
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
523
+ delete_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID);
524
+ echo json_encode(array('result' => true));
525
+ wp_die();
526
+ } else {
527
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
528
+ wp_die();
529
+ }
530
+ }
531
+
532
+ public function saveShipData() {
533
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
534
+ require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Save.php');
535
+ $post = $_POST;
536
+ $metaOg = false;
537
+ $metaCard = false;
538
+
539
+ if (!isset($post['b2s']) || !is_array($post['b2s']) || !isset($post['post_id']) || (int) $post['post_id'] == 0) {
540
+ echo json_encode(array('result' => false));
541
+ wp_die();
542
+ }
543
+
544
+ $b2sShipSend = new B2S_Ship_Save();
545
+
546
+ delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $post['post_id']);
547
+ delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $post['post_id']);
548
+
549
+ $content = array();
550
+ $schedResult = array();
551
+ $defaultPostData = array('token' => B2S_PLUGIN_TOKEN,
552
+ 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
553
+ 'post_id' => (int) $post['post_id'],
554
+ 'default_titel' => isset($post['default_titel']) ? sanitize_text_field($post['default_titel']) : '',
555
+ 'no_cache' => 0, //default inactive , 1=active 0=not
556
+ 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))));
557
+
558
+ foreach ($post['b2s'] as $networkAuthId => $data) {
559
+ if (!isset($data['url']) || !isset($data['network_id'])) {
560
+ continue;
561
+ }
562
+
563
+ if ((int) $data['network_id'] == 1 || (int) $data['network_id'] == 3 || (int) $data['network_id'] == 19) {
564
+ $linkNoCache = B2S_Tools::getNoCacheData(B2S_PLUGIN_BLOG_USER_ID);
565
+ if (is_array($linkNoCache) && isset($linkNoCache[$data['network_id']]) && (int) $linkNoCache[$data['network_id']] > 0) {
566
+ $defaultPostData['no_cache'] = $linkNoCache[$data['network_id']];
567
+ }
568
+ }
569
+
570
+ //Change/Set MetaTags
571
+ if (in_array((int) $data['network_id'], json_decode(B2S_PLUGIN_NETWORK_META_TAGS, true)['og']) && $metaOg == false && (int) $post['post_id'] > 0 && isset($data['post_format']) && (int) $data['post_format'] == 0 && isset($post['change_og_meta']) && (int) $post['change_og_meta'] == 1) { //LinkPost
572
+ $metaOg = true;
573
+ $meta = B2S_Meta::getInstance();
574
+ $meta->getMeta((int) $post['post_id']);
575
+ if (isset($data['og_title']) && !empty($data['og_title'])) {
576
+ $meta->setMeta('og_title', sanitize_text_field($data['og_title']));
577
+ }
578
+ if (isset($data['og_desc']) && !empty($data['og_desc'])) {
579
+ $meta->setMeta('og_desc', sanitize_text_field($data['og_desc']));
580
+ }
581
+ if (isset($data['image_url']) && !empty($data['image_url'])) {
582
+ $meta->setMeta('og_image', trim(esc_url($data['image_url'])));
583
+ $meta->setMeta('og_image_alt', '');
584
+ }
585
+ $meta->updateMeta((int) $post['post_id']);
586
+ //TODO update scheds
587
+ global $wpdb;
588
+ $res = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}b2s_posts LEFT JOIN {$wpdb->prefix}b2s_posts_sched_details ON {$wpdb->prefix}b2s_posts.sched_details_id = {$wpdb->prefix}b2s_posts_sched_details.id LEFT JOIN {$wpdb->prefix}b2s_posts_network_details ON {$wpdb->prefix}b2s_posts.network_details_id = {$wpdb->prefix}b2s_posts_network_details.id WHERE {$wpdb->prefix}b2s_posts.sched_details_id > 0 AND {$wpdb->prefix}b2s_posts.post_id = %d AND {$wpdb->prefix}b2s_posts_network_details.network_id IN (" . implode(',', json_decode(B2S_PLUGIN_NETWORK_META_TAGS, true)['og']) . ") AND sched_date_utc > %s", $post['post_id'], gmdate('Y-m-d H:i:s')));
589
+ foreach ($res as $key => $sched) {
590
+ $schedData = unserialize($sched->sched_data);
591
+ if ((isset($schedData['post_format']) && (int) $schedData['post_format'] == 0) || (!isset($schedData['post_format']) && isset($schedData['image_url']) && !empty($schedData['image_url']))) {
592
+ $schedData['image_url'] = $data['image_url'];
593
+ $wpdb->update($wpdb->prefix . 'b2s_posts_sched_details', array(
594
+ 'sched_data' => serialize($schedData),
595
+ 'image_url' => $data['image_url']
596
+ ), array("id" => $sched->sched_details_id), array('%s', '%s', '%d'));
597
+ }
598
+ }
599
+ }
600
+
601
+ //Change/Set MetaTags
602
+ if (((int) $data['network_id'] == 2 || (int) $data['network_id'] == 24) && $metaCard == false && (int) $post['post_id'] > 0 && isset($data['post_format']) && (int) $data['post_format'] == 0 && isset($post['change_card_meta']) && (int) $post['change_card_meta'] == 1) { //LinkPost
603
+ $metaCard = true;
604
+ $meta = B2S_Meta::getInstance();
605
+ $meta->getMeta((int) $post['post_id']);
606
+ if (isset($data['card_title']) && !empty($data['card_title'])) {
607
+ $meta->setMeta('card_title', sanitize_text_field($data['card_title']));
608
+ }
609
+ if (isset($data['card_desc']) && !empty($data['card_desc'])) {
610
+ $meta->setMeta('card_desc', sanitize_text_field($data['card_desc']));
611
+ }
612
+ if (isset($data['image_url']) && !empty($data['image_url'])) {
613
+ $meta->setMeta('card_image', trim(esc_url($data['image_url'])));
614
+ }
615
+ $meta->updateMeta((int) $post['post_id']);
616
+ }
617
+
618
+ //TOS XING Group
619
+ if (isset($data['network_tos_group_id']) && !empty($data['network_tos_group_id'])) {
620
+ $options = new B2S_Options(0, 'B2S_PLUGIN_TOS_XING_GROUP_CROSSPOSTING');
621
+ $options->_setOption((int) $post['post_id'], $data['network_tos_group_id'], true);
622
+ }
623
+
624
+ $sendData = array("board" => isset($data['board']) ? sanitize_text_field($data['board']) : '',
625
+ "group" => isset($data['group']) ? sanitize_text_field($data['group']) : '',
626
+ "custom_title" => isset($data['custom_title']) ? sanitize_text_field($data['custom_title']) : '',
627
+ "content" => (isset($data['content']) && !empty($data['content'])) ? strip_tags(preg_replace("/(<[\/]*)em(>)/", "$1i$2", html_entity_decode($data['content'])), '<p><h1><h2><br><i><b><a><img>') : '',
628
+ 'url' => isset($data['url']) ? htmlspecialchars_decode(esc_url($data['url'])) : '',
629
+ 'image_url' => isset($data['image_url']) ? trim(esc_url($data['image_url'])) : '',
630
+ 'tags' => isset($data['tags']) ? $data['tags'] : array(),
631
+ 'network_id' => isset($data['network_id']) ? (int) $data['network_id'] : 0,
632
+ 'instant_sharing' => isset($data['instant_sharing']) ? (int) $data['instant_sharing'] : 0,
633
+ 'network_tos_group_id' => (isset($data['network_tos_group_id']) && !empty($data['network_tos_group_id'])) ? trim(sanitize_text_field($data['network_tos_group_id'])) : '',
634
+ 'network_type' => isset($data['network_type']) ? (int) $data['network_type'] : '',
635
+ 'network_kind' => isset($data['network_kind']) ? (int) $data['network_kind'] : 0,
636
+ 'marketplace_category' => isset($data['marketplace_category']) ? (int) $data['marketplace_category'] : 0,
637
+ 'marketplace_type' => isset($data['marketplace_type']) ? (int) $data['marketplace_type'] : 0,
638
+ 'network_display_name' => isset($data['network_display_name']) ? sanitize_text_field($data['network_display_name']) : '',
639
+ 'network_auth_id' => $networkAuthId,
640
+ 'post_format' => isset($data['post_format']) ? (int) $data['post_format'] : '',
641
+ 'user_timezone' => isset($post['user_timezone']) ? (int) $post['user_timezone'] : 0,
642
+ 'publish_date' => isset($post['publish_date']) ? date('Y-m-d H:i:s', strtotime($post['publish_date'])) : date('Y-m-d H:i:s', current_time('timestamp')),
643
+ 'frame_color' => ((isset($data['frame_color']) && !empty($data['frame_color'])) ? sanitize_text_field($data['frame_color']) : '#ffffff')
644
+ );
645
+
646
+ if (isset($data['post_format']) && (int) $data['post_format'] == 1) {
647
+ $multi_images = array();
648
+ if (isset($data['multi_image_1']) && !empty($data['multi_image_1'])) {
649
+ array_push($multi_images, $data['multi_image_1']);
650
+ }
651
+ if (isset($data['multi_image_2']) && !empty($data['multi_image_2'])) {
652
+ array_push($multi_images, $data['multi_image_2']);
653
+ }
654
+ if (isset($data['multi_image_3']) && !empty($data['multi_image_3'])) {
655
+ array_push($multi_images, $data['multi_image_3']);
656
+ }
657
+ if (!empty($multi_images)) {
658
+ $sendData['multi_images'] = json_encode($multi_images);
659
+ }
660
+ }
661
+
662
+ //since V4.8.0 Check Relay and prepare Data
663
+ $relayData = array();
664
+ if ((int) $data['network_id'] == 2 && isset($data['post_relay_account'][0]) && !empty($data['post_relay_account'][0]) && isset($data['post_relay_delay'][0]) && !empty($data['post_relay_delay'][0])) {
665
+ $relayData = array('auth' => $data['post_relay_account'], 'delay' => $data['post_relay_delay']);
666
+ }
667
+
668
+ //mode: share now
669
+ $schedData = array();
670
+ if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 0) {
671
+ $b2sShipSend->savePublishDetails(array_merge($defaultPostData, $sendData), $relayData);
672
+ //mode: schedule custom once times
673
+ } else if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 1 && isset($data['date'][0]) && isset($data['time'][0])) {
674
+ $schedData = array(
675
+ 'date' => isset($data['date']) ? $data['date'] : array(),
676
+ 'time' => isset($data['time']) ? $data['time'] : array(),
677
+ 'sched_content' => isset($data['sched_content']) ? $data['sched_content'] : array(),
678
+ 'sched_image_url' => isset($data['sched_image_url']) ? $data['sched_image_url'] : array(),
679
+ 'sched_multi_image_1' => isset($data['sched_multi_image_1']) ? $data['sched_multi_image_1'] : array(),
680
+ 'sched_multi_image_2' => isset($data['sched_multi_image_2']) ? $data['sched_multi_image_2'] : array(),
681
+ 'sched_multi_image_3' => isset($data['sched_multi_image_3']) ? $data['sched_multi_image_3'] : array(),
682
+ 'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
683
+ 'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
684
+ 'saveSetting' => isset($data['saveSchedSetting']) ? true : false);
685
+ $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
686
+ $content = array_merge($content, $schedResult);
687
+ //mode: recurrently schedule
688
+ } else {
689
+ $schedData = array(
690
+ 'interval_select' => isset($data['intervalSelect']) ? $data['intervalSelect'] : array(),
691
+ 'duration_month' => isset($data['duration_month']) ? $data['duration_month'] : array(),
692
+ 'select_day' => isset($data['select_day']) ? $data['select_day'] : array(),
693
+ 'duration_time' => isset($data['duration_time']) ? $data['duration_time'] : array(),
694
+ 'select_timespan' => isset($data['select_timespan']) ? $data['select_timespan'] : array(),
695
+ 'weeks' => isset($data['weeks']) ? $data['weeks'] : 0,
696
+ 'date' => isset($data['date']) ? $data['date'] : array(),
697
+ 'time' => isset($data['time']) ? $data['time'] : array(),
698
+ 'mo' => isset($data['mo']) ? $data['mo'] : array(),
699
+ 'di' => isset($data['di']) ? $data['di'] : array(),
700
+ 'mi' => isset($data['mi']) ? $data['mi'] : array(),
701
+ 'do' => isset($data['do']) ? $data['do'] : array(),
702
+ 'fr' => isset($data['fr']) ? $data['fr'] : array(),
703
+ 'sa' => isset($data['sa']) ? $data['sa'] : array(),
704
+ 'so' => isset($data['so']) ? $data['so'] : array(),
705
+ 'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
706
+ 'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
707
+ 'saveSetting' => isset($data['saveSchedSetting']) ? true : false
708
+ );
709
+
710
+ $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
711
+ $content = array_merge($content, $schedResult);
712
+ }
713
+ }
714
+
715
+ if (!empty($b2sShipSend->postDataApprove)) {
716
+ $sendResult = $b2sShipSend->getShareApproveDetails();
717
+ $content = array_merge($content, $sendResult);
718
+ }
719
+
720
+ if (!empty($b2sShipSend->postData)) {
721
+ $sendResult = $b2sShipSend->postPublish();
722
+ $content = array_merge($content, $sendResult);
723
+ }
724
+
725
+ echo json_encode(array('result' => true, 'content' => $content));
726
+ wp_die();
727
+ } else {
728
+ echo json_encode(array('result' => false, 'error' => 'nonce'));
729
+ wp_die();
730
+ }
731
+ }
732
+
733
+ public function saveSocialMetaTags() {
734
+ if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
735
+ $result = array('result' => true);
736
+ if (isset($_POST['is_admin']) && (int) $_POST['is_admin'] == 1) {
737
+
738
+ $options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
739
+
740
+ $og_active = (!isset($_POST['b2s_og_active'])) ? 0 : 1;
741
+ $options->_setOption('og_active', $og_active);
742
+ $options->_setOption('og_default_title', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanit