Blog2Social: Social Media Auto Post & Scheduler - Version 6.3.0

Version Description

Blog2Social Community and Autoposter Retweets

Download this release

Release Info

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

Code changes from version 6.2.0 to 6.3.0

assets/css/b2s/curation.css CHANGED
@@ -1,209 +1,229 @@
1
- .b2s-curation-input-area-info-header-text{
2
- margin: 15px 0 10px !important;
3
- font-style: normal;
4
- font-weight: normal;
5
- font-size: 16px;
6
- color: #5d5d5d;
7
- }
8
-
9
- .b2s-color-text-red{
10
- color: #f14242 !important;
11
- }
12
-
13
- .b2s-btn-curation-continue{
14
- font-weight: 600 !important;
15
- letter-spacing: .1em;
16
- text-transform: uppercase;
17
- font-size: 12px !important;
18
- }
19
-
20
- .b2s-curation-input-area-btn{
21
- margin: 25px 0 0;
22
- }
23
-
24
- #b2s-curation-input-url-help, .b2s-curation-result-area, .b2s-curation-image-area{
25
- display: none;
26
- }
27
-
28
- .b2s-loading-area {
29
- width: 100% !important;
30
- }
31
-
32
- .b2s-btn-change-url-preview{
33
- cursor: pointer;
34
- }
35
- #b2s-curation-no-review-info, #b2s-curation-no-auth-info, .b2s-post-curation-ship-date-area, #b2s-curation-no-data-info, #b2s-curation-saved-draft-info, .b2s-curation-post-list-area{
36
- display: none;
37
- }
38
-
39
- .b2s-post-item-details-preview-url{
40
- word-wrap: break-word;
41
- }
42
-
43
- .b2s-post-item-details-preview-title{
44
- font-weight: 600;
45
- font-size: 14px;
46
- }
47
- .b2s-post-item-details-preview-desc{
48
- font-size: 12px;
49
- }
50
-
51
- #b2s-post-curation-twitter-select option:disabled {
52
- color: #d54e21;
53
- opacity: 0.2;
54
- }
55
-
56
-
57
- .b2s-post-item-area {
58
- width: 100%;
59
- }
60
-
61
- .b2s-post-item-thumb {
62
- width: 5%;
63
- margin-right: 8px;
64
- }
65
- .b2s-post-item-details, .b2s-post-item-thumb {
66
- float: left;
67
- }
68
- .b2s-post-item-details {
69
- width: 93%;
70
- }
71
-
72
- .b2s-post-item-thumb img {
73
- border-radius: 50%;
74
- width: 48px;
75
- }
76
-
77
- .b2s-post-item-details h4 {
78
- font-size: 16px;
79
- font-weight: 600;
80
- text-transform: uppercase;
81
- margin: 3px 3px 3px 0px;
82
- }
83
-
84
- .b2s-post-item-network-deprecated {
85
- font-weight: 600;
86
- font-size: 14px;
87
- margin: 3px 3px 3px 0px;
88
- }
89
-
90
- .b2s-post-item-details p {
91
- font-size: 12px;
92
- }
93
-
94
- .b2s-post-item-details-message-result {
95
- margin-top: 2px;
96
- }
97
-
98
- .b2s-post-curation-ship-date[readonly]{
99
- background-color: #fff !important;
100
- }
101
-
102
- #b2s-btn-curation-draft {
103
- margin-left: 10px;
104
- }
105
-
106
- .b2s-curation-format-link {
107
- border-top-right-radius: 0px !important;
108
- border-bottom-right-radius: 0px !important;
109
- }
110
-
111
- .b2s-curation-format-image {
112
- border-top-left-radius: 0px !important;
113
- border-bottom-left-radius: 0px !important;
114
- }
115
-
116
- .b2s-image-remove-btn{
117
- position: absolute;
118
- top: -5px;
119
- right: 0px;
120
- font-weight: 700 !important;
121
- }
122
-
123
- .b2s-post-item-details-url-image {
124
- cursor: pointer;
125
- margin-right: 10px;
126
- margin-bottom: 20px;
127
- border: 1px dashed #bdbfc2;
128
- box-shadow: none;
129
- padding: 5px;
130
- }
131
-
132
- .b2s-curation-image-area {
133
- margin-top: 20px;
134
- }
135
-
136
- .b2s-post-item-details-item-message-area {
137
- display: inline-block;
138
- position: relative;
139
- min-width: 100%;
140
- }
141
-
142
- .emoji-picker__content .active {
143
- background-color: #fff;
144
- }
145
-
146
- .emoji-picker__content {
147
- height: 21.5rem;
148
- }
149
-
150
- .emoji-picker__preview {
151
- display: none;
152
- }
153
-
154
- .emoji-picker {
155
- height: auto;
156
- z-index: 1060;
157
- }
158
-
159
- .emoji-picker__tab.active {
160
- color: #79b333;
161
- border-bottom: 3px solid #79b333;
162
- }
163
-
164
- .b2s-image-item{
165
- background-color: #fff;
166
- border: 1px solid #ddd;
167
- display: block;
168
- float: left;
169
- height: 200px;
170
- line-height: 1.42857;
171
- margin-bottom: 15px;
172
- margin-left: 15px;
173
- margin-top: 15px;
174
- overflow: hidden;
175
- padding: 4px;
176
-
177
- transition: border 0.2s ease-in-out 0s;
178
- width: 185px;
179
- }
180
- .img-thumbnail{
181
- display: block !important;
182
- height: auto;
183
- margin-left: auto;
184
- margin-right: auto;
185
- max-height: 100%;
186
- }
187
-
188
- .b2s-image-item-thumb{
189
- height: 150px;
190
- }
191
- .b2s-image-item-thumb label{
192
- display: inline;
193
- }
194
- .b2s-image-item-caption{
195
- color: #333;
196
- }
197
-
198
- .b2s-image-change {
199
- margin-right: 5px !important;
200
- }
201
-
202
- .b2s-curation-result-area {
203
- margin-top: 20px;
204
- }
205
-
206
- .b2s-break-word {
207
- white-space: normal !important;
208
- text-align: left !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
1
+ .b2s-curation-input-area-info-header-text{
2
+ margin: 15px 0 10px !important;
3
+ font-style: normal;
4
+ font-weight: normal;
5
+ font-size: 16px;
6
+ color: #5d5d5d;
7
+ }
8
+
9
+ .b2s-color-text-red{
10
+ color: #f14242 !important;
11
+ }
12
+
13
+ .b2s-btn-curation-continue{
14
+ font-weight: 600 !important;
15
+ letter-spacing: .1em;
16
+ text-transform: uppercase;
17
+ font-size: 12px !important;
18
+ }
19
+
20
+ .b2s-curation-input-area-btn{
21
+ margin: 25px 0 0;
22
+ }
23
+
24
+ #b2s-curation-input-url-help, .b2s-curation-result-area, .b2s-curation-image-area{
25
+ display: none;
26
+ }
27
+
28
+ .b2s-loading-area {
29
+ width: 100% !important;
30
+ }
31
+
32
+ .b2s-btn-change-url-preview{
33
+ cursor: pointer;
34
+ }
35
+ #b2s-curation-no-review-info, #b2s-curation-no-auth-info, .b2s-post-curation-ship-date-area, #b2s-curation-no-data-info, #b2s-curation-saved-draft-info, .b2s-curation-post-list-area{
36
+ display: none;
37
+ }
38
+
39
+ .b2s-post-item-details-preview-url{
40
+ word-wrap: break-word;
41
+ }
42
+
43
+ .b2s-post-item-details-preview-title{
44
+ font-weight: 600;
45
+ font-size: 14px;
46
+ }
47
+ .b2s-post-item-details-preview-desc{
48
+ font-size: 12px;
49
+ }
50
+
51
+ #b2s-post-curation-twitter-select option:disabled {
52
+ color: #d54e21;
53
+ opacity: 0.2;
54
+ }
55
+
56
+
57
+ .b2s-post-item-area {
58
+ width: 100%;
59
+ }
60
+
61
+ .b2s-post-item-thumb {
62
+ width: 5%;
63
+ margin-right: 8px;
64
+ }
65
+ .b2s-post-item-details, .b2s-post-item-thumb {
66
+ float: left;
67
+ }
68
+ .b2s-post-item-details {
69
+ width: 93%;
70
+ }
71
+
72
+ .b2s-post-item-thumb img {
73
+ border-radius: 50%;
74
+ width: 48px;
75
+ }
76
+
77
+ .b2s-post-item-details h4 {
78
+ font-size: 16px;
79
+ font-weight: 600;
80
+ text-transform: uppercase;
81
+ margin: 3px 3px 3px 0px;
82
+ }
83
+
84
+ .b2s-post-item-network-deprecated {
85
+ font-weight: 600;
86
+ font-size: 14px;
87
+ margin: 3px 3px 3px 0px;
88
+ }
89
+
90
+ .b2s-post-item-details p {
91
+ font-size: 12px;
92
+ }
93
+
94
+ .b2s-post-item-details-message-result {
95
+ margin-top: 2px;
96
+ }
97
+
98
+ .b2s-post-curation-ship-date[readonly]{
99
+ background-color: #fff !important;
100
+ }
101
+
102
+ #b2s-btn-curation-draft {
103
+ margin-left: 10px;
104
+ }
105
+
106
+ .b2s-curation-format-link {
107
+ border-top-right-radius: 0px !important;
108
+ border-bottom-right-radius: 0px !important;
109
+ }
110
+
111
+ .b2s-curation-format-image {
112
+ border-top-left-radius: 0px !important;
113
+ border-bottom-left-radius: 0px !important;
114
+ }
115
+
116
+ .b2s-image-remove-btn{
117
+ position: absolute;
118
+ top: -5px;
119
+ right: 0px;
120
+ font-weight: 700 !important;
121
+ }
122
+
123
+ .b2s-post-item-details-url-image {
124
+ cursor: pointer;
125
+ margin-right: 10px;
126
+ margin-bottom: 20px;
127
+ border: 1px dashed #bdbfc2;
128
+ box-shadow: none;
129
+ padding: 5px;
130
+ }
131
+
132
+ .b2s-curation-image-area {
133
+ margin-top: 20px;
134
+ }
135
+
136
+ .b2s-post-item-details-item-message-area {
137
+ display: inline-block;
138
+ position: relative;
139
+ min-width: 100%;
140
+ }
141
+
142
+ .emoji-picker__content .active {
143
+ background-color: #fff;
144
+ }
145
+
146
+ .emoji-picker__content {
147
+ height: 21.5rem;
148
+ }
149
+
150
+ .emoji-picker__preview {
151
+ display: none;
152
+ }
153
+
154
+ .emoji-picker {
155
+ height: auto;
156
+ z-index: 1060;
157
+ }
158
+
159
+ .emoji-picker__tab.active {
160
+ color: #79b333;
161
+ border-bottom: 3px solid #79b333;
162
+ }
163
+
164
+ .b2s-image-item{
165
+ background-color: #fff;
166
+ border: 1px solid #ddd;
167
+ display: block;
168
+ float: left;
169
+ height: 200px;
170
+ line-height: 1.42857;
171
+ margin-bottom: 15px;
172
+ margin-left: 15px;
173
+ margin-top: 15px;
174
+ overflow: hidden;
175
+ padding: 4px;
176
+
177
+ transition: border 0.2s ease-in-out 0s;
178
+ width: 185px;
179
+ }
180
+ .img-thumbnail{
181
+ display: block !important;
182
+ height: auto;
183
+ margin-left: auto;
184
+ margin-right: auto;
185
+ max-height: 100%;
186
+ }
187
+
188
+ .b2s-image-item-thumb{
189
+ height: 150px;
190
+ }
191
+ .b2s-image-item-thumb label{
192
+ display: inline;
193
+ }
194
+ .b2s-image-item-caption{
195
+ color: #333;
196
+ }
197
+
198
+ .b2s-image-change {
199
+ margin-right: 5px !important;
200
+ }
201
+
202
+ .b2s-curation-result-area {
203
+ margin-top: 20px;
204
+ }
205
+
206
+ .b2s-break-word {
207
+ white-space: normal !important;
208
+ text-align: left !important;
209
+ }
210
+
211
+ .b2s-network-info-img {
212
+ width: 5.5%;
213
+ margin-left: 5px;
214
+ }
215
+
216
+ .b2s-network-info-img-disabled {
217
+ width: 5.5%;
218
+ opacity: 0.3;
219
+ }
220
+
221
+ .b2s-network-imgs {
222
+ margin-top: 10px;
223
+ margin-bottom: 10px;
224
+ display: inline-block;
225
+ }
226
+
227
+ .b2s-bold {
228
+ font-weight: 600;
229
  }
assets/css/b2s/network.css CHANGED
@@ -1,640 +1,644 @@
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: 15px;
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-3 {
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-12 {
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-2 {
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-name-1 {
312
- margin-left: -20px;
313
- color: #385898;
314
- font-family: Helvetica, Arial, sans-serif;
315
- font-size: 14px;
316
- font-weight: 600;
317
- }
318
-
319
- .b2s-edit-template-preview-profile-name-3 {
320
- margin-left: -20px;
321
- font-family: Helvetica, Arial, sans-serif;
322
- font-size: 14px;
323
- font-weight: 600;
324
- }
325
-
326
- .b2s-edit-template-preview-profile-name-2 {
327
- font-family: Helvetica, Arial, sans-serif;
328
- font-size: 14px;
329
- font-weight: 600;
330
- }
331
-
332
- .b2s-edit-template-preview-profile-name-12 {
333
- font-family: Helvetica, Arial, sans-serif;
334
- font-size: 12px;
335
- font-weight: 600;
336
- margin-left: -10px;
337
- margin-top: 10px;
338
- }
339
-
340
- .b2s-edit-template-preview-content-profile-name-12 {
341
- font-family: Helvetica, Arial, sans-serif;
342
- font-size: 12px;
343
- font-weight: 600;
344
- margin-right: 5px;
345
- }
346
-
347
- .b2s-edit-template-preview-profile-handle-2 {
348
- font-size: 14px;
349
- color: gray;
350
- }
351
-
352
- .b2s-edit-template-preview-content {
353
- word-wrap: break-word;
354
- }
355
-
356
- .b2s-edit-template-preview-link-image, .b2s-edit-template-preview-image-image {
357
- width: 100%;
358
- }
359
-
360
- .b2s-edit-template-preview-2 {
361
- margin-left: -20px;
362
- }
363
-
364
- .b2s-edit-template-preview-image-image-2 {
365
- border-radius: 10px;
366
- border: 1px solid lightgrey;
367
- margin-top: 10px;
368
- }
369
-
370
- .b2s-edit-template-preview-image-image-3, .b2s-edit-template-preview-link-image-3 {
371
- margin-top: 10px;
372
- border-top: 1px solid lightgray;
373
- border-bottom: 1px solid lightgray;
374
- }
375
-
376
- .b2s-edit-template-preview-link-image-2 {
377
- width: auto !important;
378
- height: 85px;
379
- }
380
-
381
- .b2s-edit-template-preview-image-12 {
382
- width: 100%;
383
- }
384
-
385
- .b2s-edit-template-link-post {
386
- border-top-right-radius: 0px !important;
387
- border-bottom-right-radius: 0px !important;
388
- }
389
-
390
- .b2s-edit-template-image-post {
391
- border-top-left-radius: 0px !important;
392
- border-bottom-left-radius: 0px !important;
393
- }
394
-
395
- .b2s-edit-template-preview-image-border-12 {
396
- padding: 0 !important;
397
- border-top: 1px solid lightgray;
398
- border-bottom: 1px solid lightgray;
399
- margin: 10px 0px;
400
- overflow: hidden;
401
- height: 370px;
402
- }
403
-
404
- .b2s-edit-template-preview-border-12 {
405
- padding: 10px 0px;
406
- }
407
- .b2s-edit-template-preview-border-1 {
408
- padding-top: 10px;
409
- }
410
-
411
- .b2s-edit-template-preview-border-3 {
412
- padding-top: 10px;
413
- }
414
-
415
- .b2s-edit-template-preview-border {
416
- border: 1px solid lightgray;
417
- }
418
-
419
- .b2s-edit-template-preview-content-1 {
420
- margin: 5px 0px;
421
- }
422
-
423
- .b2s-edit-template-preview-content-3 {
424
- margin: 5px 0px;
425
- }
426
-
427
- .b2s-edit-template-preview-image-border-1 {
428
- padding: 0px !important;
429
- border-top: 1px solid lightgray;
430
- border-bottom: 1px solid lightgray;
431
- }
432
-
433
- .b2s-edit-template-preview-image-border-3 {
434
- padding: 0px !important;
435
- }
436
-
437
- .b2s-edit-template-preview-link-title {
438
- font-weight: 700;
439
- font-size: 16px;
440
- }
441
-
442
- .b2s-edit-template-preview-link-meta-box-1 {
443
- background-color: #f2f3f5;
444
- padding-bottom: 5px;
445
- border-bottom: 1px solid lightgray;
446
- }
447
-
448
- .b2s-edit-template-preview-link-meta-box-2 {
449
- border: 1px solid lightgray;
450
- border-radius: 14px;
451
- margin-left: 0px !important;
452
- margin-top: 10px;
453
- }
454
-
455
- .b2s-edit-template-preview-link-meta-box-image-2 {
456
- overflow: hidden;
457
- height: 85px;
458
- display: flex;
459
- align-items: center;
460
- justify-content: center;
461
- border-top-left-radius: 14px;
462
- border-bottom-left-radius: 14px;
463
- border-right: 1px solid lightgray;
464
- }
465
-
466
- .b2s-edit-template-preview-link-meta-box-desc-2 {
467
- color: gray;
468
- }
469
-
470
- .b2s-edit-template-preview-link-meta-box-domain-2 {
471
- color: gray;
472
- }
473
-
474
- .b2s-edit-template-preview-link-meta-box-3 {
475
- background-color: #f2f3f5;
476
- padding: 5px 0px;
477
- border-bottom: 1px solid lightgray;
478
- }
479
-
480
- .b2s-edit-template-preview-link-meta-box-domain-3 {
481
- font-size: 10px;
482
- color: gray;
483
- }
484
-
485
- .b2s-edit-template-preview-link-meta-box-title-3 {
486
- font-weight: 600;
487
- }
488
-
489
- .b2s-edit-template-link-info {
490
- color: #31708f;
491
- }
492
-
493
- .b2s-edit-template-section-headline {
494
- font-size: 14px;
495
- font-weight: 600;
496
- }
497
-
498
- .b2s-edit-template-post-content {
499
- width: 100%;
500
- height: 80px;
501
- }
502
-
503
- .b2s-edit-template-image-cut {
504
- width: 200%;
505
- margin-left: -205px;
506
- margin-top: -83px;
507
- }
508
-
509
- .b2s-edit-template-image-frame {
510
- margin-top: 50px;
511
- }
512
-
513
- .b2s-edit-template-preview-dots-12 {
514
- margin-top: -5px;
515
- font-weight: 1000;
516
- font-size: 15px;
517
- letter-spacing: 2px;
518
- }
519
-
520
- .b2s-edit-template-preview-like-icons-12 {
521
- width: 100px;
522
- margin: -5px 0px 5px -5px;
523
- }
524
-
525
- .b2s-edit-template-preview-like-icons-1 {
526
- width: 100%;
527
- margin: 5px 0px;
528
- }
529
-
530
- .b2s-edit-template-preview-like-icons-2 {
531
- width: 100%;
532
- margin-top: 5px;
533
- }
534
-
535
- .b2s-edit-template-preview-like-icons-3 {
536
- margin-top: 5px;
537
- }
538
-
539
- .b2s-edit-template-network-img {
540
- height: 20px;
541
- width: auto !important;
542
- margin-right: 5px;
543
- }
544
-
545
- .b2s-edit-template-character-limit-label{
546
- padding-top: 4px;
547
- font-weight: 600;
548
- }
549
- .b2s-info-character-limit-text{
550
- margin: 0 0 10px;
551
- }
552
-
553
- .b2s-edit-template-preview-border-19 {
554
- padding-top: 15px;
555
- padding-bottom: 15px;
556
- border-radius: 3px;
557
- }
558
-
559
- .b2s-edit-template-preview-profile-img-19 {
560
- height: 40px;
561
- }
562
-
563
- .b2s-edit-template-preview-profile-name-19 {
564
- color: #009090;
565
- font-size: 13px;
566
- font-weight: 600;
567
- line-height: 18px;
568
- }
569
-
570
- .b2s-edit-template-preview-header-19 {
571
- padding-top: 15px;
572
- padding-bottom: 15px;
573
- border-bottom: 1px solid lightgray;
574
- margin-bottom: 15px;
575
- }
576
-
577
- .b2s-edit-template-preview-like-icons-19 {
578
- margin-top: 15px;
579
- width: 120px;
580
- }
581
-
582
- .b2s-edit-template-preview-link-meta-box-title-19 {
583
- color: #009090;
584
- font-size: 18px;
585
- font-weight: 400;
586
- line-height: 22px;
587
- }
588
-
589
- .b2s-edit-template-preview-link-meta-box-desc-19 {
590
- font-size: 13px;
591
- line-height: 18px;
592
- }
593
-
594
- .b2s-edit-template-preview-link-meta-box-domain-19 {
595
- font-size: 13px;
596
- line-height: 18px;
597
- color: gray;
598
- }
599
-
600
- .b2s-edit-template-image-preview .b2s-edit-template-preview-image-border-19 {
601
- padding: 0px;
602
- }
603
-
604
- .b2s-edit-template-preview-content-19 {
605
- margin: 15px 0px;
606
- }
607
-
608
- .b2s-login-form-label {
609
- padding-top: 7px;
610
- margin-top: 0;
611
- margin-bottom: 0;
612
- text-align: right;
613
- font-weight: bold;
614
- }
615
-
616
- #b2s-auth-network-6-location, #b2s-auth-network-6-board {
617
- max-width: 100% !important;
618
- }
619
-
620
- .b2s-edit-template-title {
621
- display: inline;
622
- }
623
-
624
- .b2s-url-parameter-remove-btn {
625
- font-weight: bold;
626
- font-size: 18px;
627
- line-height: 1.5;
628
- cursor: pointer;
629
- }
630
-
631
- .b2s-url-parameter-legend-text {
632
- font-size: 12px;
633
- font-weight: 600;
634
- letter-spacing: 0;
635
- margin-top: 10px;
636
- }
637
-
638
- .b2s-url-parameter-content {
639
- padding-top: 6px;
 
 
 
 
640
  }
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: 15px;
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-3 {
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-12 {
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-2 {
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-name-1 {
312
+ margin-left: -20px;
313
+ color: #385898;
314
+ font-family: Helvetica, Arial, sans-serif;
315
+ font-size: 14px;
316
+ font-weight: 600;
317
+ }
318
+
319
+ .b2s-edit-template-preview-profile-name-3 {
320
+ margin-left: -20px;
321
+ font-family: Helvetica, Arial, sans-serif;
322
+ font-size: 14px;
323
+ font-weight: 600;
324
+ }
325
+
326
+ .b2s-edit-template-preview-profile-name-2 {
327
+ font-family: Helvetica, Arial, sans-serif;
328
+ font-size: 14px;
329
+ font-weight: 600;
330
+ }
331
+
332
+ .b2s-edit-template-preview-profile-name-12 {
333
+ font-family: Helvetica, Arial, sans-serif;
334
+ font-size: 12px;
335
+ font-weight: 600;
336
+ margin-left: -10px;
337
+ margin-top: 10px;
338
+ }
339
+
340
+ .b2s-edit-template-preview-content-profile-name-12 {
341
+ font-family: Helvetica, Arial, sans-serif;
342
+ font-size: 12px;
343
+ font-weight: 600;
344
+ margin-right: 5px;
345
+ }
346
+
347
+ .b2s-edit-template-preview-profile-handle-2 {
348
+ font-size: 14px;
349
+ color: gray;
350
+ }
351
+
352
+ .b2s-edit-template-preview-content {
353
+ word-wrap: break-word;
354
+ }
355
+
356
+ .b2s-edit-template-preview-link-image, .b2s-edit-template-preview-image-image {
357
+ width: 100%;
358
+ }
359
+
360
+ .b2s-edit-template-preview-2 {
361
+ margin-left: -20px;
362
+ }
363
+
364
+ .b2s-edit-template-preview-image-image-2 {
365
+ border-radius: 10px;
366
+ border: 1px solid lightgrey;
367
+ margin-top: 10px;
368
+ }
369
+
370
+ .b2s-edit-template-preview-image-image-3, .b2s-edit-template-preview-link-image-3 {
371
+ margin-top: 10px;
372
+ border-top: 1px solid lightgray;
373
+ border-bottom: 1px solid lightgray;
374
+ }
375
+
376
+ .b2s-edit-template-preview-link-image-2 {
377
+ width: auto !important;
378
+ height: 85px;
379
+ }
380
+
381
+ .b2s-edit-template-preview-image-12 {
382
+ width: 100%;
383
+ }
384
+
385
+ .b2s-edit-template-link-post {
386
+ border-top-right-radius: 0px !important;
387
+ border-bottom-right-radius: 0px !important;
388
+ }
389
+
390
+ .b2s-edit-template-image-post {
391
+ border-top-left-radius: 0px !important;
392
+ border-bottom-left-radius: 0px !important;
393
+ }
394
+
395
+ .b2s-edit-template-preview-image-border-12 {
396
+ padding: 0 !important;
397
+ border-top: 1px solid lightgray;
398
+ border-bottom: 1px solid lightgray;
399
+ margin: 10px 0px;
400
+ overflow: hidden;
401
+ height: 370px;
402
+ }
403
+
404
+ .b2s-edit-template-preview-border-12 {
405
+ padding: 10px 0px;
406
+ }
407
+ .b2s-edit-template-preview-border-1 {
408
+ padding-top: 10px;
409
+ }
410
+
411
+ .b2s-edit-template-preview-border-3 {
412
+ padding-top: 10px;
413
+ }
414
+
415
+ .b2s-edit-template-preview-border {
416
+ border: 1px solid lightgray;
417
+ }
418
+
419
+ .b2s-edit-template-preview-content-1 {
420
+ margin: 5px 0px;
421
+ }
422
+
423
+ .b2s-edit-template-preview-content-3 {
424
+ margin: 5px 0px;
425
+ }
426
+
427
+ .b2s-edit-template-preview-image-border-1 {
428
+ padding: 0px !important;
429
+ border-top: 1px solid lightgray;
430
+ border-bottom: 1px solid lightgray;
431
+ }
432
+
433
+ .b2s-edit-template-preview-image-border-3 {
434
+ padding: 0px !important;
435
+ }
436
+
437
+ .b2s-edit-template-preview-link-title {
438
+ font-weight: 700;
439
+ font-size: 16px;
440
+ }
441
+
442
+ .b2s-edit-template-preview-link-meta-box-1 {
443
+ background-color: #f2f3f5;
444
+ padding-bottom: 5px;
445
+ border-bottom: 1px solid lightgray;
446
+ }
447
+
448
+ .b2s-edit-template-preview-link-meta-box-2 {
449
+ border: 1px solid lightgray;
450
+ border-radius: 14px;
451
+ margin-left: 0px !important;
452
+ margin-top: 10px;
453
+ }
454
+
455
+ .b2s-edit-template-preview-link-meta-box-image-2 {
456
+ overflow: hidden;
457
+ height: 85px;
458
+ display: flex;
459
+ align-items: center;
460
+ justify-content: center;
461
+ border-top-left-radius: 14px;
462
+ border-bottom-left-radius: 14px;
463
+ border-right: 1px solid lightgray;
464
+ }
465
+
466
+ .b2s-edit-template-preview-link-meta-box-desc-2 {
467
+ color: gray;
468
+ }
469
+
470
+ .b2s-edit-template-preview-link-meta-box-domain-2 {
471
+ color: gray;
472
+ }
473
+
474
+ .b2s-edit-template-preview-link-meta-box-3 {
475
+ background-color: #f2f3f5;
476
+ padding: 5px 0px;
477
+ border-bottom: 1px solid lightgray;
478
+ }
479
+
480
+ .b2s-edit-template-preview-link-meta-box-domain-3 {
481
+ font-size: 10px;
482
+ color: gray;
483
+ }
484
+
485
+ .b2s-edit-template-preview-link-meta-box-title-3 {
486
+ font-weight: 600;
487
+ }
488
+
489
+ .b2s-edit-template-link-info {
490
+ color: #31708f;
491
+ }
492
+
493
+ .b2s-edit-template-section-headline {
494
+ font-size: 14px;
495
+ font-weight: 600;
496
+ }
497
+
498
+ .b2s-edit-template-post-content {
499
+ width: 100%;
500
+ height: 80px;
501
+ }
502
+
503
+ .b2s-edit-template-image-cut {
504
+ width: 200%;
505
+ margin-left: -205px;
506
+ margin-top: -83px;
507
+ }
508
+
509
+ .b2s-edit-template-image-frame {
510
+ margin-top: 50px;
511
+ }
512
+
513
+ .b2s-edit-template-preview-dots-12 {
514
+ margin-top: -5px;
515
+ font-weight: 1000;
516
+ font-size: 15px;
517
+ letter-spacing: 2px;
518
+ }
519
+
520
+ .b2s-edit-template-preview-like-icons-12 {
521
+ width: 100px;
522
+ margin: -5px 0px 5px -5px;
523
+ }
524
+
525
+ .b2s-edit-template-preview-like-icons-1 {
526
+ width: 100%;
527
+ margin: 5px 0px;
528
+ }
529
+
530
+ .b2s-edit-template-preview-like-icons-2 {
531
+ width: 100%;
532
+ margin-top: 5px;
533
+ }
534
+
535
+ .b2s-edit-template-preview-like-icons-3 {
536
+ margin-top: 5px;
537
+ }
538
+
539
+ .b2s-edit-template-network-img {
540
+ height: 20px;
541
+ width: auto !important;
542
+ margin-right: 5px;
543
+ }
544
+
545
+ .b2s-edit-template-character-limit-label{
546
+ padding-top: 4px;
547
+ font-weight: 600;
548
+ }
549
+ .b2s-info-character-limit-text{
550
+ margin: 0 0 10px;
551
+ }
552
+
553
+ .b2s-edit-template-preview-border-19 {
554
+ padding-top: 15px;
555
+ padding-bottom: 15px;
556
+ border-radius: 3px;
557
+ }
558
+
559
+ .b2s-edit-template-preview-profile-img-19 {
560
+ height: 40px;
561
+ }
562
+
563
+ .b2s-edit-template-preview-profile-name-19 {
564
+ color: #009090;
565
+ font-size: 13px;
566
+ font-weight: 600;
567
+ line-height: 18px;
568
+ }
569
+
570
+ .b2s-edit-template-preview-header-19 {
571
+ padding-top: 15px;
572
+ padding-bottom: 15px;
573
+ border-bottom: 1px solid lightgray;
574
+ margin-bottom: 15px;
575
+ }
576
+
577
+ .b2s-edit-template-preview-like-icons-19 {
578
+ margin-top: 15px;
579
+ width: 120px;
580
+ }
581
+
582
+ .b2s-edit-template-preview-link-meta-box-title-19 {
583
+ color: #009090;
584
+ font-size: 18px;
585
+ font-weight: 400;
586
+ line-height: 22px;
587
+ }
588
+
589
+ .b2s-edit-template-preview-link-meta-box-desc-19 {
590
+ font-size: 13px;
591
+ line-height: 18px;
592
+ }
593
+
594
+ .b2s-edit-template-preview-link-meta-box-domain-19 {
595
+ font-size: 13px;
596
+ line-height: 18px;
597
+ color: gray;
598
+ }
599
+
600
+ .b2s-edit-template-image-preview .b2s-edit-template-preview-image-border-19 {
601
+ padding: 0px;
602
+ }
603
+
604
+ .b2s-edit-template-preview-content-19 {
605
+ margin: 15px 0px;
606
+ }
607
+
608
+ .b2s-login-form-label {
609
+ padding-top: 7px;
610
+ margin-top: 0;
611
+ margin-bottom: 0;
612
+ text-align: right;
613
+ font-weight: bold;
614
+ }
615
+
616
+ #b2s-auth-network-6-location, #b2s-auth-network-6-board {
617
+ max-width: 100% !important;
618
+ }
619
+
620
+ .b2s-edit-template-title {
621
+ display: inline;
622
+ }
623
+
624
+ .b2s-url-parameter-remove-btn {
625
+ font-weight: bold;
626
+ font-size: 18px;
627
+ line-height: 1.5;
628
+ cursor: pointer;
629
+ }
630
+
631
+ .b2s-url-parameter-legend-text {
632
+ font-size: 12px;
633
+ font-weight: 600;
634
+ letter-spacing: 0;
635
+ margin-top: 10px;
636
+ }
637
+
638
+ .b2s-url-parameter-content {
639
+ padding-top: 6px;
640
+ }
641
+
642
+ .b2s-add-network-continue-btn {
643
+ margin-top: 20px;
644
  }
assets/css/b2s/repost.css CHANGED
@@ -556,4 +556,20 @@ textarea.form-control {
556
 
557
  .list-group-item:first-child{
558
  border-top: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  }
556
 
557
  .list-group-item:first-child{
558
  border-top: none !important;
559
+ }
560
+
561
+ .b2s-network-info-img {
562
+ width: 5.5%;
563
+ margin-left: 5px;
564
+ }
565
+
566
+ .b2s-network-info-img-disabled {
567
+ width: 5.5%;
568
+ opacity: 0.3;
569
+ }
570
+
571
+ .b2s-network-imgs {
572
+ margin-top: 10px;
573
+ margin-bottom: 10px;
574
+ display: inline-block;
575
  }
assets/css/b2s/support.css CHANGED
@@ -1,55 +1,120 @@
1
- @media (max-width: 768px)
2
- {
3
- body .col-md-6{
4
- padding-left: 0;
5
- padding-right: 0;
6
- }
7
- }
8
- .b2s-faq-content a{
9
- text-decoration: underline;
10
- color: #444;
11
- font-size: 14px !important;
12
- }
13
- .b2s-support-topic-img{
14
- min-width: 3em;
15
- }
16
-
17
- .b2s-support-line{
18
- margin-top: 0px!important;
19
- }
20
-
21
- .b2s-support-link-not-active {
22
- pointer-events: none;
23
- cursor: default;
24
- text-decoration: none;
25
- color: gray;
26
- opacity: 0.5;
27
- }
28
-
29
- .b2s-margin-left-10 {
30
- margin-left: 10px;
31
- }
32
-
33
- #b2s-support-check-system .glyphicon {
34
- font-size: 15px;
35
- }
36
-
37
- #b2s-support-check-system hr {
38
- margin-top: 0px !important;
39
- }
40
-
41
- .b2s-support-menu > li > a {
42
- padding: 10px 15px !important;
43
- }
44
-
45
- .thumbnail-no-border{
46
- border: 0px !important;
47
- }
48
-
49
- .b2s-sharing-debugger-result-area{
50
- display: block;
51
- }
52
-
53
- .b2s-padding-top-8{
54
- padding-top:8px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
1
+ @media (max-width: 768px)
2
+ {
3
+ body .col-md-6{
4
+ padding-left: 0;
5
+ padding-right: 0;
6
+ }
7
+ }
8
+
9
+ .b2s-faq-content ol {
10
+ list-style: none;
11
+ margin-left: 0px;
12
+ }
13
+
14
+ .b2s-faq-content a{
15
+ font-size: 16px !important;
16
+ line-height: 32px;
17
+ }
18
+
19
+ .b2s-border-left {
20
+ border-left: 1px solid lightgray;
21
+ }
22
+
23
+ .b2s-support-topic-img{
24
+ min-width: 3em;
25
+ }
26
+
27
+ .b2s-support-line{
28
+ margin-top: 0px!important;
29
+ }
30
+
31
+ .b2s-support-link-not-active {
32
+ pointer-events: none;
33
+ cursor: default;
34
+ text-decoration: none;
35
+ color: gray;
36
+ opacity: 0.5;
37
+ }
38
+
39
+ .b2s-margin-left-10 {
40
+ margin-left: 10px;
41
+ }
42
+
43
+ #b2s-support-check-system .glyphicon {
44
+ font-size: 15px;
45
+ }
46
+
47
+ #b2s-support-check-system hr {
48
+ margin-top: 0px !important;
49
+ }
50
+
51
+ .b2s-support-menu > li > a {
52
+ padding: 10px 15px !important;
53
+ }
54
+
55
+ .thumbnail-no-border{
56
+ border: 0px !important;
57
+ }
58
+
59
+ .b2s-sharing-debugger-result-area{
60
+ display: block;
61
+ }
62
+
63
+ .b2s-padding-top-8{
64
+ padding-top:8px;
65
+ }
66
+
67
+ .b2s-support-icon {
68
+ font-size: 60px;
69
+ margin-top: 20px;
70
+ margin-bottom: 10px;
71
+ }
72
+
73
+ .b2s-community-container {
74
+ background-color: #f8f8f8;
75
+ padding-left: 10px;
76
+ padding-right: 10px;
77
+ padding-bottom: 10px;
78
+ border-radius: 5px;
79
+ }
80
+
81
+ .b2s-gray-text {
82
+ font-size: 16px;
83
+ color: gray;
84
+ }
85
+
86
+ .b2s-bold{
87
+ font-weight: 600;
88
+ }
89
+
90
+ .b2s-sales-support-box {
91
+ width: 27%;
92
+ height: 52px;
93
+ }
94
+
95
+ .b2s-community-btn {
96
+ padding: 8px 65px !important;
97
+ font-size: 16px !important;
98
+ font-weight: bold !important;
99
+ }
100
+
101
+ .b2s-community-register-success {
102
+ margin-top: 50px;
103
+ }
104
+
105
+ .b2s-community-container {
106
+ padding-top: 5px;
107
+ }
108
+
109
+ .b2s-community-register-form .form-group {
110
+ margin-bottom: 5px;
111
+ }
112
+
113
+ .b2s-support-phone-number-text {
114
+ margin-top: 5px;
115
+ font-size: 18px;
116
+ }
117
+
118
+ #b2s-community-terms {
119
+ margin-right: 5px;
120
  }
assets/css/b2s/wp/post-box.css CHANGED
@@ -1,303 +1,321 @@
1
- .b2s-loading-area{
2
- text-align: center;
3
- font-size: 12px;
4
- }
5
- .b2s-loader-impulse{
6
- animation: 1.5s ease-in-out 0s normal none infinite running sk-pulseScaleOut;
7
- border-radius: 100%;
8
- margin: 0 auto;
9
- }
10
- .b2s-loader-impulse{
11
- background-color: #79b331;
12
- }
13
-
14
- .b2s-loader-impulse-md{
15
- height: 48px;
16
- width: 48px;
17
- }
18
- @keyframes sk-pulseScaleOut {
19
- 0% {
20
- -webkit-transform: scale(0);
21
- transform: scale(0); }
22
- 100% {
23
- -webkit-transform: scale(1);
24
- transform: scale(1);
25
- opacity: 0; }
26
- }
27
- .b2s-info-success,.b2s-info-error, .b2s-info-warning {
28
- display:none;
29
- padding: 5px;
30
- margin-top:5px;
31
- }
32
- .b2s-info-success{
33
- border: 1px solid green;
34
- }
35
-
36
- .b2s-info-error{
37
- border: 1px solid red;
38
- }
39
-
40
- .b2s-info-warning{
41
- border: 1px solid orange;
42
- }
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{
49
- margin-top: 0.5em;
50
- margin-bottom: 0.5em;
51
- }
52
-
53
-
54
- .b2s-meta-box-modal {
55
- overflow-x: hidden;
56
- overflow-y: auto;
57
- content: "";
58
- display: none;
59
- background: rgba(0, 0, 0, 0.6);
60
- position: fixed;
61
- top: 0;
62
- left: 0;
63
- right: 0;
64
- bottom: 0;
65
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
66
- z-index: 1050;
67
- }
68
-
69
- .b2s-meta-box-modal-btn-close{
70
- color: #000;
71
- float: right;
72
- font-size: 24px;
73
- font-weight: bold;
74
- text-decoration: none;
75
- opacity: 0.4;
76
- text-shadow: 0 1px 0 #fff;
77
- background: transparent none repeat scroll 0 0;
78
- border: 0 none;
79
- cursor: pointer;
80
- padding: 0;
81
- }
82
-
83
- .b2s-meta-box-modal-dialog{
84
- background: #fefefe none repeat scroll 0 0;
85
- border-radius: 5px;
86
- width: auto;
87
- top:10%;
88
- max-width: 600px;
89
- position: relative;
90
- }
91
-
92
- @media(max-width: 420px) {
93
- .b2s-meta-box-modal-dialog{
94
- margin: 10px;
95
-
96
- }
97
- }
98
- @media(min-width: 421px) {
99
- .b2s-meta-box-modal-dialog{
100
- margin: 30px auto;
101
- }
102
- }
103
-
104
-
105
- .b2s-meta-box-modal-body {
106
- padding: 0px 15px;
107
- }
108
- .b2s-meta-box-modal-header {
109
- padding: 10px 20px;
110
- }
111
- .b2s-meta-box-modal-header {
112
- border-bottom: 1px solid #e5e5e5;
113
- padding: 15px;
114
- }
115
- .b2s-meta-box-modal-title {
116
- line-height: 1.42857;
117
- font-size: 20px;
118
- margin: 0;
119
- }
120
- .b2s-meta-box-modal-h4 {
121
- line-height: 1.42857;
122
- font-size: 20px;
123
- margin: 0;
124
- }
125
- #b2s-meta-box-close {
126
- display: none;
127
- }
128
-
129
- .b2s-btn-success, .b2s-label-success {
130
- background-color: #79B232 !important;
131
- }
132
- .b2s-center-block {
133
- display: block !important;
134
- margin-left: auto;
135
- margin-right: auto;
136
- }
137
- .b2s-btn-success {
138
- background-color: #79B232 !important;
139
- border-color: #398439 !important;
140
- color: #fff !important;
141
- }
142
-
143
- .b2s-btn-primary {
144
- color: #fff !important;
145
- background-color: #337ab7 !important;
146
- border-color: #2e6da4 !important;
147
- }
148
-
149
- .b2s-btn-none-underline{
150
- text-decoration: none !important;
151
- }
152
-
153
- .b2s-btn {
154
- -moz-user-select: none;
155
- background-image: none;
156
- border: 1px solid transparent;
157
- border-radius: 4px;
158
- cursor: pointer;
159
- display: inline-block;
160
- font-size: 12px;
161
- font-weight: normal;
162
- line-height: 1.42857;
163
- margin-bottom: 0;
164
- padding: 6px 12px;
165
- text-align: center;
166
- vertical-align: middle;
167
- }
168
-
169
- .b2s-btn-margin-bottom-15{
170
- margin-bottom: 1.5em;
171
- }
172
-
173
- .b2s-info-btn{
174
- font-size: 12px;
175
- }
176
-
177
- .b2s-btn-sm{
178
- padding: 7px !important;
179
- }
180
-
181
- .b2s-btn-close-meta-box{
182
- padding: 0px !important;
183
- float:right;
184
- position: relative !important;
185
- }
186
- .b2s-close-icon::before {
187
- background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
188
- color: #b4b9be;
189
- content: "";
190
- display: block;
191
- font: 16px/20px dashicons;
192
- height: 20px;
193
- text-align: center;
194
- width: 20px;
195
- }
196
-
197
-
198
- .b2s-close-icon{
199
- background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
200
- border: medium none;
201
- color: #b4b9be;
202
- cursor: pointer;
203
- margin: 0;
204
- padding: 9px;
205
- position: absolute;
206
- right: 1px;
207
- top: 0;
208
- }
209
-
210
- .b2s-post-meta-box-sched-area{
211
- padding: 8px !important;
212
- border: 1px solid #ddd;
213
- }
214
-
215
- .b2s-font-bold{
216
- font-weight: 600;
217
- }
218
-
219
- .b2s-calendar-icon{
220
- padding-top: 6px;
221
- }
222
-
223
- .b2s-margin-top-5{
224
- margin-top: 5px;
225
- }
226
-
227
- .b2s-btn-label-premium {
228
- color: #fff !important;
229
- font-size: 10px !important;
230
- }
231
-
232
- .b2s-label {
233
- display: inline;
234
- padding: .2em .6em .3em;
235
- font-size: 75% !important;
236
- font-weight: bold;
237
- line-height: 1;
238
- color: #fff;
239
- text-align: center;
240
- white-space: nowrap;
241
- vertical-align: baseline;
242
- border-radius: .25em;
243
-
244
- }
245
-
246
- #b2s-post-meta-box-profil-dropdown-twitter option:disabled {
247
- color: #ff4f68;
248
- }
249
-
250
- .pull-right{
251
- float: right;
252
- }
253
-
254
- .b2s-meta-box-share-info {
255
- background-color: #79B232;
256
- padding: 10px;
257
- color: #fff;
258
- }
259
-
260
- @font-face {
261
- font-family: 'Glyphicons Halflings';
262
-
263
- src: url('../../../fonts/glyphicons-halflings-regular.eot');
264
- src: url('../../../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../../../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../../../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../../../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../../../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
265
- }
266
- .glyphicon {
267
- position: relative;
268
- top: 1px;
269
- display: inline-block;
270
- font-family: 'Glyphicons Halflings';
271
- font-style: normal;
272
- font-weight: normal;
273
- line-height: 1;
274
-
275
- -webkit-font-smoothing: antialiased;
276
- -moz-osx-font-smoothing: grayscale;
277
- }
278
-
279
- .glyphicon-chevron-up::before {
280
- content: "\e113";
281
- }
282
- .glyphicon-chevron-down::before {
283
- content: "\e114";
284
- }
285
-
286
- .b2s-options-btn {
287
- cursor: pointer;
288
- text-decoration: underline;
289
- margin-top: 5px;
290
- }
291
-
292
- #b2s-meta-box-btn-customize {
293
- text-decoration: none;
294
- }
295
-
296
- .b2s-options-btn-area {
297
- text-align: right;
298
- }
299
-
300
- .b2s-w-100 {
301
- width: 100%;
302
- padding: 0px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  }
1
+ .b2s-loading-area{
2
+ text-align: center;
3
+ font-size: 12px;
4
+ }
5
+ .b2s-loader-impulse{
6
+ animation: 1.5s ease-in-out 0s normal none infinite running sk-pulseScaleOut;
7
+ border-radius: 100%;
8
+ margin: 0 auto;
9
+ }
10
+ .b2s-loader-impulse{
11
+ background-color: #79b331;
12
+ }
13
+
14
+ .b2s-loader-impulse-md{
15
+ height: 48px;
16
+ width: 48px;
17
+ }
18
+ @keyframes sk-pulseScaleOut {
19
+ 0% {
20
+ -webkit-transform: scale(0);
21
+ transform: scale(0); }
22
+ 100% {
23
+ -webkit-transform: scale(1);
24
+ transform: scale(1);
25
+ opacity: 0; }
26
+ }
27
+ .b2s-info-success,.b2s-info-error, .b2s-info-warning {
28
+ display:none;
29
+ padding: 5px;
30
+ margin-top:5px;
31
+ }
32
+ .b2s-info-success{
33
+ border: 1px solid green;
34
+ }
35
+
36
+ .b2s-info-error{
37
+ border: 1px solid red;
38
+ }
39
+
40
+ .b2s-info-warning{
41
+ border: 1px solid orange;
42
+ }
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{
49
+ margin-top: 0.5em;
50
+ margin-bottom: 0.5em;
51
+ }
52
+
53
+
54
+ .b2s-meta-box-modal {
55
+ overflow-x: hidden;
56
+ overflow-y: auto;
57
+ content: "";
58
+ display: none;
59
+ background: rgba(0, 0, 0, 0.6);
60
+ position: fixed;
61
+ top: 0;
62
+ left: 0;
63
+ right: 0;
64
+ bottom: 0;
65
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
66
+ z-index: 1050;
67
+ }
68
+
69
+ .b2s-meta-box-modal-btn-close{
70
+ color: #000;
71
+ float: right;
72
+ font-size: 24px;
73
+ font-weight: bold;
74
+ text-decoration: none;
75
+ opacity: 0.4;
76
+ text-shadow: 0 1px 0 #fff;
77
+ background: transparent none repeat scroll 0 0;
78
+ border: 0 none;
79
+ cursor: pointer;
80
+ padding: 0;
81
+ }
82
+
83
+ .b2s-meta-box-modal-dialog{
84
+ background: #fefefe none repeat scroll 0 0;
85
+ border-radius: 5px;
86
+ width: auto;
87
+ top:10%;
88
+ max-width: 600px;
89
+ position: relative;
90
+ }
91
+
92
+ @media(max-width: 420px) {
93
+ .b2s-meta-box-modal-dialog{
94
+ margin: 10px;
95
+
96
+ }
97
+ }
98
+ @media(min-width: 421px) {
99
+ .b2s-meta-box-modal-dialog{
100
+ margin: 30px auto;
101
+ }
102
+ }
103
+
104
+
105
+ .b2s-meta-box-modal-body {
106
+ padding: 0px 15px;
107
+ }
108
+ .b2s-meta-box-modal-header {
109
+ padding: 10px 20px;
110
+ }
111
+ .b2s-meta-box-modal-header {
112
+ border-bottom: 1px solid #e5e5e5;
113
+ padding: 15px;
114
+ }
115
+ .b2s-meta-box-modal-title {
116
+ line-height: 1.42857;
117
+ font-size: 20px;
118
+ margin: 0;
119
+ }
120
+ .b2s-meta-box-modal-h4 {
121
+ line-height: 1.42857;
122
+ font-size: 20px;
123
+ margin: 0;
124
+ }
125
+ #b2s-meta-box-close {
126
+ display: none;
127
+ }
128
+
129
+ .b2s-btn-success, .b2s-label-success {
130
+ background-color: #79B232 !important;
131
+ }
132
+ .b2s-center-block {
133
+ display: block !important;
134
+ margin-left: auto;
135
+ margin-right: auto;
136
+ }
137
+ .b2s-btn-success {
138
+ background-color: #79B232 !important;
139
+ border-color: #398439 !important;
140
+ color: #fff !important;
141
+ }
142
+
143
+ .b2s-btn-primary {
144
+ color: #fff !important;
145
+ background-color: #337ab7 !important;
146
+ border-color: #2e6da4 !important;
147
+ }
148
+
149
+ .b2s-btn-none-underline{
150
+ text-decoration: none !important;
151
+ }
152
+
153
+ .b2s-btn {
154
+ -moz-user-select: none;
155
+ background-image: none;
156
+ border: 1px solid transparent;
157
+ border-radius: 4px;
158
+ cursor: pointer;
159
+ display: inline-block;
160
+ font-size: 12px;
161
+ font-weight: normal;
162
+ line-height: 1.42857;
163
+ margin-bottom: 0;
164
+ padding: 6px 12px;
165
+ text-align: center;
166
+ vertical-align: middle;
167
+ }
168
+
169
+ .b2s-btn-margin-bottom-15{
170
+ margin-bottom: 1.5em;
171
+ }
172
+
173
+ .b2s-info-btn{
174
+ font-size: 12px;
175
+ }
176
+
177
+ .b2s-btn-sm{
178
+ padding: 7px !important;
179
+ }
180
+
181
+ .b2s-btn-close-meta-box{
182
+ padding: 0px !important;
183
+ float:right;
184
+ position: relative !important;
185
+ }
186
+ .b2s-close-icon::before {
187
+ background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
188
+ color: #b4b9be;
189
+ content: "";
190
+ display: block;
191
+ font: 16px/20px dashicons;
192
+ height: 20px;
193
+ text-align: center;
194
+ width: 20px;
195
+ }
196
+
197
+
198
+ .b2s-close-icon{
199
+ background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
200
+ border: medium none;
201
+ color: #b4b9be;
202
+ cursor: pointer;
203
+ margin: 0;
204
+ padding: 9px;
205
+ position: absolute;
206
+ right: 1px;
207
+ top: 0;
208
+ }
209
+
210
+ .b2s-post-meta-box-sched-area{
211
+ padding: 8px !important;
212
+ border: 1px solid #ddd;
213
+ }
214
+
215
+ .b2s-font-bold{
216
+ font-weight: 600;
217
+ }
218
+
219
+ .b2s-calendar-icon{
220
+ padding-top: 6px;
221
+ }
222
+
223
+ .b2s-margin-top-5{
224
+ margin-top: 5px;
225
+ }
226
+
227
+ .b2s-btn-label-premium {
228
+ color: #fff !important;
229
+ font-size: 10px !important;
230
+ }
231
+
232
+ .b2s-label {
233
+ display: inline;
234
+ padding: .2em .6em .3em;
235
+ font-size: 75% !important;
236
+ font-weight: bold;
237
+ line-height: 1;
238
+ color: #fff;
239
+ text-align: center;
240
+ white-space: nowrap;
241
+ vertical-align: baseline;
242
+ border-radius: .25em;
243
+
244
+ }
245
+
246
+ #b2s-post-meta-box-profil-dropdown-twitter option:disabled {
247
+ color: #ff4f68;
248
+ }
249
+
250
+ .pull-right{
251
+ float: right;
252
+ }
253
+
254
+ .b2s-meta-box-share-info {
255
+ background-color: #79B232;
256
+ padding: 10px;
257
+ color: #fff;
258
+ }
259
+
260
+ @font-face {
261
+ font-family: 'Glyphicons Halflings';
262
+
263
+ src: url('../../../fonts/glyphicons-halflings-regular.eot');
264
+ src: url('../../../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../../../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../../../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../../../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../../../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
265
+ }
266
+ .glyphicon {
267
+ position: relative;
268
+ top: 1px;
269
+ display: inline-block;
270
+ font-family: 'Glyphicons Halflings';
271
+ font-style: normal;
272
+ font-weight: normal;
273
+ line-height: 1;
274
+
275
+ -webkit-font-smoothing: antialiased;
276
+ -moz-osx-font-smoothing: grayscale;
277
+ }
278
+
279
+ .glyphicon-chevron-up::before {
280
+ content: "\e113";
281
+ }
282
+ .glyphicon-chevron-down::before {
283
+ content: "\e114";
284
+ }
285
+
286
+ .b2s-options-btn {
287
+ cursor: pointer;
288
+ text-decoration: underline;
289
+ margin-top: 5px;
290
+ }
291
+
292
+ #b2s-meta-box-btn-customize {
293
+ text-decoration: none;
294
+ }
295
+
296
+ .b2s-options-btn-area {
297
+ text-align: right;
298
+ }
299
+
300
+ .b2s-w-100 {
301
+ width: 100%;
302
+ padding: 0px !important;
303
+ }
304
+
305
+ .b2s-img-network {
306
+ width: 5%;
307
+ }
308
+
309
+ .b2s-img-network-disabled {
310
+ width: 5%;
311
+ opacity: 0.3;
312
+ }
313
+
314
+ .b2s-network-imgs {
315
+ margin-top: 10px;
316
+ margin-bottom: 10px;
317
+ }
318
+
319
+ .b2s-bold {
320
+ font-weight: 600;
321
  }
assets/js/b2s/calendar.js CHANGED
@@ -1,695 +1,696 @@
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: '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
- }
111
- }
112
- },
113
- loading: function (bool) {
114
- if (!bool) {
115
- //Routing from Dashboard - loading edit post preview
116
- var rfd = jQuery('#b2s_rfd').val();
117
- if (rfd == 1) {
118
- jQuery('#b2s_rfd').val("0");
119
- jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
120
- }
121
- }
122
- }
123
-
124
- });
125
- jQuery(".b2s-loading-area").hide();
126
- });
127
-
128
-
129
- function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
130
- if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
131
- {
132
- jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
133
- }
134
- b2s_current_post_id = post_id;
135
- jQuery("#b2sPostId").val(post_id);
136
- var $modal = jQuery("<div>");
137
- jQuery.ajax({
138
- url: ajaxurl,
139
- type: "POST",
140
- cache: false,
141
- async: false,
142
- data: {
143
- 'action': 'b2s_get_post_edit_modal',
144
- 'id': b2s_id,
145
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
146
- },
147
- success: function (data) {
148
- if (data.error == 'nonce') {
149
- jQuery('.b2s-nonce-check-fail').show();
150
- } else {
151
- $modal = $modal.html(data);
152
- }
153
- }
154
- });
155
- jQuery("body").append($modal);
156
- jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
157
- jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
158
- activatePortal(network_auth_id);
159
- initSceditor(network_auth_id);
160
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
161
- var postFormatText = b2s_calendar_formats;
162
- var isSetPostFormat = false;
163
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
164
- //is set post format => override current condidtions by user settings for this post
165
- if (post_format !== null) {
166
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
167
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
168
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
169
- //edit modal select post format
170
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
171
- 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');
172
- } else {
173
- 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()]);
174
- 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());
175
- }
176
-
177
- //if linkpost then show btn meta tags
178
- var isMetaChecked = false;
179
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
180
- if (typeof network_id != 'undefined' && jQuery.inArray(network_id.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
181
- isMetaChecked = true;
182
- }
183
- if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
184
- isMetaChecked = true;
185
- }
186
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
187
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
188
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
189
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
190
- //jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
191
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
192
- if (dataMetaType == "og") {
193
- jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
194
- } else {
195
- jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
196
- }
197
- } else {
198
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
199
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
200
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
201
- }
202
-
203
- //Content Curation
204
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
205
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
206
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
207
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
208
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
209
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
210
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
211
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
212
- } else {
213
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
214
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
215
- }
216
- }
217
- }
218
- 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');
219
- if (textLimit != "0") {
220
- networkLimitAll(network_auth_id, network_id, textLimit);
221
- } else {
222
- networkCount(network_auth_id);
223
- }
224
- var today = new Date();
225
- var dateFormat = "yyyy-mm-dd";
226
- var language = "en";
227
- var showMeridian = true;
228
- if (jQuery('#b2sUserLang').val() == "de") {
229
- dateFormat = "dd.mm.yyyy";
230
- language = "de";
231
- showMeridian = false;
232
- }
233
-
234
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
235
- format: dateFormat,
236
- language: language,
237
- maxViewMode: 2,
238
- todayHighlight: true,
239
- startDate: today,
240
- calendarWeeks: true,
241
- autoclose: true
242
- });
243
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
244
- minuteStep: 15,
245
- appendWidgetTo: 'body',
246
- showSeconds: false,
247
- showMeridian: showMeridian,
248
- defaultTime: 'current',
249
- snapToStep: true
250
- });
251
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
252
- checkSchedDateTime(network_auth_id);
253
- });
254
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
255
- checkSchedDateTime(network_auth_id);
256
- });
257
- init();
258
-
259
- //is relay post?
260
- if (relay_primary_post_id > 0) {
261
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
262
- 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')) {
263
- jQuery(this).prop("disabled", true);
264
- }
265
- });
266
- }
267
-
268
- if (!b2s_has_premium)
269
- {
270
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
271
- if (!jQuery(this).hasClass('b2s-modal-close')) {
272
- jQuery(this).prop("disabled", true);
273
- }
274
- });
275
- }
276
- }
277
-
278
- jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
279
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
280
- 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();
281
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
282
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
283
- curSource[0] = newSource[0];
284
-
285
- jQuery('.b2s-calendar-filter-network-account-list').html("");
286
- jQuery('.b2s-calendar-filter-network-account-list').hide();
287
- if (jQuery(this).val() != 'all') {
288
- jQuery.ajax({
289
- url: ajaxurl,
290
- type: "POST",
291
- dataType: "json",
292
- cache: false,
293
- async: false,
294
- data: {
295
- 'action': 'b2s_get_calendar_filter_network_auth',
296
- 'network_id': jQuery(this).val(),
297
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
298
- },
299
- success: function (data) {
300
- if (data.result == true) {
301
- jQuery(".b2s-calendar-filter-network-account-list").show();
302
- jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
303
- } else {
304
- if (data.error == 'nonce') {
305
- jQuery('.b2s-nonce-check-fail').show();
306
- }
307
- }
308
- }
309
- });
310
- }
311
- return false;
312
- });
313
-
314
-
315
- jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
316
- var filter_network_details_auth_id = jQuery(this).val();
317
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
318
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
319
- 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();
320
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
321
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
322
- curSource[0] = newSource[0];
323
-
324
- return false;
325
-
326
- });
327
-
328
- jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
329
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
330
- var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
331
- if (typeof filter_network_details_auth_id == 'undefined') {
332
- filter_network_details_auth_id = 'all';
333
- }
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_calendar').fullCalendar('removeEventSource', curSource[0]);
337
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
338
- curSource[0] = newSource[0];
339
-
340
- return false;
341
-
342
- });
343
-
344
-
345
- //Modal Edit Post close
346
- jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
347
- jQuery(jQuery(this).attr('data-modal-name')).remove();
348
- return false;
349
- });
350
-
351
-
352
- jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
353
- jQuery('#b2sPagination').val("1");
354
- b2sSortFormSubmit();
355
- return false;
356
- });
357
-
358
- jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
359
- if (event.keyCode == 13) { //Hide Enter
360
- return false;
361
- }
362
- });
363
-
364
- jQuery(document).on('click', '.b2s-pagination-btn', function () {
365
- jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
366
- b2sSortFormSubmit();
367
- return false;
368
- });
369
-
370
- jQuery(document).on('change', '.b2s-select', function () {
371
- jQuery('#b2sPagination').val("1");
372
- b2sSortFormSubmit();
373
- return false;
374
- });
375
-
376
- jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
377
- jQuery('#b2sPagination').val("1");
378
- jQuery('#b2sSortPostTitle').val("");
379
- jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
380
- jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
381
- jQuery('#b2sSortPostType').prop('selectedIndex', 0);
382
- jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
383
- jQuery('#b2sShowByDate').val("");
384
- jQuery('#b2sUserAuthId').val("");
385
- jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
386
- jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
387
- b2sSortFormSubmit();
388
- return false;
389
- });
390
-
391
- jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
392
- if (jQuery('#user_version').val() == 0) {
393
- jQuery('#b2s-sched-post-modal').modal('show');
394
- return false;
395
- }
396
- jQuery('#b2s-show-post-type-modal').modal('show');
397
- var view = jQuery('#b2s_calendar').fullCalendar('getView');
398
- var selSchedDate;
399
- if (view.type == 'month') {
400
- selSchedDate = jQuery(this).parent('td').attr('data-date');
401
- } else {
402
- selSchedDate = jQuery(this).parent('th').attr('data-date');
403
- }
404
- jQuery('#b2sSelSchedDate').val(selSchedDate);
405
- return false;
406
- });
407
-
408
- jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
409
- jQuery('#b2s-show-post-type-modal').modal('hide');
410
- jQuery('#b2s-show-post-all-modal').modal('show');
411
- if (!jQuery('#b2sSelSchedDate').length > 0) {
412
- jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
413
- }
414
- b2sSortFormSubmit();
415
- return false;
416
- });
417
-
418
- jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
419
- window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
420
- return false;
421
- });
422
-
423
- function showFilter(typ) {
424
- if (typ == 'show') {
425
- jQuery('.filterShow').hide();
426
- jQuery('.form-inline').show();
427
- jQuery('.filterHide').show();
428
- } else {
429
- jQuery('.filterShow').show();
430
- jQuery('.form-inline').hide();
431
- jQuery('.filterHide').hide();
432
- }
433
- }
434
-
435
- //b2sSortForm
436
- function b2sSortFormSubmit() {
437
- jQuery(".b2s-loading-area").show();
438
- jQuery('.b2s-sort-result-item-area').html('');
439
- jQuery('.b2s-sort-pagination-area').html('');
440
-
441
- var data = {
442
- 'action': 'b2s_sort_data',
443
- 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
444
- 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
445
- 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
446
- 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
447
- 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
448
- 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
449
- 'b2sType': jQuery('#b2sType').val(),
450
- 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
451
- 'b2sPagination': jQuery('#b2sPagination').val(),
452
- 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
453
- 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
454
- 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
455
- 'b2sUserLang': jQuery('#b2sUserLang').val(),
456
- 'b2sSchedDate': jQuery('#b2sSelSchedDate').val(),
457
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
458
- };
459
-
460
- if (jQuery('#b2sPostsPerPage').length > 0) {
461
- data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
462
- }
463
-
464
- jQuery.ajax({
465
- url: ajaxurl,
466
- type: "POST",
467
- dataType: "json",
468
- cache: false,
469
- data: data,
470
- error: function () {
471
- jQuery('.b2s-server-connection-fail').show();
472
- return false;
473
- },
474
- success: function (data) {
475
- if (typeof data === 'undefined' || data === null) {
476
- jQuery('.b2s-server-connection-fail').show();
477
- return false;
478
- }
479
- if (data.result == true) {
480
- jQuery('.b2s-loading-area').hide();
481
- jQuery('.b2s-sort-result-item-area').html(data.content).show();
482
- jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
483
- } else {
484
- if (data.error == 'nonce') {
485
- jQuery('.b2s-nonce-check-fail').show();
486
- } else {
487
- jQuery('.b2s-server-connection-fail').show();
488
- }
489
- return false;
490
- }
491
- }
492
- });
493
- return false;
494
- }
495
- //Overlay second modal
496
- jQuery('#b2s-show-post-type-modal').on('hidden.bs.modal', function () {
497
- jQuery('body').addClass('modal-open');
498
- });
499
-
500
- //Overlay second modal
501
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
502
- jQuery('body').addClass('modal-open');
503
- });
504
-
505
- //Overlay second modal
506
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
507
- jQuery('body').addClass('modal-open');
508
- });
509
-
510
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
511
- jQuery('.b2s-network-select-image-content').html("");
512
- jQuery.ajax({
513
- url: ajaxurl,
514
- type: "POST",
515
- cache: false,
516
- async: false,
517
- data: {
518
- 'action': 'b2s_get_image_modal',
519
- 'id': jQuery(this).data('post-id'),
520
- 'image_url': jQuery(this).data('image-url'),
521
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
522
- },
523
- success: function (data) {
524
- if (data.error == 'nonce') {
525
- jQuery('.b2s-nonce-check-fail').show();
526
- } else {
527
- jQuery(".b2s-network-select-image-content").html(data);
528
- }
529
- }
530
- });
531
- var authId = jQuery(this).data('network-auth-id');
532
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
533
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
534
- 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();
535
- jQuery('.b2s-selected-network-for-image-info').html(content);
536
- jQuery('#b2sInsertImageType').val("0");
537
- jQuery('.networkImage').each(function () {
538
- var width = this.naturalWidth;
539
- var height = this.naturalHeight;
540
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
541
- });
542
- jQuery('#b2s-network-select-image').modal('show');
543
- return false;
544
- });
545
- jQuery(document).on("click", ".b2s-edit-post-delete", function () {
546
- var id = jQuery(this).data("b2s-id");
547
- var post_id = jQuery(this).data("post-id");
548
- var post_for_relay = jQuery(this).data("data-post-for-relay");
549
- var post_for_approve = jQuery(this).data("data-post-for-approve");
550
- jQuery.ajax({
551
- url: ajaxurl,
552
- type: "POST",
553
- dataType: "json",
554
- cache: false,
555
- data: {
556
- 'action': 'b2s_delete_post',
557
- 'b2s_id': id,
558
- 'post_id': post_id,
559
- 'post_for_relay': post_for_relay,
560
- 'post_for_approve': post_for_approve,
561
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
562
- },
563
- success: function (data) {
564
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
565
- refreshCalender();
566
- wp.heartbeat.connectNow();
567
- }
568
- });
569
- });
570
-
571
- /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
572
- jQuery('#save_method').val("apply-all");
573
- e.preventDefault();
574
- var id = jQuery(this).data("b2s-id");
575
- jQuery.ajax({
576
- url: ajaxurl,
577
- type: "POST",
578
- dataType: "json",
579
- cache: false,
580
- data: jQuery(this).closest("form").serialize(),
581
- success: function (data) {
582
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
583
- refreshCalender();
584
- jQuery('#b2s-edit-event-modal-' + id).remove();
585
- wp.heartbeat.connectNow();
586
- }
587
- });
588
- });*/
589
-
590
- jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
591
- e.preventDefault();
592
- jQuery('#save_method').val("apply-this");
593
- var id = jQuery(this).data("b2s-id");
594
- jQuery.ajax({
595
- url: ajaxurl,
596
- type: "POST",
597
- dataType: "json",
598
- cache: false,
599
- data: jQuery(this).closest("form").serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
600
- success: function (data) {
601
- if (data.error == 'nonce') {
602
- jQuery('.b2s-nonce-check-fail').show();
603
- }
604
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
605
- refreshCalender();
606
- jQuery('#b2s-edit-event-modal-' + id).remove();
607
- jQuery('body').removeClass('modal-open');
608
- jQuery('body').removeAttr('style');
609
- wp.heartbeat.connectNow();
610
- }
611
- });
612
- });
613
- jQuery(document).on("click", ".release_locks", function () {
614
- jQuery.ajax({
615
- url: ajaxurl,
616
- type: "POST",
617
- cache: false,
618
- async: false,
619
- data: {
620
- 'action': 'b2s_get_calendar_release_locks',
621
- 'post_id': jQuery('#post_id').val(),
622
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
623
- },
624
- success: function (data) {
625
- if (data.error == 'nonce') {
626
- jQuery('.b2s-nonce-check-fail').show();
627
- }
628
- wp.heartbeat.connectNow();
629
- }
630
- });
631
- });
632
- function refreshCalender() {
633
- jQuery('#b2s_calendar').fullCalendar('refetchEvents');
634
- }
635
-
636
- jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
637
- jQuery('body').addClass('modal-open');
638
- });
639
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
640
- jQuery('body').addClass('modal-open');
641
- });
642
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
643
- jQuery('body').addClass('modal-open');
644
- });
645
- jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
646
- jQuery('body').addClass('modal-open');
647
- });
648
- //jQuery(this).attr('data-network-auth-id')
649
- function checkSchedDateTime(dataNetworkAuthId) {
650
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
651
- var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
652
- var dateStr = jQuery(dateElement).val();
653
- var minStr = jQuery(timeElement).val();
654
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
655
- if (jQuery('#b2sUserLang').val() == 'de') {
656
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
657
- } else {
658
- var minParts = minStr.split(' ');
659
- var minParts2 = minParts[0].split(':');
660
- if (minParts[1] == 'PM') {
661
- minParts2[0] = parseInt(minParts2[0]) + 12;
662
- }
663
- minStr = minParts2[0] + ':' + minParts2[1];
664
- }
665
-
666
- var minParts3 = minStr.split(':');
667
- if (minParts3[0] < 10) {
668
- minParts3[0] = '0' + minParts3[0];
669
- }
670
- var dateParts = dateStr.split('-');
671
- //utc current time
672
- var now = new Date();
673
- //offset between utc und user
674
- var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
675
- //enter hour to user time
676
- var hour = parseInt(minParts3[0]) + timeZone + offset;
677
- //calculate datetime in utc
678
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
679
- //compare enter date time with allowed user time
680
- if (enter.getTime() < now.getTime()) {
681
- //enter set on next 15 minutes and calculate on user timezone
682
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
683
- jQuery(dateElement).datepicker('update', enter);
684
- jQuery(timeElement).timepicker('setTime', enter);
685
- }
686
- }
687
-
688
-
689
- function printDateFormat(dataNetworkAuthId) {
690
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
691
- var dateStr = jQuery(dateElement).val();
692
- dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
693
- jQuery(dateElement).val(dateStr);
694
- }
695
-
 
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: '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
+ }
111
+ }
112
+ },
113
+ loading: function (bool) {
114
+ if (!bool) {
115
+ //Routing from Dashboard - loading edit post preview
116
+ var rfd = jQuery('#b2s_rfd').val();
117
+ if (rfd == 1) {
118
+ jQuery('#b2s_rfd').val("0");
119
+ jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
120
+ }
121
+ }
122
+ }
123
+
124
+ });
125
+ jQuery(".b2s-loading-area").hide();
126
+ });
127
+
128
+
129
+ function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
130
+ if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
131
+ {
132
+ jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
133
+ }
134
+ b2s_current_post_id = post_id;
135
+ jQuery("#b2sPostId").val(post_id);
136
+ var $modal = jQuery("<div>");
137
+ jQuery.ajax({
138
+ url: ajaxurl,
139
+ type: "POST",
140
+ cache: false,
141
+ async: false,
142
+ data: {
143
+ 'action': 'b2s_get_post_edit_modal',
144
+ 'id': b2s_id,
145
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
146
+ },
147
+ success: function (data) {
148
+ if (data.error == 'nonce') {
149
+ jQuery('.b2s-nonce-check-fail').show();
150
+ } else {
151
+ $modal = $modal.html(data);
152
+ }
153
+ }
154
+ });
155
+ jQuery("body").append($modal);
156
+ jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
157
+ jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
158
+ activatePortal(network_auth_id);
159
+ initSceditor(network_auth_id);
160
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
161
+ var postFormatText = b2s_calendar_formats;
162
+ var isSetPostFormat = false;
163
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
164
+ //is set post format => override current condidtions by user settings for this post
165
+ if (post_format !== null) {
166
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
167
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
168
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
169
+ //edit modal select post format
170
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
171
+ 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');
172
+ } else {
173
+ 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()]);
174
+ 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());
175
+ }
176
+
177
+ //if linkpost then show btn meta tags
178
+ var isMetaChecked = false;
179
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
180
+ if (typeof network_id != 'undefined' && jQuery.inArray(network_id.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
181
+ isMetaChecked = true;
182
+ }
183
+ if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
184
+ isMetaChecked = true;
185
+ }
186
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
187
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
188
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
189
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
190
+ //jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
191
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
192
+ if (dataMetaType == "og") {
193
+ jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
194
+ } else {
195
+ jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
196
+ }
197
+ } else {
198
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
199
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
200
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
201
+ }
202
+
203
+ //Content Curation
204
+ if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
205
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
206
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
207
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
208
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
209
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
210
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
211
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
212
+ } else {
213
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
214
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
215
+ }
216
+ }
217
+ }
218
+ 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');
219
+ if (textLimit != "0") {
220
+ networkLimitAll(network_auth_id, network_id, textLimit);
221
+ } else {
222
+ networkCount(network_auth_id);
223
+ }
224
+ var today = new Date();
225
+ var dateFormat = "yyyy-mm-dd";
226
+ var language = "en";
227
+ var showMeridian = true;
228
+ if (jQuery('#b2sUserLang').val() == "de") {
229
+ dateFormat = "dd.mm.yyyy";
230
+ language = "de";
231
+ showMeridian = false;
232
+ }
233
+
234
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
235
+ format: dateFormat,
236
+ language: language,
237
+ maxViewMode: 2,
238
+ todayHighlight: true,
239
+ startDate: today,
240
+ calendarWeeks: true,
241
+ autoclose: true
242
+ });
243
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
244
+ minuteStep: 15,
245
+ appendWidgetTo: 'body',
246
+ showSeconds: false,
247
+ showMeridian: showMeridian,
248
+ defaultTime: 'current',
249
+ snapToStep: true
250
+ });
251
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
252
+ checkSchedDateTime(network_auth_id);
253
+ });
254
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
255
+ checkSchedDateTime(network_auth_id);
256
+ });
257
+ init();
258
+
259
+ //is relay post?
260
+ if (relay_primary_post_id > 0) {
261
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
262
+ 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')) {
263
+ jQuery(this).prop("disabled", true);
264
+ }
265
+ });
266
+ }
267
+
268
+ if (!b2s_has_premium)
269
+ {
270
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
271
+ if (!jQuery(this).hasClass('b2s-modal-close')) {
272
+ jQuery(this).prop("disabled", true);
273
+ }
274
+ });
275
+ }
276
+ }
277
+
278
+ jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
279
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
280
+ 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();
281
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
282
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
283
+ curSource[0] = newSource[0];
284
+
285
+ jQuery('.b2s-calendar-filter-network-account-list').html("");
286
+ jQuery('.b2s-calendar-filter-network-account-list').hide();
287
+ if (jQuery(this).val() != 'all') {
288
+ jQuery.ajax({
289
+ url: ajaxurl,
290
+ type: "POST",
291
+ dataType: "json",
292
+ cache: false,
293
+ async: false,
294
+ data: {
295
+ 'action': 'b2s_get_calendar_filter_network_auth',
296
+ 'network_id': jQuery(this).val(),
297
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
298
+ },
299
+ success: function (data) {
300
+ if (data.result == true) {
301
+ jQuery(".b2s-calendar-filter-network-account-list").show();
302
+ jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
303
+ } else {
304
+ if (data.error == 'nonce') {
305
+ jQuery('.b2s-nonce-check-fail').show();
306
+ }
307
+ }
308
+ }
309
+ });
310
+ }
311
+ return false;
312
+ });
313
+
314
+
315
+ jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
316
+ var filter_network_details_auth_id = jQuery(this).val();
317
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
318
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
319
+ 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();
320
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
321
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
322
+ curSource[0] = newSource[0];
323
+
324
+ return false;
325
+
326
+ });
327
+
328
+ jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
329
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
330
+ var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
331
+ if (typeof filter_network_details_auth_id == 'undefined') {
332
+ filter_network_details_auth_id = 'all';
333
+ }
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_calendar').fullCalendar('removeEventSource', curSource[0]);
337
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
338
+ curSource[0] = newSource[0];
339
+
340
+ return false;
341
+
342
+ });
343
+
344
+
345
+ //Modal Edit Post close
346
+ jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
347
+ jQuery(jQuery(this).attr('data-modal-name')).remove();
348
+ return false;
349
+ });
350
+
351
+
352
+ jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
353
+ jQuery('#b2sPagination').val("1");
354
+ b2sSortFormSubmit();
355
+ return false;
356
+ });
357
+
358
+ jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
359
+ if (event.keyCode == 13) { //Hide Enter
360
+ return false;
361
+ }
362
+ });
363
+
364
+ jQuery(document).on('click', '.b2s-pagination-btn', function () {
365
+ jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
366
+ b2sSortFormSubmit();
367
+ return false;
368
+ });
369
+
370
+ jQuery(document).on('change', '.b2s-select', function () {
371
+ jQuery('#b2sPagination').val("1");
372
+ b2sSortFormSubmit();
373
+ return false;
374
+ });
375
+
376
+ jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
377
+ jQuery('#b2sPagination').val("1");
378
+ jQuery('#b2sSortPostTitle').val("");
379
+ jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
380
+ jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
381
+ jQuery('#b2sSortPostType').prop('selectedIndex', 0);
382
+ jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
383
+ jQuery('#b2sShowByDate').val("");
384
+ jQuery('#b2sUserAuthId').val("");
385
+ jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
386
+ jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
387
+ b2sSortFormSubmit();
388
+ return false;
389
+ });
390
+
391
+ jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
392
+ if (jQuery('#user_version').val() == 0) {
393
+ jQuery('#b2s-sched-post-modal').modal('show');
394
+ return false;
395
+ }
396
+ jQuery('#b2s-show-post-type-modal').modal('show');
397
+ var view = jQuery('#b2s_calendar').fullCalendar('getView');
398
+ var selSchedDate;
399
+ if (view.type == 'month') {
400
+ selSchedDate = jQuery(this).parent('td').attr('data-date');
401
+ } else {
402
+ selSchedDate = jQuery(this).parent('th').attr('data-date');
403
+ }
404
+ jQuery('#b2sSelSchedDate').val(selSchedDate);
405
+ return false;
406
+ });
407
+
408
+ jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
409
+ jQuery('#b2s-show-post-type-modal').modal('hide');
410
+ jQuery('#b2s-show-post-all-modal').modal('show');
411
+ if (!jQuery('#b2sSelSchedDate').length > 0) {
412
+ jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
413
+ }
414
+ b2sSortFormSubmit();
415
+ return false;
416
+ });
417
+
418
+ jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
419
+ window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
420
+ return false;
421
+ });
422
+
423
+ function showFilter(typ) {
424
+ if (typ == 'show') {
425
+ jQuery('.filterShow').hide();
426
+ jQuery('.form-inline').show();
427
+ jQuery('.filterHide').show();
428
+ } else {
429
+ jQuery('.filterShow').show();
430
+ jQuery('.form-inline').hide();
431
+ jQuery('.filterHide').hide();
432
+ }
433
+ }
434
+
435
+ //b2sSortForm
436
+ function b2sSortFormSubmit() {
437
+ jQuery(".b2s-loading-area").show();
438
+ jQuery('.b2s-sort-result-item-area').html('');
439
+ jQuery('.b2s-sort-pagination-area').html('');
440
+
441
+ var data = {
442
+ 'action': 'b2s_sort_data',
443
+ 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
444
+ 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
445
+ 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
446
+ 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
447
+ 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
448
+ 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
449
+ 'b2sType': jQuery('#b2sType').val(),
450
+ 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
451
+ 'b2sPagination': jQuery('#b2sPagination').val(),
452
+ 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
453
+ 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
454
+ 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
455
+ 'b2sSortPostShareStatus': jQuery('#b2sSortPostShareStatus').val(),
456
+ 'b2sUserLang': jQuery('#b2sUserLang').val(),
457
+ 'b2sSchedDate': jQuery('#b2sSelSchedDate').val(),
458
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
459
+ };
460
+
461
+ if (jQuery('#b2sPostsPerPage').length > 0) {
462
+ data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
463
+ }
464
+
465
+ jQuery.ajax({
466
+ url: ajaxurl,
467
+ type: "POST",
468
+ dataType: "json",
469
+ cache: false,
470
+ data: data,
471
+ error: function () {
472
+ jQuery('.b2s-server-connection-fail').show();
473
+ return false;
474
+ },
475
+ success: function (data) {
476
+ if (typeof data === 'undefined' || data === null) {
477
+ jQuery('.b2s-server-connection-fail').show();
478
+ return false;
479
+ }
480
+ if (data.result == true) {
481
+ jQuery('.b2s-loading-area').hide();
482
+ jQuery('.b2s-sort-result-item-area').html(data.content).show();
483
+ jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
484
+ } else {
485
+ if (data.error == 'nonce') {
486
+ jQuery('.b2s-nonce-check-fail').show();
487
+ } else {
488
+ jQuery('.b2s-server-connection-fail').show();
489
+ }
490
+ return false;
491
+ }
492
+ }
493
+ });
494
+ return false;
495
+ }
496
+ //Overlay second modal
497
+ jQuery('#b2s-show-post-type-modal').on('hidden.bs.modal', function () {
498
+ jQuery('body').addClass('modal-open');
499
+ });
500
+
501
+ //Overlay second modal
502
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
503
+ jQuery('body').addClass('modal-open');
504
+ });
505
+
506
+ //Overlay second modal
507
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
508
+ jQuery('body').addClass('modal-open');
509
+ });
510
+
511
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
512
+ jQuery('.b2s-network-select-image-content').html("");
513
+ jQuery.ajax({
514
+ url: ajaxurl,
515
+ type: "POST",
516
+ cache: false,
517
+ async: false,
518
+ data: {
519
+ 'action': 'b2s_get_image_modal',
520
+ 'id': jQuery(this).data('post-id'),
521
+ 'image_url': jQuery(this).data('image-url'),
522
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
523
+ },
524
+ success: function (data) {
525
+ if (data.error == 'nonce') {
526
+ jQuery('.b2s-nonce-check-fail').show();
527
+ } else {
528
+ jQuery(".b2s-network-select-image-content").html(data);
529
+ }
530
+ }
531
+ });
532
+ var authId = jQuery(this).data('network-auth-id');
533
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
534
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
535
+ 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();
536
+ jQuery('.b2s-selected-network-for-image-info').html(content);
537
+ jQuery('#b2sInsertImageType').val("0");
538
+ jQuery('.networkImage').each(function () {
539
+ var width = this.naturalWidth;
540
+ var height = this.naturalHeight;
541
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
542
+ });
543
+ jQuery('#b2s-network-select-image').modal('show');
544
+ return false;
545
+ });
546
+ jQuery(document).on("click", ".b2s-edit-post-delete", function () {
547
+ var id = jQuery(this).data("b2s-id");
548
+ var post_id = jQuery(this).data("post-id");
549
+ var post_for_relay = jQuery(this).data("data-post-for-relay");
550
+ var post_for_approve = jQuery(this).data("data-post-for-approve");
551
+ jQuery.ajax({
552
+ url: ajaxurl,
553
+ type: "POST",
554
+ dataType: "json",
555
+ cache: false,
556
+ data: {
557
+ 'action': 'b2s_delete_post',
558
+ 'b2s_id': id,
559
+ 'post_id': post_id,
560
+ 'post_for_relay': post_for_relay,
561
+ 'post_for_approve': post_for_approve,
562
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
563
+ },
564
+ success: function (data) {
565
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
566
+ refreshCalender();
567
+ wp.heartbeat.connectNow();
568
+ }
569
+ });
570
+ });
571
+
572
+ /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
573
+ jQuery('#save_method').val("apply-all");
574
+ e.preventDefault();
575
+ var id = jQuery(this).data("b2s-id");
576
+ jQuery.ajax({
577
+ url: ajaxurl,
578
+ type: "POST",
579
+ dataType: "json",
580
+ cache: false,
581
+ data: jQuery(this).closest("form").serialize(),
582
+ success: function (data) {
583
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
584
+ refreshCalender();
585
+ jQuery('#b2s-edit-event-modal-' + id).remove();
586
+ wp.heartbeat.connectNow();
587
+ }
588
+ });
589
+ });*/
590
+
591
+ jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
592
+ e.preventDefault();
593
+ jQuery('#save_method').val("apply-this");
594
+ var id = jQuery(this).data("b2s-id");
595
+ jQuery.ajax({
596
+ url: ajaxurl,
597
+ type: "POST",
598
+ dataType: "json",
599
+ cache: false,
600
+ data: jQuery(this).closest("form").serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
601
+ success: function (data) {
602
+ if (data.error == 'nonce') {
603
+ jQuery('.b2s-nonce-check-fail').show();
604
+ }
605
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
606
+ refreshCalender();
607
+ jQuery('#b2s-edit-event-modal-' + id).remove();
608
+ jQuery('body').removeClass('modal-open');
609
+ jQuery('body').removeAttr('style');
610
+ wp.heartbeat.connectNow();
611
+ }
612
+ });
613
+ });
614
+ jQuery(document).on("click", ".release_locks", function () {
615
+ jQuery.ajax({
616
+ url: ajaxurl,
617
+ type: "POST",
618
+ cache: false,
619
+ async: false,
620
+ data: {
621
+ 'action': 'b2s_get_calendar_release_locks',
622
+ 'post_id': jQuery('#post_id').val(),
623
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
624
+ },
625
+ success: function (data) {
626
+ if (data.error == 'nonce') {
627
+ jQuery('.b2s-nonce-check-fail').show();
628
+ }
629
+ wp.heartbeat.connectNow();
630
+ }
631
+ });
632
+ });
633
+ function refreshCalender() {
634
+ jQuery('#b2s_calendar').fullCalendar('refetchEvents');
635
+ }
636
+
637
+ jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
638
+ jQuery('body').addClass('modal-open');
639
+ });
640
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
641
+ jQuery('body').addClass('modal-open');
642
+ });
643
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
644
+ jQuery('body').addClass('modal-open');
645
+ });
646
+ jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
647
+ jQuery('body').addClass('modal-open');
648
+ });
649
+ //jQuery(this).attr('data-network-auth-id')
650
+ function checkSchedDateTime(dataNetworkAuthId) {
651
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
652
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
653
+ var dateStr = jQuery(dateElement).val();
654
+ var minStr = jQuery(timeElement).val();
655
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
656
+ if (jQuery('#b2sUserLang').val() == 'de') {
657
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
658
+ } else {
659
+ var minParts = minStr.split(' ');
660
+ var minParts2 = minParts[0].split(':');
661
+ if (minParts[1] == 'PM') {
662
+ minParts2[0] = parseInt(minParts2[0]) + 12;
663
+ }
664
+ minStr = minParts2[0] + ':' + minParts2[1];
665
+ }
666
+
667
+ var minParts3 = minStr.split(':');
668
+ if (minParts3[0] < 10) {
669
+ minParts3[0] = '0' + minParts3[0];
670
+ }
671
+ var dateParts = dateStr.split('-');
672
+ //utc current time
673
+ var now = new Date();
674
+ //offset between utc und user
675
+ var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
676
+ //enter hour to user time
677
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
678
+ //calculate datetime in utc
679
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
680
+ //compare enter date time with allowed user time
681
+ if (enter.getTime() < now.getTime()) {
682
+ //enter set on next 15 minutes and calculate on user timezone
683
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
684
+ jQuery(dateElement).datepicker('update', enter);
685
+ jQuery(timeElement).timepicker('setTime', enter);
686
+ }
687
+ }
688
+
689
+
690
+ function printDateFormat(dataNetworkAuthId) {
691
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
692
+ var dateStr = jQuery(dateElement).val();
693
+ dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
694
+ jQuery(dateElement).val(dateStr);
695
+ }
696
+
assets/js/b2s/curation.js CHANGED
@@ -1,823 +1,828 @@
1
- jQuery.noConflict();
2
-
3
- if (typeof wp.heartbeat !== "undefined") {
4
- jQuery(document).on('heartbeat-send', function (e, data) {
5
- data['b2s_heartbeat'] = 'b2s_listener';
6
- });
7
- wp.heartbeat.connectNow();
8
- }
9
- jQuery(window).on("load", function () {
10
- var url_string = window.location.href;
11
- var url_param = new URL(url_string);
12
- var url = url_param.searchParams.get("url");
13
- var comment = url_param.searchParams.get("comment");
14
- var image_id = url_param.searchParams.get("image_id");
15
- var image_url = url_param.searchParams.get("image_url");
16
- var postId = url_param.searchParams.get("postId");
17
- if (typeof postId != "undefined" && postId != "" && postId != null) {
18
- jQuery('#b2s-draft-id').val(postId);
19
- }
20
- if (typeof url != "undefined" && url != "" && url != null) {
21
- jQuery('#b2s-curation-input-url').val(url);
22
- jQuery('.b2s-btn-curation-continue').trigger('click');
23
- } else if(typeof comment != "undefined" && comment != "" && comment != null) {
24
- jQuery('.b2s-curation-format-image').trigger('click');
25
- jQuery('.b2s-post-item-details-item-message-input').val(comment);
26
- if(typeof image_id != "undefined" && image_id != "" && image_id != null && typeof image_url != "undefined" && image_url != "" && image_url != null) {
27
- jQuery('.b2s-post-item-details-url-image').attr('src', image_url);
28
- jQuery('.b2s-image-url-hidden-field').val(image_url);
29
- jQuery('.b2s-image-id-hidden-field').val(image_id);
30
- jQuery('.b2s-image-remove-btn').show();
31
- }
32
- }
33
- });
34
-
35
- jQuery(document).on('click', '.b2s-btn-curation-continue', function () {
36
- jQuery('#b2s-curation-input-url-help').hide();
37
- var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/);
38
- var url = jQuery('#b2s-curation-input-url').val();
39
- if (re.test(url)) {
40
- jQuery('#b2s-curation-input-url').removeClass('error');
41
- jQuery('.b2s-loading-area').show();
42
- jQuery('.b2s-curation-result-area').show();
43
- scrapeDetails(url);
44
- } else {
45
- jQuery('#b2s-curation-input-url').addClass('error');
46
- jQuery('#b2s-curation-input-url-help').show();
47
- }
48
- return false;
49
- });
50
-
51
- jQuery(document).on("keyup", "#b2s-curation-input-url", function () {
52
- var url = jQuery(this).val();
53
- jQuery(this).removeClass("error");
54
- jQuery('#b2s-curation-input-url-help').hide();
55
- if (url.length != "0") {
56
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
57
- url = "https://" + url;
58
- jQuery(this).val(url);
59
- }
60
- }
61
- return false;
62
- });
63
-
64
- jQuery(document).on('click', '.b2s-btn-change-url-preview', function () {
65
- jQuery('.b2s-curation-input-area').show();
66
- jQuery('.b2s-btn-curation-continue').prop("disabled", false);
67
- jQuery('.b2s-curation-settings-area').hide();
68
- jQuery('.b2s-curation-preview-area').hide();
69
- jQuery('.b2s-server-connection-fail').hide();
70
- jQuery('#b2s-curation-no-auth-info').hide();
71
- jQuery('#b2s-curation-no-review-info').hide();
72
- jQuery('#b2s-curation-no-data-info').hide();
73
- return false;
74
- });
75
-
76
- jQuery(document).on('change', '#b2s-post-curation-ship-type', function () {
77
- if (jQuery(this).val() == 1) {
78
- if (jQuery(this).attr('data-user-version') == 0) {
79
- jQuery('#b2s-sched-post-modal').modal('show');
80
- jQuery(this).val('0');
81
- return false;
82
- }
83
- }
84
-
85
- if (jQuery(this).val() == 1) {
86
- jQuery('.b2s-post-curation-ship-date-area').show();
87
- jQuery('#b2s-post-curation-ship-date').prop("disabled", false);
88
-
89
- var today = new Date();
90
-
91
- if (jQuery('#b2sSelSchedDate').val() != "") {
92
- today.setTime(jQuery('#b2sSelSchedDate').val());
93
- }
94
- if (today.getMinutes() >= 30) {
95
- today.setHours(today.getHours() + 1);
96
- today.setMinutes(0);
97
- } else {
98
- today.setMinutes(30);
99
- }
100
-
101
- var setTodayDate = today.getFullYear() + '-' + (padDate(today.getMonth() + 1)) + '-' + padDate(today.getDate()) + ' ' + formatAMPM(today);
102
- if (jQuery('#b2s-post-curation-ship-date').attr('data-language') == 'de') {
103
- setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
104
- }
105
- jQuery('#b2s-post-curation-ship-date').b2sdatepicker({'autoClose': true, 'toggleSelected': false, 'minutesStep': 15, 'minDate': new Date(), 'startDate': today, 'todayButton': new Date(), 'position': 'top left'});
106
-
107
- var curationPicker = jQuery('#b2s-post-curation-ship-date').b2sdatepicker().data('b2sdatepicker');
108
- curationPicker.selectDate(new Date(today.getFullYear(), today.getMonth(), today.getDate()));
109
- jQuery('#b2s-post-curation-ship-date').val(setTodayDate);
110
-
111
- } else {
112
- jQuery('.b2s-post-curation-ship-date-area').hide();
113
- jQuery('#b2s-post-curation-ship-date').prop("disabled", true);
114
- }
115
- });
116
-
117
- function scrapeDetails(url) {
118
- var loadSettings = true;
119
- if (!jQuery('.b2s-curation-settings-area').is(':empty')) {
120
- loadSettings = false;
121
- }
122
- jQuery('.b2s-curation-input-area').hide();
123
- jQuery('.b2s-curation-settings-area').hide();
124
- jQuery('.b2s-curation-preview-area').hide();
125
- jQuery('.b2s-curation-select').hide();
126
- jQuery('.b2s-server-connection-fail').hide();
127
- jQuery('#b2s-curation-no-auth-info').hide();
128
- jQuery('#b2s-curation-no-review-info').hide();
129
- jQuery('#b2s-curation-no-data-info').hide();
130
-
131
-
132
- jQuery.ajax({
133
- url: ajaxurl,
134
- type: "POST",
135
- dataType: "json",
136
- async: true,
137
- cache: true,
138
- data: {
139
- 'url': url,
140
- 'action': 'b2s_scrape_url',
141
- 'loadSettings': loadSettings,
142
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
143
- },
144
- error: function () {
145
- jQuery('.b2s-server-connection-fail').show();
146
- jQuery('.b2s-loading-area').hide();
147
- jQuery('.b2s-curation-settings-area').hide();
148
- jQuery('.b2s-curation-preview-area').hide();
149
- jQuery('.b2s-curation-preview-area').show();
150
- jQuery('#b2s-btn-curation-customize').prop("disabled", true);
151
- jQuery('#b2s-btn-curation-share').prop("disabled", true);
152
- return false;
153
- },
154
- success: function (data) {
155
- jQuery('.b2s-loading-area').hide();
156
- if (data.result == true) {
157
- if (loadSettings) {
158
- jQuery('.b2s-curation-settings-area').html(data.settings);
159
- jQuery('#b2s-post-curation-profile-select [value="0"]').prop('selected', true).trigger('change');
160
- }
161
- jQuery('.b2s-curation-settings-area').show();
162
- jQuery('.b2s-curation-preview-area').html(data.preview);
163
- jQuery('.b2s-curation-preview-area').show();
164
- jQuery('#b2s-btn-curation-customize').prop("disabled", false);
165
- jQuery('#b2s-btn-curation-share').prop("disabled", false);
166
-
167
- //set date + select schedulding
168
- if (jQuery('#b2sSelSchedDate').val() != "") {
169
- jQuery('#b2s-post-curation-ship-type').val('1').trigger('change');
170
- }
171
- var url_string = window.location.href;
172
- var url_param = new URL(url_string);
173
- var postId = url_param.searchParams.get("postId");
174
- if (typeof postId != "undefined" && postId != "") {
175
- jQuery('#b2s-draft-id').val(postId);
176
- }
177
- var title = url_param.searchParams.get("title");
178
- if (typeof title != "undefined" && title != "" && jQuery('#b2s-post-curation-preview-title').val() == "") {
179
- jQuery('#b2s-post-curation-preview-title').val(title);
180
- }
181
- var comment = url_param.searchParams.get("comment");
182
- if (typeof comment != "undefined" && comment != "") {
183
- jQuery('#b2s-post-curation-comment').val(comment);
184
- }
185
- loadDraftShipData();
186
- } else {
187
- if(data.error == 'nonce') {
188
- jQuery('.b2s-nonce-check-fail').show();
189
- }
190
- if (data.preview != "") {
191
- jQuery('.b2s-curation-preview-area').html(data.preview);
192
- jQuery('.b2s-curation-preview-area').show();
193
- }
194
- if (data.error == "NO_PREVIEW") {
195
- jQuery('.b2s-curation-input-area').show();
196
- jQuery('.b2s-curation-settings-area').hide();
197
- jQuery('.b2s-curation-preview-area').hide();
198
- jQuery('#b2s-curation-no-review-info').show();
199
- jQuery('#b2s-curation-no-auth-info').hide();
200
- jQuery('#b2s-curation-no-data-info').hide();
201
- }
202
- if (data.error == "NO_AUTH") {
203
- jQuery('.b2s-curation-input-area').show();
204
- jQuery('.b2s-curation-settings-area').hide();
205
- jQuery('.b2s-curation-preview-area').hide();
206
- jQuery('#b2s-curation-no-auth-info').show();
207
- jQuery('#b2s-curation-no-review-info').hide();
208
- jQuery('#b2s-curation-no-data-info').hide();
209
- }
210
- jQuery('#b2s-btn-curation-customize').prop("disabled", true);
211
- jQuery('#b2s-btn-curation-share').prop("disabled", true);
212
- }
213
- jQuery('.b2s-curation-select').show();
214
- if (data.scrapeError == true) {
215
- jQuery('#b2s-post-curation-preview-title').attr('type', 'text');
216
- }
217
- }
218
- });
219
- return false;
220
-
221
- }
222
-
223
- jQuery(document).on("keyup", "#b2s-post-curation-preview-title", function () {
224
- jQuery(this).removeClass('error');
225
- if (jQuery(this).val().length === 0) {
226
- jQuery(this).addClass('error');
227
- }
228
- return false;
229
- });
230
- jQuery(document).on("keyup", "#b2s-post-curation-comment", function () {
231
- jQuery(this).removeClass('error');
232
- if (jQuery(this).val().length === 0) {
233
- jQuery(this).addClass('error');
234
- }
235
- return false;
236
- });
237
-
238
- jQuery(document).on('click', '#b2s-btn-curation-share', function () {
239
- jQuery('#b2s-curation-no-data-info').hide();
240
- jQuery('#b2s-curation-no-auth-info').hide();
241
- jQuery('#b2s-curation-saved-draft-info').hide();
242
- jQuery('.b2s-post-curation-action').val('b2s_curation_share');
243
- var noContent = false;
244
- if(jQuery('#b2s-curation-post-format').val() == '0') {
245
- if (jQuery('#b2s-post-curation-preview-title').val().length === 0) {
246
- jQuery('#b2s-post-curation-preview-title').addClass('error');
247
- noContent = true;
248
- }
249
- if (jQuery('#b2s-post-curation-comment').val().length === 0) {
250
- jQuery('#b2s-post-curation-comment').addClass('error');
251
- noContent = true;
252
- }
253
- } else {
254
- if (jQuery('.b2s-image-url-hidden-field').val().length === 0) {
255
- jQuery('.b2s-post-item-details-url-image').addClass('error');
256
- noContent = true;
257
- }
258
- if (jQuery('#b2s-post-curation-comment-image').val().length === 0) {
259
- jQuery('#b2s-post-curation-comment-image').addClass('error');
260
- noContent = true;
261
- }
262
- }
263
- if (noContent) {
264
- return false;
265
- }
266
-
267
- jQuery('.b2s-curation-post-list').html("");
268
- jQuery('.b2s-curation-post-list-area').hide();
269
- jQuery('.b2s-loading-area').show();
270
- jQuery('.b2s-curation-settings-area').hide();
271
- jQuery('.b2s-curation-preview-area').hide();
272
- jQuery('.b2s-curation-image-area').hide();
273
- jQuery('.b2s-curation-select').hide();
274
-
275
- jQuery.ajax({
276
- processData: false,
277
- url: ajaxurl,
278
- type: "POST",
279
- dataType: "json",
280
- cache: false,
281
- data: jQuery("#b2s-curation-post-form").serialize() + '&postFormat='+jQuery('#b2s-curation-post-format').val() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
282
- error: function () {
283
- jQuery('.b2s-server-connection-fail').show();
284
- return false;
285
- },
286
- success: function (data) {
287
- if (data.result == true) {
288
- jQuery('.b2s-loading-area').hide();
289
- jQuery('.b2s-curation-post-list-area').show();
290
- jQuery('.b2s-curation-post-list').html(data.content);
291
- } else {
292
- jQuery('.b2s-loading-area').hide();
293
- jQuery('.b2s-curation-post-list-area').hide();
294
- jQuery('.b2s-curation-settings-area').show();
295
- if(jQuery('#b2s-curation-post-format').val() == '0') {
296
- jQuery('.b2s-curation-preview-area').show();
297
- } else {
298
- jQuery('.b2s-curation-image-area').show();
299
- }
300
-
301
- if (data.error == 'NO_AUTH') {
302
- jQuery('#b2s-curation-no-auth-info').show();
303
- } else if(data.error == 'nonce') {
304
- jQuery('.b2s-nonce-check-fail').show();
305
- } else {
306
- jQuery('#b2s-curation-no-data-info').show();
307
- }
308
- }
309
- wp.heartbeat.connectNow();
310
- }
311
- });
312
- return false;
313
- });
314
-
315
- window.addEventListener('message', function (e) {
316
- if (e.origin == jQuery('#b2sServerUrl').val()) {
317
- var data = JSON.parse(e.data);
318
- if (typeof data.action !== typeof undefined && data.action == 'approve') {
319
- 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>");
320
- jQuery.ajax({
321
- url: ajaxurl,
322
- type: "POST",
323
- cache: false,
324
- async: false,
325
- data: {
326
- 'action': 'b2s_update_approve_post',
327
- 'post_id': data.post_id,
328
- 'publish_link': data.publish_link,
329
- 'publish_error_code': data.publish_error_code,
330
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
331
- },
332
- success: function (data) {
333
- }
334
- });
335
- }
336
- }
337
- });
338
-
339
- function wopApprove(networkAuthId, postId, url, name) {
340
- var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
341
- 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");
342
- if (postId > 0) {
343
- function checkIfWinClosed(intervalID) {
344
- if (win.closed) {
345
- clearInterval(intervalID);
346
- //Show Modal
347
- jQuery('.b2s-publish-approve-modal').modal('show');
348
- jQuery('#b2s-approve-post-id').val(postId);
349
- jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
350
- }
351
- }
352
- var interval = setInterval(function () {
353
- checkIfWinClosed(interval);
354
- }, 500);
355
- }
356
- }
357
-
358
- jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
359
- var postId = jQuery('#b2s-approve-post-id').val();
360
- var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
361
- if (postId > 0) {
362
- 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>");
363
- jQuery('.b2s-publish-approve-modal').modal('hide');
364
- jQuery.ajax({
365
- url: ajaxurl,
366
- type: "POST",
367
- cache: false,
368
- async: false,
369
- data: {
370
- 'action': 'b2s_update_approve_post',
371
- 'post_id': postId,
372
- 'publish_link': "",
373
- 'publish_error_code': "",
374
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
375
- },
376
- success: function (data) {
377
- }
378
- });
379
- }
380
- });
381
-
382
-
383
- jQuery(document).on('click', '#b2s-btn-curation-customize', function () {
384
- jQuery('#b2s-curation-no-data-info').hide();
385
- jQuery('#b2s-curation-no-auth-info').hide();
386
- jQuery('#b2s-curation-saved-draft-info').hide();
387
- var noContent = false;
388
- if(jQuery('#b2s-curation-post-format').val() == '0') {
389
- if (jQuery('#b2s-post-curation-preview-title').val().length === 0) {
390
- jQuery('#b2s-post-curation-preview-title').addClass('error');
391
- noContent = true;
392
- }
393
- if (jQuery('#b2s-post-curation-comment').val().length === 0) {
394
- jQuery('#b2s-post-curation-comment').addClass('error');
395
- noContent = true;
396
- }
397
- } else {
398
- if (jQuery('.b2s-image-url-hidden-field').val().length === 0) {
399
- jQuery('.b2s-post-item-details-url-image').addClass('error');
400
- noContent = true;
401
- }
402
- if (jQuery('#b2s-post-curation-comment-image').val().length === 0) {
403
- jQuery('#b2s-post-curation-comment-image').addClass('error');
404
- noContent = true;
405
- }
406
- }
407
- if (noContent) {
408
- return false;
409
- }
410
- jQuery('.b2s-post-curation-action').val('b2s_curation_customize');
411
- jQuery('.b2s-loading-area').show();
412
- jQuery('.b2s-curation-settings-area').hide();
413
- jQuery('.b2s-curation-preview-area').hide();
414
- jQuery('.b2s-curation-image-area').hide();
415
- jQuery('.b2s-curation-select').hide();
416
- jQuery.ajax({
417
- processData: false,
418
- url: ajaxurl,
419
- type: "POST",
420
- dataType: "json",
421
- cache: false,
422
- data: jQuery("#b2s-curation-post-form").serialize() + '&postFormat='+jQuery('#b2s-curation-post-format').val() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
423
- error: function () {
424
- jQuery('.b2s-server-connection-fail').show();
425
- return false;
426
- },
427
- success: function (data) {
428
- if (data.result == true) {
429
- window.location.href = data.redirect;
430
- return false;
431
- } else {
432
- if(data.error == 'nonce') {
433
- jQuery('.b2s-nonce-check-fail').show();
434
- }
435
- jQuery('.b2s-loading-area').hide();
436
- jQuery('#b2s-curation-no-data-info').show();
437
- jQuery('.b2s-curation-settings-area').show();
438
- jQuery('.b2s-curation-preview-area').show();
439
- }
440
-
441
- }
442
- });
443
- return false;
444
- });
445
-
446
- jQuery(document).on('change', '#b2s-post-curation-profile-select', function () {
447
- var tos = false;
448
- if (jQuery('#b2s-post-curation-profile-data' + jQuery(this).val()).val() == "") {
449
- jQuery('#b2s-curation-no-auth-info').show();
450
- tos = true;
451
- } else {
452
- jQuery('#b2s-curation-no-auth-info').hide();
453
- //TOS Twitter Check
454
- var len = jQuery('#b2s-post-curation-twitter-select').children('option[data-mandant-id="' + jQuery(this).val() + '"]').length;
455
- if (len >= 1) {
456
- jQuery('.b2s-curation-twitter-area').show();
457
- jQuery('#b2s-post-curation-twitter-select').prop('disabled', false);
458
- jQuery('#b2s-post-curation-twitter-select').show();
459
- jQuery('#b2s-post-curation-twitter-select option').attr("disabled", "disabled");
460
- jQuery('#b2s-post-curation-twitter-select option[data-mandant-id="' + jQuery(this).val() + '"]').attr("disabled", false);
461
- jQuery('#b2s-post-curation-twitter-select option[data-mandant-id="' + jQuery(this).val() + '"]:first').attr("selected", "selected");
462
- } else {
463
- tos = true;
464
- }
465
-
466
- }
467
- //TOS Twitter 032018
468
- if (tos) {
469
- jQuery('.b2s-curation-twitter-area').hide();
470
- jQuery('#b2s-post-curation-twitter-select').prop('disabled', 'disabled');
471
- jQuery('#b2s-post-curation-twitter-select').hide();
472
- }
473
- });
474
-
475
-
476
-
477
- function padDate(n) {
478
- return ("0" + n).slice(-2);
479
- }
480
-
481
-
482
- function formatAMPM(date) {
483
- var hours = date.getHours();
484
- var minutes = date.getMinutes();
485
- var ampm = hours >= 12 ? 'pm' : 'am';
486
- hours = hours % 12;
487
- hours = hours ? hours : 12; // the hour '0' should be '12'
488
- minutes = minutes < 10 ? '0' + minutes : minutes;
489
- var strTime = hours + ':' + minutes + ' ' + ampm;
490
- return strTime;
491
- }
492
-
493
- jQuery(document).on('click', '#b2s-btn-curation-draft', function () {
494
- jQuery('#b2s-curation-no-data-info').hide();
495
- jQuery('#b2s-curation-no-auth-info').hide();
496
- jQuery('#b2s-curation-saved-draft-info').hide();
497
- var noContent = false;
498
- if(jQuery('#b2s-curation-post-format').val() == '0') {
499
- if (jQuery('#b2s-post-curation-preview-title').val().length === 0) {
500
- jQuery('#b2s-post-curation-preview-title').addClass('error');
501
- noContent = true;
502
- }
503
- if (jQuery('#b2s-post-curation-comment').val().length === 0) {
504
- jQuery('#b2s-post-curation-comment').addClass('error');
505
- noContent = true;
506
- }
507
- } else {
508
- if (jQuery('.b2s-image-url-hidden-field').val().length === 0) {
509
- jQuery('.b2s-post-item-details-url-image').addClass('error');
510
- noContent = true;
511
- }
512
- if (jQuery('#b2s-post-curation-comment-image').val().length === 0) {
513
- jQuery('#b2s-post-curation-comment-image').addClass('error');
514
- noContent = true;
515
- }
516
- }
517
- if (noContent) {
518
- return false;
519
- }
520
- jQuery('.b2s-post-curation-action').val('b2s_curation_draft');
521
- jQuery('.b2s-loading-area').show();
522
- jQuery('.b2s-curation-settings-area').hide();
523
- jQuery('.b2s-curation-preview-area').hide();
524
- jQuery('.b2s-curation-image-area').hide();
525
- jQuery('.b2s-curation-select').hide();
526
- jQuery.ajax({
527
- processData: false,
528
- url: ajaxurl,
529
- type: "POST",
530
- dataType: "json",
531
- cache: false,
532
- data: jQuery("#b2s-curation-post-form").serialize() + '&postFormat='+jQuery('#b2s-curation-post-format').val() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
533
- error: function () {
534
- jQuery('.b2s-server-connection-fail').show();
535
- return false;
536
- },
537
- success: function (data) {
538
- if (data.result == true) {
539
- if (typeof data.postId != undefined) {
540
- jQuery('#b2s-draft-id').val(data.postId);
541
- }
542
- jQuery('#b2s-curation-saved-draft-info').show();
543
- setTimeout(function () {
544
- jQuery('#b2s-curation-saved-draft-info').fadeOut("slow");
545
- }, 5000);
546
- } else {
547
- jQuery('#b2s-curation-no-data-info').show();
548
- if(data.error == 'nonce') {
549
- jQuery('.b2s-nonce-check-fail').show();
550
- }
551
- }
552
- jQuery('.b2s-loading-area').hide();
553
- jQuery('.b2s-curation-settings-area').show();
554
- if(jQuery('#b2s-curation-post-format').val() == '0') {
555
- jQuery('.b2s-curation-preview-area').show();
556
- } else {
557
- jQuery('.b2s-curation-image-area').show();
558
- }
559
- jQuery('.b2s-curation-select').show();
560
-
561
- }
562
- });
563
- return false;
564
- });
565
-
566
- jQuery(document).on('click', '.b2s-curation-format-link', function() {
567
- if(jQuery(this).hasClass('btn-primary')){
568
- return false;
569
- }
570
- jQuery('#b2s-post-curation-comment').val(jQuery('#b2s-post-curation-comment-image').val());
571
- jQuery('#b2s-curation-post-format').val('0');
572
- jQuery('.b2s-curation-format-link').removeClass('btn-light').addClass('btn-primary');
573
- jQuery('.b2s-curation-format-image').removeClass('btn-primary').addClass('btn-light');
574
- jQuery('.b2s-loading-area').hide();
575
- jQuery('.b2s-curation-link-area').show();
576
- jQuery('.b2s-curation-image-area').hide();
577
- if(jQuery('.b2s-curation-input-area').is(':visible')){
578
- jQuery('.b2s-curation-settings-area').hide();
579
- } else {
580
- jQuery('.b2s-curation-settings-area').show();
581
- }
582
- });
583
-
584
- jQuery(document).on('click', '.b2s-curation-format-image', function() {
585
- if(jQuery(this).hasClass('btn-primary')){
586
- return false;
587
- }
588
- jQuery('#b2s-post-curation-comment-image').val(jQuery('#b2s-post-curation-comment').val());
589
- jQuery('#b2s-curation-post-format').val('1');
590
- jQuery('.b2s-loading-area').show();
591
- jQuery('.b2s-curation-link-area').hide();
592
- jQuery('.b2s-curation-image-area').hide();
593
- jQuery('.b2s-curation-format-image').removeClass('btn-light').addClass('btn-primary');
594
- jQuery('.b2s-curation-format-link').removeClass('btn-primary').addClass('btn-light');
595
- if(jQuery('.b2s-curation-settings-area').html().length == 0) {
596
- jQuery.ajax({
597
- url: ajaxurl,
598
- type: "GET",
599
- dataType: "json",
600
- cache: false,
601
- data: {
602
- 'action': 'b2s_get_curation_ship_details',
603
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
604
- },
605
- error: function () {
606
- jQuery('.b2s-server-connection-fail').show();
607
- return false;
608
- },
609
- success: function (data) {
610
- if(jQuery('.b2s-curation-format-image').hasClass('btn-primary')) {
611
- if (data.result == true) {
612
- jQuery('.b2s-curation-settings-area').html(data.settings);
613
- jQuery('#b2s-post-curation-profile-select [value="0"]').prop('selected', true).trigger('change');
614
- jQuery('.b2s-loading-area').hide();
615
- jQuery('.b2s-curation-image-area').show();
616
- jQuery('.b2s-curation-settings-area').show();
617
- loadDraftShipData();
618
- return false;
619
- } else {
620
- jQuery('.b2s-loading-area').hide();
621
- if(data.error == 'nonce') {
622
- jQuery('.b2s-nonce-check-fail').show();
623
- }
624
- if (data.error == "NO_AUTH") {
625
- jQuery('.b2s-curation-image-area').show();
626
- jQuery('.b2s-curation-settings-area').hide();
627
- jQuery('#b2s-curation-no-auth-info').show();
628
- jQuery('#b2s-curation-no-review-info').hide();
629
- jQuery('#b2s-curation-no-data-info').hide();
630
- }
631
- jQuery('#b2s-btn-curation-customize').prop("disabled", true);
632
- jQuery('#b2s-btn-curation-share').prop("disabled", true);
633
- }
634
- }
635
- }
636
- });
637
- } else {
638
- jQuery('.b2s-loading-area').hide();
639
- jQuery('.b2s-curation-image-area').show();
640
- jQuery('.b2s-curation-settings-area').show();
641
- }
642
- return false;
643
- });
644
-
645
- var emojiTranslation = JSON.parse(jQuery('#b2sEmojiTranslation').val());
646
- var picker = new EmojiButton({
647
- position: 'auto',
648
- autoHide: false,
649
- i18n: {
650
- search: emojiTranslation['search'],
651
- categories: {
652
- recents: emojiTranslation['recents'],
653
- smileys: emojiTranslation['smileys'],
654
- animals: emojiTranslation['animals'],
655
- food: emojiTranslation['food'],
656
- activities: emojiTranslation['activities'],
657
- travel: emojiTranslation['travel'],
658
- objects: emojiTranslation['objects'],
659
- symbols: emojiTranslation['symbols'],
660
- flags: emojiTranslation['flags']
661
- },
662
- notFound: emojiTranslation['notFound']
663
- }
664
- });
665
- picker.on('emoji', function(emoji){
666
- if(jQuery('#b2s-curation-post-format').val() == '0') {
667
- var text = jQuery('#b2s-post-curation-comment').val();
668
- var start = jQuery('#b2s-post-curation-comment').attr('selectionStart');
669
- var end = jQuery('#b2s-post-curation-comment').attr('selectionEnd');
670
- } else {
671
- var text = jQuery('#b2s-post-curation-comment-image').val();
672
- var start = jQuery('#b2s-post-curation-comment-image').attr('selectionStart');
673
- var end = jQuery('#b2s-post-curation-comment-image').attr('selectionEnd');
674
- }
675
- if(typeof start == 'undefined' || typeof end == 'undefined'){
676
- start = text.length;
677
- end = text.length;
678
- }
679
- var newText = text.slice(0, start) + emoji + text.slice(end);
680
- jQuery('.b2s-post-item-details-item-message-input').val(newText);
681
- jQuery('.b2s-post-item-details-item-message-input').focus();
682
- jQuery('.b2s-post-item-details-item-message-input').prop("selectionStart", parseInt(start)+emoji.length);
683
- jQuery('.b2s-post-item-details-item-message-input').prop("selectionEnd", parseInt(start)+emoji.length);
684
- jQuery('.b2s-post-item-details-item-message-input').trigger('keyup');
685
- });
686
-
687
- jQuery(document).on('click', '.b2s-post-item-details-item-message-emoji-btn', function() {
688
- if(picker.pickerVisible) {
689
- picker.hidePicker();
690
- } else {
691
- currentEmojiNetworkAuthId = jQuery(this).attr('data-network-auth-id');
692
- currentEmojiNetworkCount = jQuery(this).attr('data-network-count');
693
- picker.showPicker(jQuery(this));
694
- }
695
- });
696
-
697
- jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-post-item-details-item-message-input', function () {
698
- var tb = jQuery(this).get(0);
699
- jQuery(this).attr('selectionStart', tb.selectionStart);
700
- jQuery(this).attr('selectionEnd', tb.selectionEnd);
701
- });
702
-
703
- jQuery(document).on('click', '.b2s-post-item-details-url-image', function() {
704
- jQuery('.b2s-select-image-modal-open').trigger('click');
705
- });
706
-
707
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
708
- jQuery('#b2s-network-select-image').modal('show');
709
- return false;
710
- });
711
-
712
- jQuery(document).on('click', '.b2s-upload-image', function () {
713
- if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
714
- jQuery('#b2s-network-select-image').modal('hide');
715
- wpMedia = wp.media({
716
- title: jQuery('#b2s_wp_media_headline').val(),
717
- button: {
718
- text: jQuery('#b2s_wp_media_btn').val(),
719
- },
720
- multiple: false,
721
- library: {type: 'image'}
722
- });
723
- wpMedia.open();
724
- wpMedia.on('select', function () {
725
- var count = parseInt(jQuery('.b2s-choose-image-count').val());
726
- count = count + 1;
727
- jQuery('.b2s-choose-image-count').val(count);
728
- var attachment = wpMedia.state().get('selection').first().toJSON();
729
- var content = '<div class="b2s-image-item">' +
730
- '<div class="b2s-image-item-thumb">' +
731
- '<label for="b2s-image-count-' + count + '">' +
732
- '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
733
- '</label>' +
734
- '</div>' +
735
- '<div class="b2s-image-item-caption text-center">' +
736
- '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
737
- '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" data-id="' + attachment.id + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
738
- '</div>' +
739
- '</div>';
740
- jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
741
- jQuery('.b2s-choose-image-no-image-info-text').hide();
742
- jQuery('.b2s-choose-image-no-image-extra-btn').hide();
743
- jQuery('.b2s-upload-image-invalid-extension').hide();
744
- jQuery('input[name=image_url]:last').prop("checked", true);
745
- jQuery('#b2s-network-select-image').modal('show');
746
- });
747
- wpMedia.on('close', function () {
748
- jQuery('#b2s-network-select-image').modal('show');
749
- });
750
- } else {
751
- jQuery('.b2s-upload-image-no-permission').show();
752
- }
753
- return false;
754
- });
755
-
756
- jQuery(document).on('click', '.b2s-image-change', function () {
757
- if (jQuery('input[name=image_url]:checked').length > 0) {
758
- jQuery('.b2s-post-item-details-url-image').attr('src', jQuery('input[name=image_url]:checked').val());
759
- jQuery('.b2s-image-url-hidden-field').val(jQuery('input[name=image_url]:checked').val());
760
- jQuery('.b2s-image-id-hidden-field').val(jQuery('input[name=image_url]:checked').data('id'));
761
- jQuery('.b2s-image-remove-btn').show();
762
- jQuery('.b2s-upload-image-invalid-extension').hide();
763
- jQuery('.b2s-upload-image-no-permission').hide();
764
- jQuery('.b2s-upload-image-free-version-info').hide();
765
- jQuery('.b2s-post-item-details-url-image').removeClass('error');
766
- }
767
- jQuery('#b2s-network-select-image').modal('hide');
768
- return false;
769
- });
770
-
771
- jQuery(document).on('click', '.b2s-image-remove-btn', function () {
772
- var defaultImage = jQuery('#b2sDefaultNoImage').val();
773
- //default
774
- jQuery('.b2s-post-item-details-url-image').attr('src', defaultImage);
775
- jQuery('.b2s-image-url-hidden-field').val("");
776
- jQuery('.b2s-image-id-hidden-field').val("");
777
- jQuery('.b2s-image-remove-btn').hide();
778
- return false;
779
- });
780
-
781
- jQuery(document).on('keyup', '.b2s-post-item-details-item-message-input', function() {
782
- jQuery(this).removeClass('error');
783
- });
784
-
785
- jQuery(document).on('click', '.b2s-curation-info-premium-btn', function () {
786
- jQuery('#b2sInfoCCModal').modal('show');
787
- });
788
-
789
- jQuery(document).on('click', '.b2s-re-share-btn', function() {
790
- jQuery('.b2s-curation-post-list-area').hide();
791
- jQuery('.b2s-curation-settings-area').show();
792
- jQuery('.b2s-curation-select').show();
793
- if(jQuery('#b2s-curation-post-format').val() == '0') {
794
- jQuery('.b2s-curation-preview-area').show();
795
- } else {
796
- jQuery('.b2s-curation-image-area').show();
797
- }
798
- });
799
-
800
- function loadDraftShipData() {
801
- var url_string = window.location.href;
802
- var url_param = new URL(url_string);
803
- var ship_type = url_param.searchParams.get("ship_type");
804
- var ship_date = url_param.searchParams.get("ship_date");
805
- var profile_select = url_param.searchParams.get("profile_select");
806
- var twitter_select = url_param.searchParams.get("twitter_select");
807
- if (typeof ship_type != "undefined" && ship_type != "" && ship_type != null && ship_type > 0) {
808
- jQuery('#b2s-post-curation-ship-type').val(ship_type);
809
- jQuery('#b2s-post-curation-ship-type').trigger('change');
810
- if (typeof ship_date != "undefined" && ship_date != "" && ship_date != null) {
811
- jQuery('#b2s-post-curation-ship-date').val(ship_date);
812
- jQuery('#b2s-post-curation-ship-date').trigger('change');
813
- }
814
- }
815
- if (typeof profile_select != "undefined" && profile_select != "" && profile_select != null) {
816
- jQuery('#b2s-post-curation-profile-select').val(profile_select);
817
- jQuery('#b2s-post-curation-profile-select').trigger('change');
818
- if (typeof twitter_select != "undefined" && twitter_select != "" && twitter_select != null && twitter_select > 0) {
819
- jQuery('#b2s-post-curation-twitter-select').val(twitter_select);
820
- jQuery('#b2s-post-curation-twitter-select').trigger('change');
821
- }
822
- }
 
 
 
 
 
823
  }
1
+ jQuery.noConflict();
2
+
3
+ if (typeof wp.heartbeat !== "undefined") {
4
+ jQuery(document).on('heartbeat-send', function (e, data) {
5
+ data['b2s_heartbeat'] = 'b2s_listener';
6
+ });
7
+ wp.heartbeat.connectNow();
8
+ }
9
+ jQuery(window).on("load", function () {
10
+ var url_string = window.location.href;
11
+ var url_param = new URL(url_string);
12
+ var url = url_param.searchParams.get("url");
13
+ var comment = url_param.searchParams.get("comment");
14
+ var image_id = url_param.searchParams.get("image_id");
15
+ var image_url = url_param.searchParams.get("image_url");
16
+ var postId = url_param.searchParams.get("postId");
17
+ if (typeof postId != "undefined" && postId != "" && postId != null) {
18
+ jQuery('#b2s-draft-id').val(postId);
19
+ }
20
+ if (typeof url != "undefined" && url != "" && url != null) {
21
+ jQuery('#b2s-curation-input-url').val(url);
22
+ jQuery('.b2s-btn-curation-continue').trigger('click');
23
+ } else if(typeof comment != "undefined" && comment != "" && comment != null) {
24
+ jQuery('.b2s-curation-format-image').trigger('click');
25
+ jQuery('.b2s-post-item-details-item-message-input').val(comment);
26
+ if(typeof image_id != "undefined" && image_id != "" && image_id != null && typeof image_url != "undefined" && image_url != "" && image_url != null) {
27
+ jQuery('.b2s-post-item-details-url-image').attr('src', image_url);
28
+ jQuery('.b2s-image-url-hidden-field').val(image_url);
29
+ jQuery('.b2s-image-id-hidden-field').val(image_id);
30
+ jQuery('.b2s-image-remove-btn').show();
31
+ }
32
+ }
33
+ });
34
+
35
+ jQuery(document).on('click', '.b2s-btn-curation-continue', function () {
36
+ jQuery('#b2s-curation-input-url-help').hide();
37
+ var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/);
38
+ var url = jQuery('#b2s-curation-input-url').val();
39
+ if (re.test(url)) {
40
+ jQuery('#b2s-curation-input-url').removeClass('error');
41
+ jQuery('.b2s-loading-area').show();
42
+ jQuery('.b2s-curation-result-area').show();
43
+ scrapeDetails(url);
44
+ } else {
45
+ jQuery('#b2s-curation-input-url').addClass('error');
46
+ jQuery('#b2s-curation-input-url-help').show();
47
+ }
48
+ return false;
49
+ });
50
+
51
+ jQuery(document).on("keyup", "#b2s-curation-input-url", function () {
52
+ var url = jQuery(this).val();
53
+ jQuery(this).removeClass("error");
54
+ jQuery('#b2s-curation-input-url-help').hide();
55
+ if (url.length != "0") {
56
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
57
+ url = "https://" + url;
58
+ jQuery(this).val(url);
59
+ }
60
+ }
61
+ return false;
62
+ });
63
+
64
+ jQuery(document).on('click', '.b2s-btn-change-url-preview', function () {
65
+ jQuery('.b2s-curation-input-area').show();
66
+ jQuery('.b2s-btn-curation-continue').prop("disabled", false);
67
+ jQuery('.b2s-curation-settings-area').hide();
68
+ jQuery('.b2s-curation-preview-area').hide();
69
+ jQuery('.b2s-server-connection-fail').hide();
70
+ jQuery('#b2s-curation-no-auth-info').hide();
71
+ jQuery('#b2s-curation-no-review-info').hide();
72
+ jQuery('#b2s-curation-no-data-info').hide();
73
+ return false;
74
+ });
75
+
76
+ jQuery(document).on('change', '#b2s-post-curation-ship-type', function () {
77
+ if (jQuery(this).val() == 1) {
78
+ if (jQuery(this).attr('data-user-version') == 0) {
79
+ jQuery('#b2s-sched-post-modal').modal('show');
80
+ jQuery(this).val('0');
81
+ return false;
82
+ }
83
+ }
84
+
85
+ if (jQuery(this).val() == 1) {
86
+ jQuery('.b2s-post-curation-ship-date-area').show();
87
+ jQuery('#b2s-post-curation-ship-date').prop("disabled", false);
88
+
89
+ var today = new Date();
90
+
91
+ if (jQuery('#b2sSelSchedDate').val() != "") {
92
+ today.setTime(jQuery('#b2sSelSchedDate').val());
93
+ }
94
+ if (today.getMinutes() >= 30) {
95
+ today.setHours(today.getHours() + 1);
96
+ today.setMinutes(0);
97
+ } else {
98
+ today.setMinutes(30);
99
+ }
100
+
101
+ var setTodayDate = today.getFullYear() + '-' + (padDate(today.getMonth() + 1)) + '-' + padDate(today.getDate()) + ' ' + formatAMPM(today);
102
+ if (jQuery('#b2s-post-curation-ship-date').attr('data-language') == 'de') {
103
+ setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
104
+ }
105
+ jQuery('#b2s-post-curation-ship-date').b2sdatepicker({'autoClose': true, 'toggleSelected': false, 'minutesStep': 15, 'minDate': new Date(), 'startDate': today, 'todayButton': new Date(), 'position': 'top left'});
106
+
107
+ var curationPicker = jQuery('#b2s-post-curation-ship-date').b2sdatepicker().data('b2sdatepicker');
108
+ curationPicker.selectDate(new Date(today.getFullYear(), today.getMonth(), today.getDate()));
109
+ jQuery('#b2s-post-curation-ship-date').val(setTodayDate);
110
+
111
+ } else {
112
+ jQuery('.b2s-post-curation-ship-date-area').hide();
113
+ jQuery('#b2s-post-curation-ship-date').prop("disabled", true);
114
+ }
115
+ });
116
+
117
+ function scrapeDetails(url) {
118
+ var loadSettings = true;
119
+ if (!jQuery('.b2s-curation-settings-area').is(':empty')) {
120
+ loadSettings = false;
121
+ }
122
+ jQuery('.b2s-curation-input-area').hide();
123
+ jQuery('.b2s-curation-settings-area').hide();
124
+ jQuery('.b2s-curation-preview-area').hide();
125
+ jQuery('.b2s-curation-select').hide();
126
+ jQuery('.b2s-server-connection-fail').hide();
127
+ jQuery('#b2s-curation-no-auth-info').hide();
128
+ jQuery('#b2s-curation-no-review-info').hide();
129
+ jQuery('#b2s-curation-no-data-info').hide();
130
+
131
+
132
+ jQuery.ajax({
133
+ url: ajaxurl,
134
+ type: "POST",
135
+ dataType: "json",
136
+ async: true,
137
+ cache: true,
138
+ data: {
139
+ 'url': url,
140
+ 'action': 'b2s_scrape_url',
141
+ 'loadSettings': loadSettings,
142
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
143
+ },
144
+ error: function () {
145
+ jQuery('.b2s-server-connection-fail').show();
146
+ jQuery('.b2s-loading-area').hide();
147
+ jQuery('.b2s-curation-settings-area').hide();
148
+ jQuery('.b2s-curation-preview-area').hide();
149
+ jQuery('.b2s-curation-preview-area').show();
150
+ jQuery('#b2s-btn-curation-customize').prop("disabled", true);
151
+ jQuery('#b2s-btn-curation-share').prop("disabled", true);
152
+ return false;
153
+ },
154
+ success: function (data) {
155
+ jQuery('.b2s-loading-area').hide();
156
+ if (data.result == true) {
157
+ if (loadSettings) {
158
+ jQuery('.b2s-curation-settings-area').html(data.settings);
159
+ jQuery('#b2s-post-curation-profile-select [value="0"]').prop('selected', true).trigger('change');
160
+ }
161
+ jQuery('.b2s-curation-settings-area').show();
162
+ jQuery('.b2s-curation-preview-area').html(data.preview);
163
+ jQuery('.b2s-curation-preview-area').show();
164
+ jQuery('#b2s-btn-curation-customize').prop("disabled", false);
165
+ jQuery('#b2s-btn-curation-share').prop("disabled", false);
166
+
167
+ //set date + select schedulding
168
+ if (jQuery('#b2sSelSchedDate').val() != "") {
169
+ jQuery('#b2s-post-curation-ship-type').val('1').trigger('change');
170
+ }
171
+ var url_string = window.location.href;
172
+ var url_param = new URL(url_string);
173
+ var postId = url_param.searchParams.get("postId");
174
+ if (typeof postId != "undefined" && postId != "") {
175
+ jQuery('#b2s-draft-id').val(postId);
176
+ }
177
+ var title = url_param.searchParams.get("title");
178
+ if (typeof title != "undefined" && title != "" && jQuery('#b2s-post-curation-preview-title').val() == "") {
179
+ jQuery('#b2s-post-curation-preview-title').val(title);
180
+ }
181
+ var comment = url_param.searchParams.get("comment");
182
+ if (typeof comment != "undefined" && comment != "") {
183
+ jQuery('#b2s-post-curation-comment').val(comment);
184
+ }
185
+ loadDraftShipData();
186
+ } else {
187
+ if(data.error == 'nonce') {
188
+ jQuery('.b2s-nonce-check-fail').show();
189
+ }
190
+ if (data.preview != "") {
191
+ jQuery('.b2s-curation-preview-area').html(data.preview);
192
+ jQuery('.b2s-curation-preview-area').show();
193
+ }
194
+ if (data.error == "NO_PREVIEW") {
195
+ jQuery('.b2s-curation-input-area').show();
196
+ jQuery('.b2s-curation-settings-area').hide();
197
+ jQuery('.b2s-curation-preview-area').hide();
198
+ jQuery('#b2s-curation-no-review-info').show();
199
+ jQuery('#b2s-curation-no-auth-info').hide();
200
+ jQuery('#b2s-curation-no-data-info').hide();
201
+ }
202
+ if (data.error == "NO_AUTH") {
203
+ jQuery('.b2s-curation-input-area').show();
204
+ jQuery('.b2s-curation-settings-area').hide();
205
+ jQuery('.b2s-curation-preview-area').hide();
206
+ jQuery('#b2s-curation-no-auth-info').show();
207
+ jQuery('#b2s-curation-no-review-info').hide();
208
+ jQuery('#b2s-curation-no-data-info').hide();
209
+ }
210
+ jQuery('#b2s-btn-curation-customize').prop("disabled", true);
211
+ jQuery('#b2s-btn-curation-share').prop("disabled", true);
212
+ }
213
+ jQuery('.b2s-curation-select').show();
214
+ if (data.scrapeError == true) {
215
+ jQuery('#b2s-post-curation-preview-title').attr('type', 'text');
216
+ }
217
+ }
218
+ });
219
+ return false;
220
+
221
+ }
222
+
223
+ jQuery(document).on("keyup", "#b2s-post-curation-preview-title", function () {
224
+ jQuery(this).removeClass('error');
225
+ if (jQuery(this).val().length === 0) {
226
+ jQuery(this).addClass('error');
227
+ }
228
+ return false;
229
+ });
230
+ jQuery(document).on("keyup", "#b2s-post-curation-comment", function () {
231
+ jQuery(this).removeClass('error');
232
+ if (jQuery(this).val().length === 0) {
233
+ jQuery(this).addClass('error');
234
+ }
235
+ return false;
236
+ });
237
+
238
+ jQuery(document).on('click', '#b2s-btn-curation-share', function () {
239
+ jQuery('#b2s-curation-no-data-info').hide();
240
+ jQuery('#b2s-curation-no-auth-info').hide();
241
+ jQuery('#b2s-curation-saved-draft-info').hide();
242
+ jQuery('.b2s-post-curation-action').val('b2s_curation_share');
243
+ var noContent = false;
244
+ if(jQuery('#b2s-curation-post-format').val() == '0') {
245
+ if (jQuery('#b2s-post-curation-preview-title').val().length === 0) {
246
+ jQuery('#b2s-post-curation-preview-title').addClass('error');
247
+ noContent = true;
248
+ }
249
+ if (jQuery('#b2s-post-curation-comment').val().length === 0) {
250
+ jQuery('#b2s-post-curation-comment').addClass('error');
251
+ noContent = true;
252
+ }
253
+ } else {
254
+ if (jQuery('.b2s-image-url-hidden-field').val().length === 0) {
255
+ jQuery('.b2s-post-item-details-url-image').addClass('error');
256
+ noContent = true;
257
+ }
258
+ if (jQuery('#b2s-post-curation-comment-image').val().length === 0) {
259
+ jQuery('#b2s-post-curation-comment-image').addClass('error');
260
+ noContent = true;
261
+ }
262
+ }
263
+ if (noContent) {
264
+ return false;
265
+ }
266
+
267
+ jQuery('.b2s-curation-post-list').html("");
268
+ jQuery('.b2s-curation-post-list-area').hide();
269
+ jQuery('.b2s-loading-area').show();
270
+ jQuery('.b2s-curation-settings-area').hide();
271
+ jQuery('.b2s-curation-preview-area').hide();
272
+ jQuery('.b2s-curation-image-area').hide();
273
+ jQuery('.b2s-curation-select').hide();
274
+
275
+ jQuery.ajax({
276
+ processData: false,
277
+ url: ajaxurl,
278
+ type: "POST",
279
+ dataType: "json",
280
+ cache: false,
281
+ data: jQuery("#b2s-curation-post-form").serialize() + '&postFormat='+jQuery('#b2s-curation-post-format').val() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
282
+ error: function () {
283
+ jQuery('.b2s-server-connection-fail').show();
284
+ return false;
285
+ },
286
+ success: function (data) {
287
+ if (data.result == true) {
288
+ jQuery('.b2s-loading-area').hide();
289
+ jQuery('.b2s-curation-post-list-area').show();
290
+ jQuery('.b2s-curation-post-list').html(data.content);
291
+ } else {
292
+ jQuery('.b2s-loading-area').hide();
293
+ jQuery('.b2s-curation-post-list-area').hide();
294
+ jQuery('.b2s-curation-settings-area').show();
295
+ if(jQuery('#b2s-curation-post-format').val() == '0') {
296
+ jQuery('.b2s-curation-preview-area').show();
297
+ } else {
298
+ jQuery('.b2s-curation-image-area').show();
299
+ }
300
+
301
+ if (data.error == 'NO_AUTH') {
302
+ jQuery('#b2s-curation-no-auth-info').show();
303
+ } else if(data.error == 'nonce') {
304
+ jQuery('.b2s-nonce-check-fail').show();
305
+ } else {
306
+ jQuery('#b2s-curation-no-data-info').show();
307
+ }
308
+ }
309
+ wp.heartbeat.connectNow();
310
+ }
311
+ });
312
+ return false;
313
+ });
314
+
315
+ window.addEventListener('message', function (e) {
316
+ if (e.origin == jQuery('#b2sServerUrl').val()) {
317
+ var data = JSON.parse(e.data);
318
+ if (typeof data.action !== typeof undefined && data.action == 'approve') {
319
+ 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>");
320
+ jQuery.ajax({
321
+ url: ajaxurl,
322
+ type: "POST",
323
+ cache: false,
324
+ async: false,
325
+ data: {
326
+ 'action': 'b2s_update_approve_post',
327
+ 'post_id': data.post_id,
328
+ 'publish_link': data.publish_link,
329
+ 'publish_error_code': data.publish_error_code,
330
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
331
+ },
332
+ success: function (data) {
333
+ }
334
+ });
335
+ }
336
+ }
337
+ });
338
+
339
+ function wopApprove(networkAuthId, postId, url, name) {
340
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
341
+ 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");
342
+ if (postId > 0) {
343
+ function checkIfWinClosed(intervalID) {
344
+ if (win.closed) {
345
+ clearInterval(intervalID);
346
+ //Show Modal
347
+ jQuery('.b2s-publish-approve-modal').modal('show');
348
+ jQuery('#b2s-approve-post-id').val(postId);
349
+ jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
350
+ }
351
+ }
352
+ var interval = setInterval(function () {
353
+ checkIfWinClosed(interval);
354
+ }, 500);
355
+ }
356
+ }
357
+
358
+ jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
359
+ var postId = jQuery('#b2s-approve-post-id').val();
360
+ var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
361
+ if (postId > 0) {
362
+ 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>");
363
+ jQuery('.b2s-publish-approve-modal').modal('hide');
364
+ jQuery.ajax({
365
+ url: ajaxurl,
366
+ type: "POST",
367
+ cache: false,
368
+ async: false,
369
+ data: {
370
+ 'action': 'b2s_update_approve_post',
371
+ 'post_id': postId,
372
+ 'publish_link': "",
373
+ 'publish_error_code': "",
374
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
375
+ },
376
+ success: function (data) {
377
+ }
378
+ });
379
+ }
380
+ });
381
+
382
+
383
+ jQuery(document).on('click', '#b2s-btn-curation-customize', function () {
384
+ jQuery('#b2s-curation-no-data-info').hide();
385
+ jQuery('#b2s-curation-no-auth-info').hide();
386
+ jQuery('#b2s-curation-saved-draft-info').hide();
387
+ var noContent = false;
388
+ if(jQuery('#b2s-curation-post-format').val() == '0') {
389
+ if (jQuery('#b2s-post-curation-preview-title').val().length === 0) {
390
+ jQuery('#b2s-post-curation-preview-title').addClass('error');
391
+ noContent = true;
392
+ }
393
+ if (jQuery('#b2s-post-curation-comment').val().length === 0) {
394
+ jQuery('#b2s-post-curation-comment').addClass('error');
395
+ noContent = true;
396
+ }
397
+ } else {
398
+ if (jQuery('.b2s-image-url-hidden-field').val().length === 0) {
399
+ jQuery('.b2s-post-item-details-url-image').addClass('error');
400
+ noContent = true;
401
+ }
402
+ if (jQuery('#b2s-post-curation-comment-image').val().length === 0) {
403
+ jQuery('#b2s-post-curation-comment-image').addClass('error');
404
+ noContent = true;
405
+ }
406
+ }
407
+ if (noContent) {
408
+ return false;
409
+ }
410
+ jQuery('.b2s-post-curation-action').val('b2s_curation_customize');
411
+ jQuery('.b2s-loading-area').show();
412
+ jQuery('.b2s-curation-settings-area').hide();
413
+ jQuery('.b2s-curation-preview-area').hide();
414
+ jQuery('.b2s-curation-image-area').hide();
415
+ jQuery('.b2s-curation-select').hide();
416
+ jQuery.ajax({
417
+ processData: false,
418
+ url: ajaxurl,
419
+ type: "POST",
420
+ dataType: "json",
421
+ cache: false,
422
+ data: jQuery("#b2s-curation-post-form").serialize() + '&postFormat='+jQuery('#b2s-curation-post-format').val() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
423
+ error: function () {
424
+ jQuery('.b2s-server-connection-fail').show();
425
+ return false;
426
+ },
427
+ success: function (data) {
428
+ if (data.result == true) {
429
+ window.location.href = data.redirect;
430
+ return false;
431
+ } else {
432
+ if(data.error == 'nonce') {
433
+ jQuery('.b2s-nonce-check-fail').show();
434
+ }
435
+ jQuery('.b2s-loading-area').hide();
436
+ jQuery('#b2s-curation-no-data-info').show();
437
+ jQuery('.b2s-curation-settings-area').show();
438
+ jQuery('.b2s-curation-preview-area').show();
439
+ }
440
+
441
+ }
442
+ });
443
+ return false;
444
+ });
445
+
446
+ jQuery(document).on('change', '#b2s-post-curation-profile-select', function () {
447
+ var tos = false;
448
+ if (jQuery('#b2s-post-curation-profile-data' + jQuery(this).val()).val() == "") {
449
+ jQuery('#b2s-curation-no-auth-info').show();
450
+ tos = true;
451
+ } else {
452
+ jQuery('#b2s-curation-no-auth-info').hide();
453
+ //TOS Twitter Check
454
+ var len = jQuery('#b2s-post-curation-twitter-select').children('option[data-mandant-id="' + jQuery(this).val() + '"]').length;
455
+ if (len >= 1) {
456
+ jQuery('.b2s-curation-twitter-area').show();
457
+ jQuery('#b2s-post-curation-twitter-select').prop('disabled', false);
458
+ jQuery('#b2s-post-curation-twitter-select').show();
459
+ jQuery('#b2s-post-curation-twitter-select option').attr("disabled", "disabled");
460
+ jQuery('#b2s-post-curation-twitter-select option[data-mandant-id="' + jQuery(this).val() + '"]').attr("disabled", false);
461
+ jQuery('#b2s-post-curation-twitter-select option[data-mandant-id="' + jQuery(this).val() + '"]:first').attr("selected", "selected");
462
+ } else {
463
+ tos = true;
464
+ }
465
+
466
+ }
467
+ //TOS Twitter 032018
468
+ if (tos) {
469
+ jQuery('.b2s-curation-twitter-area').hide();
470
+ jQuery('#b2s-post-curation-twitter-select').prop('disabled', 'disabled');
471
+ jQuery('#b2s-post-curation-twitter-select').hide();
472
+ }
473
+ });
474
+
475
+
476
+
477
+ function padDate(n) {
478
+ return ("0" + n).slice(-2);
479
+ }
480
+
481
+
482
+ function formatAMPM(date) {
483
+ var hours = date.getHours();
484
+ var minutes = date.getMinutes();
485
+ var ampm = hours >= 12 ? 'pm' : 'am';
486
+ hours = hours % 12;
487
+ hours = hours ? hours : 12; // the hour '0' should be '12'
488
+ minutes = minutes < 10 ? '0' + minutes : minutes;
489
+ var strTime = hours + ':' + minutes + ' ' + ampm;
490
+ return strTime;
491
+ }
492
+
493
+ jQuery(document).on('click', '#b2s-btn-curation-draft', function () {
494
+ jQuery('#b2s-curation-no-data-info').hide();
495
+ jQuery('#b2s-curation-no-auth-info').hide();
496
+ jQuery('#b2s-curation-saved-draft-info').hide();
497
+ var noContent = false;
498
+ if(jQuery('#b2s-curation-post-format').val() == '0') {
499
+ if (jQuery('#b2s-post-curation-preview-title').val().length === 0) {
500
+ jQuery('#b2s-post-curation-preview-title').addClass('error');
501
+ noContent = true;
502
+ }
503
+ if (jQuery('#b2s-post-curation-comment').val().length === 0) {
504
+ jQuery('#b2s-post-curation-comment').addClass('error');
505
+ noContent = true;
506
+ }
507
+ } else {
508
+ if (jQuery('.b2s-image-url-hidden-field').val().length === 0) {
509
+ jQuery('.b2s-post-item-details-url-image').addClass('error');
510
+ noContent = true;
511
+ }
512
+ if (jQuery('#b2s-post-curation-comment-image').val().length === 0) {
513
+ jQuery('#b2s-post-curation-comment-image').addClass('error');
514
+ noContent = true;
515
+ }
516
+ }
517
+ if (noContent) {
518
+ return false;
519
+ }
520
+ jQuery('.b2s-post-curation-action').val('b2s_curation_draft');
521
+ jQuery('.b2s-loading-area').show();
522
+ jQuery('.b2s-curation-settings-area').hide();
523
+ jQuery('.b2s-curation-preview-area').hide();
524
+ jQuery('.b2s-curation-image-area').hide();
525
+ jQuery('.b2s-curation-select').hide();
526
+ jQuery.ajax({
527
+ processData: false,
528
+ url: ajaxurl,
529
+ type: "POST",
530
+ dataType: "json",
531
+ cache: false,
532
+ data: jQuery("#b2s-curation-post-form").serialize() + '&postFormat='+jQuery('#b2s-curation-post-format').val() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
533
+ error: function () {
534
+ jQuery('.b2s-server-connection-fail').show();
535
+ return false;
536
+ },
537
+ success: function (data) {
538
+ if (data.result == true) {
539
+ if (typeof data.postId != undefined) {
540
+ jQuery('#b2s-draft-id').val(data.postId);
541
+ }
542
+ jQuery('#b2s-curation-saved-draft-info').show();
543
+ setTimeout(function () {
544
+ jQuery('#b2s-curation-saved-draft-info').fadeOut("slow");
545
+ }, 5000);
546
+ } else {
547
+ jQuery('#b2s-curation-no-data-info').show();
548
+ if(data.error == 'nonce') {
549
+ jQuery('.b2s-nonce-check-fail').show();
550
+ }
551
+ }
552
+ jQuery('.b2s-loading-area').hide();
553
+ jQuery('.b2s-curation-settings-area').show();
554
+ if(jQuery('#b2s-curation-post-format').val() == '0') {
555
+ jQuery('.b2s-curation-preview-area').show();
556
+ } else {
557
+ jQuery('.b2s-curation-image-area').show();
558
+ }
559
+ jQuery('.b2s-curation-select').show();
560
+
561
+ }
562
+ });
563
+ return false;
564
+ });
565
+
566
+ jQuery(document).on('click', '.b2s-curation-format-link', function() {
567
+ if(jQuery(this).hasClass('btn-primary')){
568
+ return false;
569
+ }
570
+ jQuery('#b2s-post-curation-comment').val(jQuery('#b2s-post-curation-comment-image').val());
571
+ jQuery('#b2s-curation-post-format').val('0');
572
+ jQuery('.b2s-curation-format-link').removeClass('btn-light').addClass('btn-primary');
573
+ jQuery('.b2s-curation-format-image').removeClass('btn-primary').addClass('btn-light');
574
+ jQuery('.b2s-loading-area').hide();
575
+ jQuery('.b2s-curation-link-area').show();
576
+ jQuery('.b2s-curation-image-area').hide();
577
+ if(jQuery('.b2s-curation-input-area').is(':visible')){
578
+ jQuery('.b2s-curation-settings-area').hide();
579
+ } else {
580
+ jQuery('.b2s-curation-settings-area').show();
581
+ }
582
+ });
583
+
584
+ jQuery(document).on('click', '.b2s-curation-format-image', function() {
585
+ if(jQuery(this).hasClass('btn-primary')){
586
+ return false;
587
+ }
588
+ jQuery('#b2s-post-curation-comment-image').val(jQuery('#b2s-post-curation-comment').val());
589
+ jQuery('#b2s-curation-post-format').val('1');
590
+ jQuery('.b2s-loading-area').show();
591
+ jQuery('.b2s-curation-link-area').hide();
592
+ jQuery('.b2s-curation-image-area').hide();
593
+ jQuery('.b2s-curation-format-image').removeClass('btn-light').addClass('btn-primary');
594
+ jQuery('.b2s-curation-format-link').removeClass('btn-primary').addClass('btn-light');
595
+ if(jQuery('.b2s-curation-settings-area').html().length == 0) {
596
+ jQuery.ajax({
597
+ url: ajaxurl,
598
+ type: "GET",
599
+ dataType: "json",
600
+ cache: false,
601
+ data: {
602
+ 'action': 'b2s_get_curation_ship_details',
603
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
604
+ },
605
+ error: function () {
606
+ jQuery('.b2s-server-connection-fail').show();
607
+ return false;
608
+ },
609
+ success: function (data) {
610
+ if(jQuery('.b2s-curation-format-image').hasClass('btn-primary')) {
611
+ if (data.result == true) {
612
+ jQuery('.b2s-curation-settings-area').html(data.settings);
613
+ jQuery('#b2s-post-curation-profile-select [value="0"]').prop('selected', true).trigger('change');
614
+ jQuery('.b2s-loading-area').hide();
615
+ jQuery('.b2s-curation-image-area').show();
616
+ jQuery('.b2s-curation-settings-area').show();
617
+ loadDraftShipData();
618
+ return false;
619
+ } else {
620
+ jQuery('.b2s-loading-area').hide();
621
+ if(data.error == 'nonce') {
622
+ jQuery('.b2s-nonce-check-fail').show();
623
+ }
624
+ if (data.error == "NO_AUTH") {
625
+ jQuery('.b2s-curation-image-area').show();
626
+ jQuery('.b2s-curation-settings-area').hide();
627
+ jQuery('#b2s-curation-no-auth-info').show();
628
+ jQuery('#b2s-curation-no-review-info').hide();
629
+ jQuery('#b2s-curation-no-data-info').hide();
630
+ }
631
+ jQuery('#b2s-btn-curation-customize').prop("disabled", true);
632
+ jQuery('#b2s-btn-curation-share').prop("disabled", true);
633
+ }
634
+ }
635
+ }
636
+ });
637
+ } else {
638
+ jQuery('.b2s-loading-area').hide();
639
+ jQuery('.b2s-curation-image-area').show();
640
+ jQuery('.b2s-curation-settings-area').show();
641
+ }
642
+ return false;
643
+ });
644
+
645
+ var emojiTranslation = JSON.parse(jQuery('#b2sEmojiTranslation').val());
646
+ var picker = new EmojiButton({
647
+ position: 'auto',
648
+ autoHide: false,
649
+ i18n: {
650
+ search: emojiTranslation['search'],
651
+ categories: {
652
+ recents: emojiTranslation['recents'],
653
+ smileys: emojiTranslation['smileys'],
654
+ animals: emojiTranslation['animals'],
655
+ food: emojiTranslation['food'],
656
+ activities: emojiTranslation['activities'],
657
+ travel: emojiTranslation['travel'],
658
+ objects: emojiTranslation['objects'],
659
+ symbols: emojiTranslation['symbols'],
660
+ flags: emojiTranslation['flags']
661
+ },
662
+ notFound: emojiTranslation['notFound']
663
+ }
664
+ });
665
+ picker.on('emoji', function(emoji){
666
+ if(jQuery('#b2s-curation-post-format').val() == '0') {
667
+ var text = jQuery('#b2s-post-curation-comment').val();
668
+ var start = jQuery('#b2s-post-curation-comment').attr('selectionStart');
669
+ var end = jQuery('#b2s-post-curation-comment').attr('selectionEnd');
670
+ } else {
671
+ var text = jQuery('#b2s-post-curation-comment-image').val();
672
+ var start = jQuery('#b2s-post-curation-comment-image').attr('selectionStart');
673
+ var end = jQuery('#b2s-post-curation-comment-image').attr('selectionEnd');
674
+ }
675
+ if(typeof start == 'undefined' || typeof end == 'undefined'){
676
+ start = text.length;
677
+ end = text.length;
678
+ }
679
+ var newText = text.slice(0, start) + emoji + text.slice(end);
680
+ jQuery('.b2s-post-item-details-item-message-input').val(newText);
681
+ jQuery('.b2s-post-item-details-item-message-input').focus();
682
+ jQuery('.b2s-post-item-details-item-message-input').prop("selectionStart", parseInt(start)+emoji.length);
683
+ jQuery('.b2s-post-item-details-item-message-input').prop("selectionEnd", parseInt(start)+emoji.length);
684
+ jQuery('.b2s-post-item-details-item-message-input').trigger('keyup');
685
+ });
686
+
687
+ jQuery(document).on('click', '.b2s-post-item-details-item-message-emoji-btn', function() {
688
+ if(picker.pickerVisible) {
689
+ picker.hidePicker();
690
+ } else {
691
+ currentEmojiNetworkAuthId = jQuery(this).attr('data-network-auth-id');
692
+ currentEmojiNetworkCount = jQuery(this).attr('data-network-count');
693
+ picker.showPicker(jQuery(this));
694
+ }
695
+ });
696
+
697
+ jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-post-item-details-item-message-input', function () {
698
+ var tb = jQuery(this).get(0);
699
+ jQuery(this).attr('selectionStart', tb.selectionStart);
700
+ jQuery(this).attr('selectionEnd', tb.selectionEnd);
701
+ });
702
+
703
+ jQuery(document).on('click', '.b2s-post-item-details-url-image', function() {
704
+ jQuery('.b2s-select-image-modal-open').trigger('click');
705
+ });
706
+
707
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
708
+ jQuery('#b2s-network-select-image').modal('show');
709
+ return false;
710
+ });
711
+
712
+ jQuery(document).on('click', '.b2s-network-info-modal-btn', function () {
713
+ jQuery('#b2sInfoNetworkModal').modal('show');
714
+ return false;
715
+ });
716
+
717
+ jQuery(document).on('click', '.b2s-upload-image', function () {
718
+ if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
719
+ jQuery('#b2s-network-select-image').modal('hide');
720
+ wpMedia = wp.media({
721
+ title: jQuery('#b2s_wp_media_headline').val(),
722
+ button: {
723
+ text: jQuery('#b2s_wp_media_btn').val(),
724
+ },
725
+ multiple: false,
726
+ library: {type: 'image'}
727
+ });
728
+ wpMedia.open();
729
+ wpMedia.on('select', function () {
730
+ var count = parseInt(jQuery('.b2s-choose-image-count').val());
731
+ count = count + 1;
732
+ jQuery('.b2s-choose-image-count').val(count);
733
+ var attachment = wpMedia.state().get('selection').first().toJSON();
734
+ var content = '<div class="b2s-image-item">' +
735
+ '<div class="b2s-image-item-thumb">' +
736
+ '<label for="b2s-image-count-' + count + '">' +
737
+ '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
738
+ '</label>' +
739
+ '</div>' +
740
+ '<div class="b2s-image-item-caption text-center">' +
741
+ '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
742
+ '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" data-id="' + attachment.id + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
743
+ '</div>' +
744
+ '</div>';
745
+ jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
746
+ jQuery('.b2s-choose-image-no-image-info-text').hide();
747
+ jQuery('.b2s-choose-image-no-image-extra-btn').hide();
748
+ jQuery('.b2s-upload-image-invalid-extension').hide();
749
+ jQuery('input[name=image_url]:last').prop("checked", true);
750
+ jQuery('#b2s-network-select-image').modal('show');
751
+ });
752
+ wpMedia.on('close', function () {
753
+ jQuery('#b2s-network-select-image').modal('show');
754
+ });
755
+ } else {
756
+ jQuery('.b2s-upload-image-no-permission').show();
757
+ }
758
+ return false;
759
+ });
760
+
761
+ jQuery(document).on('click', '.b2s-image-change', function () {
762
+ if (jQuery('input[name=image_url]:checked').length > 0) {
763
+ jQuery('.b2s-post-item-details-url-image').attr('src', jQuery('input[name=image_url]:checked').val());
764
+ jQuery('.b2s-image-url-hidden-field').val(jQuery('input[name=image_url]:checked').val());
765
+ jQuery('.b2s-image-id-hidden-field').val(jQuery('input[name=image_url]:checked').data('id'));
766
+ jQuery('.b2s-image-remove-btn').show();
767
+ jQuery('.b2s-upload-image-invalid-extension').hide();
768
+ jQuery('.b2s-upload-image-no-permission').hide();
769
+ jQuery('.b2s-upload-image-free-version-info').hide();
770
+ jQuery('.b2s-post-item-details-url-image').removeClass('error');
771
+ }
772
+ jQuery('#b2s-network-select-image').modal('hide');
773
+ return false;
774
+ });
775
+
776
+ jQuery(document).on('click', '.b2s-image-remove-btn', function () {
777
+ var defaultImage = jQuery('#b2sDefaultNoImage').val();
778
+ //default
779
+ jQuery('.b2s-post-item-details-url-image').attr('src', defaultImage);
780
+ jQuery('.b2s-image-url-hidden-field').val("");
781
+ jQuery('.b2s-image-id-hidden-field').val("");
782
+ jQuery('.b2s-image-remove-btn').hide();
783
+ return false;
784
+ });
785
+
786
+ jQuery(document).on('keyup', '.b2s-post-item-details-item-message-input', function() {
787
+ jQuery(this).removeClass('error');
788
+ });
789
+
790
+ jQuery(document).on('click', '.b2s-curation-info-premium-btn', function () {
791
+ jQuery('#b2sInfoCCModal').modal('show');
792
+ });
793
+
794
+ jQuery(document).on('click', '.b2s-re-share-btn', function() {
795
+ jQuery('.b2s-curation-post-list-area').hide();
796
+ jQuery('.b2s-curation-settings-area').show();
797
+ jQuery('.b2s-curation-select').show();
798
+ if(jQuery('#b2s-curation-post-format').val() == '0') {
799
+ jQuery('.b2s-curation-preview-area').show();
800
+ } else {
801
+ jQuery('.b2s-curation-image-area').show();
802
+ }
803
+ });
804
+
805
+ function loadDraftShipData() {
806
+ var url_string = window.location.href;
807
+ var url_param = new URL(url_string);
808
+ var ship_type = url_param.searchParams.get("ship_type");
809
+ var ship_date = url_param.searchParams.get("ship_date");
810
+ var profile_select = url_param.searchParams.get("profile_select");
811
+ var twitter_select = url_param.searchParams.get("twitter_select");
812
+ if (typeof ship_type != "undefined" && ship_type != "" && ship_type != null && ship_type > 0) {
813
+ jQuery('#b2s-post-curation-ship-type').val(ship_type);
814
+ jQuery('#b2s-post-curation-ship-type').trigger('change');
815
+ if (typeof ship_date != "undefined" && ship_date != "" && ship_date != null) {
816
+ jQuery('#b2s-post-curation-ship-date').val(ship_date);
817
+ jQuery('#b2s-post-curation-ship-date').trigger('change');
818
+ }
819
+ }
820
+ if (typeof profile_select != "undefined" && profile_select != "" && profile_select != null) {
821
+ jQuery('#b2s-post-curation-profile-select').val(profile_select);
822
+ jQuery('#b2s-post-curation-profile-select').trigger('change');
823
+ if (typeof twitter_select != "undefined" && twitter_select != "" && twitter_select != null && twitter_select > 0) {
824
+ jQuery('#b2s-post-curation-twitter-select').val(twitter_select);
825
+ jQuery('#b2s-post-curation-twitter-select').trigger('change');
826
+ }
827
+ }
828
  }
assets/js/b2s/network.js CHANGED
@@ -1,1577 +1,1588 @@
1
- jQuery.noConflict();
2
-
3
- jQuery(window).on("load", function () {
4
-
5
- init();
6
-
7
- if (jQuery('.b2s-network-mandant-select').val() == 0 || jQuery('.b2s-network-mandant-select').val() == -1) {
8
- jQuery('.b2s-network-mandant-btn-delete').hide();
9
- } else {
10
- jQuery('.b2s-network-mandant-btn-delete').show();
11
- }
12
- jQuery('.b2s-network-details-container-list').hide();
13
- jQuery('.b2s-network-details-container-list[data-mandant-id="' + jQuery('.b2s-network-mandant-select').val() + '"]').show();
14
-
15
- jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
16
- jQuery('.b2s-network-auth-count-current[data-network-id="' + jQuery(this).attr("data-network-id") + '"').text(jQuery(this).children('li').length - 1);
17
- });
18
- });
19
-
20
- function init() {
21
- var showMeridian = true;
22
- if (jQuery('#b2sUserLang').val() == 'de') {
23
- showMeridian = false;
24
- }
25
- jQuery('.b2s-settings-sched-item-input-time').timepicker({
26
- minuteStep: 15,
27
- appendWidgetTo: 'body',
28
- showSeconds: false,
29
- showMeridian: showMeridian,
30
- defaultTime: 'current'
31
- }).on('changeTime.timepicker', function (e) {
32
- var networkAuthId = jQuery(e.target).attr('data-network-auth-id');
33
- jQuery('.b2s-settings-sched-item-input-time[data-network-auth-id="' + networkAuthId + '"]').val(e.time.value);
34
- saveTimeSettings();
35
- });
36
- }
37
-
38
- var timeoutPlus;
39
- var timeoutMinus;
40
- jQuery(document).on('mousedown mouseup', '.b2s-sched-manager-item-input-day-btn-plus', function (e) {
41
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
42
- var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
43
- if (e.type == "mousedown") {
44
- timeoutPlus = setInterval(function () {
45
- if (current < 99) {
46
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current++);
47
- } else {
48
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(99);
49
- }
50
- }, 100);
51
- } else {
52
- clearInterval(timeoutPlus);
53
- saveTimeSettings();
54
- }
55
- return false;
56
- });
57
-
58
- jQuery(document).on('mousedown mouseup', '.b2s-sched-manager-item-input-day-btn-minus', function (e) {
59
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
60
- var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
61
- if (e.type == "mousedown") {
62
- timeoutMinus = setInterval(function () {
63
- if (current > 0) {
64
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current--);
65
- } else {
66
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(0);
67
- }
68
- }, 100);
69
- } else {
70
- clearInterval(timeoutMinus);
71
- saveTimeSettings();
72
- }
73
- return false;
74
- });
75
-
76
-
77
- jQuery(document).on('click', '.b2s-sched-manager-item-input-day-btn-minus', function () {
78
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
79
- var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
80
- if (current > 0) {
81
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current - 1);
82
- saveTimeSettings();
83
- } else {
84
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(0);
85
- }
86
- });
87
- jQuery(document).on('click', '.b2s-sched-manager-item-input-day-btn-plus', function () {
88
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
89
- var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
90
- if (current < 99) {
91
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current + 1);
92
- //TODO is show ALL other same items update
93
- saveTimeSettings();
94
- } else {
95
- jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(99);
96
- }
97
-
98
- });
99
-
100
-
101
-
102
- jQuery(document).on('change', '.b2s-network-mandant-select', function () {
103
- jQuery('.b2s-network-auth-info').hide();
104
- if (jQuery(this).val() == 0 || jQuery(this).val() == -1) {
105
- jQuery('.b2s-network-mandant-btn-delete').hide();
106
- } else {
107
- jQuery('.b2s-network-mandant-btn-delete').show();
108
- }
109
- jQuery('.b2s-network-details-container-list').hide();
110
- jQuery('.b2s-network-details-container-list[data-mandant-id="' + jQuery(this).val() + '"]').show();
111
- });
112
-
113
- jQuery(document).on('click', '.b2s-network-mandant-btn-delete', function () {
114
- jQuery('.b2s-network-auth-info').hide();
115
- jQuery('#b2s-network-delete-mandant').modal('show');
116
- });
117
-
118
- jQuery(document).on('click', '.b2s-btn-network-delete-mandant-confirm', function () {
119
- jQuery('.b2s-network-auth-area').hide();
120
- jQuery('.b2s-loading-area').show();
121
- jQuery('#b2s-network-delete-mandant').modal('hide');
122
- jQuery('.b2s-server-connection-fail').hide();
123
- jQuery.ajax({
124
- url: ajaxurl,
125
- type: "POST",
126
- dataType: "json",
127
- cache: false,
128
- data: {
129
- 'action': 'b2s_delete_mandant',
130
- 'mandantId': jQuery('.b2s-network-mandant-select').val(),
131
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
132
- },
133
- error: function () {
134
- jQuery('.b2s-server-connection-fail').show();
135
- return false;
136
- },
137
- success: function (data) {
138
- jQuery('.b2s-network-auth-info').hide();
139
- jQuery('.b2s-network-auth-area').show();
140
- jQuery('.b2s-loading-area').hide();
141
- if (data.result == true && data.mandantId >= 1) {
142
- jQuery('.b2s-network-details-container-list[data-mandant-id="' + data.mandantId + '"]').remove();
143
- jQuery(".b2s-network-mandant-select option[value='" + data.mandantId + "']").remove();
144
- jQuery(".b2s-network-mandant-select option[value='-1']").prop('selected', true);
145
- jQuery(".b2s-network-details-container-list[data-mandant-id='0']").show();
146
- jQuery('.b2s-network-remove-success').show();
147
- jQuery('.b2s-network-mandant-btn-delete').hide();
148
- } else {
149
- if (data.error == 'nonce') {
150
- jQuery('.b2s-nonce-check-fail').show();
151
- }
152
- jQuery('.b2s-network-remove-fail').show();
153
- }
154
- }
155
- });
156
- return false;
157
- });
158
-
159
- jQuery(document).on('change', '#b2s-modify-board-and-group-network-selected', function () {
160
- if (jQuery(this).attr('data-network-id') == 8) {
161
- var name = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
162
- jQuery('#b2s-modify-board-and-group-name').val(name);
163
- }
164
- return true;
165
- });
166
-
167
- jQuery(document).on('click', '#b2s-move-user-auth-to-profile', function () {
168
- jQuery('.b2s-network-auth-settings-content').hide();
169
- jQuery('.b2s-move-connection-error').hide();
170
- jQuery('.b2s-assign-error').hide();
171
- jQuery('.b2s-loading-area').show();
172
-
173
- var authId = jQuery('#b2sUserAuthId').val();
174
- var mandantId = jQuery('#b2s-move-connection-select').val();
175
- var oldMandantId = jQuery('#b2sOldMandantId').val();
176
- var networkId = jQuery('#b2sNetworkId').val();
177
- jQuery.ajax({
178
- url: ajaxurl,
179
- type: "POST",
180
- dataType: "json",
181
- cache: false,
182
- data: {
183
- 'action': 'b2s_move_user_auth_to_profile',
184
- 'networkAuthId': authId,
185
- 'mandantId': mandantId,
186
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
187
- },
188
- error: function () {
189
- jQuery('.b2s-loading-area').hide();
190
- jQuery('.b2s-server-connection-fail').show();
191
- return false;
192
- },
193
- success: function (data) {
194
- if (data.result == true) {
195
- jQuery('.b2s-loading-area').hide();
196
- jQuery('#b2s-edit-network-auth-settings').modal('hide');
197
- //change show all entry
198
- jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']').attr('data-network-mandant-id', mandantId);
199
- jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + '] .b2s-network-item-team-btn-manage').attr('data-network-mandant-id', mandantId);
200
- jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + '] .b2s-network-mandant-name').html('(' + jQuery('#b2s-move-connection-select option:selected').text() + ')');
201
-
202
- //sort entry in show all
203
- var allArray = [];
204
- var first = true;
205
- jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + '] li').each(function (index, element) {
206
- if (first !== true) {
207
- allArray.push(element);
208
- } else {
209
- first = element;
210
- }
211
- });
212
-
213
- for (i = 0; i < allArray.length; i++) {
214
- for (j = 0; j < (allArray.length - 1); j++) {
215
- if ((jQuery(allArray[j + 1]).attr('data-network-mandant-id') < jQuery(allArray[j]).attr('data-network-mandant-id')) || (jQuery(allArray[j + 1]).attr('data-network-mandant-id') == jQuery(allArray[j]).attr('data-network-mandant-id') && jQuery(allArray[j + 1]).attr('data-network-type') < jQuery(allArray[j]).attr('data-network-type')) || (jQuery(allArray[j + 1]).attr('data-network-mandant-id') == jQuery(allArray[j]).attr('data-network-mandant-id') && jQuery(allArray[j + 1]).attr('data-network-type') == jQuery(allArray[j]).attr('data-network-type') && jQuery(allArray[j + 1]).attr('data-network-auth-id') < jQuery(allArray[j]).attr('data-network-auth-id'))) {
216
- var temp = allArray[j + 1];
217
- allArray[j + 1] = allArray[j];
218
- allArray[j] = temp;
219
- }
220
- }
221
- }
222
- jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').html('');
223
- jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(first);
224
- for (i = 0; i < allArray.length; i++) {
225
- jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(allArray[i]);
226
- }
227
-
228
-
229
- //copy and remove entry in profile
230
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']').attr('data-network-mandant-id', mandantId);
231
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + '] .b2s-network-item-team-btn-manage').attr('data-network-mandant-id', mandantId);
232
- var temp_list_entry = jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']');
233
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']').remove();
234
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(temp_list_entry);
235
-
236
- //sort entry in new profile
237
- var mandantArray = [];
238
- var mandantFirst = true;
239
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + '] li').each(function (index, element) {
240
- if (mandantFirst !== true) {
241
- mandantArray.push(element);
242
- } else {
243
- mandantFirst = element;
244
- }
245
- });
246
-
247
- for (i = 0; i < mandantArray.length; i++) {
248
- for (j = 0; j < (mandantArray.length - 1); j++) {
249
- if ((jQuery(mandantArray[j + 1]).attr('data-network-mandant-id') < jQuery(mandantArray[j]).attr('data-network-mandant-id')) || (jQuery(mandantArray[j + 1]).attr('data-network-mandant-id') == jQuery(mandantArray[j]).attr('data-network-mandant-id') && jQuery(mandantArray[j + 1]).attr('data-network-type') < jQuery(mandantArray[j]).attr('data-network-type')) || (jQuery(mandantArray[j + 1]).attr('data-network-mandant-id') == jQuery(mandantArray[j]).attr('data-network-mandant-id') && jQuery(mandantArray[j + 1]).attr('data-network-type') == jQuery(mandantArray[j]).attr('data-network-type') && jQuery(mandantArray[j + 1]).attr('data-network-auth-id') < jQuery(mandantArray[j]).attr('data-network-auth-id'))) {
250
- var temp = mandantArray[j + 1];
251
- mandantArray[j + 1] = mandantArray[j];
252
- mandantArray[j] = temp;
253
- }
254
- }
255
- }
256
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').html('');
257
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(mandantFirst);
258
-
259
- for (i = 0; i < mandantArray.length; i++) {
260
- jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(mandantArray[i]);
261
- }
262
- } else {
263
- if (data.error == 'nonce') {
264
- jQuery('.b2s-nonce-check-fail').show();
265
- }
266
- jQuery('.b2s-loading-area').hide();
267
- jQuery('.b2s-network-auth-settings-content').show();
268
- jQuery('.b2s-move-connection-error').show();
269
- }
270
- return false;
271
- }
272
- });
273
- return false;
274
- });
275
-
276
- jQuery(document).on('click', '#b2s-assign-network-user-auth', function () {
277
- if (jQuery('#b2s-select-assign-user').val() <= 0) {
278
- return false;
279
- }
280
- jQuery('.b2s-network-auth-settings-content').hide();
281
- jQuery('.b2s-move-connection-error').hide();
282
- jQuery('.b2s-connection-assign').hide();
283
- jQuery('.b2s-assignment-area').hide();
284
- jQuery('.b2s-assign-error').hide();
285
- jQuery('.b2s-loading-area').show();
286
-
287
- var authId = jQuery('#b2sUserAuthId').val();
288
- var assignBlogUserId = jQuery('#b2s-select-assign-user').val();
289
- jQuery.ajax({
290
- url: ajaxurl,
291
- type: "POST",
292
- dataType: "json",
293
- cache: false,
294
- data: {
295
- 'action': 'b2s_assign_network_user_auth',
296
- 'networkAuthId': authId,
297
- 'assignBlogUserId': assignBlogUserId,
298
- 'optionBestTimes': jQuery('#b2s-network-assign-option-best-times').is(':checked'),
299
- 'optionPostingTemplate': jQuery('#b2s-network-assign-option-posting-template').is(':checked'),
300
- 'optionUrlParameter': jQuery('#b2s-network-assign-option-url-parameter').is(':checked'),
301
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
302
- },
303
- error: function () {
304
- jQuery('.b2s-loading-area').hide();
305
- jQuery('.b2s-assign-error[data-error-reason="default"]').show();
306
- jQuery('.b2s-network-auth-settings-content').show();
307
- jQuery('.b2s-connection-assign').show();
308
- jQuery('.b2s-assignment-area').show();
309
- return false;
310
- },
311
- success: function (data) {
312
- if (data.result == true) {
313
- jQuery('.b2s-loading-area').hide();
314
- jQuery('#b2s-approved-user-list').append(data.newListEntry);
315
- jQuery('#b2s-approved-user-list').show();
316
- jQuery('#b2s-select-assign-user option[value="' + assignBlogUserId + '"]').remove();
317
- if (jQuery('#b2s-select-assign-user').html() == '') {
318
- jQuery('#b2s-select-assign-user').attr('disabled', true);
319
- jQuery('.b2s-network-assign-option').hide();
320
- jQuery('#b2s-assign-info').hide();
321
- jQuery('#b2s-no-assign-user').show();
322
- }
323
- } else {
324
- if (data.error == 'nonce') {
325
- jQuery('.b2s-nonce-check-fail').show();
326
- }
327
- jQuery('.b2s-assign-error[data-error-reason="' + data.error_reason + '"]').show();
328
- }
329
- jQuery('.b2s-loading-area').hide();
330
- jQuery('.b2s-connection-assign').show();
331
- jQuery('.b2s-network-auth-settings-content').show();
332
- jQuery('.b2s-assignment-area').show();
333
- return false;
334
- }
335
- });
336
- return false;
337
- });
338
-
339
- jQuery(document).on('click', '.b2s-modify-board-and-group-network-btn', function () {
340
- jQuery('.b2s-modify-board-and-group-network-loading-area').show();
341
- jQuery('.b2s-network-auth-info').hide();
342
- jQuery('#b2s-modify-board-and-group-network-modal').modal('show');
343
- jQuery('#b2s-modify-board-and-group-network-modal-title').html(jQuery(this).attr('data-modal-title'));
344
- jQuery('#b2s-modify-board-and-group-network-auth-id').val(jQuery(this).attr('data-network-auth-id'));
345
- jQuery('#b2s-modify-board-and-group-network-id').val(jQuery(this).attr('data-network-id'));
346
- jQuery('#b2s-modify-board-and-group-network-type').val(jQuery(this).attr('data-network-type'));
347
- jQuery('.b2s-server-connection-fail').hide();
348
- jQuery('.b2s-modify-board-and-group-network-save-btn').hide();
349
- jQuery('#b2s-modify-board-and-group-network-no-data').hide();
350
- jQuery('.b2s-modify-board-and-group-network-data').html("");
351
- jQuery('.b2s-modify-board-and-group-network-data').show();
352
- jQuery('#b2s-modify-board-and-group-network-save-success').hide();
353
- jQuery('#b2s-modify-board-and-group-network-save-error').hide();
354
-
355
- var networkId = jQuery(this).attr('data-network-id');
356
- jQuery.ajax({
357
- url: ajaxurl,
358
- type: "POST",
359
- dataType: "json",
360
- cache: false,
361
- data: {
362
- 'action': 'b2s_get_network_board_and_group',
363
- 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
364
- 'networkType': jQuery(this).attr('data-network-type'),
365
- 'networkId': networkId,
366
- 'lang': jQuery('#b2sUserLang').val(),
367
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
368
- },
369
- error: function () {
370
- jQuery('.b2s-server-connection-fail').show();
371
- return false;
372
- },
373
- success: function (data) {
374
- jQuery('.b2s-modify-board-and-group-network-loading-area').hide();
375
- if (data.result == true) {
376
- jQuery('.b2s-modify-board-and-group-network-data').html(data.content);
377
- jQuery('.b2s-modify-board-and-group-network-save-btn').show();
378
- } else {
379
- if (data.error == 'nonce') {
380
- jQuery('.b2s-nonce-check-fail').show();
381
- }
382
- jQuery('#b2s-modify-board-and-group-network-no-data').show();
383
- }
384
- }
385
- });
386
- return false;
387
-
388
- });
389
-
390
-
391
- jQuery(document).on('click', '.b2s-modify-board-and-group-network-save-btn', function () {
392
-
393
- jQuery('.b2s-modify-board-and-group-network-save-btn').hide();
394
- jQuery('.b2s-modify-board-and-group-network-data').hide();
395
- jQuery('.b2s-modify-board-and-group-network-loading-area').show();
396
-
397
- var networkAuthId = jQuery('#b2s-modify-board-and-group-network-auth-id').val();
398
- var networkType = jQuery('#b2s-modify-board-and-group-network-type').val();
399
- var networkId = jQuery('#b2s-modify-board-and-group-network-id').val();
400
- var name = jQuery('#b2s-modify-board-and-group-name').val();
401
-
402
- jQuery.ajax({
403
- url: ajaxurl,
404
- type: "POST",
405
- dataType: "json",
406
- cache: false,
407
- data: {
408
- 'action': 'b2s_save_network_board_and_group',
409
- 'networkAuthId': networkAuthId,
410
- 'networkType': networkType,
411
- 'networkId': networkId,
412
- 'boardAndGroup': jQuery('#b2s-modify-board-and-group-network-selected').val(),
413
- 'boardAndGroupName': name,
414
- 'lang': jQuery('#b2sUserLang').val(),
415
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
416
- },
417
- error: function () {
418
- jQuery('.b2s-server-connection-fail').show();
419
- return false;
420
- },
421
- success: function (data) {
422
- jQuery('.b2s-modify-board-and-group-network-loading-area').hide();
423
- if (data.result == true) {
424
- jQuery('#b2s-modify-board-and-group-network-save-success').show();
425
- } else {
426
- if (data.error == 'nonce') {
427
- jQuery('.b2s-nonce-check-fail').show();
428
- }
429
- jQuery('#b2s-modify-board-and-group-network-save-error').show();
430
- }
431
- }
432
- });
433
- return false;
434
- });
435
-
436
-
437
- jQuery(document).on('click', '#b2s-delete-network-sched-post', function () {
438
- if (!jQuery(this).is(":checked")) {
439
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
440
- jQuery('#b2s-delete-network-sched-post').val('0');
441
- } else {
442
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').removeAttr('disabled');
443
- jQuery('#b2s-delete-network-sched-post').val('1');
444
- }
445
- });
446
-
447
- jQuery(document).on('click', '.b2s-network-item-auth-list-btn-delete', function () {
448
- jQuery('.b2s-loading-area').show();
449
- jQuery('.b2s-network-auth-settings-content').hide();
450
- jQuery('.b2s-network-auth-info').hide();
451
- jQuery('#b2s-network-delete-auth').modal('show');
452
- jQuery('#b2s-delete-network-auth-id').val(jQuery(this).attr('data-network-auth-id'));
453
- jQuery('#b2s-delete-network-id').val(jQuery(this).attr('data-network-id'));
454
- jQuery('#b2s-delete-network-type').val(jQuery(this).attr('data-network-type'));
455
- jQuery('#b2s-delete-assign-network-auth-id').val(jQuery(this).attr('data-assign-network-auth-id'));
456
- jQuery('#b2s-delete-blog-user-id').val(jQuery(this).attr('data-blog-user-id'));
457
- jQuery('.b2s-server-connection-fail').hide();
458
- jQuery('#b2s-delete-all-assign-text').hide();
459
- jQuery('.b2s-btn-network-delete-auth-show-post-text').hide();
460
- jQuery('.b2s-btn-network-delete-auth-show-post-btn').hide();
461
- jQuery('.b2s-btn-network-delete-auth-confirm-text').hide();
462
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').hide();
463
- jQuery('.b2s-btn-network-delete-sched-text').hide();
464
- jQuery('.b2s-btn-network-delete-assign-text').hide();
465
- jQuery('.b2s-btn-network-delete-assign-sched-text').hide();
466
- var countSchedId = jQuery(this).attr('data-network-auth-id');
467
- if (typeof jQuery(this).attr('data-assign-network-auth-id') != 'undefined' && jQuery(this).attr('data-assign-network-auth-id') > 0) {
468
- countSchedId = jQuery(this).attr('data-assign-network-auth-id');
469
- }
470
-
471
- jQuery.ajax({
472
- url: ajaxurl,
473
- type: "POST",
474
- dataType: "json",
475
- cache: false,
476
- data: {
477
- 'action': 'b2s_get_sched_posts_by_user_auth',
478
- 'networkAuthId': countSchedId,
479
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
480
- },
481
- error: function () {
482
- jQuery('.b2s-server-connection-fail').show();
483
- return false;
484
- },
485
- success: function (data) {
486
- jQuery('.b2s-loading-area').hide();
487
- if (data.result == true) {
488
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').removeAttr('disabled');
489
- if (data.count >= 1) {
490
- jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
491
- jQuery('.b2s-btn-network-delete-sched-text').show();
492
- jQuery('.b2s-btn-network-delete-auth-show-post-btn').show();
493
- jQuery('#b2s-btn-network-delete-auth-show-post-count').text(data.count);
494
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
495
- }
496
- if (data.assignListCount >= 1) {
497
- jQuery('.b2s-btn-network-delete-assign-text').show();
498
- jQuery('#b2s-delete-assignment').val('all');
499
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
500
- jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
501
- } else {
502
- jQuery('#b2s-delete-assignment').val('');
503
- }
504
- if (data.assignCount >= 1) {
505
- jQuery('.b2s-btn-network-delete-assign-sched-text').show();
506
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
507
- jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
508
- }
509
- jQuery('#b2s-delete-assign-list').val(data.assignList);
510
- } else {
511
- if (data.error == 'nonce') {
512
- jQuery('.b2s-nonce-check-fail').show();
513
- }
514
- }
515
- jQuery('.b2s-btn-network-delete-auth-confirm-text').show();
516
- jQuery('.b2s-btn-network-delete-auth-confirm-btn').show();
517
- jQuery('#b2s-delete-network-sched-post').prop('checked', false);
518
- jQuery('#b2s-delete-network-sched-post').val('0');
519
- }
520
- });
521
- return false;
522
- });
523
-
524
- jQuery(document).on('click', '.b2s-btn-network-delete-auth-show-post-btn', function () {
525
- window.location.href = jQuery('#b2s-redirect-url-sched-post').val() + "&b2sUserAuthId=" + jQuery('#b2s-delete-network-auth-id').val();
526
- return false;
527
- });
528
-
529
- jQuery(document).on('click', '.b2s-btn-network-delete-auth-confirm-btn', function () {
530
- jQuery('.b2s-network-auth-area').hide();
531
- jQuery('.b2s-loading-area').show();
532
- jQuery('#b2s-edit-network-auth-settings').modal('hide');
533
- jQuery('#b2s-network-delete-auth').modal('hide');
534
- jQuery('.b2s-server-connection-fail').hide();
535
- jQuery.ajax({
536
- url: ajaxurl,
537
- type: "POST",
538
- dataType: "json",
539
- cache: false,
540
- data: {
541
- 'action': 'b2s_delete_user_auth',
542
- 'networkAuthId': jQuery('#b2s-delete-network-auth-id').val(),
543
- 'networkId': jQuery('#b2s-delete-network-id').val(),
544
- 'networkType': jQuery('#b2s-delete-network-type').val(),
545
- 'deleteSchedPost': jQuery('#b2s-delete-network-sched-post').val(),
546
- 'assignNetworkAuthId': jQuery('#b2s-delete-assign-network-auth-id').val(),
547
- 'blogUserId': jQuery('#b2s-delete-blog-user-id').val(),
548
- 'deleteAssignment': jQuery('#b2s-delete-assignment').val(),
549
- 'assignList': jQuery('#b2s-delete-assign-list').val(),
550
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
551
- },
552
- error: function () {
553
- jQuery('.b2s-server-connection-fail').show();
554
- return false;
555
- },
556
- success: function (data) {
557
- jQuery('.b2s-network-auth-info').hide();
558
- jQuery('.b2s-network-auth-area').show();
559
- jQuery('.b2s-loading-area').hide();
560
- if (data.result == true && data.networkAuthId >= 1 && data.networkId >= 1) {
561
- jQuery('.b2s-network-item-auth-list-btn-delete[data-network-auth-id="' + data.networkAuthId + '"]').parent('div').parent('li').remove();
562
- var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + data.networkId + '"').text();
563
- if (networkCount != "0") {
564
- var newCount = parseInt(networkCount) - 1;
565
- jQuery('.b2s-network-auth-count-current[data-network-id="' + data.networkId + '"').text(newCount);
566
- }
567
- jQuery('.b2s-network-remove-success').show();
568
- } else {
569
- if (data.error == 'nonce') {
570
- jQuery('.b2s-nonce-check-fail').show();
571
- }
572
- jQuery('.b2s-network-remove-fail').show();
573
- }
574
- }
575
- });
576
- return false;
577
- });
578
-
579
- jQuery(document).on('click', '.b2s-network-add-mandant-btn-save', function () {
580
- if (!jQuery('.b2s-network-add-mandant-input').val()) {
581
- jQuery('.b2s-network-add-mandant-input').addClass('error');
582
- } else {
583
- jQuery('.b2s-network-add-mandant-btn-loading').show();
584
- jQuery('.b2s-network-add-mandant-btn-save').hide();
585
- jQuery('.b2s-network-add-mandant-input').removeClass('error');
586
- jQuery('.b2s-server-connection-fail').hide();
587
- jQuery.ajax({
588
- url: ajaxurl,
589
- type: "POST",
590
- dataType: "json",
591
- cache: false,
592
- data: {
593
- 'action': 'b2s_save_user_mandant',
594
- 'mandant': jQuery('.b2s-network-add-mandant-input').val(),
595
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
596
- },
597
- error: function () {
598
- jQuery('.b2s-server-connection-fail').show();
599
- return false;
600
- },
601
- success: function (data) {
602
- jQuery('.b2s-network-auth-info').hide();
603
- jQuery('.b2s-network-add-mandant-btn-loading').hide();
604
- jQuery('.b2s-network-add-mandant-btn-save').show();
605
- if (data.result == true) {
606
- jQuery('.b2s-network-mandant-select optgroup[id="b2s-network-select-more-client"]').append('<option value="' + data.mandantId + '">' + data.mandantName + '</option>');
607
- jQuery('.b2s-network-details-container').append(data.content);
608
- jQuery('.b2s-network-mandant-select option[value="' + data.mandantId + '"]').prop('selected', true);
609
- jQuery('.b2s-network-details-container-list').hide();
610
- jQuery('.b2s-network-details-container-list[data-mandant-id="' + data.mandantId + '"]').show();
611
- jQuery('.b2s-network-add-mandant-success').show();
612
- } else {
613
- jQuery('.b2s-network-add-mandant-error').show();
614
- }
615
- jQuery('#b2s-network-add-mandant').modal('hide');
616
-
617
- jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
618
- jQuery('.b2s-network-auth-count-current[data-network-id="' + jQuery(this).attr("data-network-id") + '"').text(jQuery(this).children('li').length);
619
- });
620
-
621
- }
622
- });
623
- }
624
- });
625
-
626
- jQuery(document).on('change', '.b2s-network-add-mandant-input', function () {
627
- if (jQuery(this).val() != "") {
628
- jQuery(this).removeClass('error');
629
- }
630
- });
631
-
632
- window.addEventListener('message', function (e) {
633
- if (e.origin == jQuery('#b2sServerUrl').val()) {
634
- var data = JSON.parse(e.data);
635
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
636
- }
637
- });
638
-
639
- function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId) {
640
- jQuery('.b2s-network-auth-info').hide();
641
- jQuery('.b2s-network-auth-success').show();
642
- jQuery('.b2s-server-connection-fail').hide();
643
- jQuery.ajax({
644
- url: ajaxurl,
645
- type: "POST",
646
- dataType: "json",
647
- cache: false,
648
- data: {
649
- 'action': 'b2s_network_save_auth_to_settings',
650
- 'mandandId': mandandId,
651
- 'networkAuthId': networkAuthId,
652
- 'networkId': networkId,
653
- 'networkType': networkType,
654
- 'displayName': displayName,
655
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
656
- },
657
- error: function () {
658
- jQuery('.b2s-server-connection-fail').show();
659
- return false;
660
- },
661
- success: function (data) {}
662
- });
663
-
664
- var typ = new Array('Profile', 'Page', 'Group');
665
- var days = 'Days';
666
- if (jQuery('#b2sUserLang').val() == 'de') {
667
- typ = new Array('Profil', 'Seite', 'Gruppe');
668
- days = 'Tage';
669
- }
670
-
671
- var networkTypeName = typ[networkType];
672
- //Tumblr
673
- if (networkId == 4) {
674
- networkTypeName = 'Blog';
675
- }
676
-
677
- //NEW
678
- if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
679
- var html = "<li class='b2s-network-item-auth-list-li b2s-label-success-border-left' data-network-auth-id='" + networkAuthId + "' data-network-mandant-id='" + mandandId + "' data-network-id='" + networkId + "' data-network-type='" + networkType + "'>";
680
- html += '<div class="pull-left"><span class="b2s-network-item-auth-type">' + networkTypeName + '</span>: ';
681
- html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
682
- if (mandandId >= 0) {
683
- var mandantName = jQuery(".b2s-network-mandant-select option:selected").text();
684
- if (mandandId <= 0) {
685
- mandantName = jQuery(".b2s-network-mandant-select option[value='0']").text();
686
- }
687
- html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
688
- }
689
-
690
- var today = new Date();
691
- if (today.getMinutes() >= 30) {
692
- today.setHours(today.getHours() + 1);
693
- today.setMinutes(0);
694
- } else {
695
- today.setMinutes(30);
696
- }
697
- var time = formatAMPM(today);
698
- if (jQuery('#b2sUserLang').val() == 'de') {
699
- time = padDate(today.getHours()) + ':' + padDate(today.getMinutes());
700
- }
701
-
702
- html += '</div>';
703
- html += '<div class="pull-right">';
704
- html += '<a class="b2s-network-item-auth-list-btn-delete b2s-add-padding-network-delete pull-right" data-network-type="' + networkType + '" data-network-id="' + networkId + '" data-network-auth-id="' + networkAuthId + '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
705
-
706
- if (jQuery('#b2sUserVersion').val() == '0') {
707
- html += '<span class="b2s-sched-manager-premium-area pull-right hidden-xs" style="width: 240px;"><span class="label label-success"><a href="#" class="btn-label-premium b2sInfoSchedTimesModalBtn">SMART</a></span></span>';
708
- } else {
709
- html += '<span class="b2s-sched-manager-time-area pull-right b2s-sched-manager-add-padding hidden-xs" style="margin-right:30px !important;">';
710
- html += '<input class="form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time" type="text" value="' + time + '" readonly data-network-auth-id="' + networkAuthId + '" data-network-mandant-id="' + mandandId + '" data-network-id="' + networkId + '" data-network-type="' + networkType + '" name="b2s-user-sched-data[time][' + networkAuthId + ']">';
711
- html += '</span>';
712
- html += '<span class="b2s-sched-manager-day-area pull-right hidden-xs" style=""><span class="b2s-sched-manager-item-input-day-btn-minus" data-network-auth-id="' + networkAuthId + '">-</span> <span class="b2s-text-middle">+</span>';
713
- html += '<input type="text" class="b2s-sched-manager-item-input-day" data-network-auth-id="' + networkAuthId + '" data-network-mandant-id="' + mandandId + '" data-network-id="' + networkId + '" data-network-type="' + networkType + '" name="b2s-user-sched-data[delay_day][' + networkAuthId + ']" value="0" readonly> <span class="b2s-text-middle">' + days + '</span> <span class="b2s-sched-manager-item-input-day-btn-plus" data-network-auth-id="' + networkAuthId + '">+</span></span>';
714
- }
715
- html += '</div>';
716
- html += '<div class="clearfix"></div>';
717
- html += '</li>';
718
-
719
- jQuery(html).insertAfter('.b2s-network-item-auth-list-li[data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-view="all"]:first');
720
- jQuery(html).insertAfter('.b2s-network-item-auth-list-li[data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-view="selected"]:first');
721
- jQuery('.b2s-settings-sched-item-input-time[data-network-auth-id="' + networkAuthId + '"]').val(time);
722
- var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + networkId + '"').text();
723
- var newCount = parseInt(networkCount) + 1;
724
- jQuery('.b2s-network-auth-count-current[data-network-id="' + networkId + '"').text(newCount);
725
- init();
726
- if (jQuery('#b2sUserVersion').val() >= 1) {
727
- saveTimeSettings();
728
- }
729
-
730
- //Update
731
- } else {
732
- jQuery('.b2s-network-auth-update-btn[data-network-auth-id="' + networkAuthId + '"').show();
733
- if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').length > 0) {
734
- var html = '<span class="b2s-network-item-auth-type">' + typ[networkType] + '</span>: ';
735
- html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
736
- if (mandandId >= 0) {
737
- var mandantName = jQuery(".b2s-network-mandant-select option:selected").text();
738
- if (mandandId <= 0) {
739
- mandantName = jQuery(".b2s-network-mandant-select option[value='0']").text();
740
- }
741
- html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
742
- }
743
- jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"] div:first').html(html);
744
- jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').removeClass('b2s-label-danger-border-left').addClass('b2s-label-success-border-left');
745
- }
746
- }
747
- //Update other Auth with same networkId, networkType and displayName (only optical)
748
- jQuery('.b2s-network-item-auth-list-li[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').each(function () {
749
- if (jQuery(this).find('.b2s-network-item-auth-user-name').html() == displayName) {
750
- jQuery(this).removeClass('b2s-label-danger-border-left').addClass('b2s-label-success-border-left');
751
- jQuery(this).find('.b2s-network-auth-list-info[data-b2s-auth-info="isInterrupted"]').hide();
752
- }
753
- });
754
- }
755
-
756
-
757
- jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
758
- jQuery('.b2s-server-connection-fail').hide();
759
- jQuery.ajax({
760
- url: ajaxurl,
761
- type: "POST",
762
- dataType: "json",
763
- cache: false,
764
- data: {
765
- 'action': 'b2s_get_settings_sched_time_default',
766
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
767
- },
768
- error: function () {
769
- jQuery('.b2s-server-connection-fail').show();
770
- return false;
771
- },
772
- success: function (data) {
773
- if (data.result == true) {
774
- jQuery.each(data.times, function (network_id, time) {
775
- time.forEach(function (network_type_time, count) {
776
- if (network_type_time != "") {
777
- jQuery('.b2s-settings-sched-item-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val(network_type_time);
778
- count++;
779
- }
780
- });
781
- });
782
- saveTimeSettings();
783
- } else {
784
- if (data.error == 'nonce') {
785
- jQuery('.b2s-nonce-check-fail').show();
786
- }
787
- }
788
- }
789
- });
790
- return false;
791
- });
792
-
793
- function saveTimeSettings() {
794
- jQuery('.b2s-settings-user-error').hide();
795
- jQuery.ajax({
796
- processData: false,
797
- url: ajaxurl,
798
- type: "POST",
799
- dataType: "json",
800
- cache: false,
801
- data: jQuery('#b2sSaveTimeSettings').serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
802
- error: function () {
803
- return false;
804
- },
805
- success: function (data) {
806
- if (data.result !== true) {
807
- if (data.error == 'nonce') {
808
- jQuery('.b2s-nonce-check-fail').show();
809
- }
810
- jQuery('.b2s-settings-user-error').show();
811
- }
812
- }
813
- });
814
- }
815
-
816
- function wop(url, name) {
817
- jQuery('.b2s-network-auth-info').hide();
818
- jQuery('.b2s-network-auth-success').hide();
819
- var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
820
- 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");
821
- }
822
-
823
- function showFilter(typ) {
824
- if (typ == 'show') {
825
- jQuery('.filterShow').hide();
826
- jQuery('.form-inline').show();
827
- jQuery('.filterHide').show();
828
- } else {
829
- jQuery('.filterShow').show();
830
- jQuery('.form-inline').hide();
831
- jQuery('.filterHide').hide();
832
- }
833
- }
834
-
835
-
836
- function formatAMPM(date) {
837
- var hours = date.getHours();
838
- var minutes = date.getMinutes();
839
- var ampm = hours >= 12 ? 'PM' : 'AM';
840
- hours = hours % 12;
841
- hours = hours ? hours : 12; // the hour '0' should be '12'
842
- minutes = minutes < 10 ? '0' + minutes : minutes;
843
- var strTime = hours + ':' + minutes + ' ' + ampm;
844
- return strTime;
845
- }
846
-
847
- function padDate(n) {
848
- return ("0" + n).slice(-2);
849
- }
850
-
851
- jQuery(document).on('click', '.b2s-edit-template-btn', function () {
852
- jQuery('.b2s-edit-template-content').hide();
853
- jQuery('.b2s-edit-template-save-btn').hide();
854
- jQuery('.b2s-loading-area').show();
855
- jQuery('#b2s-edit-template').modal('show');
856
- jQuery('#b2s-edit-template-network-id').val(jQuery(this).attr('data-network-id'));
857
- var networkId = jQuery(this).attr('data-network-id');
858
- jQuery('.b2s-edit-template-network-img').hide();
859
- jQuery('#b2s-edit-template-network-img-' + networkId).show();
860
-
861
- jQuery.ajax({
862
- url: ajaxurl,
863
- type: "GET",
864
- dataType: "json",
865
- cache: false,
866
- data: {
867
- 'action': 'b2s_get_edit_template',
868
- 'networkId': networkId,
869
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
870
- },
871
- error: function () {
872
- jQuery('.b2s-server-connection-fail').show();
873
- return false;
874
- },
875
- success: function (data) {
876
- if (data.result == true) {
877
- jQuery('.b2s-edit-template-content').html(data.content);
878
- jQuery('.b2s-loading-area').hide();
879
- jQuery('.b2s-edit-template-content').show();
880
- jQuery('.b2s-edit-template-save-btn').show();
881
- if (jQuery('#b2sUserVersion').val() < 1 && networkId != 1) {
882
- jQuery('.b2s-edit-template-save-btn').addClass('b2s-btn-disabled');
883
- } else {
884
- jQuery('.b2s-edit-template-save-btn').removeClass('b2s-btn-disabled');
885
- }
886
- } else {
887
- if (data.error == 'nonce') {
888
- jQuery('.b2s-nonce-check-fail').show();
889
- }
890
- }
891
- }
892
- });
893
- });
894
-
895
- jQuery(window).on("load", function () {
896
- if (jQuery('#b2sUserVersion').val() >= 1) {
897
- jQuery(document).on('click', '.b2s-edit-template-link-post', function () {
898
- jQuery('.b2s-edit-template-image-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-primary').addClass('btn-light');
899
- jQuery('.b2s-edit-template-link-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-light').addClass('btn-primary');
900
- jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('0');
901
- jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
902
- jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
903
- });
904
-
905
- jQuery(document).on('click', '.b2s-edit-template-image-post', function () {
906
- jQuery('.b2s-edit-template-link-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-primary').addClass('btn-light');
907
- jQuery('.b2s-edit-template-image-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-light').addClass('btn-primary');
908
- jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('1');
909
- jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
910
- jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
911
- });
912
-
913
-
914
- document.addEventListener('dragstart', function (event) {
915
- event.dataTransfer.setData('Text', event.target.innerHTML);
916
- });
917
-
918
- document.addEventListener('drop', function (event) {
919
- setTimeout(function () {
920
- jQuery('.b2s-edit-template-post-content').trigger('keyup');
921
- }, 0);
922
- });
923
-
924
- jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-edit-template-post-content', function () {
925
- var tb = jQuery(this).get(0);
926
- jQuery('.b2s-edit-template-content-selection-start[data-network-type="' + jQuery(this).attr('data-network-type') + '"]').val(tb.selectionStart);
927
- jQuery('.b2s-edit-template-content-selection-end[data-network-type="' + jQuery(this).attr('data-network-type') + '"]').val(tb.selectionEnd);
928
- });
929
-
930
- jQuery(document).on('keyup', '.b2s-edit-template-post-content', function () {
931
- jQuery('.b2s-edit-template-preview-content[data-network-type="' + jQuery(this).attr('data-network-type') + '"]').html(jQuery(this).val().replace(/\n/g, "<br>"));
932
- });
933
-
934
- jQuery(document).on('keydown', '.b2s-edit-template-post-content', function () {
935
- var tb = jQuery(this).get(0);
936
- var start = tb.selectionStart;
937
- var end = tb.selectionEnd;
938
- var reg = new RegExp("({.+?})", "g");
939
- var amatch = null;
940
- while ((amatch = reg.exec(jQuery(this).val())) != null) {
941
- var thisMatchStart = amatch.index;
942
- var thisMatchEnd = amatch.index + amatch[0].length;
943
- //case: keydown in pattern
944
- if (start > thisMatchStart && end <= thisMatchEnd && (event.keyCode == 8 || event.keyCode == 46)) {
945
- jQuery(this).val(jQuery(this).val().substr(0, thisMatchStart) + jQuery(this).val().substr(thisMatchEnd));
946
- event.preventDefault();
947
- return false;
948
-
949
- }
950
- //case: before pattern
951
- if (start <= thisMatchStart && end > thisMatchStart && (event.keyCode > 40 || event.keyCode < 16 || event.keyCode == 32)) {
952
- event.preventDefault();
953
- return false;
954
- //case: after pattern
955
- } else if (start > thisMatchStart && start < thisMatchEnd && (event.keyCode > 40 || event.keyCode < 16 || event.keyCode == 32)) {
956
- event.preventDefault();
957
- return false;
958
- }
959
- }
960
- });
961
-
962
- jQuery(document).on('click', '.b2s-edit-template-content-post-item', function () {
963
- var networkType = jQuery(this).attr('data-network-type');
964
- var text = jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val();
965
- var start = jQuery('.b2s-edit-template-content-selection-start[data-network-type="' + networkType + '"]').val();
966
- var end = jQuery('.b2s-edit-template-content-selection-end[data-network-type="' + networkType + '"]').val();
967
-
968
- var reg = new RegExp("({.+?})", "g");
969
- var amatch = null;
970
- while ((amatch = reg.exec(text)) != null) {
971
- var thisMatchStart = amatch.index;
972
- var thisMatchEnd = amatch.index + amatch[0].length;
973
- //case: keydown in pattern
974
- if (start > thisMatchStart && end < thisMatchEnd) {
975
- event.preventDefault();
976
- return false;
977
- }
978
- }
979
- var newText = text.slice(0, start) + jQuery(this).html() + text.slice(end);
980
- jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val(newText);
981
- jQuery('.b2s-edit-template-post-content').focus();
982
- jQuery('.b2s-edit-template-post-content').trigger('keyup');
983
- event.preventDefault();
984
- return false;
985
- });
986
-
987
- jQuery(document).on('click', '.b2s-edit-template-content-clear-btn', function () {
988
- var networkType = jQuery(this).attr('data-network-type');
989
- jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val("");
990
- jQuery('.b2s-edit-template-post-content').focus();
991
- jQuery('.b2s-edit-template-post-content').trigger('keyup');
992
- event.preventDefault();
993
- return false;
994
- });
995
-
996
-
997
- jQuery(document).on('keyup', '.b2s-edit-template-range', function () {
998
- if (isNaN(parseInt(jQuery(this).val())) || parseInt(jQuery(this).val()) < 1) {
999
- jQuery(this).val("1");
1000
- }
1001
- if (jQuery(this).attr('max') > 0 && parseInt(jQuery(this).val()) > jQuery(this).attr('max')) {
1002
- jQuery(this).val(jQuery(this).attr('max'));
1003
- }
1004
- event.preventDefault();
1005
- return false;
1006
- });
1007
-
1008
- jQuery(document).on('keyup', '.b2s-edit-template-excerpt-range', function () {
1009
- if (isNaN(parseInt(jQuery(this).val())) || parseInt(jQuery(this).val()) < 1) {
1010
- jQuery(this).val("1");
1011
- }
1012
- if (jQuery(this).attr('max') > 0 && parseInt(jQuery(this).val()) > jQuery(this).attr('max')) {
1013
- jQuery(this).val(jQuery(this).attr('max'));
1014
- }
1015
- event.preventDefault();
1016
- return false;
1017
- });
1018
-
1019
-
1020
-
1021
- jQuery(document).on('click', '.b2s-edit-template-load-default', function () {
1022
- jQuery('.b2s-edit-template-content').hide();
1023
- jQuery('.b2s-edit-template-save-btn').hide();
1024
- jQuery('.b2s-edit-template-save-success').hide();
1025
- jQuery('.b2s-edit-template-save-failed').hide();
1026
- jQuery('.b2s-loading-area').show();
1027
- var networkType = jQuery(this).attr('data-network-type');
1028
-
1029
- jQuery.ajax({
1030
- url: ajaxurl,
1031
- type: "POST",
1032
- dataType: "json",
1033
- cache: false,
1034
- data: {
1035
- 'action': 'b2s_load_default_post_template',
1036
- 'networkId': jQuery('#b2s-edit-template-network-id').val(),
1037
- 'networkType': networkType,
1038
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1039
- },
1040
- error: function () {
1041
- jQuery('.b2s-loading-area').hide();
1042
- jQuery('.b2s-edit-template-content').show();
1043
- jQuery('.b2s-edit-template-save-btn').show();
1044
- jQuery('.b2s-edit-template-load-default-failed').show();
1045
- return false;
1046
- },
1047
- success: function (data) {
1048
- jQuery('.b2s-loading-area').hide();
1049
- jQuery('.b2s-edit-template-content').show();
1050
- jQuery('.b2s-edit-template-save-btn').show();
1051
- if (data.result == true) {
1052
- jQuery('.b2s-template-tab-' + networkType).html(data.html);
1053
- } else {
1054
- if (data.error == 'nonce') {
1055
- jQuery('.b2s-nonce-check-fail').show();
1056
- }
1057
- jQuery('.b2s-edit-template-load-default-failed').show();
1058
- }
1059
- }
1060
- });
1061
- });
1062
- }
1063
- });
1064
-
1065
- jQuery(document).on('click', '.b2s-edit-template-save-btn', function () {
1066
- if (jQuery('#b2sUserVersion').val() < 1 && jQuery('#b2s-edit-template-network-id').val() != 1) {
1067
- return false;
1068
- }
1069
-
1070
- if (jQuery('#b2s-edit-template-network-id').val() == 12) {
1071
- var matches = jQuery('.b2s-edit-template-post-content').val().match(/#/g);
1072
- if (matches != null && matches.length > 30) {
1073
- jQuery('.b2s-edit-template-post-content').addClass('error');
1074
- jQuery('.b2s-edit-template-hashtag-warning').show();
1075
- return false;
1076
- } else {
1077
- jQuery('.b2s-edit-template-post-content').removeClass('error');
1078
- jQuery('.b2s-edit-template-hashtag-warning').hide();
1079
- }
1080
- }
1081
-
1082
- jQuery('.b2s-edit-template-content').hide();
1083
- jQuery('.b2s-edit-template-save-btn').hide();
1084
- jQuery('.b2s-edit-template-save-success').hide();
1085
- jQuery('.b2s-edit-template-save-failed').hide();
1086
- jQuery('.b2s-loading-area').show();
1087
-
1088
- template_data = {};
1089
-
1090
- jQuery('.b2s-edit-template-post-content').each(function (i, obj) {
1091
- var networkType = jQuery(obj).attr('data-network-type');
1092
- template_data[networkType] = {};
1093
- template_data[networkType]['format'] = jQuery('.b2s-edit-template-post-format[data-network-type="' + networkType + '"]').val();
1094
- template_data[networkType]['content'] = jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val();
1095
- template_data[networkType]['range_max'] = jQuery('.b2s-edit-template-range[data-network-type="' + networkType + '"]').val();
1096
- template_data[networkType]['excerpt_range_max'] = jQuery('.b2s-edit-template-excerpt-range[data-network-type="' + networkType + '"]').val();
1097
- });
1098
-
1099
- jQuery.ajax({
1100
- url: ajaxurl,
1101
- type: "POST",
1102
- dataType: "json",
1103
- cache: false,
1104
- data: {
1105
- 'action': 'b2s_save_post_template',
1106
- 'template_data': template_data,
1107
- 'networkId': jQuery('#b2s-edit-template-network-id').val(),
1108
- 'link_no_cache': (jQuery("#link-no-cache").is(':checked') ? '1' : '0'),
1109
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1110
- },
1111
- error: function () {
1112
- jQuery('.b2s-loading-area').hide();
1113
- jQuery('.b2s-edit-template-content').show();
1114
- jQuery('.b2s-edit-template-save-btn').show();
1115
- jQuery('.b2s-edit-template-save-failed').show();
1116
- return false;
1117
- },
1118
- success: function (data) {
1119
- jQuery('.b2s-loading-area').hide();
1120
- jQuery('.b2s-edit-template-content').show();
1121
- jQuery('.b2s-edit-template-save-btn').show();
1122
- if (data.result == true) {
1123
- jQuery('.b2s-edit-template-save-success').show();
1124
- setTimeout(function () {
1125
- jQuery('.b2s-edit-template-save-success').fadeOut();
1126
- }, 3000);
1127
- } else {
1128
- if (data.error == 'nonce') {
1129
- jQuery('.b2s-nonce-check-fail').show();
1130
- }
1131
- jQuery('.b2s-edit-template-save-failed').show();
1132
- }
1133
- }
1134
- });
1135
- });
1136
-
1137
-
1138
- jQuery('#b2sInfoNoCache').on('hidden.bs.modal', function () {
1139
- jQuery('body').addClass('modal-open');
1140
- });
1141
- jQuery('#b2sInfoFormat').on('hidden.bs.modal', function () {
1142
- jQuery('body').addClass('modal-open');
1143
- });
1144
-
1145
- jQuery(document).on('click', '.b2sInfoFormatBtn', function () {
1146
- jQuery('#b2sInfoFormat').modal('show');
1147
- var id = jQuery(this).attr('data-network-id');
1148
- jQuery('.b2sInfoFormatText').hide();
1149
- jQuery('.b2sInfoFormatText[data-network-id="' + id + '"]').show();
1150
- });
1151
-
1152
- jQuery('#b2sInfoContent').on('hidden.bs.modal', function () {
1153
- jQuery('body').addClass('modal-open');
1154
- });
1155
- jQuery('#b2sInfoCharacterLimit').on('hidden.bs.modal', function () {
1156
- jQuery('body').addClass('modal-open');
1157
- });
1158
-
1159
-
1160
- jQuery(document).on('click', '.b2s-auth-network-6-login-btn', function () {
1161
- jQuery('#b2s-auth-network-6-username').removeClass('error');
1162
- jQuery('#b2s-auth-network-6-password').removeClass('error');
1163
- var loginDataCheck = true;
1164
- if (jQuery('#b2s-auth-network-6-username').val() == '') {
1165
- jQuery('#b2s-auth-network-6-username').addClass('error');
1166
- loginDataCheck = false;
1167
- }
1168
- if (jQuery('#b2s-auth-network-6-password').val() == '') {
1169
- jQuery('#b2s-auth-network-6-password').addClass('error');
1170
- loginDataCheck = false;
1171
- }
1172
- if (!loginDataCheck) {
1173
- return false;
1174
- }
1175
- jQuery('.b2s-loading-area').show();
1176
- jQuery('.b2s-auth-network-6-login-area').hide();
1177
- jQuery('.b2s-auth-network-6-login-btn').hide();
1178
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
1179
- jQuery('.b2s-auth-network-6-info').hide();
1180
- jQuery.ajax({
1181
- url: ajaxurl,
1182
- type: "POST",
1183
- dataType: "json",
1184
- cache: false,
1185
- data: {
1186
- 'action': 'b2s_auth_network_login',
1187
- 'username': jQuery('#b2s-auth-network-6-username').val(),
1188
- 'password': jQuery('#b2s-auth-network-6-password').val(),
1189
- 'location': jQuery('#b2s-auth-network-6-location').val(),
1190
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1191
- },
1192
- error: function (jqXHR) {
1193
- jQuery('.b2s-loading-area').hide();
1194
- jQuery('.b2s-auth-network-6-login-area').show();
1195
- jQuery('.b2s-auth-network-6-login-btn').show();
1196
- if (jqXHR.status == 403) {
1197
- jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
1198
- } else {
1199
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
1200
- }
1201
- return false;
1202
- },
1203
- success: function (data) {
1204
- jQuery('.b2s-loading-area').hide();
1205
- jQuery('.b2s-auth-network-6-login-area').show();
1206
- if (data.result == true) {
1207
- jQuery('#b2s-auth-network-6-board').html(data.boards);
1208
- jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
1209
- jQuery('.b2s-auth-network-6-board-area').show();
1210
- jQuery('.b2s-auth-network-6-confirm-btn').show();
1211
- jQuery('.b2s-auth-network-6-info[data-info="success"]').show();
1212
- } else {
1213
- jQuery('.b2s-auth-network-6-login-btn').show();
1214
- if (data.error == 'nonce') {
1215
- jQuery('.b2s-nonce-check-fail').show();
1216
- }
1217
- if (typeof data.error != 'undefined' && data.error != '') {
1218
- jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
1219
- return false;
1220
- }
1221
- jQuery('.b2s-auth-network-6-info[data-info="login"]').show();
1222
- }
1223
- }
1224
- });
1225
- });
1226
-
1227
- jQuery(document).on('click', '.b2s-auth-network-6-confirm-btn', function () {
1228
- jQuery('.b2s-loading-area').show();
1229
- jQuery('.b2s-auth-network-6-login-area').hide();
1230
- jQuery('.b2s-auth-network-6-login-btn').hide();
1231
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
1232
- jQuery.ajax({
1233
- url: ajaxurl,
1234
- type: "POST",
1235
- dataType: "json",
1236
- cache: false,
1237
- data: {
1238
- 'action': 'b2s_auth_network_confirm',
1239
- 'username': jQuery('#b2s-auth-network-6-username').val(),
1240
- 'password': jQuery('#b2s-auth-network-6-password').val(),
1241
- 'boardId': jQuery('#b2s-auth-network-6-board').val(),
1242
- 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
1243
- 'mandantId': jQuery('#b2s-auth-network-6-mandant-id').val(),
1244
- 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
1245
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1246
- },
1247
- error: function (jqXHR) {
1248
- jQuery('.b2s-loading-area').hide();
1249
- jQuery('.b2s-auth-network-6-login-area').show();
1250
- jQuery('.b2s-auth-network-6-confirm-btn').show();
1251
- if (jqXHR.status == 403) {
1252
- jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
1253
- } else {
1254
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
1255
- }
1256
- return false;
1257
- },
1258
- success: function (data) {
1259
- jQuery('.b2s-loading-area').hide();
1260
- jQuery('.b2s-auth-network-6-login-area').show();
1261
- jQuery('.b2s-auth-network-6-confirm-btn').show();
1262
- if (data.result == true) {
1263
- jQuery('#b2sAuthNetwork6Modal').modal('hide');
1264
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
1265
- } else {
1266
- if (data.error == 'nonce') {
1267
- jQuery('.b2s-nonce-check-fail').show();
1268
- }
1269
- if (typeof data.error != 'undefined' && data.error != '') {
1270
- jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
1271
- return false;
1272
- }
1273
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
1274
- }
1275
- }
1276
- });
1277
- });
1278
-
1279
- jQuery(document).on('click', '.b2s-network-auth-btn[data-auth-method="client"]', function () {
1280
- jQuery('#b2s-auth-network-6-mandant-id').val(jQuery(this).attr('data-network-mandant-id'));
1281
- jQuery('#b2sAuthNetwork6Modal').modal('show');
1282
- });
1283
- jQuery(document).on('click', '.b2s-network-add-mandant-btn', function () {
1284
- jQuery('#b2s-network-add-mandant').modal('show');
1285
- });
1286
- jQuery(document).on('click', '.b2sInfoSchedTimesModalBtn', function () {
1287
- jQuery('#b2sInfoSchedTimesModal').modal('show');
1288
- });
1289
- jQuery(document).on('click', '.b2sInfoNetwork18Btn', function () {
1290
- jQuery('#b2sInfoNetwork18').modal('show');
1291
- });
1292
- jQuery(document).on('click', '.b2sInfoNoCacheBtn', function () {
1293
- jQuery('#b2sInfoNoCache').modal('show');
1294
- });
1295
- jQuery(document).on('click', '.b2sInfoContentBtn', function () {
1296
- jQuery('#b2sInfoContent').modal('show');
1297
- });
1298
- jQuery(document).on('click', '.b2sInfoCharacterLimitBtn', function () {
1299
- jQuery('#b2sInfoCharacterLimit').modal('show');
1300
- });
1301
-
1302
- jQuery(document).on('click', '.b2s-network-auth-update-btn[data-auth-method="client"]', function () {
1303
- jQuery('#b2s-auth-network-6-auth-id').val(jQuery(this).attr('data-network-auth-id'));
1304
- jQuery('#b2s-auth-network-6-mandant-id').val(jQuery(this).attr('data-network-mandant-id'));
1305
- jQuery('#b2sAuthNetwork6Modal').modal('show');
1306
- });
1307
-
1308
- //reset
1309
- jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
1310
- jQuery('.b2s-loading-area').hide();
1311
- jQuery('.b2s-auth-network-6-login-area').show();
1312
- jQuery('#b2s-auth-network-6-auth-id').val('');
1313
- jQuery('#b2s-auth-network-6-board').html('');
1314
- jQuery('#b2s-auth-network-6-ident-data').val('');
1315
- jQuery('.b2s-auth-network-6-info').hide();
1316
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
1317
- jQuery('.b2s-auth-network-6-login-btn').show();
1318
- jQuery('.b2s-auth-network-6-board-area').hide();
1319
- jQuery('#b2s-auth-network-6-username').val('');
1320
- jQuery('#b2s-auth-network-6-password').val('');
1321
- });
1322
-
1323
- jQuery(".b2s-auth-network-6-reveal").mousedown(function () {
1324
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'text'));
1325
- });
1326
- jQuery(".b2s-auth-network-6-reveal").mouseup(function () {
1327
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
1328
- });
1329
- jQuery(".b2s-auth-network-6-reveal").mouseout(function () {
1330
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
1331
- });
1332
- // END Pinterest
1333
-
1334
- //START Network Auth Settings
1335
- jQuery(document).on('click', '.b2s-network-auth-settings-btn', function () {
1336
- jQuery('#b2s-edit-network-auth-settings').modal('show');
1337
- if (jQuery('#b2sUserVersion').val() >= 3) {
1338
-
1339
- jQuery('.b2s-network-auth-settings-content').hide();
1340
- jQuery('.b2s-loading-area').show();
1341
-
1342
- jQuery('.b2s-move-connection-error').hide();
1343
- jQuery('.b2s-connection-assign').hide();
1344
- jQuery('.b2s-assignment-area').hide();
1345
- jQuery('.b2s-connection-owner').hide();
1346
- jQuery('.b2s-assign-error').hide();
1347
- jQuery('#b2s-no-assign-user').hide();
1348
- jQuery('#b2s-assign-info').show();
1349
- jQuery('.b2s-url-parameter-error').hide();
1350
- jQuery('.b2s-url-parameter-content').show();
1351
-
1352
- jQuery('#b2sUserAuthId').val(jQuery(this).attr('data-network-auth-id'));
1353
- jQuery('#b2sOldMandantId').val(jQuery(this).attr('data-network-mandant-id'));
1354
- jQuery('#b2sNetworkId').val(jQuery(this).attr('data-network-id'));
1355
- jQuery('#b2sNetworkType').val(jQuery(this).attr('data-network-type'));
1356
-
1357
- //Move connection to network mandant
1358
- if (jQuery('#b2s-move-connection-select').length) {
1359
- jQuery('#b2s-move-connection-select').html(jQuery('.b2s-network-mandant-select').html());
1360
- jQuery("#b2s-move-connection-select option[value='-1']").remove();
1361
- jQuery("#b2s-move-connection-select option[value='" + jQuery(this).attr('data-network-mandant-id') + "']").remove();
1362
- if (jQuery(this).attr('data-network-mandant-id') <= 0) {
1363
- if (jQuery('#b2s-network-select-more-client').length) {
1364
- var temp_options = jQuery('#b2s-move-connection-select #b2s-network-select-more-client').html();
1365
- jQuery("#b2s-move-connection-select optiongroup").remove();
1366
- jQuery("#b2s-move-connection-select").html(temp_options);
1367
- } else {
1368
- jQuery('#b2s-move-connection-input').hide();
1369
- jQuery('#b2s-move-connection-error').show();
1370
- }
1371
- } else {
1372
- if (!jQuery('#b2s-move-connection-select #b2s-network-select-more-client option').length) {
1373
- var temp_options = jQuery("#b2s-move-connection-select option[value='0']");
1374
- jQuery("#b2s-move-connection-select optiongroup").remove();
1375
- jQuery("#b2s-move-connection-select").html(temp_options);
1376
- }
1377
- }
1378
- }
1379
-
1380
- jQuery.ajax({
1381
- url: ajaxurl,
1382
- type: "GET",
1383
- dataType: "json",
1384
- cache: false,
1385
- data: {
1386
- 'action': 'b2s_get_network_auth_settings',
1387
- 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
1388
- 'owner': jQuery(this).attr('data-connection-owner'),
1389
- 'networkId': jQuery(this).attr('data-network-id'),
1390
- 'networkType': jQuery('#b2sNetworkType').val(),
1391
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1392
- },
1393
- error: function () {
1394
- jQuery('.b2s-server-connection-fail').show();
1395
- return false;
1396
- },
1397
- success: function (data) {
1398
- if (data.result == true) {
1399
- jQuery('.b2s-loading-area').hide();
1400
- jQuery('.b2s-network-auth-settings-content').show();
1401
- var result = JSON.parse(data.data);
1402
-
1403
- //URL Parameter
1404
- if (typeof result.urlParameter != 'undefined' && result.urlParameter.length > 0) {
1405
- jQuery('.b2s-url-parameter-content').html(result.urlParameter);
1406
- if (jQuery('.b2s-url-parameter-entry').length <= 0) {
1407
- jQuery('.b2s-col-name').hide();
1408
- }
1409
- } else {
1410
- jQuery('.b2s-url-parameter-error[data-error-reason="default"]').show();
1411
- jQuery('.b2s-url-parameter-content').hide();
1412
- }
1413
-
1414
- //User Assign
1415
- if (typeof result.ownerName != 'undefined') { //Case: network is assigned by other user
1416
- jQuery('#b2s-connection-owner-name').text(result.ownerName);
1417
- jQuery('.b2s-connection-owner').show();
1418
- jQuery('.b2s-assignment-area').show();
1419
- } else if (typeof result.userSelect != 'undefined' && typeof result.assignList != 'undefined') { //Case: user is network owner
1420
- jQuery('#b2s-connection-assign-select').html(result.userSelect);
1421
- jQuery('.b2s-network-assign-list').html(result.assignList);
1422
- if (jQuery('#b2s-approved-user-list li').length <= 1) {
1423
- jQuery('#b2s-approved-user-list').hide();
1424
- } else {
1425
- jQuery('#b2s-approved-user-list').show();
1426
- }
1427
- if (jQuery('#b2s-select-assign-user').html() == '') {
1428
- jQuery('#b2s-select-assign-user').attr('disabled', true);
1429
- jQuery('#b2s-assign-network-user-auth').attr('disabled', true);
1430
- jQuery('.b2s-network-assign-option').hide();
1431
- jQuery('#b2s-assign-info').hide();
1432
- jQuery('#b2s-no-assign-user').show();
1433
- } else {
1434
- jQuery('#b2s-select-assign-user').removeAttr('disabled');
1435
- jQuery('#b2s-assign-network-user-auth').removeAttr('disabled');
1436
- jQuery('.b2s-network-assign-option').show();
1437
- jQuery('#b2s-no-assign-user').hide();
1438
- jQuery('#b2s-assign-info').show();
1439
- }
1440
- jQuery('.b2s-connection-assign').show();
1441
- jQuery('.b2s-assignment-area').show();
1442
- jQuery('.b2s-network-assign-list').show();
1443
- jQuery('#b2s-connection-assign-select').show();
1444
- } else {
1445
- jQuery('.b2s-assign-error[data-error-reason="default"]').show();
1446
- jQuery('.b2s-connection-assign').show();
1447
- jQuery('.b2s-assignment-area').show();
1448
- jQuery('#b2s-assign-network-user-auth').hide();
1449
- jQuery('#b2s-assign-info').hide();
1450
- jQuery('.b2s-network-assign-option').hide();
1451
- jQuery('.b2s-network-assign-list').hide();
1452
- jQuery('#b2s-connection-assign-select').hide();
1453
- }
1454
-
1455
- } else {
1456
- jQuery('#b2s-edit-network-auth-settings').modal('hide');
1457
- if(result.error == 'nonce') {
1458
- jQuery('.b2s-nonce-check-fail').show();
1459
- return false;
1460
- }
1461
- jQuery('.b2s-server-connection-fail').show();
1462
- return false;
1463
- }
1464
- }
1465
- });
1466
- } else {
1467
- jQuery('.b2s-loading-area').hide();
1468
- }
1469
- });
1470
-
1471
- //START URL Parameter
1472
- jQuery(document).on('click', '.b2s-url-parameter-add-btn', function () {
1473
- jQuery('.b2s-col-name').show();
1474
- var html = '<li class="b2s-url-parameter-entry row">';
1475
- html += '<div class="col-md-5"><input class="form-control b2s-link-parameter-name" value=""></div>';
1476
- html += '<div class="col-md-5"><input class="form-control b2s-link-parameter-value" value=""></div>';
1477
- html += '<div class="col-md-1"><span aria-hidden="true" class="b2s-url-parameter-remove-btn text-danger">&times;</span></div>';
1478
- html += '</li>';
1479
- jQuery('.b2s-url-parameter-list').append(html);
1480
- if (jQuery('.b2s-url-parameter-entry').length >= 10) {
1481
- jQuery('.b2s-url-parameter-add-btn').hide();
1482
- }
1483
- });
1484
-
1485
- jQuery(document).on('click', '.b2s-url-parameter-remove-btn', function () {
1486
- jQuery(this).closest('li').remove();
1487
- if (jQuery('.b2s-url-parameter-entry').length <= 0) {
1488
- jQuery('.b2s-col-name').hide();
1489
- }
1490
- jQuery('.b2s-url-parameter-add-btn').show();
1491
- });
1492
-
1493
- jQuery(document).on('click', '.b2s-url-parameter-save-btn', function () {
1494
- jQuery('.b2s-network-auth-settings-content').hide();
1495
- jQuery('.b2s-loading-area').show();
1496
- jQuery('.b2s-url-parameter-error').hide();
1497
-
1498
- var urlParameter = {};
1499
- jQuery('.b2s-url-parameter-entry').each(function () {
1500
- if (jQuery(this).find('.b2s-link-parameter-name').val().length != 0 && jQuery(this).find('.b2s-link-parameter-value').val().length != 0) {
1501
- urlParameter[jQuery(this).find('.b2s-link-parameter-name').val()] = jQuery(this).find('.b2s-link-parameter-value').val();
1502
- }
1503
- });
1504
-
1505
- var originNetworkAuthId = jQuery(this).attr('data-network-auth-id');
1506
-
1507
- var networks = [];
1508
- if (jQuery('.b2s-url-parameter-for-all').is(':checked')) { //get all network connections
1509
- jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li').each(function () {
1510
- if (typeof jQuery(this).data('network-auth-id') != 'undefined') {
1511
- networks.push({
1512
- 'networkAuthId': jQuery(this).data('network-auth-id'),
1513
- 'networkId': jQuery(this).data('network-id'),
1514
- 'networkType': jQuery(this).data('network-type'),
1515
- 'displayName': jQuery(this).find('.b2s-network-item-auth-user-name').text()
1516
- });
1517
- }
1518
- });
1519
- } else if (jQuery('.b2s-url-parameter-for-all-network').is(':checked')) { //get all network connections for specific network
1520
- jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li[data-network-id="' + jQuery(this).data('network-id') + '"]').each(function () {
1521
- if (typeof jQuery(this).data('network-auth-id') != 'undefined') {
1522
- networks.push({
1523
- 'networkAuthId': jQuery(this).data('network-auth-id'),
1524
- 'networkId': jQuery(this).data('network-id'),
1525
- 'networkType': jQuery(this).data('network-type'),
1526
- 'displayName': jQuery(this).find('.b2s-network-item-auth-user-name').text()
1527
- });
1528
- }
1529
- });
1530
- } else { //only current network connection
1531
- networks.push({
1532
- 'networkAuthId': originNetworkAuthId,
1533
- 'networkId': jQuery(this).data('network-id'),
1534
- 'networkType': jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li[data-network-auth-id="' + originNetworkAuthId + '"]').data('network-type'),
1535
- 'displayName': jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li[data-network-auth-id="' + originNetworkAuthId + '"]').find('.b2s-network-item-auth-user-name').text()
1536
- });
1537
- }
1538
-
1539
- jQuery.ajax({
1540
- url: ajaxurl,
1541
- type: "POST",
1542
- dataType: "json",
1543
- cache: false,
1544
- data: {
1545
- 'action': 'b2s_save_url_parameter',
1546
- 'originNetworkAuthId': originNetworkAuthId,
1547
- 'networks': networks,
1548
- 'networkId': jQuery(this).attr('data-network-id'),
1549
- 'urlParameter': JSON.stringify(urlParameter),
1550
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1551
- },
1552
- error: function () {
1553
- jQuery('.b2s-server-connection-fail').show();
1554
- return false;
1555
- },
1556
- success: function (data) {
1557
- jQuery('.b2s-loading-area').hide();
1558
- jQuery('.b2s-network-auth-settings-content').show();
1559
- if (data.result == true) {
1560
- if (data.html.length > 0) {
1561
- jQuery('.b2s-url-parameter-content').html(data.html);
1562
- if (jQuery('.b2s-url-parameter-entry').length <= 0) {
1563
- jQuery('.b2s-col-name').hide();
1564
- }
1565
- }
1566
- } else {
1567
- if (data.error == 'nonce') {
1568
- jQuery('.b2s-nonce-check-fail').show();
1569
- } else {
1570
- jQuery('.b2s-url-parameter-error[data-error-reason="save"]').show();
1571
- }
1572
- }
1573
- }
1574
- });
1575
- });
1576
- //END URL Parameter
1577
- //END Network Auth Settings
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+
3
+ jQuery(window).on("load", function () {
4
+
5
+ init();
6
+
7
+ if (jQuery('.b2s-network-mandant-select').val() == 0 || jQuery('.b2s-network-mandant-select').val() == -1) {
8
+ jQuery('.b2s-network-mandant-btn-delete').hide();
9
+ } else {
10
+ jQuery('.b2s-network-mandant-btn-delete').show();
11
+ }
12
+ jQuery('.b2s-network-details-container-list').hide();
13
+ jQuery('.b2s-network-details-container-list[data-mandant-id="' + jQuery('.b2s-network-mandant-select').val() + '"]').show();
14
+
15
+ jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
16
+ jQuery('.b2s-network-auth-count-current[data-network-id="' + jQuery(this).attr("data-network-id") + '"').text(jQuery(this).children('li').length - 1);
17
+ });
18
+ });
19
+
20
+ function init() {
21
+ var showMeridian = true;
22
+ if (jQuery('#b2sUserLang').val() == 'de') {
23
+ showMeridian = false;
24
+ }
25
+ jQuery('.b2s-settings-sched-item-input-time').timepicker({
26
+ minuteStep: 15,
27
+ appendWidgetTo: 'body',
28
+ showSeconds: false,
29
+ showMeridian: showMeridian,
30
+ defaultTime: 'current'
31
+ }).on('changeTime.timepicker', function (e) {
32
+ var networkAuthId = jQuery(e.target).attr('data-network-auth-id');
33
+ jQuery('.b2s-settings-sched-item-input-time[data-network-auth-id="' + networkAuthId + '"]').val(e.time.value);
34
+ saveTimeSettings();
35
+ });
36
+ }
37
+
38
+ var timeoutPlus;
39
+ var timeoutMinus;
40
+ jQuery(document).on('mousedown mouseup', '.b2s-sched-manager-item-input-day-btn-plus', function (e) {
41
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
42
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
43
+ if (e.type == "mousedown") {
44
+ timeoutPlus = setInterval(function () {
45
+ if (current < 99) {
46
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current++);
47
+ } else {
48
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(99);
49
+ }
50
+ }, 100);
51
+ } else {
52
+ clearInterval(timeoutPlus);
53
+ saveTimeSettings();
54
+ }
55
+ return false;
56
+ });
57
+
58
+ jQuery(document).on('mousedown mouseup', '.b2s-sched-manager-item-input-day-btn-minus', function (e) {
59
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
60
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
61
+ if (e.type == "mousedown") {
62
+ timeoutMinus = setInterval(function () {
63
+ if (current > 0) {
64
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current--);
65
+ } else {
66
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(0);
67
+ }
68
+ }, 100);
69
+ } else {
70
+ clearInterval(timeoutMinus);
71
+ saveTimeSettings();
72
+ }
73
+ return false;
74
+ });
75
+
76
+
77
+ jQuery(document).on('click', '.b2s-sched-manager-item-input-day-btn-minus', function () {
78
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
79
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
80
+ if (current > 0) {
81
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current - 1);
82
+ saveTimeSettings();
83
+ } else {
84
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(0);
85
+ }
86
+ });
87
+ jQuery(document).on('click', '.b2s-sched-manager-item-input-day-btn-plus', function () {
88
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
89
+ var current = parseInt(jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val());
90
+ if (current < 99) {
91
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(current + 1);
92
+ //TODO is show ALL other same items update
93
+ saveTimeSettings();
94
+ } else {
95
+ jQuery('.b2s-sched-manager-item-input-day[data-network-auth-id="' + networkAuthId + '"]').val(99);
96
+ }
97
+
98
+ });
99
+
100
+
101
+
102
+ jQuery(document).on('change', '.b2s-network-mandant-select', function () {
103
+ jQuery('.b2s-network-auth-info').hide();
104
+ if (jQuery(this).val() == 0 || jQuery(this).val() == -1) {
105
+ jQuery('.b2s-network-mandant-btn-delete').hide();
106
+ } else {
107
+ jQuery('.b2s-network-mandant-btn-delete').show();
108
+ }
109
+ jQuery('.b2s-network-details-container-list').hide();
110
+ jQuery('.b2s-network-details-container-list[data-mandant-id="' + jQuery(this).val() + '"]').show();
111
+ });
112
+
113
+ jQuery(document).on('click', '.b2s-network-mandant-btn-delete', function () {
114
+ jQuery('.b2s-network-auth-info').hide();
115
+ jQuery('#b2s-network-delete-mandant').modal('show');
116
+ });
117
+
118
+ jQuery(document).on('click', '.b2s-btn-network-delete-mandant-confirm', function () {
119
+ jQuery('.b2s-network-auth-area').hide();
120
+ jQuery('.b2s-loading-area').show();
121
+ jQuery('#b2s-network-delete-mandant').modal('hide');
122
+ jQuery('.b2s-server-connection-fail').hide();
123
+ jQuery.ajax({
124
+ url: ajaxurl,
125
+ type: "POST",
126
+ dataType: "json",
127
+ cache: false,
128
+ data: {
129
+ 'action': 'b2s_delete_mandant',
130
+ 'mandantId': jQuery('.b2s-network-mandant-select').val(),
131
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
132
+ },
133
+ error: function () {
134
+ jQuery('.b2s-server-connection-fail').show();
135
+ return false;
136
+ },
137
+ success: function (data) {
138
+ jQuery('.b2s-network-auth-info').hide();
139
+ jQuery('.b2s-network-auth-area').show();
140
+ jQuery('.b2s-loading-area').hide();
141
+ if (data.result == true && data.mandantId >= 1) {
142
+ jQuery('.b2s-network-details-container-list[data-mandant-id="' + data.mandantId + '"]').remove();
143
+ jQuery(".b2s-network-mandant-select option[value='" + data.mandantId + "']").remove();
144
+ jQuery(".b2s-network-mandant-select option[value='-1']").prop('selected', true);
145
+ jQuery(".b2s-network-details-container-list[data-mandant-id='0']").show();
146
+ jQuery('.b2s-network-remove-success').show();
147
+ jQuery('.b2s-network-mandant-btn-delete').hide();
148
+ } else {
149
+ if (data.error == 'nonce') {
150
+ jQuery('.b2s-nonce-check-fail').show();
151
+ }
152
+ jQuery('.b2s-network-remove-fail').show();
153
+ }
154
+ }
155
+ });
156
+ return false;
157
+ });
158
+
159
+ jQuery(document).on('change', '#b2s-modify-board-and-group-network-selected', function () {
160
+ if (jQuery(this).attr('data-network-id') == 8) {
161
+ var name = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
162
+ jQuery('#b2s-modify-board-and-group-name').val(name);
163
+ }
164
+ return true;
165
+ });
166
+
167
+ jQuery(document).on('click', '#b2s-move-user-auth-to-profile', function () {
168
+ jQuery('.b2s-network-auth-settings-content').hide();
169
+ jQuery('.b2s-move-connection-error').hide();
170
+ jQuery('.b2s-assign-error').hide();
171
+ jQuery('.b2s-loading-area').show();
172
+
173
+ var authId = jQuery('#b2sUserAuthId').val();
174
+ var mandantId = jQuery('#b2s-move-connection-select').val();
175
+ var oldMandantId = jQuery('#b2sOldMandantId').val();
176
+ var networkId = jQuery('#b2sNetworkId').val();
177
+ jQuery.ajax({
178
+ url: ajaxurl,
179
+ type: "POST",
180
+ dataType: "json",
181
+ cache: false,
182
+ data: {
183
+ 'action': 'b2s_move_user_auth_to_profile',
184
+ 'networkAuthId': authId,
185
+ 'mandantId': mandantId,
186
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
187
+ },
188
+ error: function () {
189
+ jQuery('.b2s-loading-area').hide();
190
+ jQuery('.b2s-server-connection-fail').show();
191
+ return false;
192
+ },
193
+ success: function (data) {
194
+ if (data.result == true) {
195
+ jQuery('.b2s-loading-area').hide();
196
+ jQuery('#b2s-edit-network-auth-settings').modal('hide');
197
+ //change show all entry
198
+ jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']').attr('data-network-mandant-id', mandantId);
199
+ jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + '] .b2s-network-item-team-btn-manage').attr('data-network-mandant-id', mandantId);
200
+ jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + '] .b2s-network-mandant-name').html('(' + jQuery('#b2s-move-connection-select option:selected').text() + ')');
201
+
202
+ //sort entry in show all
203
+ var allArray = [];
204
+ var first = true;
205
+ jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + '] li').each(function (index, element) {
206
+ if (first !== true) {
207
+ allArray.push(element);
208
+ } else {
209
+ first = element;
210
+ }
211
+ });
212
+
213
+ for (i = 0; i < allArray.length; i++) {
214
+ for (j = 0; j < (allArray.length - 1); j++) {
215
+ if ((jQuery(allArray[j + 1]).attr('data-network-mandant-id') < jQuery(allArray[j]).attr('data-network-mandant-id')) || (jQuery(allArray[j + 1]).attr('data-network-mandant-id') == jQuery(allArray[j]).attr('data-network-mandant-id') && jQuery(allArray[j + 1]).attr('data-network-type') < jQuery(allArray[j]).attr('data-network-type')) || (jQuery(allArray[j + 1]).attr('data-network-mandant-id') == jQuery(allArray[j]).attr('data-network-mandant-id') && jQuery(allArray[j + 1]).attr('data-network-type') == jQuery(allArray[j]).attr('data-network-type') && jQuery(allArray[j + 1]).attr('data-network-auth-id') < jQuery(allArray[j]).attr('data-network-auth-id'))) {
216
+ var temp = allArray[j + 1];
217
+ allArray[j + 1] = allArray[j];
218
+ allArray[j] = temp;
219
+ }
220
+ }
221
+ }
222
+ jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').html('');
223
+ jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(first);
224
+ for (i = 0; i < allArray.length; i++) {
225
+ jQuery('.b2s-network-details-container-list[data-mandant-id=-1] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(allArray[i]);
226
+ }
227
+
228
+
229
+ //copy and remove entry in profile
230
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']').attr('data-network-mandant-id', mandantId);
231
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + '] .b2s-network-item-team-btn-manage').attr('data-network-mandant-id', mandantId);
232
+ var temp_list_entry = jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']');
233
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + oldMandantId + '] .b2s-network-item-auth-list-li[data-network-auth-id=' + authId + ']').remove();
234
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(temp_list_entry);
235
+
236
+ //sort entry in new profile
237
+ var mandantArray = [];
238
+ var mandantFirst = true;
239
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + '] li').each(function (index, element) {
240
+ if (mandantFirst !== true) {
241
+ mandantArray.push(element);
242
+ } else {
243
+ mandantFirst = element;
244
+ }
245
+ });
246
+
247
+ for (i = 0; i < mandantArray.length; i++) {
248
+ for (j = 0; j < (mandantArray.length - 1); j++) {
249
+ if ((jQuery(mandantArray[j + 1]).attr('data-network-mandant-id') < jQuery(mandantArray[j]).attr('data-network-mandant-id')) || (jQuery(mandantArray[j + 1]).attr('data-network-mandant-id') == jQuery(mandantArray[j]).attr('data-network-mandant-id') && jQuery(mandantArray[j + 1]).attr('data-network-type') < jQuery(mandantArray[j]).attr('data-network-type')) || (jQuery(mandantArray[j + 1]).attr('data-network-mandant-id') == jQuery(mandantArray[j]).attr('data-network-mandant-id') && jQuery(mandantArray[j + 1]).attr('data-network-type') == jQuery(mandantArray[j]).attr('data-network-type') && jQuery(mandantArray[j + 1]).attr('data-network-auth-id') < jQuery(mandantArray[j]).attr('data-network-auth-id'))) {
250
+ var temp = mandantArray[j + 1];
251
+ mandantArray[j + 1] = mandantArray[j];
252
+ mandantArray[j] = temp;
253
+ }
254
+ }
255
+ }
256
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').html('');
257
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(mandantFirst);
258
+
259
+ for (i = 0; i < mandantArray.length; i++) {
260
+ jQuery('.b2s-network-details-container-list[data-mandant-id=' + mandantId + '] .b2s-network-item-auth-list[data-network-id=' + networkId + ']').append(mandantArray[i]);
261
+ }
262
+ } else {
263
+ if (data.error == 'nonce') {
264
+ jQuery('.b2s-nonce-check-fail').show();
265
+ }
266
+ jQuery('.b2s-loading-area').hide();
267
+ jQuery('.b2s-network-auth-settings-content').show();
268
+ jQuery('.b2s-move-connection-error').show();
269
+ }
270
+ return false;
271
+ }
272
+ });
273
+ return false;
274
+ });
275
+
276
+ jQuery(document).on('click', '#b2s-assign-network-user-auth', function () {
277
+ if (jQuery('#b2s-select-assign-user').val() <= 0) {
278
+ return false;
279
+ }
280
+ jQuery('.b2s-network-auth-settings-content').hide();
281
+ jQuery('.b2s-move-connection-error').hide();
282
+ jQuery('.b2s-connection-assign').hide();
283
+ jQuery('.b2s-assignment-area').hide();
284
+ jQuery('.b2s-assign-error').hide();
285
+ jQuery('.b2s-loading-area').show();
286
+
287
+ var authId = jQuery('#b2sUserAuthId').val();
288
+ var assignBlogUserId = jQuery('#b2s-select-assign-user').val();
289
+ jQuery.ajax({
290
+ url: ajaxurl,
291
+ type: "POST",
292
+ dataType: "json",
293
+ cache: false,
294
+ data: {
295
+ 'action': 'b2s_assign_network_user_auth',
296
+ 'networkAuthId': authId,
297
+ 'assignBlogUserId': assignBlogUserId,
298
+ 'optionBestTimes': jQuery('#b2s-network-assign-option-best-times').is(':checked'),
299
+ 'optionPostingTemplate': jQuery('#b2s-network-assign-option-posting-template').is(':checked'),
300
+ 'optionUrlParameter': jQuery('#b2s-network-assign-option-url-parameter').is(':checked'),
301
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
302
+ },
303
+ error: function () {
304
+ jQuery('.b2s-loading-area').hide();
305
+ jQuery('.b2s-assign-error[data-error-reason="default"]').show();
306
+ jQuery('.b2s-network-auth-settings-content').show();
307
+ jQuery('.b2s-connection-assign').show();
308
+ jQuery('.b2s-assignment-area').show();
309
+ return false;
310
+ },
311
+ success: function (data) {
312
+ if (data.result == true) {
313
+ jQuery('.b2s-loading-area').hide();
314
+ jQuery('#b2s-approved-user-list').append(data.newListEntry);
315
+ jQuery('#b2s-approved-user-list').show();
316
+ jQuery('#b2s-select-assign-user option[value="' + assignBlogUserId + '"]').remove();
317
+ if (jQuery('#b2s-select-assign-user').html() == '') {
318
+ jQuery('#b2s-select-assign-user').attr('disabled', true);
319
+ jQuery('.b2s-network-assign-option').hide();
320
+ jQuery('#b2s-assign-info').hide();
321
+ jQuery('#b2s-no-assign-user').show();
322
+ }
323
+ } else {
324
+ if (data.error == 'nonce') {
325
+ jQuery('.b2s-nonce-check-fail').show();
326
+ }
327
+ jQuery('.b2s-assign-error[data-error-reason="' + data.error_reason + '"]').show();
328
+ }
329
+ jQuery('.b2s-loading-area').hide();
330
+ jQuery('.b2s-connection-assign').show();
331
+ jQuery('.b2s-network-auth-settings-content').show();
332
+ jQuery('.b2s-assignment-area').show();
333
+ return false;
334
+ }
335
+ });
336
+ return false;
337
+ });
338
+
339
+ jQuery(document).on('click', '.b2s-modify-board-and-group-network-btn', function () {
340
+ jQuery('.b2s-modify-board-and-group-network-loading-area').show();
341
+ jQuery('.b2s-network-auth-info').hide();
342
+ jQuery('#b2s-modify-board-and-group-network-modal').modal('show');
343
+ jQuery('#b2s-modify-board-and-group-network-modal-title').html(jQuery(this).attr('data-modal-title'));
344
+ jQuery('#b2s-modify-board-and-group-network-auth-id').val(jQuery(this).attr('data-network-auth-id'));
345
+ jQuery('#b2s-modify-board-and-group-network-id').val(jQuery(this).attr('data-network-id'));
346
+ jQuery('#b2s-modify-board-and-group-network-type').val(jQuery(this).attr('data-network-type'));
347
+ jQuery('.b2s-server-connection-fail').hide();
348
+ jQuery('.b2s-modify-board-and-group-network-save-btn').hide();
349
+ jQuery('#b2s-modify-board-and-group-network-no-data').hide();
350
+ jQuery('.b2s-modify-board-and-group-network-data').html("");
351
+ jQuery('.b2s-modify-board-and-group-network-data').show();
352
+ jQuery('#b2s-modify-board-and-group-network-save-success').hide();
353
+ jQuery('#b2s-modify-board-and-group-network-save-error').hide();
354
+
355
+ var networkId = jQuery(this).attr('data-network-id');
356
+ jQuery.ajax({
357
+ url: ajaxurl,
358
+ type: "POST",
359
+ dataType: "json",
360
+ cache: false,
361
+ data: {
362
+ 'action': 'b2s_get_network_board_and_group',
363
+ 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
364
+ 'networkType': jQuery(this).attr('data-network-type'),
365
+ 'networkId': networkId,
366
+ 'lang': jQuery('#b2sUserLang').val(),
367
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
368
+ },
369
+ error: function () {
370
+ jQuery('.b2s-server-connection-fail').show();
371
+ return false;
372
+ },
373
+ success: function (data) {
374
+ jQuery('.b2s-modify-board-and-group-network-loading-area').hide();
375
+ if (data.result == true) {
376
+ jQuery('.b2s-modify-board-and-group-network-data').html(data.content);
377
+ jQuery('.b2s-modify-board-and-group-network-save-btn').show();
378
+ } else {
379
+ if (data.error == 'nonce') {
380
+ jQuery('.b2s-nonce-check-fail').show();
381
+ }
382
+ jQuery('#b2s-modify-board-and-group-network-no-data').show();
383
+ }
384
+ }
385
+ });
386
+ return false;
387
+
388
+ });
389
+
390
+
391
+ jQuery(document).on('click', '.b2s-modify-board-and-group-network-save-btn', function () {
392
+
393
+ jQuery('.b2s-modify-board-and-group-network-save-btn').hide();
394
+ jQuery('.b2s-modify-board-and-group-network-data').hide();
395
+ jQuery('.b2s-modify-board-and-group-network-loading-area').show();
396
+
397
+ var networkAuthId = jQuery('#b2s-modify-board-and-group-network-auth-id').val();
398
+ var networkType = jQuery('#b2s-modify-board-and-group-network-type').val();
399
+ var networkId = jQuery('#b2s-modify-board-and-group-network-id').val();
400
+ var name = jQuery('#b2s-modify-board-and-group-name').val();
401
+
402
+ jQuery.ajax({
403
+ url: ajaxurl,
404
+ type: "POST",
405
+ dataType: "json",
406
+ cache: false,
407
+ data: {
408
+ 'action': 'b2s_save_network_board_and_group',
409
+ 'networkAuthId': networkAuthId,
410
+ 'networkType': networkType,
411
+ 'networkId': networkId,
412
+ 'boardAndGroup': jQuery('#b2s-modify-board-and-group-network-selected').val(),
413
+ 'boardAndGroupName': name,
414
+ 'lang': jQuery('#b2sUserLang').val(),
415
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
416
+ },
417
+ error: function () {
418
+ jQuery('.b2s-server-connection-fail').show();
419
+ return false;
420
+ },
421
+ success: function (data) {
422
+ jQuery('.b2s-modify-board-and-group-network-loading-area').hide();
423
+ if (data.result == true) {
424
+ jQuery('#b2s-modify-board-and-group-network-save-success').show();
425
+ } else {
426
+ if (data.error == 'nonce') {
427
+ jQuery('.b2s-nonce-check-fail').show();
428
+ }
429
+ jQuery('#b2s-modify-board-and-group-network-save-error').show();
430
+ }
431
+ }
432
+ });
433
+ return false;
434
+ });
435
+
436
+
437
+ jQuery(document).on('click', '#b2s-delete-network-sched-post', function () {
438
+ if (!jQuery(this).is(":checked")) {
439
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
440
+ jQuery('#b2s-delete-network-sched-post').val('0');
441
+ } else {
442
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').removeAttr('disabled');
443
+ jQuery('#b2s-delete-network-sched-post').val('1');
444
+ }
445
+ });
446
+
447
+ jQuery(document).on('click', '.b2s-network-item-auth-list-btn-delete', function () {
448
+ jQuery('.b2s-loading-area').show();
449
+ jQuery('.b2s-network-auth-settings-content').hide();
450
+ jQuery('.b2s-network-auth-info').hide();
451
+ jQuery('#b2s-network-delete-auth').modal('show');
452
+ jQuery('#b2s-delete-network-auth-id').val(jQuery(this).attr('data-network-auth-id'));
453
+ jQuery('#b2s-delete-network-id').val(jQuery(this).attr('data-network-id'));
454
+ jQuery('#b2s-delete-network-type').val(jQuery(this).attr('data-network-type'));
455
+ jQuery('#b2s-delete-assign-network-auth-id').val(jQuery(this).attr('data-assign-network-auth-id'));
456
+ jQuery('#b2s-delete-blog-user-id').val(jQuery(this).attr('data-blog-user-id'));
457
+ jQuery('.b2s-server-connection-fail').hide();
458
+ jQuery('#b2s-delete-all-assign-text').hide();
459
+ jQuery('.b2s-btn-network-delete-auth-show-post-text').hide();
460
+ jQuery('.b2s-btn-network-delete-auth-show-post-btn').hide();
461
+ jQuery('.b2s-btn-network-delete-auth-confirm-text').hide();
462
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').hide();
463
+ jQuery('.b2s-btn-network-delete-sched-text').hide();
464
+ jQuery('.b2s-btn-network-delete-assign-text').hide();
465
+ jQuery('.b2s-btn-network-delete-assign-sched-text').hide();
466
+ var countSchedId = jQuery(this).attr('data-network-auth-id');
467
+ if (typeof jQuery(this).attr('data-assign-network-auth-id') != 'undefined' && jQuery(this).attr('data-assign-network-auth-id') > 0) {
468
+ countSchedId = jQuery(this).attr('data-assign-network-auth-id');
469
+ }
470
+
471
+ jQuery.ajax({
472
+ url: ajaxurl,
473
+ type: "POST",
474
+ dataType: "json",
475
+ cache: false,
476
+ data: {
477
+ 'action': 'b2s_get_sched_posts_by_user_auth',
478
+ 'networkAuthId': countSchedId,
479
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
480
+ },
481
+ error: function () {
482
+ jQuery('.b2s-server-connection-fail').show();
483
+ return false;
484
+ },
485
+ success: function (data) {
486
+ jQuery('.b2s-loading-area').hide();
487
+ if (data.result == true) {
488
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').removeAttr('disabled');
489
+ if (data.count >= 1) {
490
+ jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
491
+ jQuery('.b2s-btn-network-delete-sched-text').show();
492
+ jQuery('.b2s-btn-network-delete-auth-show-post-btn').show();
493
+ jQuery('#b2s-btn-network-delete-auth-show-post-count').text(data.count);
494
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
495
+ }
496
+ if (data.assignListCount >= 1) {
497
+ jQuery('.b2s-btn-network-delete-assign-text').show();
498
+ jQuery('#b2s-delete-assignment').val('all');
499
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
500
+ jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
501
+ } else {
502
+ jQuery('#b2s-delete-assignment').val('');
503
+ }
504
+ if (data.assignCount >= 1) {
505
+ jQuery('.b2s-btn-network-delete-assign-sched-text').show();
506
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').prop('disabled', true);
507
+ jQuery('.b2s-btn-network-delete-auth-show-post-text').show();
508
+ }
509
+ jQuery('#b2s-delete-assign-list').val(data.assignList);
510
+ } else {
511
+ if (data.error == 'nonce') {
512
+ jQuery('.b2s-nonce-check-fail').show();
513
+ }
514
+ }
515
+ jQuery('.b2s-btn-network-delete-auth-confirm-text').show();
516
+ jQuery('.b2s-btn-network-delete-auth-confirm-btn').show();
517
+ jQuery('#b2s-delete-network-sched-post').prop('checked', false);
518
+ jQuery('#b2s-delete-network-sched-post').val('0');
519
+ }
520
+ });
521
+ return false;
522
+ });
523
+
524
+ jQuery(document).on('click', '.b2s-btn-network-delete-auth-show-post-btn', function () {
525
+ window.location.href = jQuery('#b2s-redirect-url-sched-post').val() + "&b2sUserAuthId=" + jQuery('#b2s-delete-network-auth-id').val();
526
+ return false;
527
+ });
528
+
529
+ jQuery(document).on('click', '.b2s-btn-network-delete-auth-confirm-btn', function () {
530
+ jQuery('.b2s-network-auth-area').hide();
531
+ jQuery('.b2s-loading-area').show();
532
+ jQuery('#b2s-edit-network-auth-settings').modal('hide');
533
+ jQuery('#b2s-network-delete-auth').modal('hide');
534
+ jQuery('.b2s-server-connection-fail').hide();
535
+ jQuery.ajax({
536
+ url: ajaxurl,
537
+ type: "POST",
538
+ dataType: "json",
539
+ cache: false,
540
+ data: {
541
+ 'action': 'b2s_delete_user_auth',
542
+ 'networkAuthId': jQuery('#b2s-delete-network-auth-id').val(),
543
+ 'networkId': jQuery('#b2s-delete-network-id').val(),
544
+ 'networkType': jQuery('#b2s-delete-network-type').val(),
545
+ 'deleteSchedPost': jQuery('#b2s-delete-network-sched-post').val(),
546
+ 'assignNetworkAuthId': jQuery('#b2s-delete-assign-network-auth-id').val(),
547
+ 'blogUserId': jQuery('#b2s-delete-blog-user-id').val(),
548
+ 'deleteAssignment': jQuery('#b2s-delete-assignment').val(),
549
+ 'assignList': jQuery('#b2s-delete-assign-list').val(),
550
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
551
+ },
552
+ error: function () {
553
+ jQuery('.b2s-server-connection-fail').show();
554
+ return false;
555
+ },
556
+ success: function (data) {
557
+ jQuery('.b2s-network-auth-info').hide();
558
+ jQuery('.b2s-network-auth-area').show();
559
+ jQuery('.b2s-loading-area').hide();
560
+ if (data.result == true && data.networkAuthId >= 1 && data.networkId >= 1) {
561
+ jQuery('.b2s-network-item-auth-list-btn-delete[data-network-auth-id="' + data.networkAuthId + '"]').parent('div').parent('li').remove();
562
+ var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + data.networkId + '"').text();
563
+ if (networkCount != "0") {
564
+ var newCount = parseInt(networkCount) - 1;
565
+ jQuery('.b2s-network-auth-count-current[data-network-id="' + data.networkId + '"').text(newCount);
566
+ }
567
+ jQuery('.b2s-network-remove-success').show();
568
+ } else {
569
+ if (data.error == 'nonce') {
570
+ jQuery('.b2s-nonce-check-fail').show();
571
+ }
572
+ jQuery('.b2s-network-remove-fail').show();
573
+ }
574
+ }
575
+ });
576
+ return false;
577
+ });
578
+
579
+ jQuery(document).on('click', '.b2s-network-add-mandant-btn-save', function () {
580
+ if (!jQuery('.b2s-network-add-mandant-input').val()) {
581
+ jQuery('.b2s-network-add-mandant-input').addClass('error');
582
+ } else {
583
+ jQuery('.b2s-network-add-mandant-btn-loading').show();
584
+ jQuery('.b2s-network-add-mandant-btn-save').hide();
585
+ jQuery('.b2s-network-add-mandant-input').removeClass('error');
586
+ jQuery('.b2s-server-connection-fail').hide();
587
+ jQuery.ajax({
588
+ url: ajaxurl,
589
+ type: "POST",
590
+ dataType: "json",
591
+ cache: false,
592
+ data: {
593
+ 'action': 'b2s_save_user_mandant',
594
+ 'mandant': jQuery('.b2s-network-add-mandant-input').val(),
595
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
596
+ },
597
+ error: function () {
598
+ jQuery('.b2s-server-connection-fail').show();
599
+ return false;
600
+ },
601
+ success: function (data) {
602
+ jQuery('.b2s-network-auth-info').hide();
603
+ jQuery('.b2s-network-add-mandant-btn-loading').hide();
604
+ jQuery('.b2s-network-add-mandant-btn-save').show();
605
+ if (data.result == true) {
606
+ jQuery('.b2s-network-mandant-select optgroup[id="b2s-network-select-more-client"]').append('<option value="' + data.mandantId + '">' + data.mandantName + '</option>');
607
+ jQuery('.b2s-network-details-container').append(data.content);
608
+ jQuery('.b2s-network-mandant-select option[value="' + data.mandantId + '"]').prop('selected', true);
609
+ jQuery('.b2s-network-details-container-list').hide();
610
+ jQuery('.b2s-network-details-container-list[data-mandant-id="' + data.mandantId + '"]').show();
611
+ jQuery('.b2s-network-add-mandant-success').show();
612
+ } else {
613
+ jQuery('.b2s-network-add-mandant-error').show();
614
+ }
615
+ jQuery('#b2s-network-add-mandant').modal('hide');
616
+
617
+ jQuery('.b2s-network-item-auth-list[data-network-count="true"]').each(function () {
618
+ jQuery('.b2s-network-auth-count-current[data-network-id="' + jQuery(this).attr("data-network-id") + '"').text(jQuery(this).children('li').length);
619
+ });
620
+
621
+ }
622
+ });
623
+ }
624
+ });
625
+
626
+ jQuery(document).on('change', '.b2s-network-add-mandant-input', function () {
627
+ if (jQuery(this).val() != "") {
628
+ jQuery(this).removeClass('error');
629
+ }
630
+ });
631
+
632
+ window.addEventListener('message', function (e) {
633
+ if (e.origin == jQuery('#b2sServerUrl').val()) {
634
+ var data = JSON.parse(e.data);
635
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
636
+ }
637
+ });
638
+
639
+ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId) {
640
+ jQuery('.b2s-network-auth-info').hide();
641
+ jQuery('.b2s-network-auth-success').show();
642
+ jQuery('.b2s-server-connection-fail').hide();
643
+ jQuery.ajax({
644
+ url: ajaxurl,
645
+ type: "POST",
646
+ dataType: "json",
647
+ cache: false,
648
+ data: {
649
+ 'action': 'b2s_network_save_auth_to_settings',
650
+ 'mandandId': mandandId,
651
+ 'networkAuthId': networkAuthId,
652
+ 'networkId': networkId,
653
+ 'networkType': networkType,
654
+ 'displayName': displayName,
655
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
656
+ },
657
+ error: function () {
658
+ jQuery('.b2s-server-connection-fail').show();
659
+ return false;
660
+ },
661
+ success: function (data) {}
662
+ });
663
+
664
+ var typ = new Array('Profile', 'Page', 'Group');
665
+ var days = 'Days';
666
+ if (jQuery('#b2sUserLang').val() == 'de') {
667
+ typ = new Array('Profil', 'Seite', 'Gruppe');
668
+ days = 'Tage';
669
+ }
670
+
671
+ var networkTypeName = typ[networkType];
672
+ //Tumblr
673
+ if (networkId == 4) {
674
+ networkTypeName = 'Blog';
675
+ }
676
+
677
+ //NEW
678
+ if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
679
+ var html = "<li class='b2s-network-item-auth-list-li b2s-label-success-border-left' data-network-auth-id='" + networkAuthId + "' data-network-mandant-id='" + mandandId + "' data-network-id='" + networkId + "' data-network-type='" + networkType + "'>";
680
+ html += '<div class="pull-left"><span class="b2s-network-item-auth-type">' + networkTypeName + '</span>: ';
681
+ html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
682
+ if (mandandId >= 0) {
683
+ var mandantName = jQuery(".b2s-network-mandant-select option:selected").text();
684
+ if (mandandId <= 0) {
685
+ mandantName = jQuery(".b2s-network-mandant-select option[value='0']").text();
686
+ }
687
+ html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
688
+ }
689
+
690
+ var today = new Date();
691
+ if (today.getMinutes() >= 30) {
692
+ today.setHours(today.getHours() + 1);
693
+ today.setMinutes(0);
694
+ } else {
695
+ today.setMinutes(30);
696
+ }
697
+ var time = formatAMPM(today);
698
+ if (jQuery('#b2sUserLang').val() == 'de') {
699
+ time = padDate(today.getHours()) + ':' + padDate(today.getMinutes());
700
+ }
701
+
702
+ html += '</div>';
703
+ html += '<div class="pull-right">';
704
+ html += '<a class="b2s-network-item-auth-list-btn-delete b2s-add-padding-network-delete pull-right" data-network-type="' + networkType + '" data-network-id="' + networkId + '" data-network-auth-id="' + networkAuthId + '" href="#"><span class="glyphicon glyphicon-trash glyphicon-grey"></span></a>';
705
+
706
+ if (jQuery('#b2sUserVersion').val() == '0') {
707
+ html += '<span class="b2s-sched-manager-premium-area pull-right hidden-xs" style="width: 240px;"><span class="label label-success"><a href="#" class="btn-label-premium b2sInfoSchedTimesModalBtn">SMART</a></span></span>';
708
+ } else {
709
+ html += '<span class="b2s-sched-manager-time-area pull-right b2s-sched-manager-add-padding hidden-xs" style="margin-right:30px !important;">';
710
+ html += '<input class="form-control b2s-box-sched-time-input b2s-settings-sched-item-input-time" type="text" value="' + time + '" readonly data-network-auth-id="' + networkAuthId + '" data-network-mandant-id="' + mandandId + '" data-network-id="' + networkId + '" data-network-type="' + networkType + '" name="b2s-user-sched-data[time][' + networkAuthId + ']">';
711
+ html += '</span>';
712
+ html += '<span class="b2s-sched-manager-day-area pull-right hidden-xs" style=""><span class="b2s-sched-manager-item-input-day-btn-minus" data-network-auth-id="' + networkAuthId + '">-</span> <span class="b2s-text-middle">+</span>';
713
+ html += '<input type="text" class="b2s-sched-manager-item-input-day" data-network-auth-id="' + networkAuthId + '" data-network-mandant-id="' + mandandId + '" data-network-id="' + networkId + '" data-network-type="' + networkType + '" name="b2s-user-sched-data[delay_day][' + networkAuthId + ']" value="0" readonly> <span class="b2s-text-middle">' + days + '</span> <span class="b2s-sched-manager-item-input-day-btn-plus" data-network-auth-id="' + networkAuthId + '">+</span></span>';
714
+ }
715
+ html += '</div>';
716
+ html += '<div class="clearfix"></div>';
717
+ html += '</li>';
718
+
719
+ jQuery(html).insertAfter('.b2s-network-item-auth-list-li[data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-view="all"]:first');
720
+ jQuery(html).insertAfter('.b2s-network-item-auth-list-li[data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-view="selected"]:first');
721
+ jQuery('.b2s-settings-sched-item-input-time[data-network-auth-id="' + networkAuthId + '"]').val(time);
722
+ var networkCount = jQuery('.b2s-network-auth-count-current[data-network-count-trigger="true"][data-network-id="' + networkId + '"').text();
723
+ var newCount = parseInt(networkCount) + 1;
724
+ jQuery('.b2s-network-auth-count-current[data-network-id="' + networkId + '"').text(newCount);
725
+ init();
726
+ if (jQuery('#b2sUserVersion').val() >= 1) {
727
+ saveTimeSettings();
728
+ }
729
+
730
+ //Update
731
+ } else {
732
+ jQuery('.b2s-network-auth-update-btn[data-network-auth-id="' + networkAuthId + '"').show();
733
+ if (jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').length > 0) {
734
+ var html = '<span class="b2s-network-item-auth-type">' + typ[networkType] + '</span>: ';
735
+ html += '<span class="b2s-network-item-auth-user-name">' + displayName + '</span>';
736
+ if (mandandId >= 0) {
737
+ var mandantName = jQuery(".b2s-network-mandant-select option:selected").text();
738
+ if (mandandId <= 0) {
739
+ mandantName = jQuery(".b2s-network-mandant-select option[value='0']").text();
740
+ }
741
+ html += ' <span class="b2s-network-mandant-name">(' + mandantName + ')</span>';
742
+ }
743
+ jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"] div:first').html(html);
744
+ jQuery('.b2s-network-item-auth-list-li[data-network-auth-id="' + networkAuthId + '"][data-network-mandant-id="' + mandandId + '"][data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').removeClass('b2s-label-danger-border-left').addClass('b2s-label-success-border-left');
745
+ }
746
+ }
747
+ //Update other Auth with same networkId, networkType and displayName (only optical)
748
+ jQuery('.b2s-network-item-auth-list-li[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"]').each(function () {
749
+ if (jQuery(this).find('.b2s-network-item-auth-user-name').html() == displayName) {
750
+ jQuery(this).removeClass('b2s-label-danger-border-left').addClass('b2s-label-success-border-left');
751
+ jQuery(this).find('.b2s-network-auth-list-info[data-b2s-auth-info="isInterrupted"]').hide();
752
+ }
753
+ });
754
+ }
755
+
756
+
757
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
758
+ jQuery('.b2s-server-connection-fail').hide();
759
+ jQuery.ajax({
760
+ url: ajaxurl,
761
+ type: "POST",
762
+ dataType: "json",
763
+ cache: false,
764
+ data: {
765
+ 'action': 'b2s_get_settings_sched_time_default',
766
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
767
+ },
768
+ error: function () {
769
+ jQuery('.b2s-server-connection-fail').show();
770
+ return false;
771
+ },
772
+ success: function (data) {
773
+ if (data.result == true) {
774
+ jQuery.each(data.times, function (network_id, time) {
775
+ time.forEach(function (network_type_time, count) {
776
+ if (network_type_time != "") {
777
+ jQuery('.b2s-settings-sched-item-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val(network_type_time);
778
+ count++;
779
+ }
780
+ });
781
+ });
782
+ saveTimeSettings();
783
+ } else {
784
+ if (data.error == 'nonce') {
785
+ jQuery('.b2s-nonce-check-fail').show();
786
+ }
787
+ }
788
+ }
789
+ });
790
+ return false;
791
+ });
792
+
793
+ function saveTimeSettings() {
794
+ jQuery('.b2s-settings-user-error').hide();
795
+ jQuery.ajax({
796
+ processData: false,
797
+ url: ajaxurl,
798
+ type: "POST",
799
+ dataType: "json",
800
+ cache: false,
801
+ data: jQuery('#b2sSaveTimeSettings').serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
802
+ error: function () {
803
+ return false;
804
+ },
805
+ success: function (data) {
806
+ if (data.result !== true) {
807
+ if (data.error == 'nonce') {
808
+ jQuery('.b2s-nonce-check-fail').show();
809
+ }
810
+ jQuery('.b2s-settings-user-error').show();
811
+ }
812
+ }
813
+ });
814
+ }
815
+
816
+ function wop(url, name) {
817
+ jQuery('.b2s-network-auth-info').hide();
818
+ jQuery('.b2s-network-auth-success').hide();
819
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
820
+ 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");
821
+ }
822
+
823
+ function showFilter(typ) {
824
+ if (typ == 'show') {
825
+ jQuery('.filterShow').hide();
826
+ jQuery('.form-inline').show();
827
+ jQuery('.filterHide').show();
828
+ } else {
829
+ jQuery('.filterShow').show();
830
+ jQuery('.form-inline').hide();
831
+ jQuery('.filterHide').hide();
832
+ }
833
+ }
834
+
835
+
836
+ function formatAMPM(date) {
837
+ var hours = date.getHours();
838
+ var minutes = date.getMinutes();
839
+ var ampm = hours >= 12 ? 'PM' : 'AM';
840
+ hours = hours % 12;
841
+ hours = hours ? hours : 12; // the hour '0' should be '12'
842
+ minutes = minutes < 10 ? '0' + minutes : minutes;
843
+ var strTime = hours + ':' + minutes + ' ' + ampm;
844
+ return strTime;
845
+ }
846
+
847
+ function padDate(n) {
848
+ return ("0" + n).slice(-2);
849
+ }
850
+
851
+ jQuery(document).on('click', '.b2s-edit-template-btn', function () {
852
+ jQuery('.b2s-edit-template-content').hide();
853
+ jQuery('.b2s-edit-template-save-btn').hide();
854
+ jQuery('.b2s-loading-area').show();
855
+ jQuery('#b2s-edit-template').modal('show');
856
+ jQuery('#b2s-edit-template-network-id').val(jQuery(this).attr('data-network-id'));
857
+ var networkId = jQuery(this).attr('data-network-id');
858
+ jQuery('.b2s-edit-template-network-img').hide();
859
+ jQuery('#b2s-edit-template-network-img-' + networkId).show();
860
+
861
+ jQuery.ajax({
862
+ url: ajaxurl,
863
+ type: "GET",
864
+ dataType: "json",
865
+ cache: false,
866
+ data: {
867
+ 'action': 'b2s_get_edit_template',
868
+ 'networkId': networkId,
869
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
870
+ },
871
+ error: function () {
872
+ jQuery('.b2s-server-connection-fail').show();
873
+ return false;
874
+ },
875
+ success: function (data) {
876
+ if (data.result == true) {
877
+ jQuery('.b2s-edit-template-content').html(data.content);
878
+ jQuery('.b2s-loading-area').hide();
879
+ jQuery('.b2s-edit-template-content').show();
880
+ jQuery('.b2s-edit-template-save-btn').show();
881
+ if (jQuery('#b2sUserVersion').val() < 1 && networkId != 1) {
882
+ jQuery('.b2s-edit-template-save-btn').addClass('b2s-btn-disabled');
883
+ } else {
884
+ jQuery('.b2s-edit-template-save-btn').removeClass('b2s-btn-disabled');
885
+ }
886
+ } else {
887
+ if (data.error == 'nonce') {
888
+ jQuery('.b2s-nonce-check-fail').show();
889
+ }
890
+ }
891
+ }
892
+ });
893
+ });
894
+
895
+ jQuery(window).on("load", function () {
896
+ if (jQuery('#b2sUserVersion').val() >= 1) {
897
+ jQuery(document).on('click', '.b2s-edit-template-link-post', function () {
898
+ jQuery('.b2s-edit-template-image-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-primary').addClass('btn-light');
899
+ jQuery('.b2s-edit-template-link-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-light').addClass('btn-primary');
900
+ jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('0');
901
+ jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
902
+ jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
903
+ });
904
+
905
+ jQuery(document).on('click', '.b2s-edit-template-image-post', function () {
906
+ jQuery('.b2s-edit-template-link-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-primary').addClass('btn-light');
907
+ jQuery('.b2s-edit-template-image-post[data-network-type=' + jQuery(this).attr('data-network-type') + ']').removeClass('btn-light').addClass('btn-primary');
908
+ jQuery('.b2s-edit-template-post-format[data-network-type=' + jQuery(this).attr('data-network-type') + ']').val('1');
909
+ jQuery('.b2s-edit-template-link-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').hide();
910
+ jQuery('.b2s-edit-template-image-preview[data-network-type=' + jQuery(this).attr('data-network-type') + ']').show();
911
+ });
912
+
913
+
914
+ document.addEventListener('dragstart', function (event) {
915
+ event.dataTransfer.setData('Text', event.target.innerHTML);
916
+ });
917
+
918
+ document.addEventListener('drop', function (event) {
919
+ setTimeout(function () {
920
+ jQuery('.b2s-edit-template-post-content').trigger('keyup');
921
+ }, 0);
922
+ });
923
+
924
+ jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-edit-template-post-content', function () {
925
+ var tb = jQuery(this).get(0);
926
+ jQuery('.b2s-edit-template-content-selection-start[data-network-type="' + jQuery(this).attr('data-network-type') + '"]').val(tb.selectionStart);
927
+ jQuery('.b2s-edit-template-content-selection-end[data-network-type="' + jQuery(this).attr('data-network-type') + '"]').val(tb.selectionEnd);
928
+ });
929
+
930
+ jQuery(document).on('keyup', '.b2s-edit-template-post-content', function () {
931
+ jQuery('.b2s-edit-template-preview-content[data-network-type="' + jQuery(this).attr('data-network-type') + '"]').html(jQuery(this).val().replace(/\n/g, "<br>"));
932
+ });
933
+
934
+ jQuery(document).on('keydown', '.b2s-edit-template-post-content', function () {
935
+ var tb = jQuery(this).get(0);
936
+ var start = tb.selectionStart;
937
+ var end = tb.selectionEnd;
938
+ var reg = new RegExp("({.+?})", "g");
939
+ var amatch = null;
940
+ while ((amatch = reg.exec(jQuery(this).val())) != null) {
941
+ var thisMatchStart = amatch.index;
942
+ var thisMatchEnd = amatch.index + amatch[0].length;
943
+ //case: keydown in pattern
944
+ if (start > thisMatchStart && end <= thisMatchEnd && (event.keyCode == 8 || event.keyCode == 46)) {
945
+ jQuery(this).val(jQuery(this).val().substr(0, thisMatchStart) + jQuery(this).val().substr(thisMatchEnd));
946
+ event.preventDefault();
947
+ return false;
948
+
949
+ }
950
+ //case: before pattern
951
+ if (start <= thisMatchStart && end > thisMatchStart && (event.keyCode > 40 || event.keyCode < 16 || event.keyCode == 32)) {
952
+ event.preventDefault();
953
+ return false;
954
+ //case: after pattern
955
+ } else if (start > thisMatchStart && start < thisMatchEnd && (event.keyCode > 40 || event.keyCode < 16 || event.keyCode == 32)) {
956
+ event.preventDefault();
957
+ return false;
958
+ }
959
+ }
960
+ });
961
+
962
+ jQuery(document).on('click', '.b2s-edit-template-content-post-item', function () {
963
+ var networkType = jQuery(this).attr('data-network-type');
964
+ var text = jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val();
965
+ var start = jQuery('.b2s-edit-template-content-selection-start[data-network-type="' + networkType + '"]').val();
966
+ var end = jQuery('.b2s-edit-template-content-selection-end[data-network-type="' + networkType + '"]').val();
967
+
968
+ var reg = new RegExp("({.+?})", "g");
969
+ var amatch = null;
970
+ while ((amatch = reg.exec(text)) != null) {
971
+ var thisMatchStart = amatch.index;
972
+ var thisMatchEnd = amatch.index + amatch[0].length;
973
+ //case: keydown in pattern
974
+ if (start > thisMatchStart && end < thisMatchEnd) {
975
+ event.preventDefault();
976
+ return false;
977
+ }
978
+ }
979
+ var newText = text.slice(0, start) + jQuery(this).html() + text.slice(end);
980
+ jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val(newText);
981
+ jQuery('.b2s-edit-template-post-content').focus();
982
+ jQuery('.b2s-edit-template-post-content').trigger('keyup');
983
+ event.preventDefault();
984
+ return false;
985
+ });
986
+
987
+ jQuery(document).on('click', '.b2s-edit-template-content-clear-btn', function () {
988
+ var networkType = jQuery(this).attr('data-network-type');
989
+ jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val("");
990
+ jQuery('.b2s-edit-template-post-content').focus();
991
+ jQuery('.b2s-edit-template-post-content').trigger('keyup');
992
+ event.preventDefault();
993
+ return false;
994
+ });
995
+
996
+
997
+ jQuery(document).on('keyup', '.b2s-edit-template-range', function () {
998
+ if (isNaN(parseInt(jQuery(this).val())) || parseInt(jQuery(this).val()) < 1) {
999
+ jQuery(this).val("1");
1000
+ }
1001
+ if (jQuery(this).attr('max') > 0 && parseInt(jQuery(this).val()) > jQuery(this).attr('max')) {
1002
+ jQuery(this).val(jQuery(this).attr('max'));
1003
+ }
1004
+ event.preventDefault();
1005
+ return false;
1006
+ });
1007
+
1008
+ jQuery(document).on('keyup', '.b2s-edit-template-excerpt-range', function () {
1009
+ if (isNaN(parseInt(jQuery(this).val())) || parseInt(jQuery(this).val()) < 1) {
1010
+ jQuery(this).val("1");
1011
+ }
1012
+ if (jQuery(this).attr('max') > 0 && parseInt(jQuery(this).val()) > jQuery(this).attr('max')) {
1013
+ jQuery(this).val(jQuery(this).attr('max'));
1014
+ }
1015
+ event.preventDefault();
1016
+ return false;
1017
+ });
1018
+
1019
+
1020
+
1021
+ jQuery(document).on('click', '.b2s-edit-template-load-default', function () {
1022
+ jQuery('.b2s-edit-template-content').hide();
1023
+ jQuery('.b2s-edit-template-save-btn').hide();
1024
+ jQuery('.b2s-edit-template-save-success').hide();
1025
+ jQuery('.b2s-edit-template-save-failed').hide();
1026
+ jQuery('.b2s-loading-area').show();
1027
+ var networkType = jQuery(this).attr('data-network-type');
1028
+
1029
+ jQuery.ajax({
1030
+ url: ajaxurl,
1031
+ type: "POST",
1032
+ dataType: "json",
1033
+ cache: false,
1034
+ data: {
1035
+ 'action': 'b2s_load_default_post_template',
1036
+ 'networkId': jQuery('#b2s-edit-template-network-id').val(),
1037
+ 'networkType': networkType,
1038
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1039
+ },
1040
+ error: function () {
1041
+ jQuery('.b2s-loading-area').hide();
1042
+ jQuery('.b2s-edit-template-content').show();
1043
+ jQuery('.b2s-edit-template-save-btn').show();
1044
+ jQuery('.b2s-edit-template-load-default-failed').show();
1045
+ return false;
1046
+ },
1047
+ success: function (data) {
1048
+ jQuery('.b2s-loading-area').hide();
1049
+ jQuery('.b2s-edit-template-content').show();
1050
+ jQuery('.b2s-edit-template-save-btn').show();
1051
+ if (data.result == true) {
1052
+ jQuery('.b2s-template-tab-' + networkType).html(data.html);
1053
+ } else {
1054
+ if (data.error == 'nonce') {
1055
+ jQuery('.b2s-nonce-check-fail').show();
1056
+ }
1057
+ jQuery('.b2s-edit-template-load-default-failed').show();
1058
+ }
1059
+ }
1060
+ });
1061
+ });
1062
+ }
1063
+ });
1064
+
1065
+ jQuery(document).on('click', '.b2s-edit-template-save-btn', function () {
1066
+ if (jQuery('#b2sUserVersion').val() < 1 && jQuery('#b2s-edit-template-network-id').val() != 1) {
1067
+ return false;
1068
+ }
1069
+
1070
+ if (jQuery('#b2s-edit-template-network-id').val() == 12) {
1071
+ var matches = jQuery('.b2s-edit-template-post-content').val().match(/#/g);
1072
+ if (matches != null && matches.length > 30) {
1073
+ jQuery('.b2s-edit-template-post-content').addClass('error');
1074
+ jQuery('.b2s-edit-template-hashtag-warning').show();
1075
+ return false;
1076
+ } else {
1077
+ jQuery('.b2s-edit-template-post-content').removeClass('error');
1078
+ jQuery('.b2s-edit-template-hashtag-warning').hide();
1079
+ }
1080
+ }
1081
+
1082
+ jQuery('.b2s-edit-template-content').hide();
1083
+ jQuery('.b2s-edit-template-save-btn').hide();
1084
+ jQuery('.b2s-edit-template-save-success').hide();
1085
+ jQuery('.b2s-edit-template-save-failed').hide();
1086
+ jQuery('.b2s-loading-area').show();
1087
+
1088
+ template_data = {};
1089
+
1090
+ jQuery('.b2s-edit-template-post-content').each(function (i, obj) {
1091
+ var networkType = jQuery(obj).attr('data-network-type');
1092
+ template_data[networkType] = {};
1093
+ template_data[networkType]['format'] = jQuery('.b2s-edit-template-post-format[data-network-type="' + networkType + '"]').val();
1094
+ template_data[networkType]['content'] = jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val();
1095
+ template_data[networkType]['range_max'] = jQuery('.b2s-edit-template-range[data-network-type="' + networkType + '"]').val();
1096
+ template_data[networkType]['excerpt_range_max'] = jQuery('.b2s-edit-template-excerpt-range[data-network-type="' + networkType + '"]').val();
1097
+ });
1098
+
1099
+ jQuery.ajax({
1100
+ url: ajaxurl,
1101
+ type: "POST",
1102
+ dataType: "json",
1103
+ cache: false,
1104
+ data: {
1105
+ 'action': 'b2s_save_post_template',
1106
+ 'template_data': template_data,
1107
+ 'networkId': jQuery('#b2s-edit-template-network-id').val(),
1108
+ 'link_no_cache': (jQuery("#link-no-cache").is(':checked') ? '1' : '0'),
1109
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1110
+ },
1111
+ error: function () {
1112
+ jQuery('.b2s-loading-area').hide();
1113
+ jQuery('.b2s-edit-template-content').show();
1114
+ jQuery('.b2s-edit-template-save-btn').show();
1115
+ jQuery('.b2s-edit-template-save-failed').show();
1116
+ return false;
1117
+ },
1118
+ success: function (data) {
1119
+ jQuery('.b2s-loading-area').hide();
1120
+ jQuery('.b2s-edit-template-content').show();
1121
+ jQuery('.b2s-edit-template-save-btn').show();
1122
+ if (data.result == true) {
1123
+ jQuery('.b2s-edit-template-save-success').show();
1124
+ setTimeout(function () {
1125
+ jQuery('.b2s-edit-template-save-success').fadeOut();
1126
+ }, 3000);
1127
+ } else {
1128
+ if (data.error == 'nonce') {
1129
+ jQuery('.b2s-nonce-check-fail').show();
1130
+ }
1131
+ jQuery('.b2s-edit-template-save-failed').show();
1132
+ }
1133
+ }
1134
+ });
1135
+ });
1136
+
1137
+
1138
+ jQuery('#b2sInfoNoCache').on('hidden.bs.modal', function () {
1139
+ jQuery('body').addClass('modal-open');
1140
+ });
1141
+ jQuery('#b2sInfoFormat').on('hidden.bs.modal', function () {
1142
+ jQuery('body').addClass('modal-open');
1143
+ });
1144
+
1145
+ jQuery(document).on('click', '.b2sInfoFormatBtn', function () {
1146
+ jQuery('#b2sInfoFormat').modal('show');
1147
+ var id = jQuery(this).attr('data-network-id');
1148
+ jQuery('.b2sInfoFormatText').hide();
1149
+ jQuery('.b2sInfoFormatText[data-network-id="' + id + '"]').show();
1150
+ });
1151
+
1152
+ jQuery('#b2sInfoContent').on('hidden.bs.modal', function () {
1153
+ jQuery('body').addClass('modal-open');
1154
+ });
1155
+ jQuery('#b2sInfoCharacterLimit').on('hidden.bs.modal', function () {
1156
+ jQuery('body').addClass('modal-open');
1157
+ });
1158
+
1159
+
1160
+ jQuery(document).on('click', '.b2s-auth-network-6-login-btn', function () {
1161
+ jQuery('#b2s-auth-network-6-username').removeClass('error');
1162
+ jQuery('#b2s-auth-network-6-password').removeClass('error');
1163
+ var loginDataCheck = true;
1164
+ if (jQuery('#b2s-auth-network-6-username').val() == '') {
1165
+ jQuery('#b2s-auth-network-6-username').addClass('error');
1166
+ loginDataCheck = false;
1167
+ }
1168
+ if (jQuery('#b2s-auth-network-6-password').val() == '') {
1169
+ jQuery('#b2s-auth-network-6-password').addClass('error');
1170
+ loginDataCheck = false;
1171
+ }
1172
+ if (!loginDataCheck) {
1173
+ return false;
1174
+ }
1175
+ jQuery('.b2s-loading-area').show();
1176
+ jQuery('.b2s-auth-network-6-login-area').hide();
1177
+ jQuery('.b2s-auth-network-6-login-btn').hide();
1178
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
1179
+ jQuery('.b2s-auth-network-6-info').hide();
1180
+ jQuery.ajax({
1181
+ url: ajaxurl,
1182
+ type: "POST",
1183
+ dataType: "json",
1184
+ cache: false,
1185
+ data: {
1186
+ 'action': 'b2s_auth_network_login',
1187
+ 'username': jQuery('#b2s-auth-network-6-username').val(),
1188
+ 'password': jQuery('#b2s-auth-network-6-password').val(),
1189
+ 'location': jQuery('#b2s-auth-network-6-location').val(),
1190
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1191
+ },
1192
+ error: function (jqXHR) {
1193
+ jQuery('.b2s-loading-area').hide();
1194
+ jQuery('.b2s-auth-network-6-login-area').show();
1195
+ jQuery('.b2s-auth-network-6-login-btn').show();
1196
+ if (jqXHR.status == 403) {
1197
+ jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
1198
+ } else {
1199
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
1200
+ }
1201
+ return false;
1202
+ },
1203
+ success: function (data) {
1204
+ jQuery('.b2s-loading-area').hide();
1205
+ jQuery('.b2s-auth-network-6-login-area').show();
1206
+ if (data.result == true) {
1207
+ jQuery('#b2s-auth-network-6-board').html(data.boards);
1208
+ jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
1209
+ jQuery('.b2s-auth-network-6-board-area').show();
1210
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
1211
+ jQuery('.b2s-auth-network-6-info[data-info="success"]').show();
1212
+ } else {
1213
+ jQuery('.b2s-auth-network-6-login-btn').show();
1214
+ if (data.error == 'nonce') {
1215
+ jQuery('.b2s-nonce-check-fail').show();
1216
+ }
1217
+ if (typeof data.error != 'undefined' && data.error != '') {
1218
+ jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
1219
+ return false;
1220
+ }
1221
+ jQuery('.b2s-auth-network-6-info[data-info="login"]').show();
1222
+ }
1223
+ }
1224
+ });
1225
+ });
1226
+
1227
+ jQuery(document).on('click', '.b2s-auth-network-6-confirm-btn', function () {
1228
+ jQuery('.b2s-loading-area').show();
1229
+ jQuery('.b2s-auth-network-6-login-area').hide();
1230
+ jQuery('.b2s-auth-network-6-login-btn').hide();
1231
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
1232
+ jQuery.ajax({
1233
+ url: ajaxurl,
1234
+ type: "POST",
1235
+ dataType: "json",
1236
+ cache: false,
1237
+ data: {
1238
+ 'action': 'b2s_auth_network_confirm',
1239
+ 'username': jQuery('#b2s-auth-network-6-username').val(),
1240
+ 'password': jQuery('#b2s-auth-network-6-password').val(),
1241
+ 'boardId': jQuery('#b2s-auth-network-6-board').val(),
1242
+ 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
1243
+ 'mandantId': jQuery('#b2s-auth-network-6-mandant-id').val(),
1244
+ 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
1245
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1246
+ },
1247
+ error: function (jqXHR) {
1248
+ jQuery('.b2s-loading-area').hide();
1249
+ jQuery('.b2s-auth-network-6-login-area').show();
1250
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
1251
+ if (jqXHR.status == 403) {
1252
+ jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
1253
+ } else {
1254
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
1255
+ }
1256
+ return false;
1257
+ },
1258
+ success: function (data) {
1259
+ jQuery('.b2s-loading-area').hide();
1260
+ jQuery('.b2s-auth-network-6-login-area').show();
1261
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
1262
+ if (data.result == true) {
1263
+ jQuery('#b2sAuthNetwork6Modal').modal('hide');
1264
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
1265
+ } else {
1266
+ if (data.error == 'nonce') {
1267
+ jQuery('.b2s-nonce-check-fail').show();
1268
+ }
1269
+ if (typeof data.error != 'undefined' && data.error != '') {
1270
+ jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
1271
+ return false;
1272
+ }
1273
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
1274
+ }
1275
+ }
1276
+ });
1277
+ });
1278
+
1279
+ jQuery(document).on('click', '.b2s-network-auth-btn[data-auth-method="client"]', function () {
1280
+ jQuery('#b2s-auth-network-6-mandant-id').val(jQuery(this).attr('data-network-mandant-id'));
1281
+ jQuery('#b2sAuthNetwork6Modal').modal('show');
1282
+ });
1283
+ jQuery(document).on('click', '.b2s-network-add-mandant-btn', function () {
1284
+ jQuery('#b2s-network-add-mandant').modal('show');
1285
+ });
1286
+ jQuery(document).on('click', '.b2sInfoSchedTimesModalBtn', function () {
1287
+ jQuery('#b2sInfoSchedTimesModal').modal('show');
1288
+ });
1289
+ jQuery(document).on('click', '.b2sInfoNetwork18Btn', function () {
1290
+ jQuery('#b2sInfoNetwork18').modal('show');
1291
+ });
1292
+ jQuery(document).on('click', '.b2sInfoNoCacheBtn', function () {
1293
+ jQuery('#b2sInfoNoCache').modal('show');
1294
+ });
1295
+ jQuery(document).on('click', '.b2sInfoContentBtn', function () {
1296
+ jQuery('#b2sInfoContent').modal('show');
1297
+ });
1298
+ jQuery(document).on('click', '.b2sInfoCharacterLimitBtn', function () {
1299
+ jQuery('#b2sInfoCharacterLimit').modal('show');
1300
+ });
1301
+
1302
+ jQuery(document).on('click', '.b2s-network-auth-update-btn[data-auth-method="client"]', function () {
1303
+ jQuery('#b2s-auth-network-6-auth-id').val(jQuery(this).attr('data-network-auth-id'));
1304
+ jQuery('#b2s-auth-network-6-mandant-id').val(jQuery(this).attr('data-network-mandant-id'));
1305
+ jQuery('#b2sAuthNetwork6Modal').modal('show');
1306
+ });
1307
+
1308
+ //reset
1309
+ jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
1310
+ jQuery('.b2s-loading-area').hide();
1311
+ jQuery('.b2s-auth-network-6-login-area').show();
1312
+ jQuery('#b2s-auth-network-6-auth-id').val('');
1313
+ jQuery('#b2s-auth-network-6-board').html('');
1314
+ jQuery('#b2s-auth-network-6-ident-data').val('');
1315
+ jQuery('.b2s-auth-network-6-info').hide();
1316
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
1317
+ jQuery('.b2s-auth-network-6-login-btn').show();
1318
+ jQuery('.b2s-auth-network-6-board-area').hide();
1319
+ jQuery('#b2s-auth-network-6-username').val('');
1320
+ jQuery('#b2s-auth-network-6-password').val('');
1321
+ });
1322
+
1323
+ jQuery(".b2s-auth-network-6-reveal").mousedown(function () {
1324
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'text'));
1325
+ });
1326
+ jQuery(".b2s-auth-network-6-reveal").mouseup(function () {
1327
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
1328
+ });
1329
+ jQuery(".b2s-auth-network-6-reveal").mouseout(function () {
1330
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
1331
+ });
1332
+ // END Pinterest
1333
+
1334
+ //START Network Auth Settings
1335
+ jQuery(document).on('click', '.b2s-network-auth-settings-btn', function () {
1336
+ jQuery('#b2s-edit-network-auth-settings').modal('show');
1337
+ if (jQuery('#b2sUserVersion').val() >= 3) {
1338
+
1339
+ jQuery('.b2s-network-auth-settings-content').hide();
1340
+ jQuery('.b2s-loading-area').show();
1341
+
1342
+ jQuery('.b2s-move-connection-error').hide();
1343
+ jQuery('.b2s-connection-assign').hide();
1344
+ jQuery('.b2s-assignment-area').hide();
1345
+ jQuery('.b2s-connection-owner').hide();
1346
+ jQuery('.b2s-assign-error').hide();
1347
+ jQuery('#b2s-no-assign-user').hide();
1348
+ jQuery('#b2s-assign-info').show();
1349
+ jQuery('.b2s-url-parameter-error').hide();
1350
+ jQuery('.b2s-url-parameter-content').show();
1351
+
1352
+ jQuery('#b2sUserAuthId').val(jQuery(this).attr('data-network-auth-id'));
1353
+ jQuery('#b2sOldMandantId').val(jQuery(this).attr('data-network-mandant-id'));
1354
+ jQuery('#b2sNetworkId').val(jQuery(this).attr('data-network-id'));
1355
+ jQuery('#b2sNetworkType').val(jQuery(this).attr('data-network-type'));
1356
+
1357
+ //Move connection to network mandant
1358
+ if (jQuery('#b2s-move-connection-select').length) {
1359
+ jQuery('#b2s-move-connection-select').html(jQuery('.b2s-network-mandant-select').html());
1360
+ jQuery("#b2s-move-connection-select option[value='-1']").remove();
1361
+ jQuery("#b2s-move-connection-select option[value='" + jQuery(this).attr('data-network-mandant-id') + "']").remove();
1362
+ if (jQuery(this).attr('data-network-mandant-id') <= 0) {
1363
+ if (jQuery('#b2s-network-select-more-client').length) {
1364
+ var temp_options = jQuery('#b2s-move-connection-select #b2s-network-select-more-client').html();
1365
+ jQuery("#b2s-move-connection-select optiongroup").remove();
1366
+ jQuery("#b2s-move-connection-select").html(temp_options);
1367
+ } else {
1368
+ jQuery('#b2s-move-connection-input').hide();
1369
+ jQuery('#b2s-move-connection-error').show();
1370
+ }
1371
+ } else {
1372
+ if (!jQuery('#b2s-move-connection-select #b2s-network-select-more-client option').length) {
1373
+ var temp_options = jQuery("#b2s-move-connection-select option[value='0']");
1374
+ jQuery("#b2s-move-connection-select optiongroup").remove();
1375
+ jQuery("#b2s-move-connection-select").html(temp_options);
1376
+ }
1377
+ }
1378
+ }
1379
+
1380
+ jQuery.ajax({
1381
+ url: ajaxurl,
1382
+ type: "GET",
1383
+ dataType: "json",
1384
+ cache: false,
1385
+ data: {
1386
+ 'action': 'b2s_get_network_auth_settings',
1387
+ 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
1388
+ 'owner': jQuery(this).attr('data-connection-owner'),
1389
+ 'networkId': jQuery(this).attr('data-network-id'),
1390
+ 'networkType': jQuery('#b2sNetworkType').val(),
1391
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1392
+ },
1393
+ error: function () {
1394
+ jQuery('.b2s-server-connection-fail').show();
1395
+ return false;
1396
+ },
1397
+ success: function (data) {
1398
+ if (data.result == true) {
1399
+ jQuery('.b2s-loading-area').hide();
1400
+ jQuery('.b2s-network-auth-settings-content').show();
1401
+ var result = JSON.parse(data.data);
1402
+
1403
+ //URL Parameter
1404
+ if (typeof result.urlParameter != 'undefined' && result.urlParameter.length > 0) {
1405
+ jQuery('.b2s-url-parameter-content').html(result.urlParameter);
1406
+ if (jQuery('.b2s-url-parameter-entry').length <= 0) {
1407
+ jQuery('.b2s-col-name').hide();
1408
+ }
1409
+ } else {
1410
+ jQuery('.b2s-url-parameter-error[data-error-reason="default"]').show();
1411
+ jQuery('.b2s-url-parameter-content').hide();
1412
+ }
1413
+
1414
+ //User Assign
1415
+ if (typeof result.ownerName != 'undefined') { //Case: network is assigned by other user
1416
+ jQuery('#b2s-connection-owner-name').text(result.ownerName);
1417
+ jQuery('.b2s-connection-owner').show();
1418
+ jQuery('.b2s-assignment-area').show();
1419
+ } else if (typeof result.userSelect != 'undefined' && typeof result.assignList != 'undefined') { //Case: user is network owner
1420
+ jQuery('#b2s-connection-assign-select').html(result.userSelect);
1421
+ jQuery('.b2s-network-assign-list').html(result.assignList);
1422
+ if (jQuery('#b2s-approved-user-list li').length <= 1) {
1423
+ jQuery('#b2s-approved-user-list').hide();
1424
+ } else {
1425
+ jQuery('#b2s-approved-user-list').show();
1426
+ }
1427
+ if (jQuery('#b2s-select-assign-user').html() == '') {
1428
+ jQuery('#b2s-select-assign-user').attr('disabled', true);
1429
+ jQuery('#b2s-assign-network-user-auth').attr('disabled', true);
1430
+ jQuery('.b2s-network-assign-option').hide();
1431
+ jQuery('#b2s-assign-info').hide();
1432
+ jQuery('#b2s-no-assign-user').show();
1433
+ } else {
1434
+ jQuery('#b2s-select-assign-user').removeAttr('disabled');
1435
+ jQuery('#b2s-assign-network-user-auth').removeAttr('disabled');
1436
+ jQuery('.b2s-network-assign-option').show();
1437
+ jQuery('#b2s-no-assign-user').hide();
1438
+ jQuery('#b2s-assign-info').show();
1439
+ }
1440
+ jQuery('.b2s-connection-assign').show();
1441
+ jQuery('.b2s-assignment-area').show();
1442
+ jQuery('.b2s-network-assign-list').show();
1443
+ jQuery('#b2s-connection-assign-select').show();
1444
+ } else {
1445
+ jQuery('.b2s-assign-error[data-error-reason="default"]').show();
1446
+ jQuery('.b2s-connection-assign').show();
1447
+ jQuery('.b2s-assignment-area').show();
1448
+ jQuery('#b2s-assign-network-user-auth').hide();
1449
+ jQuery('#b2s-assign-info').hide();
1450
+ jQuery('.b2s-network-assign-option').hide();
1451
+ jQuery('.b2s-network-assign-list').hide();
1452
+ jQuery('#b2s-connection-assign-select').hide();
1453
+ }
1454
+
1455
+ } else {
1456
+ jQuery('#b2s-edit-network-auth-settings').modal('hide');
1457
+ if(result.error == 'nonce') {
1458
+ jQuery('.b2s-nonce-check-fail').show();
1459
+ return false;
1460
+ }
1461
+ jQuery('.b2s-server-connection-fail').show();
1462
+ return false;
1463
+ }
1464
+ }
1465
+ });
1466
+ } else {
1467
+ jQuery('.b2s-loading-area').hide();
1468
+ }
1469
+ });
1470
+
1471
+ //START URL Parameter
1472
+ jQuery(document).on('click', '.b2s-url-parameter-add-btn', function () {
1473
+ jQuery('.b2s-col-name').show();
1474
+ var html = '<li class="b2s-url-parameter-entry row">';
1475
+ html += '<div class="col-md-5"><input class="form-control b2s-link-parameter-name" value=""></div>';
1476
+ html += '<div class="col-md-5"><input class="form-control b2s-link-parameter-value" value=""></div>';
1477
+ html += '<div class="col-md-1"><span aria-hidden="true" class="b2s-url-parameter-remove-btn text-danger">&times;</span></div>';
1478
+ html += '</li>';
1479
+ jQuery('.b2s-url-parameter-list').append(html);
1480
+ if (jQuery('.b2s-url-parameter-entry').length >= 10) {
1481
+ jQuery('.b2s-url-parameter-add-btn').hide();
1482
+ }
1483
+ });
1484
+
1485
+ jQuery(document).on('click', '.b2s-url-parameter-remove-btn', function () {
1486
+ jQuery(this).closest('li').remove();
1487
+ if (jQuery('.b2s-url-parameter-entry').length <= 0) {
1488
+ jQuery('.b2s-col-name').hide();
1489
+ }
1490
+ jQuery('.b2s-url-parameter-add-btn').show();
1491
+ });
1492
+
1493
+ jQuery(document).on('click', '.b2s-url-parameter-save-btn', function () {
1494
+ jQuery('.b2s-network-auth-settings-content').hide();
1495
+ jQuery('.b2s-loading-area').show();
1496
+ jQuery('.b2s-url-parameter-error').hide();
1497
+
1498
+ var urlParameter = {};
1499
+ jQuery('.b2s-url-parameter-entry').each(function () {
1500
+ if (jQuery(this).find('.b2s-link-parameter-name').val().length != 0 && jQuery(this).find('.b2s-link-parameter-value').val().length != 0) {
1501
+ urlParameter[jQuery(this).find('.b2s-link-parameter-name').val()] = jQuery(this).find('.b2s-link-parameter-value').val();
1502
+ }
1503
+ });
1504
+
1505
+ var originNetworkAuthId = jQuery(this).attr('data-network-auth-id');
1506
+
1507
+ var networks = [];
1508
+ if (jQuery('.b2s-url-parameter-for-all').is(':checked')) { //get all network connections
1509
+ jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li').each(function () {
1510
+ if (typeof jQuery(this).data('network-auth-id') != 'undefined') {
1511
+ networks.push({
1512
+ 'networkAuthId': jQuery(this).data('network-auth-id'),
1513
+ 'networkId': jQuery(this).data('network-id'),
1514
+ 'networkType': jQuery(this).data('network-type'),
1515
+ 'displayName': jQuery(this).find('.b2s-network-item-auth-user-name').text()
1516
+ });
1517
+ }
1518
+ });
1519
+ } else if (jQuery('.b2s-url-parameter-for-all-network').is(':checked')) { //get all network connections for specific network
1520
+ jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li[data-network-id="' + jQuery(this).data('network-id') + '"]').each(function () {
1521
+ if (typeof jQuery(this).data('network-auth-id') != 'undefined') {
1522
+ networks.push({
1523
+ 'networkAuthId': jQuery(this).data('network-auth-id'),
1524
+ 'networkId': jQuery(this).data('network-id'),
1525
+ 'networkType': jQuery(this).data('network-type'),
1526
+ 'displayName': jQuery(this).find('.b2s-network-item-auth-user-name').text()
1527
+ });
1528
+ }
1529
+ });
1530
+ } else { //only current network connection
1531
+ networks.push({
1532
+ 'networkAuthId': originNetworkAuthId,
1533
+ 'networkId': jQuery(this).data('network-id'),
1534
+ 'networkType': jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li[data-network-auth-id="' + originNetworkAuthId + '"]').data('network-type'),
1535
+ 'displayName': jQuery('.b2s-network-details-container-list[data-mandant-id="-1"] .b2s-network-item-auth-list-li[data-network-auth-id="' + originNetworkAuthId + '"]').find('.b2s-network-item-auth-user-name').text()
1536
+ });
1537
+ }
1538
+
1539
+ jQuery.ajax({
1540
+ url: ajaxurl,
1541
+ type: "POST",
1542
+ dataType: "json",
1543
+ cache: false,
1544
+ data: {
1545
+ 'action': 'b2s_save_url_parameter',
1546
+ 'originNetworkAuthId': originNetworkAuthId,
1547
+ 'networks': networks,
1548
+ 'networkId': jQuery(this).attr('data-network-id'),
1549
+ 'urlParameter': JSON.stringify(urlParameter),
1550
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1551
+ },
1552
+ error: function () {
1553
+ jQuery('.b2s-server-connection-fail').show();
1554
+ return false;
1555
+ },
1556
+ success: function (data) {
1557
+ jQuery('.b2s-loading-area').hide();
1558
+ jQuery('.b2s-network-auth-settings-content').show();
1559
+ if (data.result == true) {
1560
+ if (data.html.length > 0) {
1561
+ jQuery('.b2s-url-parameter-content').html(data.html);
1562
+ if (jQuery('.b2s-url-parameter-entry').length <= 0) {
1563
+ jQuery('.b2s-col-name').hide();
1564
+ }
1565
+ }
1566
+ } else {
1567
+ if (data.error == 'nonce') {
1568
+ jQuery('.b2s-nonce-check-fail').show();
1569
+ } else {
1570
+ jQuery('.b2s-url-parameter-error[data-error-reason="save"]').show();
1571
+ }
1572
+ }
1573
+ }
1574
+ });
1575
+ });
1576
+ //END URL Parameter
1577
+ //END Network Auth Settings
1578
+
1579
+ jQuery(document).on('click', '.b2s-network-add-page-info-btn', function() {
1580
+ jQuery('#b2sNetworkAddInfoModal').modal('show');
1581
+ var b2sAuthUrl = jQuery(this).data('b2s-auth-url');
1582
+ jQuery(document).on('click', '.b2s-add-network-continue-btn', function() {
1583
+ jQuery('#b2sNetworkAddInfoModal').modal('hide');
1584
+ wop(b2sAuthUrl + '&choose=page', 'Blog2Social Network');
1585
+ return false;
1586
+ });
1587
+ return false;
1588
+ });
assets/js/b2s/repost.js CHANGED
@@ -97,6 +97,7 @@ jQuery(document).on('click', '.b2s-re-post-submit-btn', function() {
97
  jQuery('.b2s-repost-options-area').hide();
98
  jQuery('.b2s-repost-queue-area').hide();
99
  jQuery('.b2s-re-post-no-content').hide();
 
100
  jQuery('.b2s-re-post-limit-error').hide();
101
  jQuery('.b2s-loading-area').show();
102
  jQuery.ajax({
@@ -133,6 +134,10 @@ jQuery(document).on('click', '.b2s-re-post-submit-btn', function() {
133
  jQuery('.b2s-re-post-no-content').show();
134
  return false;
135
  }
 
 
 
 
136
  if (data.error == 'limit') {
137
  jQuery('.b2s-re-post-limit-error').show();
138
  return false;
@@ -749,4 +754,9 @@ jQuery(document).on('change', '.b2s-re-post-date-end', function() {
749
  jQuery('.b2s-re-post-date-active').prop('checked', true);
750
  }
751
  jQuery('.b2s-re-post-date-end').removeClass('error');
 
 
 
 
 
752
  });
97
  jQuery('.b2s-repost-options-area').hide();
98
  jQuery('.b2s-repost-queue-area').hide();
99
  jQuery('.b2s-re-post-no-content').hide();
100
+ jQuery('.b2s-re-post-content-in-queue').hide();
101
  jQuery('.b2s-re-post-limit-error').hide();
102
  jQuery('.b2s-loading-area').show();
103
  jQuery.ajax({
134
  jQuery('.b2s-re-post-no-content').show();
135
  return false;
136
  }
137
+ if (data.error == 'content_in_queue') {
138
+ jQuery('.b2s-re-post-content-in-queue').show();
139
+ return false;
140
+ }
141
  if (data.error == 'limit') {
142
  jQuery('.b2s-re-post-limit-error').show();
143
  return false;
754
  jQuery('.b2s-re-post-date-active').prop('checked', true);
755
  }
756
  jQuery('.b2s-re-post-date-end').removeClass('error');
757
+ });
758
+
759
+ jQuery(document).on('click', '.b2s-network-info-modal-btn', function () {
760
+ jQuery('#b2sInfoNetworkModal').modal('show');
761
+ return false;
762
  });
assets/js/b2s/ship.js CHANGED
@@ -1,3881 +1,3885 @@
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.plugins.xhtml.allowedTags = ['h1', 'h2', 'p', 'br', 'i', 'em', 'b', 'a', 'img'];
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-upload-image').attr('data-network-auth-id', networkAuthId);
96
- 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();
97
- jQuery('.b2s-selected-network-for-image-info').html(content);
98
- jQuery('#b2s-network-select-image').modal('show');
99
- jQuery('.b2s-image-change-meta-network').hide();
100
- jQuery('#b2sInsertImageType').val("1");
101
- imageSize();
102
-
103
- },
104
- txtExec: function () {
105
- var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
106
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
107
- jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
108
- 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();
109
- jQuery('.b2s-selected-network-for-image-info').html(content);
110
- jQuery('#b2s-network-select-image').modal('show');
111
- jQuery('#b2sInsertImageType').val("1");
112
- imageSize();
113
- }, tooltip: "Image"});
114
- jQuery.sceditor.command.set(
115
- "custom-emoji", {
116
- exec: function () {
117
- var me = this;
118
- if (pickerHTML.pickerVisible) {
119
- pickerHTML.hidePicker();
120
- } else {
121
- pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
122
- currentPickerHTMLContent = this;
123
- }
124
- },
125
- txtExec: function () {
126
- var me = this;
127
- if (pickerHTML.pickerVisible) {
128
- pickerHTML.hidePicker();
129
- } else {
130
- pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
131
- currentPickerHTMLContent = this;
132
- }
133
- }, tooltip: "Emoji"});
134
-
135
-
136
- jQuery(document).on('click', '.b2s-toogle-calendar-btn', function () {
137
-
138
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
139
- var networkId = jQuery(this).attr('data-network-id');
140
- var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
141
- var currentBtnText = jQuery(this).text();
142
-
143
- jQuery(this).text(toogleBtnText);
144
- jQuery(this).attr('data-toogle-text-btn', currentBtnText);
145
-
146
- //change to show
147
- var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
148
- if (calendar.hasClass('hide')) {
149
- calendar.removeClass('hide');
150
- calendar.addClass('show');
151
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').removeClass('hide');
152
-
153
- if (calendar.is(':empty')) {
154
- 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();
155
-
156
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar({
157
- editable: false,
158
- locale: b2s_calendar_locale,
159
- eventLimit: 2,
160
- contentHeight: 530,
161
- timeFormat: 'H:mm',
162
- eventSources: [b2s_cur_source_ship_calendar[0]],
163
- eventRender: function (event, element) {
164
- show = true;
165
- $header = jQuery("<div>").addClass("b2s-calendar-header");
166
- $isRelayPost = '';
167
- $isCuratedPost = '';
168
- if (event.post_type == 'b2s_ex_post') {
169
- $isCuratedPost = ' (Curated Post)';
170
- }
171
- if (event.relay_primary_post_id > 0) {
172
- $isRelayPost = ' (Retweet)';
173
- }
174
- $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
175
- element.find(".fc-time").after($network_name);
176
- element.html(element.html());
177
- $parent = element.parent();
178
- $header.append(element.find(".fc-content"));
179
- element.append($header);
180
- $body = jQuery("<div>").addClass("b2s-calendar-body");
181
- $body.append(event.avatar);
182
- $body.append(element.find(".fc-title"));
183
- $body.append(jQuery("<br>"));
184
- var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
185
- $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;' />")
186
- $em.append(event.network_name);
187
- $em.append(jQuery("<span>").text(": " + event.profile));
188
- $body.append($em);
189
- element.append($body);
190
- },
191
- dayRender: function (date, element) {
192
- if (!jQuery(element[0]).hasClass('fc-past')) {
193
- var date = jQuery(element[0]).attr('data-date');
194
- var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
195
- $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);
196
- sel_element.append($header);
197
- }
198
- }
199
- });
200
- } else {
201
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar('refetchEvents');
202
- }
203
-
204
- } else {
205
- calendar.removeClass('show');
206
- calendar.addClass('hide');
207
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
208
-
209
- }
210
-
211
- return false;
212
-
213
- });
214
-
215
- jQuery(document).on('click', '.b2s-calendar-add-schedule-btn', function () {
216
- var selSchedDate = jQuery(this).parent('td').attr('data-date');
217
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
218
-
219
- if (jQuery('#user_version').val() == 0) {
220
- jQuery('.b2s-post-item-details-release-input-date-select-reset[data-network-auth-id="' + networkAuthId + '"]').val('0');
221
- jQuery('#b2s-sched-post-modal').modal('show');
222
- return false;
223
- }
224
-
225
- if (jQuery('#b2sUserLang').val() == 'de') {
226
- selSchedDate = selSchedDate.substring(8, 10) + '.' + selSchedDate.substring(5, 7) + '.' + selSchedDate.substring(0, 4);
227
- }
228
-
229
- //isfirst
230
- if (!jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"] option[value="1"]:selected').length > 0) {
231
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
232
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
233
- } else {
234
- //add
235
- var curSel = jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"]').filter(':visible');
236
- if (curSel.length > 0) {
237
- curSel.trigger('click');
238
- netCountNext = parseInt(curSel.attr('data-network-count')) + 1;
239
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + netCountNext + '"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
240
- } else {
241
- //do not adding write to first
242
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
243
- }
244
- }
245
- return false;
246
- });
247
-
248
- jQuery(document).on('change', '.b2s-calendar-filter-network-sel', function () {
249
- 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();
250
- 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();
251
- jQuery(this).attr('data-last-sel', jQuery(this).val());
252
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('removeEventSource', oldSource);
253
- jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('addEventSource', newSource);
254
- return false;
255
- });
256
-
257
-
258
- jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
259
- jQuery('.b2s-server-connection-fail').hide();
260
- jQuery.ajax({
261
- url: ajaxurl,
262
- type: "POST",
263
- dataType: "json",
264
- cache: false,
265
- data: {
266
- 'action': 'b2s_get_settings_sched_time_default',
267
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
268
- },
269
- error: function () {
270
- jQuery('.b2s-server-connection-fail').show();
271
- return false;
272
- },
273
- success: function (data) {
274
- if (data.result == true) {
275
- var tomorrow = new Date();
276
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
277
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
278
- }
279
- tomorrow.setDate(tomorrow.getDate() + 1);
280
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
281
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
282
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
283
- var today = new Date();
284
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
285
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
286
- }
287
-
288
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
289
- var todayDate = ("0" + today.getDate()).slice(-2);
290
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
291
- var lang = jQuery('#b2sUserLang').val();
292
- if (lang == "de") {
293
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
294
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
295
- }
296
-
297
- jQuery.each(data.times, function (network_id, time) {
298
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
299
- time.forEach(function (network_type_time, count) {
300
- if (network_type_time != "") {
301
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
302
- if (jQuery(this).is(':not(:disabled)')) {
303
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
304
- //is not set special dates
305
- 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') {
306
- 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");
307
- }
308
- var hours = network_type_time.substring(0, 2);
309
- if (lang == "en") {
310
- var timeparts = network_type_time.split(' ');
311
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
312
- }
313
- if (hours < today.getHours()) {
314
- 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);
315
- 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);
316
- } else {
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"]').val(dateToday);
318
- 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);
319
- }
320
- 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);
321
- 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);
322
- }
323
- });
324
- count++;
325
- }
326
- });
327
- }
328
- });
329
- } else {
330
- if (data.error == 'nonce') {
331
- jQuery('.b2s-nonce-check-fail').show();
332
- }
333
- }
334
- }
335
- });
336
- return false;
337
- });
338
-
339
-
340
- function formatAMPM(date) {
341
- var hours = date.getHours();
342
- var minutes = date.getMinutes();
343
- var ampm = hours >= 12 ? 'pm' : 'am';
344
- hours = hours % 12;
345
- hours = hours ? hours : 12; // the hour '0' should be '12'
346
- minutes = minutes < 10 ? '0' + minutes : minutes;
347
- var strTime = hours + ':' + minutes + ' ' + ampm;
348
- return strTime;
349
- }
350
-
351
-
352
-
353
- jQuery(document).on('click', '.b2s-sidbar-network-auth-btn', function () {
354
- jQuery('#b2s-network-list-modal').modal('show');
355
- return false;
356
- });
357
- jQuery(document).on('click', '.change-meta-tag', function () {
358
- var attr = jQuery(this).attr('readonly');
359
- if (typeof attr !== typeof undefined && attr !== false) {
360
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
361
- //Content cuation
362
- var postType = jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-post-wp-type');
363
- if (postType != "ex") {
364
- jQuery('.meta-text').hide();
365
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
366
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
367
- var isMetaChecked = false;
368
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
369
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
370
- isMetaChecked = true;
371
- }
372
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
373
- isMetaChecked = true;
374
- }
375
- var showDefault = true;
376
- if (postFormat == "0" && !isMetaChecked) { //isLinkPost
377
- showDefault = false;
378
- if (networkId == "1") {
379
- jQuery('.isOgMetaChecked').show();
380
- } else {
381
- jQuery('.isCardMetaChecked').show();
382
- }
383
- }
384
- if (showDefault) {
385
- jQuery('.isLinkPost').show();
386
- }
387
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
388
- }
389
- }
390
- return false;
391
- });
392
- // Linkpost change Meta Tags title + desc
393
- jQuery(document).on('keyup', '.change-meta-tag', function () {
394
- var currentText = jQuery(this).val();
395
- var metaTag = jQuery(this).attr('data-meta');
396
- jQuery('.change-meta-tag[data-meta=' + metaTag + ']').each(function () {
397
- //override this content with current content by keyup
398
- jQuery(this).val(currentText);
399
- });
400
- return false;
401
- });
402
- jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
403
- jQuery('.b2s-server-connection-fail').hide();
404
- jQuery.ajax({
405
- url: ajaxurl,
406
- type: "POST",
407
- dataType: "json",
408
- cache: false,
409
- data: {
410
- 'action': 'b2s_get_settings_sched_time_user',
411
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
412
- },
413
- error: function () {
414
- jQuery('.b2s-server-connection-fail').show();
415
- return false;
416
- },
417
- success: function (data) {
418
- var tomorrow = new Date();
419
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
420
- tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
421
- }
422
-
423
- tomorrow.setDate(tomorrow.getDate() + 1);
424
- var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
425
- var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
426
- var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
427
- var today = new Date();
428
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
429
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
430
- }
431
-
432
- var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
433
- var todayDate = ("0" + today.getDate()).slice(-2);
434
- var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
435
- var lang = jQuery('#b2sUserLang').val();
436
- if (lang == "de") {
437
- dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
438
- dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
439
- }
440
- if (data.result == true) {
441
- //V5.1.0 seeding
442
- if (data.type == 'new') {
443
- //new
444
- jQuery.each(data.times, function (network_auth_id, time) {
445
- if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
446
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').is(':not(:disabled)')) {
447
- //is not set special dates
448
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
449
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
450
- }
451
- var hours = time.substring(0, 2);
452
- if (lang == "en") {
453
- var timeparts = time.split(' ');
454
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
455
- }
456
-
457
- var isDelay = false;
458
- var delayDay = data.delay_day[network_auth_id];
459
- if (delayDay != undefined) {
460
- if (delayDay > 0) {
461
- var delay = new Date();
462
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
463
- delay.setTime(jQuery('#b2sBlogPostSchedDate').val());
464
- }
465
- delay.setDate(delay.getDate() + parseInt(delayDay));
466
- var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
467
- var delayDate = ("0" + delay.getDate()).slice(-2);
468
- var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
469
- if (lang == 'de') {
470
- dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
471
- }
472
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
473
- isDelay = true;
474
-
475
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
476
- }
477
- }
478
- if (!isDelay) {
479
- if (hours < today.getHours()) {
480
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
481
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
482
- } else {
483
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
484
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
485
- }
486
- }
487
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
488
- 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)));
489
- }
490
- }
491
- });
492
- } else {
493
- //old
494
- jQuery.each(data.times, function (network_id, time) {
495
- if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
496
- time.forEach(function (network_type_time, count) {
497
- if (network_type_time != "") {
498
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
499
- if (jQuery(this).is(':not(:disabled)')) {
500
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
501
- //is not set special dates
502
- 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') {
503
- 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");
504
- }
505
- var hours = network_type_time.substring(0, 2);
506
- if (lang == "en") {
507
- var timeparts = network_type_time.split(' ');
508
- hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
509
- }
510
- if (hours < today.getHours()) {
511
- 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);
512
- 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);
513
- } else {
514
- 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);
515
- 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);
516
- }
517
- 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);
518
- 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);
519
- }
520
- });
521
- count++;
522
- }
523
- });
524
- }
525
- });
526
- }
527
- } else {
528
- if (data.error == 'nonce') {
529
- jQuery('.b2s-nonce-check-fail').show();
530
- }
531
- //default load best Times
532
- //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
533
- //set current time
534
- jQuery('.b2s-post-item:visible').each(function () {
535
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
536
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
537
- //is not set special dates
538
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
539
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
540
- }
541
- }
542
- });
543
- }
544
- }
545
- });
546
- return false;
547
- });
548
- jQuery('#b2sPreFeatureModal').on('show.bs.modal', function () {
549
- jQuery('.b2s-post-item-details-release-input-date-select-reset').val('0');
550
- });
551
- jQuery(document).on('click', '.b2s-network-list-add-btn-profeature', function () {
552
- jQuery('#b2s-network-list-modal').modal('hide');
553
- });
554
- jQuery(document).on('click', '.b2s-post-item-details-release-area-sched-for-all', function () {
555
- var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
556
- var dataNetworkCount = 0;
557
- var selMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val();
558
- if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="1"]').is(":visible")) {
559
- dataNetworkCount = 1;
560
- }
561
- if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="2"]').is(":visible")) {
562
- dataNetworkCount = 2;
563
- }
564
-
565
- jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
566
- 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) {
567
- jQuery(this).val(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val());
568
- //view elements
569
- releaseChoose(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
570
- //view elements interval
571
- if (selMode == 2) {
572
- for (var i = 0; i <= dataNetworkCount; i++) {
573
- var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
574
- releaseChooseInterval(curInterval, '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]', i);
575
- }
576
- }
577
- }
578
- });
579
- //set values
580
- for (var i = 0; i <= dataNetworkCount; i++) {
581
- 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());
582
- 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());
583
- if (selMode == 2) {
584
- var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
585
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]').val(curInterval);
586
- if (curInterval == 0) {
587
- 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());
588
- 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'));
589
- 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'));
590
- 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'));
591
- 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'));
592
- 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'));
593
- 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'));
594
- 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'));
595
- }
596
- if (curInterval == 1) {
597
- 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());
598
- 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());
599
- }
600
- if (curInterval == 2) {
601
- 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());
602
- 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());
603
- }
604
- }
605
- }
606
-
607
- if (dataNetworkCount == 2) {
608
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
609
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
610
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').hide();
611
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"]').show();
612
- } else if (dataNetworkCount == 1) {
613
- jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
614
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').show();
615
- }
616
-
617
- return false;
618
- });
619
- jQuery(document).on("click", ".b2s-user-network-settings-post-format", function () {
620
- jQuery('.b2s-settings-user-success').hide();
621
- jQuery('.b2s-settings-user-error').hide();
622
- jQuery('.b2s-server-connection-fail').hide();
623
- var networkId = jQuery(this).attr("data-network-id");
624
- var networkType = jQuery(this).attr("data-network-type");
625
- var postFormat = jQuery(this).val();
626
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
627
- var postFormatType = jQuery(this).attr("data-post-format-type");
628
- var postType = jQuery(this).attr("data-post-wp-type");
629
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
630
- //PostFormat
631
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
632
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
633
- if (jQuery('#user_version').val() >= 2) {
634
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][postFormat]);
635
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(postFormat);
636
- } else {
637
- jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][postFormat]);
638
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
639
- }
640
- if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-meta-type') == 'og' && postType != "ex") {
641
- if (currentOGImage == '' && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != '') {
642
- currentOGImage = jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val();
643
- if (postFormat == "0") {
644
- jQuery('.b2s-network-select-btn[data-meta-type="og"]').each(function () {
645
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentOGImage);
646
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentOGImage);
647
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
648
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
649
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
650
- }
651
- });
652
- }
653
- }
654
- if (postFormat == "0" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != currentOGImage) {
655
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
656
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
657
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
658
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
659
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
660
- }
661
- }
662
- }
663
- }
664
- var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').attr('data-network-text-limit');
665
- if (textLimit != "0") {
666
- networkLimitAll(networkAuthId, networkId, textLimit);
667
- } else {
668
- networkCount(networkAuthId);
669
- }
670
-
671
- //Edit Meta Tags
672
- var isMetaChecked = false;
673
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
674
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
675
- isMetaChecked = true;
676
- }
677
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
678
- isMetaChecked = true;
679
- }
680
- if (isMetaChecked && postFormat == '0' && jQuery('#user_version').val() > 0) { //If linkpost
681
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
682
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
683
- var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
684
- if (dataMetaType == "og") {
685
- jQuery('#b2sChangeOgMeta').val("1");
686
- } else {
687
- jQuery('#b2sChangeCardMeta').val("1");
688
- }
689
-
690
- //Copy from further item meta tags by same network
691
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
692
- 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
693
- 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());
694
- 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());
695
- 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());
696
- if (jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]:visible').length == 1) {
697
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
698
- } else {
699
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
700
- }
701
-
702
- return true;
703
- }
704
- });
705
-
706
- //Set & Check Link
707
- if (typeof jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]') !== undefined) {
708
- //Facebook + Twitter && Linkpost
709
- if (networkId == 1 || networkId == 2 && postFormat == 0) {
710
- if (jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
711
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefault_url').val());
712
- }
713
- }
714
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
715
- if (jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hasClass('disabled')) {
716
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').removeClass('disabled');
717
- }
718
- }
719
-
720
- } else {
721
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
722
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
723
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
724
- }
725
-
726
- //Content Curation V5.0.0
727
- if (postType == "ex") {
728
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
729
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
730
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
731
- if (postFormat == '0') {
732
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
733
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
734
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
735
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
736
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
737
- } else {
738
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
739
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
740
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
741
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
742
- }
743
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
744
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
745
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
746
- }
747
- }
748
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
749
- jQuery(this).addClass('b2s-settings-checked');
750
- jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
751
- checkGifAnimation(networkAuthId, networkId);
752
- return false;
753
- });
754
- jQuery(document).on("click", ".b2s-post-ship-item-full-text", function () {
755
- jQuery('.b2s-server-connection-fail').hide();
756
- var curSchedCount = jQuery(this).attr('data-network-count');
757
- jQuery.ajax({
758
- url: ajaxurl,
759
- type: "POST",
760
- dataType: "json",
761
- cache: false,
762
- data: {
763
- 'action': 'b2s_ship_item_full_text',
764
- 'postId': jQuery('#b2sPostId').val(),
765
- 'userLang': jQuery('#b2sUserLang').val(),
766
- 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
767
- 'networkId': jQuery(this).attr('data-network-id'),
768
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
769
- },
770
- error: function () {
771
- jQuery('.b2s-server-connection-fail').show();
772
- return false;
773
- },
774
- success: function (data) {
775
- if (data.result == true) {
776
- messageInput = jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + curSchedCount + '"][data-network-auth-id="' + data.networkAuthId + '"]');
777
- messageInput.val(data.text);
778
- networkCount(data.networkAuthId);
779
- networkTextLimit = messageInput.attr('data-network-text-limit');
780
- if (typeof networkTextLimit != undefined) {
781
- if (parseInt(networkTextLimit) > 0 && parseInt(data.networkId) > 0) {
782
- networkLimitAll(data.networkAuthId, data.networkId, networkTextLimit);
783
- }
784
- }
785
- } else {
786
- if (data.error == 'nonce') {
787
- jQuery('.b2s-nonce-check-fail').show();
788
- }
789
- }
790
- }
791
- });
792
- return false;
793
- });
794
- jQuery(document).on("click", ".b2s-post-ship-item-message-delete", function () {
795
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
796
- var networkCountId = jQuery(this).attr('data-network-count');
797
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
798
- initSceditor(networkAuthId);
799
- networkCount(networkAuthId);
800
- return false;
801
- });
802
- jQuery(document).on("click", ".b2s-post-ship-item-copy-original-text", function () {
803
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
804
- var networkCountId = jQuery(this).attr('data-network-count');
805
- var networkId = jQuery(this).attr('data-network-id');
806
- var text = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').val();
807
- if (text == "" && networkId == 2) {
808
- text = jQuery('#b2sTwitterOrginalPost').val();
809
- }
810
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(text);
811
- networkCount(networkAuthId);
812
- return false;
813
- });
814
- jQuery(document).on("click", ".b2s-network-select-btn", function () {
815
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
816
- var networkId = jQuery(this).attr('data-network-id');
817
- var networkType = jQuery(this).attr('data-network-type');
818
- var metaType = jQuery(this).attr('data-meta-type');
819
-
820
- //doppelklick Schutz
821
- if (!jQuery(this).hasClass('b2s-network-select-btn-deactivate')) {
822
- //active?
823
- if (!jQuery(this).children().hasClass('active')) {
824
- //TOS XING Groups
825
- if ((networkId == 8 || networkId == 19) && networkType == 2) {
826
- 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'))) {
827
- jQuery('#b2s-tos-xing-group-modal').modal('show');
828
- return false;
829
- } else {
830
- b2sTosXingGroupCount++;
831
- }
832
- }
833
- //schon vorhanden?
834
- 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')) {
835
- activatePortal(networkAuthId);
836
- //PostFormat
837
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0 || networkId == 15) {
838
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
839
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').attr('data-post-format-type');
840
- if (jQuery('#user_version').val() >= 2) {
841
- 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()]);
842
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
843
- //if linkpost then show btn meta tags
844
- var isMetaChecked = false;
845
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
846
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
847
- isMetaChecked = true;
848
- }
849
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
850
- isMetaChecked = true;
851
- }
852
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
853
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
854
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
855
- var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
856
- if (dataMetaType == "og") {
857
- jQuery('#b2sChangeOgMeta').val("1");
858
- } else {
859
- jQuery('#b2sChangeCardMeta').val("1");
860
- }
861
-
862
- //Copy from further item meta tags by same network
863
- jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
864
- 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
865
- 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());
866
- 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());
867
- 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'));
868
- 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());
869
- if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
870
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
871
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
872
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
873
- }
874
- } else {
875
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
876
- }
877
-
878
- return true;
879
- }
880
- });
881
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
882
- if(jQuery('.b2s-network-select-btn[data-network-auth-id="'+networkAuthId+'"]').data('meta-type') == 'og' && changedOGImage == true) {
883
- if (currentOGImage != "") {
884
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
885
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
886
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
887
- } else {
888
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
889
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
890
- }
891
- } else {
892
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
893
- }
894
- } else {
895
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
896
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
897
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
898
- }
899
-
900
- } else {
901
- 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()]);
902
- jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
903
- }
904
-
905
- //Content Curation
906
- if (jQuery('#b2sPostType').val() == 'ex') {
907
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
908
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
909
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
910
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 0) {
911
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
912
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
913
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
914
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
915
- } else {
916
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
917
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
918
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
919
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
920
- }
921
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
922
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
923
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
924
- }
925
- }
926
- }
927
-
928
- //XING TOS Group
929
- jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"').show();
930
-
931
- //Twitter TOS 032018 - protected multiple accounts with same content to same time
932
- //delete comment field one more
933
- if (networkId == 2) {
934
- if (jQuery('.b2s-post-item[data-network-id="' + networkId + '"]:visible').length == 1) {
935
- jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text(jQuery('#b2sTwitterOrginalPost').val());
936
- } else {
937
- jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text("");
938
- }
939
- }
940
- checkGifAnimation(networkAuthId, networkId);
941
- } else {
942
- jQuery(this).addClass('b2s-network-select-btn-deactivate');
943
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').show();
944
- jQuery('.b2s-empty-area').hide();
945
- loadingDummyShow(networkAuthId, jQuery(this).attr('data-network-id'));
946
- jQuery('.b2s-server-connection-fail').hide();
947
- var legacyMode = jQuery('#isLegacyMode').val();
948
- if (legacyMode == "1") {
949
- legacyMode = false; // loading is sync (stack)
950
- } else {
951
- legacyMode = true; // loading is async (parallel)
952
- }
953
- jQuery.ajax({
954
- url: ajaxurl,
955
- type: "POST",
956
- dataType: "json",
957
- async: legacyMode,
958
- cache: false,
959
- data: {
960
- 'action': 'b2s_ship_item',
961
- 'networkAuthId': networkAuthId,
962
- 'networkType': jQuery(this).attr('data-network-type'),
963
- 'networkKind': jQuery(this).attr('data-network-kind'),
964
- 'networkId': networkId,
965
- 'networkDisplayName': jQuery(this).attr('data-network-display-name'),
966
- 'instantSharing': jQuery(this).attr('data-instant-sharing'),
967
- 'networkTosGroupId': jQuery(this).attr('data-network-tos-group-id'),
968
- 'userLang': jQuery('#b2sUserLang').val(),
969
- 'postId': jQuery('#b2sPostId').val(),
970
- 'relayCount': jQuery('#b2sRelayCount').val(),
971
- 'selSchedDate': jQuery('#selSchedDate').val(),
972
- 'b2sPostType': jQuery('#b2sPostType').val(),
973
- 'b2sIsDraft': jQuery('#b2sIsDraft').val(),
974
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
975
- },
976
- beforeSend: function (jqXHR) { // before jQuery send the request we will push it to our array
977
- jQuery.xhrPool.push(jqXHR);
978
- },
979
- complete: function (jqXHR) { // when some of the requests completed it will splice from the array
980
- var index = jQuery.xhrPool.indexOf(jqXHR);
981
- if (index > -1) {
982
- jQuery.xhrPool.splice(index, 1);
983
- }
984
- },
985
- error: function (jqXHR) {
986
- var index = jQuery.xhrPool.indexOf(jqXHR);
987
- if (index > -1) {
988
- jQuery.xhrPool.splice(index, 1);
989
- }
990
- loadingDummyConnectionFail(networkAuthId, networkId);
991
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').hide();
992
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
993
- jQuery('.b2s-server-connection-fail').show();
994
- return true;
995
- },
996
- success: function (data) {
997
- if (data != undefined) {
998
- jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + data.networkAuthId + '"]').hide();
999
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
1000
- if (data.result == true) {
1001
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1002
- var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
1003
- var pos = order.indexOf(data.networkAuthId.toString());
1004
- var add = false;
1005
- for (var i = pos; i >= 0; i--) {
1006
- if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
1007
- jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(data.content);
1008
- i = -1;
1009
- add = true;
1010
- }
1011
- }
1012
- if (add == false) {
1013
- jQuery('.b2s-post-list').prepend(data.content);
1014
- }
1015
-
1016
- activatePortal(data.networkAuthId);
1017
- var dateFormat = "yyyy-mm-dd";
1018
- var language = "en";
1019
- var showMeridian = true;
1020
- if (jQuery('#b2sUserLang').val() == "de") {
1021
- dateFormat = "dd.mm.yyyy";
1022
- language = "de";
1023
- showMeridian = false;
1024
- }
1025
- var today = new Date();
1026
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
1027
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
1028
- }
1029
-
1030
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
1031
- format: dateFormat,
1032
- language: language,
1033
- maxViewMode: 2,
1034
- todayHighlight: true,
1035
- startDate: today,
1036
- calendarWeeks: true,
1037
- autoclose: true
1038
- });
1039
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
1040
- minuteStep: 15,
1041
- appendWidgetTo: 'body',
1042
- showSeconds: false,
1043
- showMeridian: showMeridian,
1044
- defaultTime: today, //'current',
1045
- snapToStep: true
1046
- });
1047
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
1048
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1049
- });
1050
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
1051
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1052
- });
1053
- //Check Text Limit
1054
- 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');
1055
- if (textLimit != "0") {
1056
- networkLimitAll(data.networkAuthId, data.networkId, textLimit);
1057
- } else {
1058
- networkCount(data.networkAuthId);
1059
- }
1060
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger("change");
1061
- initSceditor(data.networkAuthId);
1062
- //Bild setzen
1063
- if (jQuery('#b2s_blog_default_image').val() != "") {
1064
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').length > 0) {
1065
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
1066
- var attachmenUrl = jQuery('#b2s_blog_default_image').val();
1067
- var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
1068
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
1069
- if (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1) {
1070
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-network-default-image').val());
1071
- } else {
1072
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
1073
- }
1074
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1075
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1076
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="0"]').show();
1077
- } else {
1078
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1079
- }
1080
- }
1081
- jQuery('.b2s-image-url-hidden-field').val(jQuery('#b2s_blog_default_image').val());
1082
- }
1083
-
1084
- //Time zone
1085
- jQuery('.b2s-settings-time-zone-text').html(jQuery('#user_timezone_text').val());
1086
- //PostFormat
1087
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0 || data.networkId == 15) {
1088
- var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
1089
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').attr('data-post-format-type');
1090
- if (jQuery('#user_version').val() >= 2) {
1091
- 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()]);
1092
- 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());
1093
- var isMetaChecked = false;
1094
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1095
- if (typeof data.networkId != 'undefined' && jQuery.inArray(data.networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1096
- isMetaChecked = true;
1097
- }
1098
- if (data.networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1099
- isMetaChecked = true;
1100
- }
1101
-
1102
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
1103
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1104
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1105
- var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').attr("data-meta-type");
1106
- if (dataMetaType == "og") {
1107
- jQuery('#b2sChangeOgMeta').val("1");
1108
- //TODO change image to OG image
1109
- } else {
1110
- jQuery('#b2sChangeCardMeta').val("1");
1111
- }
1112
-
1113
- //Copy from further item meta tags by same network
1114
- jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
1115
- 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
1116
- 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());
1117
- 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());
1118
- 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'));
1119
- 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());
1120
-
1121
- if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
1122
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1123
- } else {
1124
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1125
- }
1126
- return true;
1127
- }
1128
- });
1129
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1130
- if (data.draft == false) {
1131
- if(jQuery('.b2s-network-select-btn[data-network-auth-id="'+data.networkAuthId+'"]').data('meta-type') == 'og' && changedOGImage == true) {
1132
- if (currentOGImage != "") {
1133
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1134
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1135
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1136
- } else {
1137
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1138
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1139
- }
1140
- } else {
1141
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1142
- }
1143
-
1144
- }
1145
- } else {
1146
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1147
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1148
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1149
- }
1150
-
1151
- } else {
1152
- 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()]);
1153
- 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());
1154
- }
1155
-
1156
-
1157
- if (jQuery('#selSchedDate').val() != "") {
1158
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1159
- }
1160
-
1161
-
1162
- //Twitter TOS 032018 - protected multiple accounts with same content to same time
1163
- //delete comment field one more
1164
- if (data.networkId == 2) {
1165
- if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 1) {
1166
- var firstAuth = jQuery('.b2s-post-item[data-network-id="' + data.networkId + '"]:first').attr('data-network-auth-id');
1167
- if (firstAuth != data.networkAuthId) {
1168
- jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1169
- } else {
1170
- if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 2) {
1171
- jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1172
- }
1173
- }
1174
- } else {
1175
- //set original post
1176
- jQuery('#b2sTwitterOrginalPost').val(jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').val());
1177
- }
1178
- }
1179
-
1180
- //Content Curation
1181
- if (jQuery('#b2sPostType').val() == 'ex') {
1182
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1183
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1184
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + data.networkAuthId + '"]').attr("style", "display:none !important");
1185
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == 0) {
1186
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1187
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1188
- } else {
1189
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1190
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1191
- }
1192
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1193
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1194
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1195
- }
1196
-
1197
- //CC Imagepost V6.0.0
1198
- if (jQuery('#b2sExPostFormat').val() == 0 || jQuery('#b2sExPostFormat').val() == 1) {
1199
- jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1200
- jQuery('.b2s-user-network-settings-post-format[value="' + jQuery('#b2sExPostFormat').val() + '"][data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1201
- }
1202
- }
1203
-
1204
- }
1205
-
1206
- //Draft
1207
- if (data.draft == true) {
1208
- if (data.draftActions.post_format == "0" || data.draftActions.post_format == "1") {
1209
- jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1210
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').addClass('disabled');
1211
- 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');
1212
- }
1213
-
1214
- jQuery.each(data.draftActions.sched_image_url, function (index, value) {
1215
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1216
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1217
- if (currentOGImage == '') {
1218
- currentOGImage = value;
1219
- } else {
1220
- value = currentOGImage;
1221
- }
1222
- }
1223
- if (value == "") {
1224
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + index + '"]').hide();
1225
- 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());
1226
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val("");
1227
- } else {
1228
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', value);
1229
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1230
- }
1231
- });
1232
-
1233
- if (data.draftActions.releaseSelect == "1") {
1234
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1235
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1236
-
1237
- jQuery.each(data.draftActions.date, function (index, value) {
1238
- if (index == "1" || index == "2") {
1239
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1240
- }
1241
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1242
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1243
- });
1244
- jQuery.each(data.draftActions.time, function (index, value) {
1245
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1246
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1247
- });
1248
- jQuery.each(data.draftActions.sched_content, function (index, value) {
1249
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1250
- });
1251
- }
1252
- if (data.draftActions.releaseSelect == "2") {
1253
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1254
- jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1255
-
1256
- jQuery.each(data.draftActions.intervalSelect, function (index, value) {
1257
- if (index == "1" || index == "2") {
1258
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1259
- }
1260
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1261
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1262
- });
1263
- jQuery.each(data.draftActions.weeks, function (index, value) {
1264
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1265
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1266
- });
1267
- jQuery.each(data.draftActions.duration_month, function (index, value) {
1268
- jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1269
- jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1270
- });
1271
- jQuery.each(data.draftActions.duration_time, function (index, value) {
1272
- jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1273
- jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1274
- });
1275
- jQuery.each(data.draftActions.select_day, function (index, value) {
1276
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1277
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1278
- });
1279
- jQuery.each(data.draftActions.select_timespan, function (index, value) {
1280
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1281
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1282
- });
1283
- jQuery.each(data.draftActions.mo, function (index, value) {
1284
- jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1285
- });
1286
- jQuery.each(data.draftActions.di, function (index, value) {
1287
- jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1288
- });
1289
- jQuery.each(data.draftActions.mi, function (index, value) {
1290
- jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1291
- });
1292
- jQuery.each(data.draftActions.do, function (index, value) {
1293
- jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1294
- });
1295
- jQuery.each(data.draftActions.fr, function (index, value) {
1296
- jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1297
- });
1298
- jQuery.each(data.draftActions.sa, function (index, value) {
1299
- jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1300
- });
1301
- jQuery.each(data.draftActions.so, function (index, value) {
1302
- jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1303
- });
1304
- jQuery.each(data.draftActions.date, function (index, value) {
1305
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1306
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1307
- });
1308
- jQuery.each(data.draftActions.time, function (index, value) {
1309
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1310
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1311
- });
1312
- }
1313
-
1314
- if (data.draftActions.post_relay == "1") {
1315
- jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').attr('checked', true);
1316
- jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1317
-
1318
- jQuery.each(data.draftActions.post_relay_account, function (index, value) {
1319
- if (index >= 1) {
1320
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1321
- }
1322
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1323
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1324
- });
1325
- jQuery.each(data.draftActions.post_relay_delay, function (index, value) {
1326
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1327
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1328
- });
1329
- }
1330
-
1331
- while (jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').is(':visible')) {
1332
- jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1333
- }
1334
- jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val('');
1335
- jQuery.each(data.draftActions.tags, function (index, value) {
1336
- if (index >= 1) {
1337
- jQuery('.ad-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1338
- }
1339
- jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val(value);
1340
- });
1341
-
1342
- jQuery('.b2s-post-item-details-item-title-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.custom_title);
1343
-
1344
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.url);
1345
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('error');
1346
-
1347
-
1348
- if (data.networkId == 1) {
1349
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_title);
1350
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_desc);
1351
- }
1352
-
1353
- if (data.networkId == 2) {
1354
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_title);
1355
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_desc);
1356
- }
1357
-
1358
- if (data.draftActions.image_url == "") {
1359
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1360
- 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());
1361
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val("");
1362
- } else {
1363
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', data.draftActions.image_url);
1364
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val(data.draftActions.image_url);
1365
- }
1366
- checkSchedDateTime(data.networkAuthId);
1367
- }
1368
-
1369
- //XING Groups
1370
- if (data.networkId == 19 && data.networkType == 2) {
1371
- if (jQuery('.networkKind[data-network-auth-id="' + data.networkAuthId + '"]').val() == '3') {
1372
- jQuery('.marketplace_area[data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + data.networkId + '"]').show();
1373
- }
1374
- }
1375
- //XING TOS Group
1376
- if (data.networkId == 19) {
1377
- jQuery('.b2s-content-info[data-network-auth-id="' + data.networkAuthId + '"').show();
1378
- }
1379
-
1380
- if (metaType == 'og' && currentOGImage != '') {
1381
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1382
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1383
- }
1384
-
1385
- } else {
1386
- if (data.error == 'nonce') {
1387
- jQuery('.b2s-nonce-check-fail').show();
1388
- }
1389
- //TOS XING Groups
1390
- if (typeof data.reason !== "undefined") {
1391
- if (data.reason == 'tos_xing_group_exists') {
1392
- b2sTosXingGroupCount--;
1393
- deactivatePortal(data.networkAuthId);
1394
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1395
- jQuery('#b2s-tos-xing-group-modal').modal('show');
1396
- return false;
1397
- }
1398
- }
1399
- }
1400
- checkGifAnimation(data.networkAuthId, data.networkId);
1401
- }
1402
- }
1403
- });
1404
- }
1405
- } else {
1406
- //TOS XING Groups
1407
- if ((networkId == 8 || networkId == 19) && networkType == 2) {
1408
- b2sTosXingGroupCount--;
1409
- }
1410
- deactivatePortal(networkAuthId);
1411
- }
1412
- }
1413
- return false;
1414
- });
1415
- jQuery(document).on('click', '.b2s-post-item-details-url-image', function () {
1416
- var networkAuthId = jQuery(this).attr("data-network-auth-id");
1417
- var networkCountId = jQuery(this).attr("data-network-count");
1418
- if (jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').is(":visible")) {
1419
-
1420
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1421
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
1422
- var isMetaChecked = false;
1423
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1424
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1425
- isMetaChecked = true;
1426
- }
1427
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1428
- isMetaChecked = true;
1429
- }
1430
-
1431
- if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Faceboo or Twitter
1432
- jQuery('.meta-text').hide();
1433
- if (!isMetaChecked) {
1434
- if (networkId == "1") {
1435
- jQuery('.isOgMetaChecked').show();
1436
- } else {
1437
- jQuery('.isCardMetaChecked').show();
1438
- }
1439
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1440
- return false;
1441
- }
1442
- }
1443
-
1444
- jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1445
- }
1446
- return false;
1447
- });
1448
- jQuery(document).on('click', '.b2s-submit-btn-scroll', function () {
1449
- jQuery('.b2s-submit-btn').trigger('click');
1450
- });
1451
- jQuery(document).on('click', '.b2s-post-ship-item-post-format', function () {
1452
- if (jQuery('#user_version').val() >= 1) {
1453
- jQuery('.b2s-user-network-settings-post-format-area').hide();
1454
- jQuery('.b2s-user-network-settings-post-format-area[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1455
- jQuery('#b2s-post-ship-item-post-format-network-title').html(jQuery('.b2s-user-network-settings-post-format-area[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').attr('data-network-title'));
1456
- if (jQuery('#user_version').val() >= 2) {
1457
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').removeClass('b2s-settings-checked');
1458
- var currentPostFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
1459
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"][data-post-format="' + currentPostFormat + '"]').addClass('b2s-settings-checked');
1460
- jQuery('#b2s-post-ship-item-post-format-network-display-name').html(jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').text().toUpperCase());
1461
- }
1462
- jQuery('.b2s-post-format-settings-info').hide();
1463
- jQuery('.b2s-post-format-settings-info[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1464
- jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
1465
- jQuery('.b2s-user-network-settings-post-format').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
1466
- jQuery('.b2s-user-network-settings-post-format').attr('data-post-wp-type', jQuery(this).attr('data-post-wp-type'));
1467
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "1" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() != currentOGImage && jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('data-meta-type') == 'og') {
1468
- jQuery('.b2s-select-link-chang-image').show();
1469
- } else {
1470
- jQuery('.b2s-select-link-chang-image').hide();
1471
- }
1472
- } else {
1473
- jQuery('#b2sInfoFormatModal').modal('show');
1474
- }
1475
- return false;
1476
- });
1477
- jQuery(document).on('click', '.b2s-btn-trigger-post-ship-item-post-format', function () {
1478
- jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1479
- return false;
1480
- });
1481
- jQuery(document).on('click', '.b2s-post-item-details-release-input-days', function () {
1482
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1483
- });
1484
- jQuery(document).on('change', '.b2s-post-item-details-release-input-time', function () {
1485
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1486
- });
1487
- jQuery(document).on('change', '.b2s-post-item-details-release-input-date', function () {
1488
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1489
- });
1490
- jQuery('.b2s-network-details-mandant-select').change(function () {
1491
- hideDuplicateAuths();
1492
- chooseMandant();
1493
- });
1494
- jQuery(document).on('change', '.b2s-post-item-details-item-group-select', function () {
1495
- if (jQuery(this).attr('data-change-network-display-name') == 'true') {
1496
- var label = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
1497
- jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').html(label);
1498
- jQuery('.b2s-post-ship-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(label);
1499
- }
1500
- //Xing groups
1501
- if (jQuery(this).attr('data-network-id') == '19') {
1502
- var option = jQuery('option:selected', this).attr('data-network-kind');
1503
- if (option == '3') { //Marketplace
1504
- jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1505
- } else {
1506
- jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').hide();
1507
- }
1508
- jQuery('.networkKind[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(option);
1509
- }
1510
-
1511
- return false;
1512
- });
1513
- //select recurrent sched interval mode
1514
- jQuery(document).on('change', '.b2s-post-item-details-release-input-interval-select', function () {
1515
- var interval = jQuery(this).val();
1516
- var selectorInput = '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
1517
- var dataCount = jQuery(this).attr('data-network-count');
1518
- releaseChooseInterval(interval, selectorInput, dataCount);
1519
- return false;
1520
- });
1521
- //select shipping mode
1522
- jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select', function () {
1523
- var dataNetworkCount = 0;
1524
- if (jQuery(this).val() == 0) {
1525
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1526
- if (jQuery(this).attr('data-network-id') == 2) {
1527
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1528
- }
1529
- }
1530
- if (jQuery(this).val() == 2) {
1531
- if (jQuery(this).attr('data-user-version') == 0) {
1532
- jQuery('#b2s-sched-post-modal').modal('show');
1533
- return false;
1534
- } else {
1535
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1536
- if (jQuery(this).attr('data-network-id') == 2) {
1537
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1538
- }
1539
-
1540
- for (var i = 1; i <= 2; i++) {
1541
- 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 () {
1542
- if (jQuery(this).prop('checked')) {
1543
- dataNetworkCount = 1;
1544
- }
1545
- });
1546
- }
1547
- if (dataNetworkCount == 2) {
1548
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1549
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1550
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1551
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1552
- } else if (dataNetworkCount == 1) {
1553
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1554
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1555
- }
1556
- }
1557
- }
1558
- if (jQuery(this).val() == 1) {
1559
- if (jQuery(this).attr('data-user-version') == 0) {
1560
- jQuery('#b2s-sched-post-modal').modal('show');
1561
- return false;
1562
- } else {
1563
-
1564
- //TOS Twitter 032018 - none multiple accounts post same content to same time
1565
- if (jQuery(this).attr('data-network-id') == 2) {
1566
- jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1567
- } else {
1568
- //set orginal edit content for customize sched content
1569
- 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();
1570
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(content);
1571
-
1572
- }
1573
-
1574
- checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1575
- if (dataNetworkCount == 2) {
1576
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1577
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1578
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1579
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1580
- } else if (dataNetworkCount == 1) {
1581
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1582
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1583
- }
1584
- }
1585
- }
1586
- releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
1587
- });
1588
- jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function () {
1589
- jQuery('#b2sSchedPostInfoIgnore').val("1");
1590
- jQuery('.b2s-submit-btn').trigger("click");
1591
- return false;
1592
- });
1593
- jQuery(document).on('click', '.b2s-re-share-btn', function () {
1594
- jQuery('.panel-group').removeClass('b2s-border-color-warning');
1595
- jQuery(".b2s-settings-user-sched-time-area").show();
1596
- jQuery('#b2s-sidebar-wrapper').show();
1597
- jQuery('.b2s-post-item-info-area').show();
1598
- jQuery('.b2s-post-item-details-message-info').show();
1599
- jQuery('.b2s-post-item-details-edit-area').show();
1600
- jQuery('.b2s-post-item-details-message-result').hide();
1601
- jQuery('.b2s-post-item-details-message-result').html("");
1602
- jQuery(".b2s-post-area").show();
1603
- jQuery('.b2s-publish-area').show();
1604
- jQuery('.b2s-footer-menu').show();
1605
- window.scrollTo(0, 0);
1606
- jQuery('.b2s-reporting-btn-area').hide();
1607
- jQuery('#b2sSchedPostInfoIgnore').val("0");
1608
- //Calendar close for resfresh
1609
- jQuery('.b2s-toogle-calendar-btn').each(function () {
1610
- if (!jQuery(this).hasClass('hide')) {
1611
- var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
1612
- var currentBtnText = jQuery(this).text();
1613
- jQuery(this).text(toogleBtnText);
1614
- jQuery(this).attr('data-toogle-text-btn', currentBtnText);
1615
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1616
- var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
1617
- calendar.removeClass('show');
1618
- calendar.addClass('hide');
1619
- jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
1620
- }
1621
- });
1622
-
1623
- //TOS XING Group
1624
- jQuery('.b2s-network-select-btn').each(function () {
1625
- if (jQuery(this).children().hasClass('active')) {
1626
- if (jQuery(this).attr('data-network-id') == "19" && jQuery(this).attr('data-network-type') == "2") {
1627
- b2sTosXingGroupCount--;
1628
- deactivatePortal(jQuery(this).attr('data-network-auth-id'));
1629
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-network-select-btn-deactivate');
1630
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
1631
- }
1632
- }
1633
- });
1634
-
1635
- return false;
1636
- });
1637
- jQuery(document).on('click', '.b2s-post-item-details-release-input-add', function () {
1638
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1639
- var netCount = jQuery(this).attr('data-network-count');
1640
- var networkId = jQuery(this).attr('data-network-id');
1641
- var networkType = jQuery(this).attr('data-network-type');
1642
- var netCountNext = parseInt(netCount) + 1;
1643
- var curMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val();
1644
- jQuery(this).hide();
1645
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]').hide();
1646
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1647
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1648
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1649
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1650
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1651
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1652
-
1653
- if (curMode == 1) {
1654
- //since 4.9.0 custom content
1655
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1656
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1657
- }
1658
- //recurrently
1659
- if (curMode == 2) {
1660
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1661
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1662
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1663
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1664
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1665
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1666
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').val('1');
1667
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1668
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1669
- //since 4.9.0 custom content
1670
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').hide();
1671
- }
1672
-
1673
- return false;
1674
- });
1675
- jQuery(document).on('click', '.b2s-post-item-details-release-input-hide', function () {
1676
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1677
- var netCount = jQuery(this).attr('data-network-count');
1678
- var netCountBevor = parseInt(netCount) - 1;
1679
- var selectorInput = '[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]'
1680
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
1681
- jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1682
- jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1683
- //clean all fields
1684
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
1685
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
1686
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).val('');
1687
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
1688
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('checked', false);
1689
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
1690
- //since 4.9.0 custom content
1691
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput).prop('disabled', true);
1692
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput).removeClass('error');
1693
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
1694
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
1695
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
1696
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
1697
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
1698
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled', true);
1699
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).val("1");
1700
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
1701
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled', true);
1702
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).val("1");
1703
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
1704
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
1705
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled', true);
1706
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).val("1");
1707
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
1708
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled', true);
1709
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).val("1");
1710
- return false;
1711
- });
1712
- jQuery(document).on("keyup", ".complete_network_url", function () {
1713
- var url = jQuery(this).val();
1714
- jQuery(this).removeClass("error");
1715
- if (url.length != "0") {
1716
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
1717
- url = "http://" + url;
1718
- jQuery(this).val(url);
1719
- }
1720
- } else if (jQuery(this).hasClass("required_network_url")) {
1721
- 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
1722
- url = jQuery("#b2sDefault_url").val();
1723
- jQuery(this).val(url);
1724
- }
1725
- }
1726
- });
1727
- jQuery(document).on('click', '.scroll-to-top', function () {
1728
- window.scrollTo(0, 0);
1729
- return false;
1730
- });
1731
- jQuery(document).on('click', '.scroll-to-bottom', function () {
1732
- window.scrollTo(0, document.body.scrollHeight);
1733
- return false;
1734
- });
1735
- jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', function () {
1736
- var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/);
1737
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1738
- var url = jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val();
1739
- if (re.test(url)) {
1740
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
1741
- jQuery(this).addClass('glyphicon-refresh-animate');
1742
- jQuery('.b2s-server-connection-fail').hide();
1743
- jQuery.ajax({
1744
- url: ajaxurl,
1745
- type: "POST",
1746
- dataType: "json",
1747
- cache: false,
1748
- data: {
1749
- 'action': 'b2s_ship_item_reload_url',
1750
- 'networkId': jQuery(this).attr('data-network-id'),
1751
- 'networkAuthId': networkAuthId,
1752
- 'postId': jQuery('#b2sPostId').val(),
1753
- 'defaultUrl': jQuery('#b2sDefault_url').val(),
1754
- 'url': url,
1755
- 'postType': jQuery('#b2sPostType').val(),
1756
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1757
- },
1758
- error: function () {
1759
- jQuery('.b2s-server-connection-fail').show();
1760
- return false;
1761
- },
1762
- success: function (data) {
1763
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
1764
- if (data.result == true) {
1765
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.title);
1766
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.description);
1767
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
1768
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1769
- }
1770
- if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '1') {
1771
- if (data.image != "") {
1772
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1773
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(data.image);
1774
- } else {
1775
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1776
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1777
- }
1778
- checkGifAnimation(data.networkAuthId, data.networkId);
1779
- }
1780
- } else {
1781
- if (data.error == 'nonce') {
1782
- jQuery('.b2s-nonce-check-fail').show();
1783
- }
1784
- }
1785
- }
1786
-
1787
- });
1788
- } else {
1789
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
1790
- }
1791
- });
1792
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
1793
- jQuery('.b2s-upload-image-invalid-extension').hide();
1794
- jQuery('.b2s-image-change-meta-network').hide();
1795
- jQuery('.b2s-image-change-this-network').show();
1796
- var metaType = jQuery(this).attr('data-meta-type');
1797
- var authId = jQuery(this).attr('data-network-auth-id');
1798
- var countId = jQuery(this).attr('data-network-count');
1799
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').val();
1800
- var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + authId + ']').attr("data-network-id");
1801
- var isMetaChecked = false;
1802
- var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1803
- if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1804
- isMetaChecked = true;
1805
- }
1806
- if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1807
- isMetaChecked = true;
1808
- }
1809
-
1810
- if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Facebook or Twitter
1811
- jQuery('.meta-text').hide();
1812
- if (!isMetaChecked) {
1813
- if (networkId == "1") {
1814
- jQuery('.isOgMetaChecked').show();
1815
- } else {
1816
- jQuery('.isCardMetaChecked').show();
1817
- }
1818
- jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1819
- return false;
1820
- }
1821
- }
1822
-
1823
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId);
1824
- jQuery('.b2s-image-change-all-network').attr('data-network-count', countId).attr('data-network-id', networkId);
1825
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId).attr('data-network-count', countId);
1826
- 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();
1827
- jQuery('.b2s-selected-network-for-image-info').html(content);
1828
- jQuery('#b2sInsertImageType').val("0");
1829
- if (typeof metaType !== 'undefined') {
1830
- jQuery('.b2s-image-change-this-network').attr('data-meta-type', metaType);
1831
-
1832
- if (metaType == 'og' && postFormat != "1") {
1833
- var activeMetaNetworks = {};
1834
- var inactiveMetaNetworks = {};
1835
- jQuery('.b2s-network-select-btn[data-meta-type="' + metaType + '"]').each(function () {
1836
- if (jQuery(this).find('.active').length > 0) {
1837
- activeMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1838
- } else {
1839
- inactiveMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1840
- }
1841
- });
1842
-
1843
- jQuery('.b2s-change-meta-image-networks').html('');
1844
- jQuery.each(activeMetaNetworks, function (key, value) {
1845
- 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>');
1846
- });
1847
- jQuery.each(inactiveMetaNetworks, function (key, value) {
1848
- 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>');
1849
- });
1850
- jQuery('.b2s-change-meta-image-info').show();
1851
-
1852
- jQuery('.b2s-image-change-meta-network').show();
1853
- jQuery('.b2s-image-change-this-network').hide();
1854
-
1855
- jQuery(document).on('click', '.b2s-image-change-meta-network', function () {
1856
- currentOGImage = jQuery('input[name=image_url]:checked').val();
1857
- changedOGImage = true;
1858
- if (jQuery('.b2s-input-hidden[name="action"][value="b2s_edit_save_post"]').length > 0) { //sched or calender view
1859
- jQuery('.b2s-image-change-this-network').trigger('click');
1860
- } else { //ship view
1861
- jQuery.each(activeMetaNetworks, function (networkAuthId, networkId) {
1862
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1863
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1864
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1865
- checkGifAnimation(networkAuthId, networkId);
1866
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1867
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1868
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1869
- }
1870
- }
1871
- });
1872
- jQuery.each(inactiveMetaNetworks, function (networkAuthId, networkId) {
1873
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1874
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1875
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1876
- checkGifAnimation(networkAuthId, networkId);
1877
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1878
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1879
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1880
- }
1881
- }
1882
- });
1883
- }
1884
- jQuery('#b2s-network-select-image').modal('hide');
1885
- });
1886
- } else {
1887
- jQuery('.b2s-change-meta-image-info').hide();
1888
- }
1889
-
1890
- } else {
1891
- jQuery('.b2s-image-change-this-network').attr('data-meta-type', "");
1892
- jQuery('.b2s-change-meta-image-info').hide();
1893
- }
1894
- //set selected image
1895
- var selImageVal = jQuery('.b2s-post-item-details-url-image[data-network-count="' + countId + '"][data-network-auth-id="' + authId + '"]').attr('src');
1896
- jQuery('#b2s-network-select-image').modal('show');
1897
- jQuery('.checkNetworkImage[data-src="' + selImageVal + '"]').attr('checked', 'checked');
1898
- imageSize();
1899
- return false;
1900
- });
1901
- jQuery(document).on('click', '.b2s-image-remove-btn', function () {
1902
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1903
- var networkCountId = jQuery(this).attr('data-network-count');
1904
- var defaultImage = jQuery('#b2sDefaultNoImage').val();
1905
- //default
1906
- if (networkCountId == -1) {
1907
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1908
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1909
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1910
- } else {
1911
- //customize sched content
1912
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1913
- jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
1914
- jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').hide();
1915
- }
1916
-
1917
- //add check linkpost change meta tag image for this network
1918
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1919
- var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1920
- if (typeof postFormat !== typeof undefined && postFormat !== false) {
1921
- if (postFormat == "0") { //if linkpost
1922
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1923
- 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
1924
- //override this image with current image
1925
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1926
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1927
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1928
- }
1929
- });
1930
- if (jQuery('.b2s-select-image-modal-open[data-network-auth-id=' + networkAuthId + ']').attr('data-meta-type') == 'og') {
1931
- jQuery('.b2s-select-image-modal-open[data-meta-type="og"]').each(function () {
1932
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == "0") {
1933
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1934
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1935
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1936
- }
1937
- });
1938
- currentOGImage = '';
1939
- changedOGImage = true;
1940
- }
1941
- //customize sched content
1942
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1943
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1944
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1945
- }
1946
- }
1947
- return false;
1948
- });
1949
- jQuery(document).on('click', '.b2s-image-change-this-network', function () {
1950
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
1951
- var networkCountId = jQuery(this).attr('data-network-count');
1952
- var networkId = jQuery(this).attr('data-network-id');
1953
- var currentImage = jQuery('input[name=image_url]:checked').val();
1954
- if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
1955
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
1956
- sceditor.insert("<br /><img src='" + currentImage + "'/><br />");
1957
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage); //Torial
1958
- } else {
1959
- //default
1960
- if (networkCountId == -1) {
1961
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1962
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1963
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1964
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1965
- } else {
1966
- //customize sched content
1967
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1968
- jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1969
- jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1970
- jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').show();
1971
- }
1972
-
1973
- if (jQuery(this).attr('data-meta-type') == "og") {
1974
- jQuery('#b2sChangeOgMeta').val("1");
1975
- }
1976
- if (jQuery(this).attr('data-meta-type') == "card") {
1977
- jQuery('#b2sChangeCardMeta').val("1");
1978
- }
1979
-
1980
- //add check linkpost change meta tag image for this network
1981
- var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1982
- var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1983
- if (typeof postFormat !== typeof undefined && postFormat !== false) {
1984
- if (networkId != 12) { // ignore for instagram
1985
- if (postFormat == "0") { //if linkpost
1986
- jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1987
- 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
1988
- //override this image with current image
1989
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentImage);
1990
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
1991
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentImage);
1992
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1993
- if (networkCountId >= 0) {
1994
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1995
- }
1996
- }
1997
- });
1998
- //customize sched content
1999
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
2000
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
2001
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
2002
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
2003
- if (networkCountId >= 0) {
2004
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').hide();
2005
- }
2006
- }
2007
- }
2008
- }
2009
- }
2010
- jQuery('.b2s-upload-image-invalid-extension').hide();
2011
- jQuery('.b2s-upload-image-no-permission').hide();
2012
- jQuery('.b2s-upload-image-free-version-info').hide();
2013
- jQuery('#b2s-network-select-image').modal('hide');
2014
- checkGifAnimation(networkAuthId, networkId);
2015
- return false;
2016
- });
2017
- jQuery(document).on('change', '.b2s-post-item-details-relay', function () {
2018
- if (jQuery(this).attr('data-user-version') == 0) {
2019
- jQuery(this).prop("checked", false);
2020
- jQuery('#b2sInfoPostRelayModal').modal('show');
2021
- return false;
2022
- }
2023
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2024
- if (jQuery(this).is(":checked")) {
2025
-
2026
- if (jQuery('#b2sRelayAccountData').val() != "") {
2027
- jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
2028
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2029
- 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();
2030
- 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();
2031
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2032
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2033
- 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');
2034
- 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');
2035
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2036
- //Relay Html Data
2037
- 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) {
2038
- var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2039
- 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);
2040
- }
2041
-
2042
- } else {
2043
- jQuery(this).prop("checked", false);
2044
- }
2045
-
2046
- } else {
2047
- jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2048
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2049
- jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2050
- jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2051
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2052
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
2053
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
2054
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2055
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2056
- }
2057
- return false;
2058
- });
2059
- jQuery(document).on('click', '.b2s-post-item-details-relay-input-add', function () {
2060
- var netCount = jQuery(this).attr('data-network-count');
2061
- var netCountNext = parseInt(netCount) + 1;
2062
- jQuery(this).hide();
2063
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2064
- 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();
2065
- 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();
2066
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2067
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2068
- 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');
2069
- 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');
2070
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2071
- jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2072
- //Relay Html Data
2073
- 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) {
2074
- var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2075
- 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);
2076
- }
2077
-
2078
- return false;
2079
- });
2080
- jQuery(document).on('click', '.b2s-post-item-details-relay-input-hide', function () {
2081
- var netCount = jQuery(this).attr('data-network-count');
2082
- jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2083
- 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();
2084
- 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();
2085
- jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2086
- jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2087
- 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);
2088
- 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);
2089
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide()
2090
- jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2091
- if (netCount >= 1) {
2092
- var before = netCount - 1;
2093
- jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + before + '"]').show();
2094
- }
2095
-
2096
- return false;
2097
- });
2098
- jQuery(document).on('click', '.b2s-image-change-all-network', function () {
2099
- jQuery('.b2s-post-item-details-item-message-input-allow-html').each(function () {
2100
- var sce = jQuery(this).sceditor('instance');
2101
- if (typeof sce !== 'undefined' && typeof sce.insert !== 'undefined') {
2102
- if (sce.getBody().find(".b2s-post-item-details-image-html-src").length > 0) {
2103
- sce.getBody().find(".b2s-post-item-details-image-html-src").attr('src', jQuery('input[name=image_url]:checked').val());
2104
- } else {
2105
- sce.insert("<br /><img class='b2s-post-item-details-image-html-src' src='" + jQuery('input[name=image_url]:checked').val() + "'/><br />");
2106
- }
2107
- }
2108
- });
2109
- var noGifs = '';
2110
- if (typeof jQuery('input[name=image_url]:checked').val() !== typeof undefined) {
2111
- var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1).toLowerCase();
2112
- if (attachmenUrlExt == 'gif') {
2113
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2114
- jQuery.each(networkNotAllowGif, function (key, value) {
2115
- noGifs += ':not([data-network-id="' + value + '"])';
2116
- });
2117
- }
2118
- }
2119
- jQuery('.b2s-post-item-details-url-image[data-network-image-change="1"]' + noGifs).attr('src', jQuery('input[name=image_url]:checked').val());
2120
- jQuery('#b2s_blog_default_image').val(jQuery('input[name=image_url]:checked').val());
2121
- jQuery('.b2s-post-item-details-url-image' + noGifs).removeClass('b2s-img-required');
2122
- jQuery('.b2s-image-url-hidden-field' + noGifs).val(jQuery('input[name=image_url]:checked').val());
2123
- jQuery('.b2s-image-remove-btn' + noGifs).show();
2124
- jQuery('.b2s-post-item-details-release-input-date-select' + noGifs).each(function () {
2125
- if (jQuery(this).val() == 1) {
2126
- jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]' + noGifs).hide();
2127
- }
2128
- });
2129
-
2130
- jQuery('.b2s-upload-image-invalid-extension').hide();
2131
- jQuery('.b2s-upload-image-no-permission').hide();
2132
- jQuery('.b2s-upload-image-free-version-info').hide();
2133
- jQuery('.b2sChangeOgMeta').val("1");
2134
- jQuery('.b2sChangeCardMeta').val("1");
2135
- jQuery('#b2s-network-select-image').modal('hide');
2136
-
2137
- currentOGImage = jQuery('input[name=image_url]:checked').val();
2138
- changedOGImage = true;
2139
- if (typeof currentOGImage !== typeof undefined) {
2140
- var attachmenUrlExt = currentOGImage.substr(currentOGImage.lastIndexOf('.') + 1);
2141
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
2142
- if (attachmenUrlExt == 'gif') {
2143
- jQuery('.b2s-image-url-hidden-field').each(function () {
2144
- checkGifAnimation(jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-id'));
2145
- });
2146
- }
2147
- }
2148
- return false;
2149
- });
2150
- jQuery(document).on('click', '.b2s-upload-image', function () {
2151
- var networkAuthId = jQuery(this).attr('data-network-auth-id');
2152
- if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
2153
- jQuery('#b2s-network-select-image').modal('hide');
2154
- wpMedia = wp.media({
2155
- title: jQuery('#b2s_wp_media_headline').val(),
2156
- button: {
2157
- text: jQuery('#b2s_wp_media_btn').val(),
2158
- },
2159
- multiple: false,
2160
- library: {type: 'image'}
2161
- });
2162
- wpMedia.open();
2163
- wpMedia.on('select', function () {
2164
- var validExtensions = ['jpg', 'jpeg', 'png', 'gif'];
2165
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2166
- var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2167
- var attachment = wpMedia.state().get('selection').first().toJSON();
2168
- var attachmenUrl = attachment.url;
2169
- var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
2170
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
2171
- if (jQuery.inArray(attachmenUrlExt, validExtensions) == -1 || (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1)) {
2172
- jQuery('#b2s-network-select-image').modal('show');
2173
- jQuery('.b2s-upload-image-invalid-extension').show();
2174
- jQuery('#b2s-upload-image-invalid-extension-file-name').html('<span class="glyphicon glyphicon-ban-circle"></span> ' + attachment.name + '.' + attachmenUrlExt + '<br>');
2175
- jQuery('.b2s-choose-image-no-image-info-text').hide();
2176
- jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2177
- return false;
2178
- }
2179
- var count = parseInt(jQuery('.b2s-choose-image-count').val());
2180
- count = count + 1;
2181
- jQuery('.b2s-choose-image-count').val(count);
2182
- var content = '<div class="b2s-image-item">' +
2183
- '<div class="b2s-image-item-thumb">' +
2184
- '<label for="b2s-image-count-' + count + '">' +
2185
- '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
2186
- '</label>' +
2187
- '</div>' +
2188
- '<div class="b2s-image-item-caption text-center">' +
2189
- '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
2190
- '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
2191
- '</div>' +
2192
- '</div>';
2193
- jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
2194
- // jQuery('.b2s-image-change-btn-area').show();
2195
- jQuery('.b2s-choose-image-no-image-info-text').hide();
2196
- jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2197
- jQuery('.b2s-upload-image-invalid-extension').hide();
2198
- jQuery('input[name=image_url]:last').prop("checked", true);
2199
- jQuery('#b2s-network-select-image').modal('show');
2200
- imageSize();
2201
- });
2202
- wpMedia.on('close', function () {
2203
- jQuery('#b2s-network-select-image').modal('show');
2204
- });
2205
- } else {
2206
- jQuery('.b2s-upload-image-no-permission').show();
2207
- }
2208
- return false;
2209
- });
2210
- jQuery(document).on('change', '.checkNetworkImage', function () {
2211
- var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2212
- var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1);
2213
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
2214
- if (attachmenUrlExt == 'gif') {
2215
- var networkAuthId = jQuery('.b2s-upload-image').attr('data-network-auth-id');
2216
- var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2217
- if (jQuery.inArray(networkId, networkNotAllowGif) != -1) {
2218
- jQuery('.b2s-image-change-this-network').attr('disabled', true);
2219
- jQuery('.b2s-image-change-all-network').attr('disabled', true);
2220
- jQuery('.b2s-upload-image-invalid-extension').show();
2221
- jQuery('#b2s-upload-image-invalid-extension-file-name').html();
2222
- } else {
2223
- jQuery('.b2s-image-change-this-network').attr('disabled', false);
2224
- jQuery('.b2s-image-change-all-network').attr('disabled', false);
2225
- }
2226
- jQuery('.b2s-gif-support-info').show();
2227
- } else {
2228
- jQuery('.b2s-image-change-this-network').attr('disabled', false);
2229
- jQuery('.b2s-image-change-all-network').attr('disabled', false);
2230
- jQuery('.b2s-gif-support-info').hide();
2231
- }
2232
- });
2233
- jQuery('#b2s-network-select-image').on('shown.bs.modal', function () {
2234
- jQuery('.checkNetworkImage').trigger('change');
2235
- });
2236
- jQuery(document).on('click', '.b2s-upload-image-free-version', function () {
2237
- jQuery('.b2s-upload-image-free-version-info').show();
2238
- });
2239
- jQuery("#b2sNetworkSent").keypress(function (e) {
2240
- if (e.keyCode == 13 && e.target.tagName == "INPUT")
2241
- return false;
2242
- });
2243
- jQuery.validator.addMethod("checkUrl", function (value, element, regexp) {
2244
- var re = new RegExp(regexp);
2245
- return this.optional(element) || re.test(value);
2246
- }, "Invalid Url");
2247
- jQuery.validator.addClassRules("b2s-post-item-details-item-url-input", {
2248
- checkUrl: /^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/
2249
- });
2250
- //Twitter TOS 032018 - protected multiple accounts with same content to same time ( by all connections)
2251
- jQuery.validator.addMethod("unique", function (value, element, params) {
2252
- var curNetworkAuthId = jQuery(element).attr('data-network-auth-id');
2253
- var curNetworkId = jQuery(element).attr('data-network-id');
2254
- var prefix = params;
2255
- var selector = jQuery.validator.format("[name!='{0}'][unique='{1}'][data-network-id='" + curNetworkId + "']", element.name, prefix);
2256
- var matches = new Array();
2257
-
2258
- jQuery('.b2s-unique-content[data-network-id="' + curNetworkId + '"]').hide();
2259
- jQuery('.tw-textarea-input').removeClass('error');
2260
-
2261
- jQuery(selector).each(function (index, item) {
2262
- //none disabled elements || ignore default content if curSchedMode=1
2263
- 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)) {
2264
- return true;
2265
- }
2266
- if (jQuery.trim(value) == jQuery.trim(jQuery(item).val())) {
2267
- jQuery('.b2s-unique-content[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').show();
2268
- matches.push(item);
2269
- }
2270
- });
2271
- if (matches.length != 0) {
2272
- jQuery('.b2s-unique-content[data-network-auth-id="' + curNetworkAuthId + '"]').show();
2273
- }
2274
- return true;
2275
- });
2276
-
2277
-
2278
- jQuery.validator.classRuleSettings.unique = {
2279
- unique: true
2280
- };
2281
- jQuery.validator.addMethod("checkTags", function (value, element, test) {
2282
- var allowed_tags = ['p', 'h1', 'h2', 'br', 'i', 'em', 'b', 'a', 'img'];
2283
- var tags = value.match(/(<([^>]+)>)/ig);
2284
- if (tags !== null && tags.length > 0) {
2285
- if (jQuery(element).hasClass('b2s-post-item-details-item-message-input-allow-html')) {
2286
- for (var i = 0; i < tags.length; i++) {
2287
- var allowed_count = 0;
2288
- for (var e = 0; e < allowed_tags.length; e++) {
2289
- var regex = new RegExp("<\s*(\/)?" + allowed_tags[e] + "(( [^>]*>)|[>])");
2290
- if (tags[i].match(regex) != null) {
2291
- allowed_count = 1;
2292
- }
2293
- }
2294
- if (allowed_count == 0) {
2295
- return false;
2296
- }
2297
- }
2298
- } else {
2299
- return false;
2300
- }
2301
- }
2302
- return true;
2303
- });
2304
- jQuery.validator.addClassRules('b2s-post-item-details-item-message-input', {'checkTags': true});
2305
- jQuery.validator.addClassRules('b2s-post-item-details-release-input-date-select', {'checkSched': true});
2306
- jQuery.validator.addClassRules('b2s-post-item-details-item-title-input', {required: true});
2307
- jQuery.validator.addMethod('checkSched', function (value, element, rest) {
2308
- if (jQuery(element).is(':not(:disabled)') && jQuery(element).val() != 0) {
2309
- var networkAuthId = jQuery(element).attr('data-network-auth-id');
2310
- if (jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2311
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2312
- return false;
2313
- } else {
2314
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2315
- }
2316
- if (jQuery(element).val() == 1) {
2317
- if (jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2318
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2319
- return false;
2320
- } else {
2321
- jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2322
- }
2323
-
2324
- } else {
2325
- var maxCount = jQuery('.b2s-post-item-details-release-input-daySelect[data-network-auth-id="' + networkAuthId + '"]').length;
2326
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2327
- var daySelect = false;
2328
- var daySelectErrorCount = 0;
2329
- for (var count = 0; count < maxCount; count++) {
2330
- if (jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').is(':not(:disabled)')) {
2331
- daySelect = false;
2332
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').each(function () {
2333
- if (jQuery(this).is(':checked')) {
2334
- daySelect = true;
2335
- }
2336
- });
2337
- if (daySelect === false) {
2338
- daySelectErrorCount += 1;
2339
- jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').addClass('error');
2340
- }
2341
- }
2342
- }
2343
- if (daySelectErrorCount != 0) {
2344
- return false;
2345
- }
2346
- }
2347
- }
2348
- return true;
2349
- });
2350
- jQuery("#b2sNetworkSent").validate({
2351
- ignore: "",
2352
- errorPlacement: function () {
2353
- return false;
2354
- },
2355
- submitHandler: function (form) {
2356
- if (checkNetworkSelected() == false) {
2357
- return false;
2358
- }
2359
- if (checkPostSchedOnBlog() == false) {
2360
- return false;
2361
- }
2362
- if (checkImageByImageNetworks() == false) {
2363
- return false;
2364
- }
2365
-
2366
- var userDate = new Date();
2367
- var pubDate = userDate.getFullYear() + "-" + padDate(userDate.getMonth() + 1) + "-" + padDate(userDate.getDate()) + " " + padDate(userDate.getHours()) + ":" + padDate(userDate.getMinutes()) + ":" + padDate(userDate.getSeconds());
2368
- jQuery('#publish_date').val(pubDate);
2369
- jQuery(".b2s-loading-area").show();
2370
- jQuery(".b2s-post-area").hide();
2371
- jQuery(".b2s-settings-user-sched-time-area").hide();
2372
- jQuery('#b2s-sidebar-wrapper').hide();
2373
- jQuery('.b2s-post-item-info-area').hide();
2374
- jQuery.xhrPool.abortAll();
2375
- jQuery('.b2s-server-connection-fail').hide();
2376
- jQuery.ajax({
2377
- processData: false,
2378
- url: ajaxurl,
2379
- type: "POST",
2380
- dataType: "json",
2381
- cache: false,
2382
- data: jQuery(form).serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
2383
- error: function () {
2384
- jQuery('.b2s-server-connection-fail').show();
2385
- return false;
2386
- },
2387
- success: function (data) {
2388
- if (data.error == 'nonce') {
2389
- jQuery('.b2s-nonce-check-fail').show();
2390
- return false;
2391
- }
2392
- var content = data.content;
2393
- jQuery(".b2s-loading-area").hide();
2394
- for (var i = 0; i < content.length; i++) {
2395
- jQuery('.b2s-post-item-details-message-info[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2396
- jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2397
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
2398
- jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
2399
- jQuery('.b2s-content-info').hide();
2400
- if (typeof content[i]['approve'] !== typeof undefined) {
2401
- jQuery('.panel-group[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').addClass('b2s-border-color-warning');
2402
- }
2403
- }
2404
- jQuery(".b2s-post-area").show();
2405
- jQuery('.b2s-publish-area').hide();
2406
- jQuery('.b2s-footer-menu').hide();
2407
- window.scrollTo(0, 0);
2408
- jQuery('.b2s-empty-area').hide();
2409
- jQuery('.b2s-reporting-btn-area').show();
2410
- wp.heartbeat.connectNow();
2411
- }
2412
- });
2413
- return false;
2414
- }
2415
- });
2416
- jQuery('#b2s-network-list-modal').on('show.bs.modal', function (e) {
2417
- jQuery('.b2s-network-list-modal-mandant').html(jQuery(".b2s-network-details-mandant-select option:selected").text());
2418
- });
2419
- jQuery(window).on("load", function () {
2420
- var showMeridian = true;
2421
- if (jQuery('#b2sUserLang').val() == 'de') {
2422
- showMeridian = false;
2423
- }
2424
- jQuery('.b2s-settings-sched-item-input-time').timepicker({
2425
- minuteStep: 30,
2426
- appendWidgetTo: 'body',
2427
- showSeconds: false,
2428
- showMeridian: showMeridian,
2429
- defaultTime: 'current'
2430
- });
2431
- });
2432
-
2433
- jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
2434
- var selectedAuth = new Array();
2435
- jQuery('.b2s-network-list.active').each(function () {
2436
- selectedAuth.push(jQuery(this).parents('.b2s-network-select-btn').attr('data-network-auth-id'));
2437
- });
2438
- jQuery('.b2s-server-connection-fail').hide();
2439
- jQuery.ajax({
2440
- url: ajaxurl,
2441
- type: "POST",
2442
- dataType: "json",
2443
- cache: false,
2444
- data: {
2445
- 'action': 'b2s_ship_navbar_save_settings',
2446
- 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
2447
- 'selectedAuth': selectedAuth,
2448
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2449
- },
2450
- error: function () {
2451
- jQuery('.b2s-server-connection-fail').show();
2452
- return false;
2453
- },
2454
- success: function (data) {
2455
- if (data.result == true) {
2456
- jQuery('.b2s-ship-settings-save').show();
2457
- window.scrollTo(0, 0);
2458
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2459
- jQuery('.b2s-network-list').each(function () {
2460
- var jsonMandantIds = jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
2461
- if (jsonMandantIds !== undefined) {
2462
- var jsonMandantIds = jQuery.parseJSON(jsonMandantIds);
2463
- if (jsonMandantIds.indexOf(mandantId) !== -1 && !jQuery(this).hasClass('active')) {
2464
- //remove
2465
- var newMandant = new Array();
2466
- jQuery(jsonMandantIds).each(function (index, item) {
2467
- if (item !== mandantId) {
2468
- newMandant.push(item);
2469
- }
2470
- });
2471
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(newMandant));
2472
- } else if (jsonMandantIds.indexOf(mandantId) == -1 && jQuery(this).hasClass('active')) {
2473
- //add
2474
- jsonMandantIds.push(mandantId);
2475
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(jsonMandantIds));
2476
- }
2477
- }
2478
- });
2479
- } else {
2480
- if (data.error == 'nonce') {
2481
- jQuery('.b2s-nonce-check-fail').show();
2482
- }
2483
- }
2484
- }
2485
- });
2486
- });
2487
- window.addEventListener('message', function (e) {
2488
- if (e.origin == jQuery('#b2sServerUrl').val()) {
2489
- var data = JSON.parse(e.data);
2490
- if (typeof data.action !== typeof undefined && data.action == 'approve') {
2491
- 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>");
2492
- jQuery.ajax({
2493
- url: ajaxurl,
2494
- type: "POST",
2495
- cache: false,
2496
- async: false,
2497
- data: {
2498
- 'action': 'b2s_update_approve_post',
2499
- 'post_id': data.post_id,
2500
- 'publish_link': data.publish_link,
2501
- 'publish_error_code': data.publish_error_code,
2502
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2503
- },
2504
- success: function (data) {
2505
- }
2506
- });
2507
- } else {
2508
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId, data.instant_sharing);
2509
- }
2510
- }
2511
- });
2512
-
2513
- jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
2514
- var postId = jQuery('#b2s-approve-post-id').val();
2515
- var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
2516
- if (postId > 0) {
2517
- 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>");
2518
- jQuery('.b2s-publish-approve-modal').modal('hide');
2519
- jQuery.ajax({
2520
- url: ajaxurl,
2521
- type: "POST",
2522
- cache: false,
2523
- async: false,
2524
- data: {
2525
- 'action': 'b2s_update_approve_post',
2526
- 'post_id': postId,
2527
- 'publish_link': "",
2528
- 'publish_error_code': "",
2529
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2530
- },
2531
- success: function (data) {
2532
- }
2533
- });
2534
- }
2535
- });
2536
-
2537
-
2538
-
2539
- jQuery.xhrPool.abortAll = function () { // our abort function
2540
- jQuery(this).each(function (idx, jqXHR) {
2541
- jqXHR.abort();
2542
- });
2543
- jQuery.xhrPool.length = 0
2544
- };
2545
- function loadingDummyShow(networkAuthId, networkId) {
2546
- jQuery('.b2s-post-item-connection-fail-dummy[data-network-auth-id="' + networkAuthId + '"]').remove();
2547
- var html = '<div class="b2s-post-item b2s-post-item-loading-dummy" data-network-auth-id="' + networkAuthId + '">'
2548
- + '<div class="panel panel-group">'
2549
- + '<div class="panel-body">'
2550
- + '<div class="b2s-post-item-area">'
2551
- + '<div class="b2s-post-item-details">'
2552
- + '<div class="b2s-loader-impulse b2s-loader-impulse-md b2s-post-item-loading-impulse-area">'
2553
- + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2554
- + '</div>'
2555
- + '<div class="clearfix"></div>'
2556
- + '<div class="text-center"><small>'
2557
- + jQuery('#b2sJsTextLoading').val()
2558
- + '</small></div>'
2559
- + '</div>'
2560
- + '</div>'
2561
- + '</div>'
2562
- + '</div>';
2563
- var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
2564
- var pos = order.indexOf(networkAuthId.toString());
2565
- var add = false;
2566
- for (var i = pos; i >= 0; i--) {
2567
- if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
2568
- jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(html);
2569
- i = -1;
2570
- add = true;
2571
- }
2572
- }
2573
- if (add == false) {
2574
- jQuery('.b2s-post-list').prepend(html);
2575
- }
2576
- }
2577
-
2578
- function loadingDummyConnectionFail(networkAuthId, networkId) {
2579
- var html = '<div class="b2s-post-item b2s-post-item-connection-fail-dummy" data-network-auth-id="' + networkAuthId + '">'
2580
- + '<div class="panel panel-group">'
2581
- + '<div class="panel-body">'
2582
- + '<div class="b2s-post-item-area">'
2583
- + '<div class="b2s-post-item-details">'
2584
- + '<div class="b2s-post-item-details-portal-img-area">'
2585
- + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2586
- + '</div>'
2587
- + '<div class="clearfix"></div>'
2588
- + '<div class="text-center"><small>'
2589
- + jQuery('#b2sJsTextConnectionFail').val()
2590
- + '</small>'
2591
- + '<br/>'
2592
- + '<a class="btn btn-link btn-sm" target="_blank" href="' + jQuery('#b2sJsTextConnectionFailLink').val() + '">' + jQuery('#b2sJsTextConnectionFailLinkText').val() + '</a>'
2593
- + '</div>'
2594
- + '</div>'
2595
- + '</div>'
2596
- + '</div>'
2597
- + '</div>';
2598
- jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + networkAuthId + '"]').replaceWith(html);
2599
- }
2600
-
2601
- function init(firstrun) {
2602
- var dateFormat = "yyyy-mm-dd";
2603
- var language = "en";
2604
- var showMeridian = true;
2605
- if (jQuery('#b2sUserLang').val() == "de") {
2606
- dateFormat = "dd.mm.yyyy";
2607
- language = "de";
2608
- showMeridian = false;
2609
- }
2610
- var today = new Date();
2611
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
2612
- today.setTime(jQuery('#b2sBlogPostSchedDate').val());
2613
- }
2614
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
2615
- format: dateFormat,
2616
- language: language,
2617
- maxViewMode: 2,
2618
- todayHighlight: true,
2619
- startDate: today,
2620
- calendarWeeks: true,
2621
- autoclose: true
2622
- });
2623
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
2624
- minuteStep: 15,
2625
- appendWidgetTo: 'body',
2626
- showSeconds: false,
2627
- showMeridian: showMeridian,
2628
- defaultTime: 'current',
2629
- snapToStep: true
2630
- });
2631
- checkNetworkSelected();
2632
- //imageCheck();
2633
- if (firstrun == true) {
2634
- jQuery(window).scroll(function () {
2635
- submitArea();
2636
- });
2637
- jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
2638
- releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), 0);
2639
- });
2640
-
2641
- //V5.0.0 Content Curation set selected Profile
2642
- if (jQuery(".b2s-network-details-mandant-select option[value='" + jQuery('#selProfile').val() + "']").length > 0) {
2643
- jQuery('.b2s-network-details-mandant-select').val(jQuery('#selProfile').val());
2644
- }
2645
- hideDuplicateAuths();
2646
- chooseMandant();
2647
- }
2648
- }
2649
-
2650
-
2651
-
2652
- function initSceditor(networkAuthId) {
2653
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2654
- if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2655
- sceditor.destroy();
2656
- }
2657
- if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').data('network-id') == 14) {// Torial is only HTML Network that dose not support Emojis
2658
- var toolbar = "h1,h2,bold,italic,link,unlink,custom-image|source";
2659
- } else {
2660
- var toolbar = "h1,h2,bold,italic,link,unlink,custom-image,custom-emoji|source";
2661
- }
2662
- jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor({
2663
- plugins: 'xhtml',
2664
- toolbar: toolbar,
2665
- autoUpdate: true,
2666
- emoticonsEnabled: false
2667
- });
2668
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2669
- if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2670
- sceditor.keyUp(function () {
2671
- jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(jQuery(this).prev('.b2s-post-item-details-item-message-input').sceditor('instance').getBody().text().length);
2672
- });
2673
- jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').next('.sceditor-container').find('textarea').on('keyup', function () {
2674
- var tmp = document.createElement("DIV");
2675
- tmp.innerHTML = jQuery(this).val();
2676
- jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(tmp.innerText.length);
2677
- });
2678
- }
2679
-
2680
-
2681
- }
2682
-
2683
- function submitArea() {
2684
- if (jQuery('.b2s-publish-area').length > 0) {
2685
- if (jQuery(window).scrollTop() + jQuery(window.top).height() >= jQuery('.b2s-publish-area').offset().top) {
2686
- jQuery(".b2s-footer-menu").hide();
2687
- } else {
2688
- jQuery(".b2s-footer-menu").show();
2689
- }
2690
- }
2691
- }
2692
-
2693
- function imageSize() {
2694
- jQuery('.networkImage').each(function () {
2695
- var width = this.naturalWidth;
2696
- var height = this.naturalHeight;
2697
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
2698
- if (width == 0)
2699
- {
2700
- setTimeout(function () {
2701
- imageSize();
2702
- }, 50);
2703
- }
2704
- });
2705
- }
2706
-
2707
- function navbarDeactivatePortal(reason) {
2708
- if (reason == "image") {
2709
- var portale = Array(6, 7, 12);
2710
- for (var i = 0; i <= portale.length; i++) {
2711
- jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').addClass('b2s-network-select-btn-deactivate');
2712
- jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').show();
2713
- }
2714
- }
2715
- }
2716
-
2717
- function navbarActivatePortal(reason) {
2718
- if (reason == "image") {
2719
- var portale = Array(6, 7, 12);
2720
- for (var i = 0; i <= portale.length; i++) {
2721
- jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').removeClass('b2s-network-select-btn-deactivate');
2722
- jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').hide();
2723
- }
2724
- }
2725
- }
2726
-
2727
- function deactivatePortal(networkAuthId) {
2728
- var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2729
- jQuery(selector).hide();
2730
- jQuery(selector).find('.form-control').each(function () {
2731
- jQuery(this).attr("disabled", "disabled");
2732
- });
2733
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
2734
- checkNetworkSelected();
2735
- submitArea();
2736
- return true;
2737
- }
2738
-
2739
- function activatePortal(networkAuthId, check) {
2740
- var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2741
- jQuery(selector).show();
2742
- jQuery(selector).find('.form-control').each(function () {
2743
-
2744
- if (!jQuery(this).hasClass('b2s-post-item-details-item-message-input')) {
2745
- jQuery(this).removeAttr("disabled", "disabled");
2746
- }
2747
-
2748
- if ((jQuery(this).hasClass('b2s-post-item-details-release-input-weeks')) ||
2749
- (jQuery(this).hasClass('b2s-post-item-details-release-input-date')) ||
2750
- (jQuery(this).hasClass('b2s-post-item-details-release-input-time')) ||
2751
- (jQuery(this).hasClass('b2s-post-item-details-release-input-days')) ||
2752
- (jQuery(this).hasClass('b2s-post-item-details-relay-input-delay')) ||
2753
- (jQuery(this).hasClass('b2s-post-item-details-relay-input-account'))) {
2754
- if (!jQuery(this).is(':visible')) {
2755
- jQuery(this).prop('disabled', true);
2756
- }
2757
- }
2758
- });
2759
- //Customize Content
2760
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
2761
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
2762
- jQuery(selector).find('.b2s-post-item-details-item-message-input').each(function () {
2763
- if (jQuery(this).is(':visible')) {
2764
- jQuery(this).removeAttr("disabled", "disabled");
2765
- }
2766
- });
2767
- } else {
2768
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').removeAttr("disabled", "disabled");
2769
- }
2770
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().addClass('active').find('.b2s-network-hide').removeClass('b2s-network-hide');
2771
- checkNetworkSelected();
2772
- submitArea();
2773
- }
2774
-
2775
- function checkNetworkSelected() {
2776
- //überprüfen ob mindestens ein PostItem vorhanden und sichtbar ist
2777
- var visible = false;
2778
- jQuery('.b2s-post-list').find('.b2s-post-item').each(function () {
2779
- if (jQuery(this).is(":visible")) {
2780
- visible = true;
2781
- }
2782
- });
2783
- if (jQuery('.b2s-post-list').text().trim() == "" || visible == false) {
2784
- jQuery('.b2s-publish-area').hide();
2785
- jQuery('.b2s-footer-menu').hide();
2786
- jQuery('.b2s-empty-area').show();
2787
- return false;
2788
- } else {
2789
- jQuery('.b2s-publish-area').show();
2790
- if (jQuery('.b2s-publish-area').length > 0) {
2791
- if (jQuery(window).scrollTop() + jQuery(window.top).height() < jQuery('.b2s-publish-area').offset().top) {
2792
- jQuery('.b2s-footer-menu').show();
2793
- }
2794
- }
2795
- jQuery('.b2s-empty-area').hide();
2796
- return true;
2797
- }
2798
- }
2799
-
2800
- function checkPostSchedOnBlog() {
2801
- if (jQuery('#b2sBlogPostSchedDate').length > 0 && jQuery('#b2sPostType').val() == "") {
2802
- if (jQuery('#b2sSchedPostInfoIgnore').val() == "0") {
2803
- if (jQuery('.b2s-post-item-details-release-input-date-select option[value="0"]:selected').length > 0) {
2804
- jQuery('#b2s-network-sched-post-info').modal("show");
2805
- return false;
2806
- }
2807
- }
2808
- }
2809
- return true;
2810
- }
2811
-
2812
- function checkImageByImageNetworks() {
2813
- var result = true;
2814
- jQuery('.b2sOnlyWithImage').each(function () {
2815
- if (jQuery(this).is(":visible")) {
2816
- if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "") {
2817
- if (!jQuery('#b2s-network-select-image').hasClass('in')) {
2818
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-img-required');
2819
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
2820
- jQuery('.b2s-upload-image').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
2821
- jQuery('#b2s-network-select-image').modal('show');
2822
- imageSize();
2823
- window.scrollTo(0, (jQuery(this).offset().top - 45));
2824
- }
2825
- result = false;
2826
- }
2827
- }
2828
- });
2829
- return result;
2830
- }
2831
-
2832
-
2833
- function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
2834
- var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
2835
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2836
- if (choose == 0) {
2837
-
2838
- //since 4.8.0 customize content
2839
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2840
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2841
- jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2842
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2843
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2844
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2845
- jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2846
- jQuery('.b2s-post-tool-area' + selectorInput).show();
2847
- }
2848
-
2849
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2850
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2851
- jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2852
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2853
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2854
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2855
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2856
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
2857
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2858
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2859
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2860
- //monthly- duration month
2861
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2862
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2863
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2864
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2865
- //monthly- publish day (select-day)
2866
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2867
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2868
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2869
- //own period- duration times
2870
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2871
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2872
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2873
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2874
- //own period- timespan
2875
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2876
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2877
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2878
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled');
2879
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2880
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).hide();
2881
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2882
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', true);
2883
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2884
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2885
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2886
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2887
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).hide();
2888
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).hide();
2889
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2890
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2891
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2892
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2893
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).hide();
2894
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2895
- } else if (choose == 1) {
2896
-
2897
- //since 4.8.0 customize content
2898
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2899
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').prop('disabled', true);
2900
- jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').hide();
2901
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').hide();
2902
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').hide();
2903
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').hide();
2904
- jQuery('.b2s-post-original-area' + selectorInput).removeClass('col-sm-7').removeClass('col-lg-9');
2905
- jQuery('.b2s-post-tool-area' + selectorInput).hide();
2906
- //TOS Network Twitter
2907
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-id') == "2") {
2908
- jQuery('.b2s-post-ship-item-copy-original-text' + selectorInput + '[data-network-count="0"]').trigger('click');
2909
- }
2910
- }
2911
-
2912
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2913
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2914
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2915
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2916
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2917
- for (var i = 0; i <= dataNetworkCount; i++) {
2918
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2919
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2920
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2921
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2922
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2923
- //since 4.8.0 customize content
2924
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2925
- jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2926
- }
2927
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2928
- jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled');
2929
- //monthly- duration month
2930
- jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2931
- jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2932
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2933
- jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2934
- //monthly- publish day (select-day)
2935
- jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2936
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2937
- jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2938
- //own period- duration times
2939
- jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2940
- jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2941
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2942
- jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2943
- //own period- timespan
2944
- jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2945
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2946
- jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2947
- //new since v.4.5.0
2948
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2949
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2950
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2951
- jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2952
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2953
- jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
2954
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2955
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2956
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2957
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).show();
2958
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2959
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2960
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2961
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2962
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2963
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2964
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).show();
2965
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2966
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2967
- } else if (choose == 2) {
2968
-
2969
- //since 4.8.0 customize content
2970
- if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2971
- jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2972
- jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2973
- jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2974
- jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2975
- jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2976
- jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2977
- jQuery('.b2s-post-tool-area' + selectorInput).show();
2978
- }
2979
-
2980
- jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2981
- jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2982
- jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2983
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2984
- jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2985
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2986
- jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2987
- jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2988
- jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).show();
2989
- jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2990
- jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2991
- jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2992
- for (var i = 0; i <= dataNetworkCount; i++) {
2993
- jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2994
- //new since v4.5.0
2995
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).show();
2996
- jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2997
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2998
- jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2999
- jQuery('.b2s-post-item-details-release-input-daySelect[data-network-count="' + i + '"]' + selectorInput).show();
3000
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
3001
- jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3002
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).show();
3003
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3004
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3005
- }
3006
- jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).show();
3007
- jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).show();
3008
- jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
3009
- jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
3010
- jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).show();
3011
- jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).show();
3012
- jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).show();
3013
- jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
3014
- jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
3015
- jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).show();
3016
- }
3017
-
3018
- var showMeridian = true;
3019
- if (jQuery('#b2sUserLang').val() == 'de') {
3020
- showMeridian = false;
3021
- }
3022
-
3023
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
3024
- minuteStep: 15,
3025
- appendWidgetTo: 'body',
3026
- showSeconds: false,
3027
- showMeridian: showMeridian,
3028
- defaultTime: 'current',
3029
- snapToStep: true
3030
- });
3031
- }
3032
-
3033
-
3034
- function releaseChooseInterval(interval, selectorInput, dataCount) {
3035
- //change view
3036
- if (interval == 0) { //weekly,default
3037
- // show
3038
- //select days
3039
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3040
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3041
- //duration weeks
3042
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
3043
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
3044
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).show();
3045
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3046
- //hide
3047
- //monthly- duration month
3048
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3049
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3050
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3051
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3052
- //monthly- publish day (select-day)
3053
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3054
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3055
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3056
- //own period- duration times
3057
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3058
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3059
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3060
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3061
- //own period- timespan
3062
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3063
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3064
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3065
- }
3066
-
3067
- if (interval == 1) { //monthly
3068
- // show
3069
- //duration month
3070
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3071
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3072
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).show();
3073
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3074
- //publish day (select-day)
3075
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3076
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3077
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3078
- //hide
3079
- //weekly - select days
3080
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3081
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3082
- //weekly- duration weeks
3083
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3084
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3085
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3086
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3087
- //own period- duration times
3088
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3089
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3090
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3091
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3092
- //own period- timespan
3093
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3094
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3095
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3096
- }
3097
-
3098
- if (interval == 2) { //own period
3099
- // show
3100
- //duration times
3101
- jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3102
- jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3103
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).show(); //select
3104
- jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled'); //select
3105
- //timespan
3106
- jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3107
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3108
- jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3109
- //hide
3110
- //weekly - select days
3111
- jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3112
- jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3113
- //weekly- duration weeks
3114
- jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3115
- jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3116
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3117
- jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3118
- //monthly- duration month
3119
- jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3120
- jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3121
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3122
- jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3123
- //monthly- publish day (select-day)
3124
- jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3125
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3126
- jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3127
- }
3128
- }
3129
-
3130
-
3131
-
3132
- function addTag(networkAuthId) {
3133
- var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3134
- 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][]">');
3135
- jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3136
- var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3137
- if (typeof limit !== typeof undefined && limit !== false) {
3138
- if (jQuery(selector).length >= limit) {
3139
- jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3140
- }
3141
- }
3142
- }
3143
-
3144
- function removeTag(networkAuthId) {
3145
- var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3146
- jQuery(selector).last().remove();
3147
- if (jQuery(selector).length === 1) {
3148
- jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3149
- }
3150
- var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3151
- if (typeof limit !== typeof undefined && limit !== false) {
3152
- if (jQuery(selector).length < limit) {
3153
- jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3154
- }
3155
- }
3156
- }
3157
-
3158
- function networkLimitAll(networkAuthId, networkId, limit) {
3159
-
3160
- var networkCountId = -1; //default;
3161
- if (jQuery(':focus').length > 0) {
3162
- var attr = jQuery(':focus').attr('data-network-count');
3163
- if (typeof attr !== typeof undefined && attr !== false) {
3164
- networkCountId = attr;
3165
- }
3166
- }
3167
-
3168
- var regX = /(<([^>]+)>)/ig;
3169
- var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3170
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3171
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3172
- if (url.length != "0") {
3173
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3174
- url = "http://" + url;
3175
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3176
- }
3177
- } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3178
- 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
3179
- url = jQuery("#b2sDefault_url").val();
3180
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3181
- }
3182
- }
3183
-
3184
- var textLength = text.length;
3185
- var newText = text;
3186
- if (networkId == "2") { //twitter
3187
- if (url.length != "0") {
3188
- limit = limit - 24;
3189
- }
3190
- }
3191
- if (networkId == "3") { //linkedin
3192
- if (url.length != "0") {
3193
- limit = limit - url.length;
3194
- }
3195
- }
3196
- 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
3197
- if (url.length != "0") {
3198
- limit = limit - url.length;
3199
- }
3200
- }
3201
- if (networkId == "12") { //instagram
3202
- var matches = text.match(/(#[^# ]{1,})/g);
3203
- if (matches != null && matches.length > 30) {
3204
- jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').show();
3205
- jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").addClass("warning");
3206
- } else {
3207
- jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').hide();
3208
- jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").removeClass("warning");
3209
- }
3210
- }
3211
-
3212
- if (textLength >= limit) {
3213
- newText = text.substring(0, limit);
3214
- var pos = getCaretPos(this);
3215
- jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val(newText.replace(regX, ""));
3216
- setCaretPos(this, pos);
3217
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3218
- var textLength = text.length;
3219
- }
3220
- var newLen = limit - textLength;
3221
- jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(newLen);
3222
- }
3223
-
3224
- function networkCount(networkAuthId) {
3225
-
3226
- var networkCountId = -1; //default;
3227
- if (jQuery(':focus').length > 0) {
3228
- var attr = jQuery(':focus').attr('data-network-count');
3229
- if (typeof attr !== typeof undefined && attr !== false) {
3230
- networkCountId = attr;
3231
- }
3232
- }
3233
- var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3234
- var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3235
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3236
- if (url.length != "0") {
3237
- if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3238
- url = "http://" + url;
3239
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3240
- }
3241
- } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3242
- 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
3243
- url = jQuery("#b2sDefault_url").val();
3244
- jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3245
- }
3246
- }
3247
- var textLength = text.length;
3248
- jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
3249
- }
3250
-
3251
-
3252
- function getCaretPos(domElem) {
3253
- var pos;
3254
- if (document.selection) {
3255
- domElem.focus();
3256
- var sel = document.selection.createRange();
3257
- sel.moveStart("character", -domElem.value.length);
3258
- pos = sel.text.length;
3259
- } else if (domElem.selectionStart || domElem.selectionStart == "0")
3260
- pos = domElem.selectionStart;
3261
- return pos;
3262
- }
3263
-
3264
- function setCaretPos(domElem, pos) {
3265
- if (domElem.setSelectionRange) {
3266
- domElem.focus();
3267
- domElem.setSelectionRange(pos, pos);
3268
- } else if (domElem.createTextRange) {
3269
- var range = domElem.createTextRange();
3270
- range.collapse(true);
3271
- range.moveEnd("character", pos);
3272
- range.moveStart("character", pos);
3273
- range.select();
3274
- }
3275
- }
3276
-
3277
- function ucfirst(str) {
3278
- str += '';
3279
- return str.charAt(0).toUpperCase() + str.substr(1);
3280
- }
3281
-
3282
-
3283
- function hideDuplicateAuths() {
3284
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3285
- jQuery(this).show();
3286
- });
3287
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3288
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3289
- if (jQuery(this).is(":visible")) {
3290
- var dataNetworkDisplayName = jQuery(this).children('.b2s-network-select-btn').attr('data-network-display-name');
3291
- var dataNetworkId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-id');
3292
- var dataNetworkType = jQuery(this).children('.b2s-network-select-btn').attr('data-network-type');
3293
- var dataNetworkAuthId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-auth-id');
3294
- 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 () {
3295
- var selectedDataMandantId = jQuery.parseJSON(jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id'));
3296
- if (jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-default-id') != mandantId && selectedDataMandantId.indexOf(mandantId) == -1) {
3297
- jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').hide();
3298
- }
3299
- });
3300
- }
3301
- });
3302
- }
3303
-
3304
- function chooseMandant() {
3305
- //Laden abbrechen und anzeige zurück setzten
3306
- jQuery.xhrPool.abortAll();
3307
- jQuery('.b2s-post-item-loading-dummy').remove();
3308
- jQuery('.b2s-network-status-img-loading').hide();
3309
- jQuery('.b2s-network-select-btn-deactivate').removeClass('b2s-network-select-btn-deactivate');
3310
- //imageCheck();
3311
- //TOS XING Groups
3312
- b2sTosXingGroupCount = 0;
3313
- //expiredDate wieder setzten
3314
- jQuery('.b2s-network-status-expiredDate').each(function () {
3315
- if (jQuery(this).is(':visible')) {
3316
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').addClass('b2s-network-select-btn-deactivate');
3317
- }
3318
- });
3319
- jQuery('.b2s-network-select-btn-deactivate')
3320
- var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3321
- jQuery('.b2s-post-item').hide();
3322
- jQuery('.b2s-post-item').find('.form-control').each(function () {
3323
- jQuery(this).attr("disabled", "disabled");
3324
- jQuery(this).removeClass('error');
3325
- });
3326
- jQuery('.b2s-network-select-btn').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
3327
- //Check IS RE-PUBLISH
3328
- if (jQuery('#b2sSelectedNetworkAuthId').val() > 0 && jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").length > 0) { //exisits?
3329
- jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").trigger('click');
3330
- var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
3331
- jQuery('.b2s-network-details-mandant-select').val(mandantId);
3332
- jQuery('#b2sSelectedNetworkAuthId').val("0");
3333
- } else {
3334
- jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3335
- var mandantIds = jQuery.parseJSON(jQuery(this).attr('data-mandant-id'));
3336
- if (mandantIds.indexOf(mandantId) != -1 && !jQuery(this).children('.b2s-network-select-btn').hasClass('b2s-network-select-btn-deactivate')) {
3337
- jQuery(this).children('.b2s-network-select-btn').trigger('click');
3338
- }
3339
- });
3340
- }
3341
-
3342
- checkNetworkSelected();
3343
- }
3344
-
3345
- function padDate(n) {
3346
- return ("0" + n).slice(-2);
3347
- }
3348
-
3349
- function wop(url, name) {
3350
- jQuery('.b2s-network-auth-success').hide();
3351
- var location = window.location.protocol + '//' + window.location.hostname;
3352
- url = encodeURI(url + '&mandant_id=' + jQuery('.b2s-network-details-mandant-select').val() + '&location=' + location);
3353
- 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");
3354
- }
3355
-
3356
-
3357
- function wopApprove(networkAuthId, postId, url, name) {
3358
- var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
3359
- 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");
3360
- if (postId > 0) {
3361
- function checkIfWinClosed(intervalID) {
3362
- if (win.closed) {
3363
- clearInterval(intervalID);
3364
- //Show Modal
3365
- jQuery('.b2s-publish-approve-modal').modal('show');
3366
- jQuery('#b2s-approve-post-id').val(postId);
3367
- jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
3368
- }
3369
- }
3370
- var interval = setInterval(function () {
3371
- checkIfWinClosed(interval);
3372
- }, 500);
3373
- }
3374
- }
3375
-
3376
-
3377
- function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId, instant_sharing) {
3378
- jQuery('.b2s-network-auth-success').show();
3379
- jQuery('#b2s-network-list-modal').modal('hide');
3380
- jQuery('#b2s-network-list-modal').hide();
3381
- jQuery('body').removeClass('modal-open');
3382
- jQuery('body').removeAttr('style');
3383
- if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3384
- jQuery('.b2s-server-connection-fail').hide();
3385
- jQuery.ajax({
3386
- url: ajaxurl,
3387
- type: "POST",
3388
- dataType: "json",
3389
- cache: false,
3390
- data: {
3391
- 'action': 'b2s_ship_navbar_item',
3392
- 'networkId': networkId,
3393
- 'networkType': networkType,
3394
- 'displayName': displayName,
3395
- 'networkAuthId': networkAuthId,
3396
- 'instant_sharing': instant_sharing,
3397
- 'mandandId': mandandId,
3398
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3399
- },
3400
- error: function () {
3401
- jQuery('.b2s-server-connection-fail').show();
3402
- return false;
3403
- },
3404
- success: function (data) {
3405
- if (data.result == true) {
3406
- jQuery(data.content).insertAfter('.b2s-sidbar-network-auth-btn');
3407
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
3408
- } else {
3409
- if (data.error == 'nonce') {
3410
- jQuery('.b2s-nonce-check-fail').show();
3411
- }
3412
- }
3413
- }
3414
- });
3415
- } else {
3416
- jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + networkAuthId + '"]').remove();
3417
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
3418
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
3419
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-display-name', displayName);
3420
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"] > .b2s-network-list > .b2s-network-details > h4').text(displayName);
3421
- jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
3422
- }
3423
- jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-display-name="' + displayName.toLowerCase() + '"]').each(function () {
3424
- jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
3425
- jQuery(this).removeClass('b2s-network-select-btn-deactivate');
3426
- jQuery(this).removeAttr('onclick');
3427
- });
3428
- }
3429
-
3430
- //jQuery(this).attr('data-network-auth-id')
3431
- function checkSchedDateTime(dataNetworkAuthId) {
3432
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
3433
- var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
3434
- var dateStr = jQuery(dateElement).val();
3435
- var minStr = jQuery(timeElement).val();
3436
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
3437
- if (jQuery('#b2sUserLang').val() == 'de') {
3438
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
3439
- } else {
3440
- var minParts = minStr.split(' ');
3441
- var minParts2 = minParts[0].split(':');
3442
- if (minParts[1] == 'PM') {
3443
- minParts2[0] = parseInt(minParts2[0]) + 12;
3444
- }
3445
- minStr = minParts2[0] + ':' + minParts2[1];
3446
- }
3447
-
3448
- var minParts3 = minStr.split(':');
3449
- if (minParts3[0] < 10) {
3450
- minParts3[0] = '0' + minParts3[0];
3451
- }
3452
- var dateParts = dateStr.split('-');
3453
- //utc current time
3454
- var now = new Date();
3455
- //offset between utc und user
3456
- var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
3457
- //enter hour to user time
3458
- var hour = parseInt(minParts3[0]) + timeZone + offset;
3459
- //calculate datetime in utc
3460
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
3461
- //compare enter date time with allowed user time
3462
- if (enter.getTime() < now.getTime()) {
3463
- //enter set on next 15 minutes and calculate on user timezone
3464
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
3465
- jQuery(dateElement).datepicker('update', enter);
3466
- jQuery(timeElement).timepicker('setTime', enter);
3467
- }
3468
-
3469
- //network deprecated
3470
- if (jQuery(dateElement).attr('data-network-id') == '8') {
3471
- var deprecatedDate = new Date('2019-03-30T23:59:59');
3472
- var count = jQuery(dateElement).attr('data-network-count');
3473
- if (enter.getTime() > deprecatedDate.getTime()) {
3474
- jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3475
- jQuery(dateElement).datepicker('update', now);
3476
- jQuery(timeElement).timepicker('setTime', now);
3477
- }
3478
- }
3479
-
3480
- //network deprecated
3481
- if (jQuery(dateElement).attr('data-network-id') == '10') {
3482
- var deprecatedDate = new Date('2019-04-01T23:59:59');
3483
- var count = jQuery(dateElement).attr('data-network-count');
3484
- if (enter.getTime() > deprecatedDate.getTime()) {
3485
- jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3486
- jQuery(dateElement).datepicker('update', now);
3487
- jQuery(timeElement).timepicker('setTime', now);
3488
- }
3489
- }
3490
-
3491
- }
3492
-
3493
- jQuery(document).on("click", ".b2s-draft-btn", function (event) {
3494
- event.preventDefault();
3495
- jQuery('.b2s-loader-btn-ship').css('display', 'inline-block');
3496
- jQuery('.b2s-submit-btn').prop('disabled', true);
3497
- jQuery('.b2s-submit-btn-scroll').prop('disabled', true);
3498
- jQuery('.b2s-post-draft-saved-success').hide();
3499
- jQuery('.b2s-post-draft-saved-fail').hide();
3500
- jQuery('.b2s-server-connection-fail').hide();
3501
-
3502
- jQuery.ajax({
3503
- url: ajaxurl,
3504
- type: "GET",
3505
- cache: false,
3506
- data: {
3507
- action: 'b2s_check_draft_exists',
3508
- postId: jQuery('#post_id').val(),
3509
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3510
- },
3511
- error: function () {
3512
- saveDraft();
3513
- return false;
3514
- },
3515
- success: function (data) {
3516
- result = JSON.parse(data);
3517
- if (result.result == true) {
3518
- jQuery('#b2s-save-draft-modal').modal('show');
3519
- return true;
3520
- } else {
3521
- if (result.error == 'nonce') {
3522
- jQuery('.b2s-nonce-check-fail').show();
3523
- }
3524
- }
3525
- saveDraft();
3526
- return false;
3527
- }
3528
- });
3529
-
3530
- });
3531
-
3532
- jQuery(document).on('click', '.b2s-draft-btn-scroll', function () {
3533
- jQuery('.b2s-draft-btn').trigger('click');
3534
- });
3535
-
3536
- function saveDraft() {
3537
- jQuery('#action').val('b2s_save_draft_data');
3538
- var data = jQuery('#b2sNetworkSent').serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
3539
- jQuery('#action').val('b2s_save_ship_data');
3540
- jQuery.ajax({
3541
- url: ajaxurl,
3542
- type: "POST",
3543
- cache: false,
3544
- data: data,
3545
- error: function () {
3546
- jQuery('.b2s-loader-btn-ship').css('display', 'none');
3547
- jQuery('.b2s-submit-btn').removeAttr('disabled');
3548
- jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3549
- jQuery('.b2s-server-connection-fail').show();
3550
- window.scrollTo(0, 0);
3551
- return false;
3552
- },
3553
- success: function (data) {
3554
- jQuery('.b2s-loader-btn-ship').css('display', 'none');
3555
- jQuery('.b2s-submit-btn').removeAttr('disabled');
3556
- jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3557
- result = JSON.parse(data);
3558
- if (result.result == true) {
3559
- jQuery('.b2s-post-draft-saved-success').show();
3560
- window.setTimeout(function () {
3561
- jQuery('.b2s-post-draft-saved-success').fadeOut();
3562
- }, 5000);
3563
- } else {
3564
- if (result.error == 'nonce') {
3565
- jQuery('.b2s-nonce-check-fail').show();
3566
- }
3567
- jQuery('.b2s-post-draft-saved-fail').show();
3568
- window.setTimeout(function () {
3569
- jQuery('.b2s-post-draft-saved-fail').fadeOut();
3570
- }, 5000);
3571
- }
3572
- window.scrollTo(0, 0);
3573
- return true;
3574
- }
3575
- });
3576
- }
3577
-
3578
- jQuery('#b2s-save-draft-modal').on('hidden.bs.modal', function () {
3579
- jQuery('.b2s-loader-btn-ship').css('display', 'none');
3580
- jQuery('.b2s-submit-btn').removeAttr('disabled');
3581
- jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3582
- });
3583
-
3584
- jQuery(document).on('click', '.b2s-save-draft-confirm-btn', function () {
3585
- saveDraft();
3586
- jQuery('#b2s-save-draft-modal').modal('hide');
3587
- return true;
3588
- });
3589
-
3590
- jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3591
- jQuery('body').addClass('modal-open');
3592
- });
3593
-
3594
- // START Pinterest
3595
- jQuery(document).on('click', '.b2s-auth-network-6-login-btn', function () {
3596
- jQuery('#b2s-auth-network-6-username').removeClass('error');
3597
- jQuery('#b2s-auth-network-6-password').removeClass('error');
3598
- var loginDataCheck = true;
3599
- if (jQuery('#b2s-auth-network-6-username').val() == '') {
3600
- jQuery('#b2s-auth-network-6-username').addClass('error');
3601
- loginDataCheck = false;
3602
- }
3603
- if (jQuery('#b2s-auth-network-6-password').val() == '') {
3604
- jQuery('#b2s-auth-network-6-password').addClass('error');
3605
- loginDataCheck = false;
3606
- }
3607
- if (!loginDataCheck) {
3608
- return false;
3609
- }
3610
- jQuery('.b2s-loading-area').show();
3611
- jQuery('.b2s-auth-network-6-login-area').hide();
3612
- jQuery('.b2s-auth-network-6-login-btn').hide();
3613
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
3614
- jQuery('.b2s-auth-network-6-info').hide();
3615
- jQuery.ajax({
3616
- url: ajaxurl,
3617
- type: "POST",
3618
- dataType: "json",
3619
- cache: false,
3620
- data: {
3621
- 'action': 'b2s_auth_network_login',
3622
- 'username': jQuery('#b2s-auth-network-6-username').val(),
3623
- 'password': jQuery('#b2s-auth-network-6-password').val(),
3624
- 'location': jQuery('#b2s-auth-network-6-location').val(),
3625
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3626
- },
3627
- error: function (jqXHR) {
3628
- jQuery('.b2s-loading-area').hide();
3629
- jQuery('.b2s-auth-network-6-login-area').show();
3630
- jQuery('.b2s-auth-network-6-login-btn').show();
3631
- if (jqXHR.status == 403) {
3632
- jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3633
- } else {
3634
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3635
- }
3636
- return false;
3637
- },
3638
- success: function (data) {
3639
- jQuery('.b2s-loading-area').hide();
3640
- jQuery('.b2s-auth-network-6-login-area').show();
3641
- if (data.result == true) {
3642
- jQuery('#b2s-auth-network-6-board').html(data.boards);
3643
- jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
3644
- jQuery('.b2s-auth-network-6-board-area').show();
3645
- jQuery('.b2s-auth-network-6-confirm-btn').show();
3646
- jQuery('.b2s-auth-network-6-info[data-info="success"]').show();
3647
- } else {
3648
- jQuery('.b2s-auth-network-6-login-btn').show();
3649
- if (data.error == 'nonce') {
3650
- jQuery('.b2s-nonce-check-fail').show();
3651
- }
3652
- if (typeof data.error != 'undefined' && data.error != '') {
3653
- jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3654
- return false;
3655
- }
3656
- jQuery('.b2s-auth-network-6-info[data-info="login"]').show();
3657
- }
3658
- }
3659
- });
3660
- });
3661
-
3662
- jQuery(document).on('click', '.b2s-auth-network-6-confirm-btn', function () {
3663
- jQuery('.b2s-loading-area').show();
3664
- jQuery('.b2s-auth-network-6-login-area').hide();
3665
- jQuery('.b2s-auth-network-6-login-btn').hide();
3666
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
3667
- jQuery.ajax({
3668
- url: ajaxurl,
3669
- type: "POST",
3670
- dataType: "json",
3671
- cache: false,
3672
- data: {
3673
- 'action': 'b2s_auth_network_confirm',
3674
- 'username': jQuery('#b2s-auth-network-6-username').val(),
3675
- 'password': jQuery('#b2s-auth-network-6-password').val(),
3676
- 'boardId': jQuery('#b2s-auth-network-6-board').val(),
3677
- 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
3678
- 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
3679
- 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
3680
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3681
- },
3682
- error: function (jqXHR) {
3683
- jQuery('.b2s-loading-area').hide();
3684
- jQuery('.b2s-auth-network-6-login-area').show();
3685
- jQuery('.b2s-auth-network-6-confirm-btn').show();
3686
- if (jqXHR.status == 403) {
3687
- jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3688
- } else {
3689
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3690
- }
3691
- return false;
3692
- },
3693
- success: function (data) {
3694
- jQuery('.b2s-loading-area').hide();
3695
- jQuery('.b2s-auth-network-6-login-area').show();
3696
- jQuery('.b2s-auth-network-6-confirm-btn').show();
3697
- if (data.result == true) {
3698
- jQuery('#b2sAuthNetwork6Modal').modal('hide');
3699
- loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
3700
- } else {
3701
- if (data.error == 'nonce') {
3702
- jQuery('.b2s-nonce-check-fail').show();
3703
- }
3704
- if (typeof data.error != 'undefined' && data.error != '') {
3705
- jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3706
- return false;
3707
- }
3708
- jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3709
- }
3710
- }
3711
- });
3712
- });
3713
-
3714
- jQuery(document).on('click', '.b2s-network-list-add-btn[data-auth-method="client"]', function () {
3715
- jQuery('#b2sAuthNetwork6Modal').modal('show');
3716
- });
3717
-
3718
- jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3719
- jQuery('.b2s-loading-area').hide();
3720
- jQuery('.b2s-auth-network-6-login-area').show();
3721
- jQuery('#b2s-auth-network-6-auth-id').val('');
3722
- jQuery('#b2s-auth-network-6-board').html('');
3723
- jQuery('#b2s-auth-network-6-ident-data').val('');
3724
- jQuery('.b2s-auth-network-6-info').hide();
3725
- jQuery('.b2s-auth-network-6-confirm-btn').hide();
3726
- jQuery('.b2s-auth-network-6-login-btn').show();
3727
- jQuery('.b2s-auth-network-6-board-area').hide();
3728
- jQuery('#b2s-auth-network-6-username').val('');
3729
- jQuery('#b2s-auth-network-6-password').val('');
3730
- });
3731
-
3732
- jQuery(".b2s-auth-network-6-reveal").mousedown(function () {
3733
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'text'));
3734
- });
3735
- jQuery(".b2s-auth-network-6-reveal").mouseup(function () {
3736
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3737
- });
3738
- jQuery(".b2s-auth-network-6-reveal").mouseout(function () {
3739
- jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3740
- });
3741
- // END Pinterest
3742
-
3743
- jQuery(document).on('click', '.b2sInfoPostRelayModalBtn', function () {
3744
- jQuery('#b2sInfoPostRelayModal').modal('show');
3745
- });
3746
- jQuery(document).on('click', '.b2sInfoSchedTimesModalBtn', function () {
3747
- jQuery('#b2sInfoSchedTimesModal').modal('show');
3748
- });
3749
- jQuery(document).on('click', '.b2s-network-setting-save-btn', function () {
3750
- jQuery('#b2s-network-setting-save').modal('show');
3751
- });
3752
- jQuery(document).on('click', '.b2s-network-list-modal-btn', function () {
3753
- jQuery('#b2s-network-list-modal').modal('show');
3754
- });
3755
- jQuery(document).on('click', '.b2s-re-share-info-btn', function () {
3756
- jQuery('#b2s-re-share-info').modal('show');
3757
- });
3758
-
3759
- function checkGifAnimation(networkAuthId, networkId) {
3760
- 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() != '') {
3761
- 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);
3762
- attachmenUrlExt = attachmenUrlExt.toLowerCase();
3763
- if (attachmenUrlExt == 'gif') {
3764
- var postFormat = 0;
3765
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').length > 0) {
3766
- postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val();
3767
- }
3768
- var animatedGif = JSON.parse(jQuery('#b2sAnimateGif').val());
3769
- if (typeof animatedGif[networkId] != "undefined" && animatedGif[networkId][postFormat] == true) {
3770
- 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());
3771
- } else {
3772
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').each(function () {
3773
- var imgItem = this;
3774
- window.setTimeout(function () {
3775
- freeze_gif(imgItem);
3776
- }, 1);
3777
- });
3778
- }
3779
- } else {
3780
- 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()) {
3781
- 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());
3782
- }
3783
- }
3784
- }
3785
- return false;
3786
- }
3787
-
3788
- function freeze_gif(i) {
3789
- var c = document.createElement('canvas');
3790
- var w = c.width = i.width;
3791
- var h = c.height = i.height;
3792
- c.getContext('2d').drawImage(i, 0, 0, w, h);
3793
- try {
3794
- i.src = c.toDataURL("image/gif"); // if possible, retain all css aspects
3795
- } catch (e) { // cross-domain -- mimic original with all its tag attributes
3796
- for (var j = 0, a; a = i.attributes[j]; j++)
3797
- c.setAttribute(a.name, a.value);
3798
- i.parentNode.replaceChild(c, i);
3799
- }
3800
- return false;
3801
- }
3802
-
3803
- var currentEmojiNetworkAuthId = 0;
3804
- var currentEmojiNetworkCount = -1;
3805
- var emojiTranslation = JSON.parse(jQuery('#b2sEmojiTranslation').val());
3806
- var picker = new EmojiButton({
3807
- position: 'auto',
3808
- autoHide: false,
3809
- i18n: {
3810
- search: emojiTranslation['search'],
3811
- categories: {
3812
- recents: emojiTranslation['recents'],
3813
- smileys: emojiTranslation['smileys'],
3814
- animals: emojiTranslation['animals'],
3815
- food: emojiTranslation['food'],
3816
- activities: emojiTranslation['activities'],
3817
- travel: emojiTranslation['travel'],
3818
- objects: emojiTranslation['objects'],
3819
- symbols: emojiTranslation['symbols'],
3820
- flags: emojiTranslation['flags']
3821
- },
3822
- notFound: emojiTranslation['notFound']
3823
- }
3824
- });
3825
- picker.on('emoji', function (emoji) {
3826
- if (currentEmojiNetworkAuthId > 0) {
3827
- var text = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val();
3828
- var start = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionStart');
3829
- var end = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionEnd');
3830
- if (typeof start == 'undefined' || typeof end == 'undefined') {
3831
- start = text.length;
3832
- end = text.length;
3833
- }
3834
- var newText = text.slice(0, start) + emoji + text.slice(end);
3835
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val(newText);
3836
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').focus();
3837
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionStart", parseInt(start) + emoji.length);
3838
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionEnd", parseInt(start) + emoji.length);
3839
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').trigger('keyup');
3840
- }
3841
- });
3842
-
3843
- jQuery(document).on('click', '.b2s-post-item-details-item-message-emoji-btn', function () {
3844
- if (picker.pickerVisible) {
3845
- picker.hidePicker();
3846
- } else {
3847
- currentEmojiNetworkAuthId = jQuery(this).attr('data-network-auth-id');
3848
- currentEmojiNetworkCount = jQuery(this).attr('data-network-count');
3849
- picker.showPicker(jQuery(this));
3850
- }
3851
- });
3852
-
3853
- jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-post-item-details-item-message-input', function () {
3854
- var tb = jQuery(this).get(0);
3855
- jQuery(this).attr('selectionStart', tb.selectionStart);
3856
- jQuery(this).attr('selectionEnd', tb.selectionEnd);
3857
- });
3858
-
3859
- var pickerHTML = new EmojiButton({
3860
- position: 'auto',
3861
- autoHide: false,
3862
- i18n: {
3863
- search: emojiTranslation['search'],
3864
- categories: {
3865
- recents: emojiTranslation['recents'],
3866
- smileys: emojiTranslation['smileys'],
3867
- animals: emojiTranslation['animals'],
3868
- food: emojiTranslation['food'],
3869
- activities: emojiTranslation['activities'],
3870
- travel: emojiTranslation['travel'],
3871
- objects: emojiTranslation['objects'],
3872
- symbols: emojiTranslation['symbols'],
3873
- flags: emojiTranslation['flags']
3874
- },
3875
- notFound: emojiTranslation['notFound']
3876
- }
3877
- });
3878
- var currentPickerHTMLContent;
3879
- pickerHTML.on('emoji', function (emoji) {
3880
- currentPickerHTMLContent.insert(emoji);
 
 
 
 
3881
  });
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.plugins.xhtml.allowedTags = ['h1', 'h2', 'p', 'br', 'i', 'em', 'b', 'a', 'img'];
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-upload-image').attr('data-network-auth-id', networkAuthId);
96
+ 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();
97
+ jQuery('.b2s-selected-network-for-image-info').html(content);
98
+ jQuery('#b2s-network-select-image').modal('show');
99
+ jQuery('.b2s-image-change-meta-network').hide();
100
+ jQuery('#b2sInsertImageType').val("1");
101
+ imageSize();
102
+
103
+ },
104
+ txtExec: function () {
105
+ var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
106
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
107
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
108
+ 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();
109
+ jQuery('.b2s-selected-network-for-image-info').html(content);
110
+ jQuery('#b2s-network-select-image').modal('show');
111
+ jQuery('#b2sInsertImageType').val("1");
112
+ imageSize();
113
+ }, tooltip: "Image"});
114
+ jQuery.sceditor.command.set(
115
+ "custom-emoji", {
116
+ exec: function () {
117
+ var me = this;
118
+ if (pickerHTML.pickerVisible) {
119
+ pickerHTML.hidePicker();
120
+ } else {
121
+ pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
122
+ currentPickerHTMLContent = this;
123
+ }
124
+ },
125
+ txtExec: function () {
126
+ var me = this;
127
+ if (pickerHTML.pickerVisible) {
128
+ pickerHTML.hidePicker();
129
+ } else {
130
+ pickerHTML.showPicker(jQuery(this.getContentAreaContainer()).parent('.sceditor-container').find('.sceditor-toolbar').find('.sceditor-button-custom-emoji'));
131
+ currentPickerHTMLContent = this;
132
+ }
133
+ }, tooltip: "Emoji"});
134
+
135
+
136
+ jQuery(document).on('click', '.b2s-toogle-calendar-btn', function () {
137
+
138
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
139
+ var networkId = jQuery(this).attr('data-network-id');
140
+ var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
141
+ var currentBtnText = jQuery(this).text();
142
+
143
+ jQuery(this).text(toogleBtnText);
144
+ jQuery(this).attr('data-toogle-text-btn', currentBtnText);
145
+
146
+ //change to show
147
+ var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
148
+ if (calendar.hasClass('hide')) {
149
+ calendar.removeClass('hide');
150
+ calendar.addClass('show');
151
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').removeClass('hide');
152
+
153
+ if (calendar.is(':empty')) {
154
+ 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();
155
+
156
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar({
157
+ editable: false,
158
+ locale: b2s_calendar_locale,
159
+ eventLimit: 2,
160
+ contentHeight: 530,
161
+ timeFormat: 'H:mm',
162
+ eventSources: [b2s_cur_source_ship_calendar[0]],
163
+ eventRender: function (event, element) {
164
+ show = true;
165
+ $header = jQuery("<div>").addClass("b2s-calendar-header");
166
+ $isRelayPost = '';
167
+ $isCuratedPost = '';
168
+ if (event.post_type == 'b2s_ex_post') {
169
+ $isCuratedPost = ' (Curated Post)';
170
+ }
171
+ if (event.relay_primary_post_id > 0) {
172
+ $isRelayPost = ' (Retweet)';
173
+ }
174
+ $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
175
+ element.find(".fc-time").after($network_name);
176
+ element.html(element.html());
177
+ $parent = element.parent();
178
+ $header.append(element.find(".fc-content"));
179
+ element.append($header);
180
+ $body = jQuery("<div>").addClass("b2s-calendar-body");
181
+ $body.append(event.avatar);
182
+ $body.append(element.find(".fc-title"));
183
+ $body.append(jQuery("<br>"));
184
+ var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
185
+ $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;' />")
186
+ $em.append(event.network_name);
187
+ $em.append(jQuery("<span>").text(": " + event.profile));
188
+ $body.append($em);
189
+ element.append($body);
190
+ },
191
+ dayRender: function (date, element) {
192
+ if (!jQuery(element[0]).hasClass('fc-past')) {
193
+ var date = jQuery(element[0]).attr('data-date');
194
+ var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
195
+ $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);
196
+ sel_element.append($header);
197
+ }
198
+ }
199
+ });
200
+ } else {
201
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]').fullCalendar('refetchEvents');
202
+ }
203
+
204
+ } else {
205
+ calendar.removeClass('show');
206
+ calendar.addClass('hide');
207
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
208
+
209
+ }
210
+
211
+ return false;
212
+
213
+ });
214
+
215
+ jQuery(document).on('click', '.b2s-calendar-add-schedule-btn', function () {
216
+ var selSchedDate = jQuery(this).parent('td').attr('data-date');
217
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
218
+
219
+ if (jQuery('#user_version').val() == 0) {
220
+ jQuery('.b2s-post-item-details-release-input-date-select-reset[data-network-auth-id="' + networkAuthId + '"]').val('0');
221
+ jQuery('#b2s-sched-post-modal').modal('show');
222
+ return false;
223
+ }
224
+
225
+ if (jQuery('#b2sUserLang').val() == 'de') {
226
+ selSchedDate = selSchedDate.substring(8, 10) + '.' + selSchedDate.substring(5, 7) + '.' + selSchedDate.substring(0, 4);
227
+ }
228
+
229
+ //isfirst
230
+ if (!jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"] option[value="1"]:selected').length > 0) {
231
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
232
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
233
+ } else {
234
+ //add
235
+ var curSel = jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"]').filter(':visible');
236
+ if (curSel.length > 0) {
237
+ curSel.trigger('click');
238
+ netCountNext = parseInt(curSel.attr('data-network-count')) + 1;
239
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + netCountNext + '"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
240
+ } else {
241
+ //do not adding write to first
242
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="0"][data-network-auth-id="' + networkAuthId + '"]').val(selSchedDate);
243
+ }
244
+ }
245
+ return false;
246
+ });
247
+
248
+ jQuery(document).on('change', '.b2s-calendar-filter-network-sel', function () {
249
+ 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();
250
+ 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();
251
+ jQuery(this).attr('data-last-sel', jQuery(this).val());
252
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('removeEventSource', oldSource);
253
+ jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').fullCalendar('addEventSource', newSource);
254
+ return false;
255
+ });
256
+
257
+
258
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
259
+ jQuery('.b2s-server-connection-fail').hide();
260
+ jQuery.ajax({
261
+ url: ajaxurl,
262
+ type: "POST",
263
+ dataType: "json",
264
+ cache: false,
265
+ data: {
266
+ 'action': 'b2s_get_settings_sched_time_default',
267
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
268
+ },
269
+ error: function () {
270
+ jQuery('.b2s-server-connection-fail').show();
271
+ return false;
272
+ },
273
+ success: function (data) {
274
+ if (data.result == true) {
275
+ var tomorrow = new Date();
276
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
277
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
278
+ }
279
+ tomorrow.setDate(tomorrow.getDate() + 1);
280
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
281
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
282
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
283
+ var today = new Date();
284
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
285
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
286
+ }
287
+
288
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
289
+ var todayDate = ("0" + today.getDate()).slice(-2);
290
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
291
+ var lang = jQuery('#b2sUserLang').val();
292
+ if (lang == "de") {
293
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
294
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
295
+ }
296
+
297
+ jQuery.each(data.times, function (network_id, time) {
298
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
299
+ time.forEach(function (network_type_time, count) {
300
+ if (network_type_time != "") {
301
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
302
+ if (jQuery(this).is(':not(:disabled)')) {
303
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
304
+ //is not set special dates
305
+ 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') {
306
+ 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");
307
+ }
308
+ var hours = network_type_time.substring(0, 2);
309
+ if (lang == "en") {
310
+ var timeparts = network_type_time.split(' ');
311
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
312
+ }
313
+ if (hours < today.getHours()) {
314
+ 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);
315
+ 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);
316
+ } else {
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"]').val(dateToday);
318
+ 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);
319
+ }
320
+ 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);
321
+ 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);
322
+ }
323
+ });
324
+ count++;
325
+ }
326
+ });
327
+ }
328
+ });
329
+ } else {
330
+ if (data.error == 'nonce') {
331
+ jQuery('.b2s-nonce-check-fail').show();
332
+ }
333
+ }
334
+ }
335
+ });
336
+ return false;
337
+ });
338
+
339
+
340
+ function formatAMPM(date) {
341
+ var hours = date.getHours();
342
+ var minutes = date.getMinutes();
343
+ var ampm = hours >= 12 ? 'pm' : 'am';
344
+ hours = hours % 12;
345
+ hours = hours ? hours : 12; // the hour '0' should be '12'
346
+ minutes = minutes < 10 ? '0' + minutes : minutes;
347
+ var strTime = hours + ':' + minutes + ' ' + ampm;
348
+ return strTime;
349
+ }
350
+
351
+
352
+
353
+ jQuery(document).on('click', '.b2s-sidbar-network-auth-btn', function () {
354
+ jQuery('#b2s-network-list-modal').modal('show');
355
+ return false;
356
+ });
357
+ jQuery(document).on('click', '.change-meta-tag', function () {
358
+ var attr = jQuery(this).attr('readonly');
359
+ if (typeof attr !== typeof undefined && attr !== false) {
360
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
361
+ //Content cuation
362
+ var postType = jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-post-wp-type');
363
+ if (postType != "ex") {
364
+ jQuery('.meta-text').hide();
365
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
366
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
367
+ var isMetaChecked = false;
368
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
369
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
370
+ isMetaChecked = true;
371
+ }
372
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
373
+ isMetaChecked = true;
374
+ }
375
+ var showDefault = true;
376
+ if (postFormat == "0" && !isMetaChecked) { //isLinkPost
377
+ showDefault = false;
378
+ if (networkId == "1") {
379
+ jQuery('.isOgMetaChecked').show();
380
+ } else {
381
+ jQuery('.isCardMetaChecked').show();
382
+ }
383
+ }
384
+ if (showDefault) {
385
+ jQuery('.isLinkPost').show();
386
+ }
387
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
388
+ }
389
+ }
390
+ return false;
391
+ });
392
+ // Linkpost change Meta Tags title + desc
393
+ jQuery(document).on('keyup', '.change-meta-tag', function () {
394
+ var currentText = jQuery(this).val();
395
+ var metaTag = jQuery(this).attr('data-meta');
396
+ jQuery('.change-meta-tag[data-meta=' + metaTag + ']').each(function () {
397
+ //override this content with current content by keyup
398
+ jQuery(this).val(currentText);
399
+ });
400
+ return false;
401
+ });
402
+ jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
403
+ jQuery('.b2s-server-connection-fail').hide();
404
+ jQuery.ajax({
405
+ url: ajaxurl,
406
+ type: "POST",
407
+ dataType: "json",
408
+ cache: false,
409
+ data: {
410
+ 'action': 'b2s_get_settings_sched_time_user',
411
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
412
+ },
413
+ error: function () {
414
+ jQuery('.b2s-server-connection-fail').show();
415
+ return false;
416
+ },
417
+ success: function (data) {
418
+ var tomorrow = new Date();
419
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
420
+ tomorrow.setTime(jQuery('#b2sBlogPostSchedDate').val());
421
+ }
422
+
423
+ tomorrow.setDate(tomorrow.getDate() + 1);
424
+ var tomorrowMonth = ("0" + (tomorrow.getMonth() + 1)).slice(-2);
425
+ var tomorrowDate = ("0" + tomorrow.getDate()).slice(-2);
426
+ var dateTomorrow = tomorrow.getFullYear() + "-" + tomorrowMonth + "-" + tomorrowDate;
427
+ var today = new Date();
428
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
429
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
430
+ }
431
+
432
+ var todayMonth = ("0" + (today.getMonth() + 1)).slice(-2);
433
+ var todayDate = ("0" + today.getDate()).slice(-2);
434
+ var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
435
+ var lang = jQuery('#b2sUserLang').val();
436
+ if (lang == "de") {
437
+ dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
438
+ dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
439
+ }
440
+ if (data.result == true) {
441
+ //V5.1.0 seeding
442
+ if (data.type == 'new') {
443
+ //new
444
+ jQuery.each(data.times, function (network_auth_id, time) {
445
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + network_auth_id + '"]').is(":visible")) {
446
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').is(':not(:disabled)')) {
447
+ //is not set special dates
448
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val() == '0') {
449
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + network_auth_id + '"]').val('1').trigger("change");
450
+ }
451
+ var hours = time.substring(0, 2);
452
+ if (lang == "en") {
453
+ var timeparts = time.split(' ');
454
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
455
+ }
456
+
457
+ var isDelay = false;
458
+ var delayDay = data.delay_day[network_auth_id];
459
+ if (delayDay != undefined) {
460
+ if (delayDay > 0) {
461
+ var delay = new Date();
462
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
463
+ delay.setTime(jQuery('#b2sBlogPostSchedDate').val());
464
+ }
465
+ delay.setDate(delay.getDate() + parseInt(delayDay));
466
+ var delayMonth = ("0" + (delay.getMonth() + 1)).slice(-2);
467
+ var delayDate = ("0" + delay.getDate()).slice(-2);
468
+ var dateDelay = delay.getFullYear() + "-" + delayMonth + "-" + delayDate;
469
+ if (lang == 'de') {
470
+ dateDelay = delayDate + '.' + delayMonth + "." + delay.getFullYear();
471
+ }
472
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateDelay);
473
+ isDelay = true;
474
+
475
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateDelay);
476
+ }
477
+ }
478
+ if (!isDelay) {
479
+ if (hours < today.getHours()) {
480
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateTomorrow);
481
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateTomorrow);
482
+ } else {
483
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(dateToday);
484
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').datepicker('update', dateToday);
485
+ }
486
+ }
487
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + network_auth_id + '"][data-network-count="0"]').val(time);
488
+ 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)));
489
+ }
490
+ }
491
+ });
492
+ } else {
493
+ //old
494
+ jQuery.each(data.times, function (network_id, time) {
495
+ if (jQuery('.b2s-post-item[data-network-id="' + network_id + '"]').is(":visible")) {
496
+ time.forEach(function (network_type_time, count) {
497
+ if (network_type_time != "") {
498
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').each(function () {
499
+ if (jQuery(this).is(':not(:disabled)')) {
500
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
501
+ //is not set special dates
502
+ 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') {
503
+ 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");
504
+ }
505
+ var hours = network_type_time.substring(0, 2);
506
+ if (lang == "en") {
507
+ var timeparts = network_type_time.split(' ');
508
+ hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
509
+ }
510
+ if (hours < today.getHours()) {
511
+ 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);
512
+ 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);
513
+ } else {
514
+ 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);
515
+ 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);
516
+ }
517
+ 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);
518
+ 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);
519
+ }
520
+ });
521
+ count++;
522
+ }
523
+ });
524
+ }
525
+ });
526
+ }
527
+ } else {
528
+ if (data.error == 'nonce') {
529
+ jQuery('.b2s-nonce-check-fail').show();
530
+ }
531
+ //default load best Times
532
+ //jQuery('.b2s-get-settings-sched-time-default').trigger('click');
533
+ //set current time
534
+ jQuery('.b2s-post-item:visible').each(function () {
535
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
536
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').is(':not(:disabled)')) {
537
+ //is not set special dates
538
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() != '1') {
539
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val('1').trigger("change");
540
+ }
541
+ }
542
+ });
543
+ }
544
+ }
545
+ });
546
+ return false;
547
+ });
548
+ jQuery('#b2sPreFeatureModal').on('show.bs.modal', function () {
549
+ jQuery('.b2s-post-item-details-release-input-date-select-reset').val('0');
550
+ });
551
+ jQuery(document).on('click', '.b2s-network-list-add-btn-profeature', function () {
552
+ jQuery('#b2s-network-list-modal').modal('hide');
553
+ });
554
+ jQuery(document).on('click', '.b2s-post-item-details-release-area-sched-for-all', function () {
555
+ var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
556
+ var dataNetworkCount = 0;
557
+ var selMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val();
558
+ if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="1"]').is(":visible")) {
559
+ dataNetworkCount = 1;
560
+ }
561
+ if (jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="2"]').is(":visible")) {
562
+ dataNetworkCount = 2;
563
+ }
564
+
565
+ jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
566
+ 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) {
567
+ jQuery(this).val(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val());
568
+ //view elements
569
+ releaseChoose(jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
570
+ //view elements interval
571
+ if (selMode == 2) {
572
+ for (var i = 0; i <= dataNetworkCount; i++) {
573
+ var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
574
+ releaseChooseInterval(curInterval, '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]', i);
575
+ }
576
+ }
577
+ }
578
+ });
579
+ //set values
580
+ for (var i = 0; i <= dataNetworkCount; i++) {
581
+ 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());
582
+ 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());
583
+ if (selMode == 2) {
584
+ var curInterval = jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"][data-network-auth-id="' + dataNetworkAuthId + '"]').val();
585
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]').val(curInterval);
586
+ if (curInterval == 0) {
587
+ 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());
588
+ 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'));
589
+ 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'));
590
+ 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'));
591
+ 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'));
592
+ 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'));
593
+ 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'));
594
+ 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'));
595
+ }
596
+ if (curInterval == 1) {
597
+ 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());
598
+ 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());
599
+ }
600
+ if (curInterval == 2) {
601
+ 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());
602
+ 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());
603
+ }
604
+ }
605
+ }
606
+
607
+ if (dataNetworkCount == 2) {
608
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
609
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
610
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').hide();
611
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"]').show();
612
+ } else if (dataNetworkCount == 1) {
613
+ jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
614
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').show();
615
+ }
616
+
617
+ return false;
618
+ });
619
+ jQuery(document).on("click", ".b2s-user-network-settings-post-format", function () {
620
+ jQuery('.b2s-settings-user-success').hide();
621
+ jQuery('.b2s-settings-user-error').hide();
622
+ jQuery('.b2s-server-connection-fail').hide();
623
+ var networkId = jQuery(this).attr("data-network-id");
624
+ var networkType = jQuery(this).attr("data-network-type");
625
+ var postFormat = jQuery(this).val();
626
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
627
+ var postFormatType = jQuery(this).attr("data-post-format-type");
628
+ var postType = jQuery(this).attr("data-post-wp-type");
629
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
630
+ //PostFormat
631
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
632
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
633
+ if (jQuery('#user_version').val() >= 2) {
634
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormatType][postFormat]);
635
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(postFormat);
636
+ } else {
637
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormatType][postFormat]);
638
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
639
+ }
640
+ if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-meta-type') == 'og' && postType != "ex") {
641
+ if (currentOGImage == '' && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != '') {
642
+ currentOGImage = jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val();
643
+ if (postFormat == "0") {
644
+ jQuery('.b2s-network-select-btn[data-meta-type="og"]').each(function () {
645
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentOGImage);
646
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentOGImage);
647
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
648
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
649
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
650
+ }
651
+ });
652
+ }
653
+ }
654
+ if (postFormat == "0" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val() != currentOGImage) {
655
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
656
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
657
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
658
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
659
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
660
+ }
661
+ }
662
+ }
663
+ }
664
+ var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').attr('data-network-text-limit');
665
+ if (textLimit != "0") {
666
+ networkLimitAll(networkAuthId, networkId, textLimit);
667
+ } else {
668
+ networkCount(networkAuthId);
669
+ }
670
+
671
+ //Edit Meta Tags
672
+ var isMetaChecked = false;
673
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
674
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
675
+ isMetaChecked = true;
676
+ }
677
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
678
+ isMetaChecked = true;
679
+ }
680
+ if (isMetaChecked && postFormat == '0' && jQuery('#user_version').val() > 0) { //If linkpost
681
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
682
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
683
+ var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
684
+ if (dataMetaType == "og") {
685
+ jQuery('#b2sChangeOgMeta').val("1");
686
+ } else {
687
+ jQuery('#b2sChangeCardMeta').val("1");
688
+ }
689
+
690
+ //Copy from further item meta tags by same network
691
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
692
+ 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
693
+ 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());
694
+ 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());
695
+ 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());
696
+ if (jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]:visible').length == 1) {
697
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').show();
698
+ } else {
699
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="-1"]').hide();
700
+ }
701
+
702
+ return true;
703
+ }
704
+ });
705
+
706
+ //Set & Check Link
707
+ if (typeof jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]') !== undefined) {
708
+ //Facebook + Twitter && Linkpost
709
+ if (networkId == 1 || networkId == 2 && postFormat == 0) {
710
+ if (jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
711
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefault_url').val());
712
+ }
713
+ }
714
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
715
+ if (jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hasClass('disabled')) {
716
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').removeClass('disabled');
717
+ }
718
+ }
719
+
720
+ } else {
721
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
722
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
723
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
724
+ }
725
+
726
+ //Content Curation V5.0.0
727
+ if (postType == "ex") {
728
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
729
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
730
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
731
+ if (postFormat == '0') {
732
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
733
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
734
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
735
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
736
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
737
+ } else {
738
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
739
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
740
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
741
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
742
+ }
743
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
744
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
745
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
746
+ }
747
+ }
748
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
749
+ jQuery(this).addClass('b2s-settings-checked');
750
+ jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
751
+ checkGifAnimation(networkAuthId, networkId);
752
+ return false;
753
+ });
754
+ jQuery(document).on("click", ".b2s-post-ship-item-full-text", function () {
755
+ jQuery('.b2s-server-connection-fail').hide();
756
+ var curSchedCount = jQuery(this).attr('data-network-count');
757
+ jQuery.ajax({
758
+ url: ajaxurl,
759
+ type: "POST",
760
+ dataType: "json",
761
+ cache: false,
762
+ data: {
763
+ 'action': 'b2s_ship_item_full_text',
764
+ 'postId': jQuery('#b2sPostId').val(),
765
+ 'userLang': jQuery('#b2sUserLang').val(),
766
+ 'networkAuthId': jQuery(this).attr('data-network-auth-id'),
767
+ 'networkId': jQuery(this).attr('data-network-id'),
768
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
769
+ },
770
+ error: function () {
771
+ jQuery('.b2s-server-connection-fail').show();
772
+ return false;
773
+ },
774
+ success: function (data) {
775
+ if (data.result == true) {
776
+ messageInput = jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + curSchedCount + '"][data-network-auth-id="' + data.networkAuthId + '"]');
777
+ messageInput.val(data.text);
778
+ networkCount(data.networkAuthId);
779
+ networkTextLimit = messageInput.attr('data-network-text-limit');
780
+ if (typeof networkTextLimit != undefined) {
781
+ if (parseInt(networkTextLimit) > 0 && parseInt(data.networkId) > 0) {
782
+ networkLimitAll(data.networkAuthId, data.networkId, networkTextLimit);
783
+ }
784
+ }
785
+ } else {
786
+ if (data.error == 'nonce') {
787
+ jQuery('.b2s-nonce-check-fail').show();
788
+ }
789
+ }
790
+ }
791
+ });
792
+ return false;
793
+ });
794
+ jQuery(document).on("click", ".b2s-post-ship-item-message-delete", function () {
795
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
796
+ var networkCountId = jQuery(this).attr('data-network-count');
797
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
798
+ initSceditor(networkAuthId);
799
+ networkCount(networkAuthId);
800
+ return false;
801
+ });
802
+ jQuery(document).on("click", ".b2s-post-ship-item-copy-original-text", function () {
803
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
804
+ var networkCountId = jQuery(this).attr('data-network-count');
805
+ var networkId = jQuery(this).attr('data-network-id');
806
+ var text = jQuery('.b2s-post-item-details-item-message-input[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').val();
807
+ if (text == "" && networkId == 2) {
808
+ text = jQuery('#b2sTwitterOrginalPost').val();
809
+ }
810
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(text);
811
+ networkCount(networkAuthId);
812
+ return false;
813
+ });
814
+ jQuery(document).on("click", ".b2s-network-select-btn", function () {
815
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
816
+ var networkId = jQuery(this).attr('data-network-id');
817
+ var networkType = jQuery(this).attr('data-network-type');
818
+ var metaType = jQuery(this).attr('data-meta-type');
819
+
820
+ //doppelklick Schutz
821
+ if (!jQuery(this).hasClass('b2s-network-select-btn-deactivate')) {
822
+ //active?
823
+ if (!jQuery(this).children().hasClass('active')) {
824
+ //TOS XING Groups
825
+ if ((networkId == 8 || networkId == 19) && networkType == 2) {
826
+ 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'))) {
827
+ jQuery('#b2s-tos-xing-group-modal').modal('show');
828
+ return false;
829
+ } else {
830
+ b2sTosXingGroupCount++;
831
+ }
832
+ }
833
+ //schon vorhanden?
834
+ 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')) {
835
+ activatePortal(networkAuthId);
836
+ //PostFormat
837
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0 || networkId == 15) {
838
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
839
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').attr('data-post-format-type');
840
+ if (jQuery('#user_version').val() >= 2) {
841
+ 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()]);
842
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
843
+ //if linkpost then show btn meta tags
844
+ var isMetaChecked = false;
845
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
846
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
847
+ isMetaChecked = true;
848
+ }
849
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
850
+ isMetaChecked = true;
851
+ }
852
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0") {
853
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
854
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
855
+ var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
856
+ if (dataMetaType == "og") {
857
+ jQuery('#b2sChangeOgMeta').val("1");
858
+ } else {
859
+ jQuery('#b2sChangeCardMeta').val("1");
860
+ }
861
+
862
+ //Copy from further item meta tags by same network
863
+ jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
864
+ 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
865
+ 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());
866
+ 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());
867
+ 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'));
868
+ 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());
869
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
870
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
871
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == 1) {
872
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
873
+ }
874
+ } else {
875
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
876
+ }
877
+
878
+ return true;
879
+ }
880
+ });
881
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
882
+ if(jQuery('.b2s-network-select-btn[data-network-auth-id="'+networkAuthId+'"]').data('meta-type') == 'og' && changedOGImage == true) {
883
+ if (currentOGImage != "") {
884
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
885
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
886
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
887
+ } else {
888
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
889
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
890
+ }
891
+ } else {
892
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
893
+ }
894
+ } else {
895
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
896
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
897
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
898
+ }
899
+
900
+ } else {
901
+ 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()]);
902
+ jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
903
+ }
904
+
905
+ //Content Curation
906
+ if (jQuery('#b2sPostType').val() == 'ex') {
907
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
908
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
909
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + networkAuthId + '"]').attr("style", "display:none !important");
910
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() == 0) {
911
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').hide();
912
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
913
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').show();
914
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').show();
915
+ } else {
916
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"]').show();
917
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
918
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').hide();
919
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').hide();
920
+ }
921
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
922
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
923
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
924
+ }
925
+ }
926
+ }
927
+
928
+ //XING TOS Group
929
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"').show();
930
+
931
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time
932
+ //delete comment field one more
933
+ if (networkId == 2) {
934
+ if (jQuery('.b2s-post-item[data-network-id="' + networkId + '"]:visible').length == 1) {
935
+ jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text(jQuery('#b2sTwitterOrginalPost').val());
936
+ } else {
937
+ jQuery('.tw-textarea-input[data-network-auth-id="' + networkAuthId + '"]').text("");
938
+ }
939
+ }
940
+ checkGifAnimation(networkAuthId, networkId);
941
+ } else {
942
+ jQuery(this).addClass('b2s-network-select-btn-deactivate');
943
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').show();
944
+ jQuery('.b2s-empty-area').hide();
945
+ loadingDummyShow(networkAuthId, jQuery(this).attr('data-network-id'));
946
+ jQuery('.b2s-server-connection-fail').hide();
947
+ var legacyMode = jQuery('#isLegacyMode').val();
948
+ if (legacyMode == "1") {
949
+ legacyMode = false; // loading is sync (stack)
950
+ } else {
951
+ legacyMode = true; // loading is async (parallel)
952
+ }
953
+ jQuery.ajax({
954
+ url: ajaxurl,
955
+ type: "POST",
956
+ dataType: "json",
957
+ async: legacyMode,
958
+ cache: false,
959
+ data: {
960
+ 'action': 'b2s_ship_item',
961
+ 'networkAuthId': networkAuthId,
962
+ 'networkType': jQuery(this).attr('data-network-type'),
963
+ 'networkKind': jQuery(this).attr('data-network-kind'),
964
+ 'networkId': networkId,
965
+ 'networkDisplayName': jQuery(this).attr('data-network-display-name'),
966
+ 'instantSharing': jQuery(this).attr('data-instant-sharing'),
967
+ 'networkTosGroupId': jQuery(this).attr('data-network-tos-group-id'),
968
+ 'userLang': jQuery('#b2sUserLang').val(),
969
+ 'postId': jQuery('#b2sPostId').val(),
970
+ 'relayCount': jQuery('#b2sRelayCount').val(),
971
+ 'selSchedDate': jQuery('#selSchedDate').val(),
972
+ 'b2sPostType': jQuery('#b2sPostType').val(),
973
+ 'b2sIsDraft': jQuery('#b2sIsDraft').val(),
974
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
975
+ },
976
+ beforeSend: function (jqXHR) { // before jQuery send the request we will push it to our array
977
+ jQuery.xhrPool.push(jqXHR);
978
+ },
979
+ complete: function (jqXHR) { // when some of the requests completed it will splice from the array
980
+ var index = jQuery.xhrPool.indexOf(jqXHR);
981
+ if (index > -1) {
982
+ jQuery.xhrPool.splice(index, 1);
983
+ }
984
+ },
985
+ error: function (jqXHR) {
986
+ var index = jQuery.xhrPool.indexOf(jqXHR);
987
+ if (index > -1) {
988
+ jQuery.xhrPool.splice(index, 1);
989
+ }
990
+ loadingDummyConnectionFail(networkAuthId, networkId);
991
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + networkAuthId + '"]').hide();
992
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
993
+ jQuery('.b2s-server-connection-fail').show();
994
+ return true;
995
+ },
996
+ success: function (data) {
997
+ if (data != undefined) {
998
+ jQuery('.b2s-network-status-img-loading[data-network-auth-id="' + data.networkAuthId + '"]').hide();
999
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
1000
+ if (data.result == true) {
1001
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1002
+ var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
1003
+ var pos = order.indexOf(data.networkAuthId.toString());
1004
+ var add = false;
1005
+ for (var i = pos; i >= 0; i--) {
1006
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
1007
+ jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(data.content);
1008
+ i = -1;
1009
+ add = true;
1010
+ }
1011
+ }
1012
+ if (add == false) {
1013
+ jQuery('.b2s-post-list').prepend(data.content);
1014
+ }
1015
+
1016
+ activatePortal(data.networkAuthId);
1017
+ var dateFormat = "yyyy-mm-dd";
1018
+ var language = "en";
1019
+ var showMeridian = true;
1020
+ if (jQuery('#b2sUserLang').val() == "de") {
1021
+ dateFormat = "dd.mm.yyyy";
1022
+ language = "de";
1023
+ showMeridian = false;
1024
+ }
1025
+ var today = new Date();
1026
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
1027
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
1028
+ }
1029
+
1030
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
1031
+ format: dateFormat,
1032
+ language: language,
1033
+ maxViewMode: 2,
1034
+ todayHighlight: true,
1035
+ startDate: today,
1036
+ calendarWeeks: true,
1037
+ autoclose: true
1038
+ });
1039
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
1040
+ minuteStep: 15,
1041
+ appendWidgetTo: 'body',
1042
+ showSeconds: false,
1043
+ showMeridian: showMeridian,
1044
+ defaultTime: today, //'current',
1045
+ snapToStep: true
1046
+ });
1047
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
1048
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1049
+ });
1050
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
1051
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1052
+ });
1053
+ //Check Text Limit
1054
+ 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');
1055
+ if (textLimit != "0") {
1056
+ networkLimitAll(data.networkAuthId, data.networkId, textLimit);
1057
+ } else {
1058
+ networkCount(data.networkAuthId);
1059
+ }
1060
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger("change");
1061
+ initSceditor(data.networkAuthId);
1062
+ //Bild setzen
1063
+ if (jQuery('#b2s_blog_default_image').val() != "") {
1064
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').length > 0) {
1065
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
1066
+ var attachmenUrl = jQuery('#b2s_blog_default_image').val();
1067
+ var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
1068
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
1069
+ if (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1) {
1070
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-network-default-image').val());
1071
+ } else {
1072
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
1073
+ }
1074
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1075
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1076
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="0"]').show();
1077
+ } else {
1078
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1079
+ }
1080
+ }
1081
+ jQuery('.b2s-image-url-hidden-field').val(jQuery('#b2s_blog_default_image').val());
1082
+ }
1083
+
1084
+ //Time zone
1085
+ jQuery('.b2s-settings-time-zone-text').html(jQuery('#user_timezone_text').val());
1086
+ //PostFormat
1087
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0 || data.networkId == 15) {
1088
+ var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
1089
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').attr('data-post-format-type');
1090
+ if (jQuery('#user_version').val() >= 2) {
1091
+ 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()]);
1092
+ 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());
1093
+ var isMetaChecked = false;
1094
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1095
+ if (typeof data.networkId != 'undefined' && jQuery.inArray(data.networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1096
+ isMetaChecked = true;
1097
+ }
1098
+ if (data.networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1099
+ isMetaChecked = true;
1100
+ }
1101
+
1102
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
1103
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1104
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
1105
+ var dataMetaType = jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').attr("data-meta-type");
1106
+ if (dataMetaType == "og") {
1107
+ jQuery('#b2sChangeOgMeta').val("1");
1108
+ //TODO change image to OG image
1109
+ } else {
1110
+ jQuery('#b2sChangeCardMeta').val("1");
1111
+ }
1112
+
1113
+ //Copy from further item meta tags by same network
1114
+ jQuery('.change-meta-tag[data-meta-type="' + dataMetaType + '"]').each(function () {
1115
+ 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
1116
+ 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());
1117
+ 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());
1118
+ 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'));
1119
+ 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());
1120
+
1121
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
1122
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1123
+ } else {
1124
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1125
+ }
1126
+ return true;
1127
+ }
1128
+ });
1129
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').show();
1130
+ if (data.draft == false) {
1131
+ if(jQuery('.b2s-network-select-btn[data-network-auth-id="'+data.networkAuthId+'"]').data('meta-type') == 'og' && changedOGImage == true) {
1132
+ if (currentOGImage != "") {
1133
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1134
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1135
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1136
+ } else {
1137
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1138
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1139
+ }
1140
+ } else {
1141
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').trigger("click");
1142
+ }
1143
+
1144
+ }
1145
+ } else {
1146
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1147
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1148
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1149
+ }
1150
+
1151
+ } else {
1152
+ 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()]);
1153
+ 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());
1154
+ }
1155
+
1156
+
1157
+ if (jQuery('#selSchedDate').val() != "") {
1158
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1159
+ }
1160
+
1161
+
1162
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time
1163
+ //delete comment field one more
1164
+ if (data.networkId == 2) {
1165
+ if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 1) {
1166
+ var firstAuth = jQuery('.b2s-post-item[data-network-id="' + data.networkId + '"]:first').attr('data-network-auth-id');
1167
+ if (firstAuth != data.networkAuthId) {
1168
+ jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1169
+ } else {
1170
+ if (jQuery('.tw-textarea-input[data-network-id="' + data.networkId + '"]:visible').length >= 2) {
1171
+ jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').text("");
1172
+ }
1173
+ }
1174
+ } else {
1175
+ //set original post
1176
+ jQuery('#b2sTwitterOrginalPost').val(jQuery('.tw-textarea-input[data-network-auth-id="' + data.networkAuthId + '"]').val());
1177
+ }
1178
+ }
1179
+
1180
+ //Content Curation
1181
+ if (jQuery('#b2sPostType').val() == 'ex') {
1182
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1183
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
1184
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + data.networkAuthId + '"]').attr("style", "display:none !important");
1185
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val() == 0) {
1186
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1187
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
1188
+ } else {
1189
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"]').show();
1190
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
1191
+ }
1192
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val() == 1) {
1193
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1194
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1195
+ }
1196
+
1197
+ //CC Imagepost V6.0.0
1198
+ if (jQuery('#b2sExPostFormat').val() == 0 || jQuery('#b2sExPostFormat').val() == 1) {
1199
+ jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1200
+ jQuery('.b2s-user-network-settings-post-format[value="' + jQuery('#b2sExPostFormat').val() + '"][data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1201
+ }
1202
+ }
1203
+
1204
+ }
1205
+
1206
+ //Draft
1207
+ if (data.draft == true) {
1208
+ if (data.draftActions.post_format == "0" || data.draftActions.post_format == "1") {
1209
+ jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1210
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').addClass('disabled');
1211
+ 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');
1212
+ }
1213
+
1214
+ jQuery.each(data.draftActions.sched_image_url, function (index, value) {
1215
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1216
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1217
+ if (currentOGImage == '') {
1218
+ currentOGImage = value;
1219
+ } else {
1220
+ value = currentOGImage;
1221
+ }
1222
+ }
1223
+ if (value == "") {
1224
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + index + '"]').hide();
1225
+ 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());
1226
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val("");
1227
+ } else {
1228
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('src', value);
1229
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1230
+ }
1231
+ });
1232
+
1233
+ if (data.draftActions.releaseSelect == "1") {
1234
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1235
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1236
+
1237
+ jQuery.each(data.draftActions.date, function (index, value) {
1238
+ if (index == "1" || index == "2") {
1239
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1240
+ }
1241
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1242
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1243
+ });
1244
+ jQuery.each(data.draftActions.time, function (index, value) {
1245
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1246
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1247
+ });
1248
+ jQuery.each(data.draftActions.sched_content, function (index, value) {
1249
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1250
+ });
1251
+ }
1252
+ if (data.draftActions.releaseSelect == "2") {
1253
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.releaseSelect);
1254
+ jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1255
+
1256
+ jQuery.each(data.draftActions.intervalSelect, function (index, value) {
1257
+ if (index == "1" || index == "2") {
1258
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1259
+ }
1260
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1261
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1262
+ });
1263
+ jQuery.each(data.draftActions.weeks, function (index, value) {
1264
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1265
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1266
+ });
1267
+ jQuery.each(data.draftActions.duration_month, function (index, value) {
1268
+ jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1269
+ jQuery('.b2s-post-item-details-release-input-months[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1270
+ });
1271
+ jQuery.each(data.draftActions.duration_time, function (index, value) {
1272
+ jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1273
+ jQuery('.b2s-post-item-details-release-input-times[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1274
+ });
1275
+ jQuery.each(data.draftActions.select_day, function (index, value) {
1276
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1277
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1278
+ });
1279
+ jQuery.each(data.draftActions.select_timespan, function (index, value) {
1280
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1281
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1282
+ });
1283
+ jQuery.each(data.draftActions.mo, function (index, value) {
1284
+ jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1285
+ });
1286
+ jQuery.each(data.draftActions.di, function (index, value) {
1287
+ jQuery('.b2s-post-item-details-release-input-lable-day-di[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1288
+ });
1289
+ jQuery.each(data.draftActions.mi, function (index, value) {
1290
+ jQuery('.b2s-post-item-details-release-input-lable-day-mi[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1291
+ });
1292
+ jQuery.each(data.draftActions.do, function (index, value) {
1293
+ jQuery('.b2s-post-item-details-release-input-lable-day-do[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1294
+ });
1295
+ jQuery.each(data.draftActions.fr, function (index, value) {
1296
+ jQuery('.b2s-post-item-details-release-input-lable-day-fr[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1297
+ });
1298
+ jQuery.each(data.draftActions.sa, function (index, value) {
1299
+ jQuery('.b2s-post-item-details-release-input-lable-day-sa[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1300
+ });
1301
+ jQuery.each(data.draftActions.so, function (index, value) {
1302
+ jQuery('.b2s-post-item-details-release-input-lable-day-so[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').attr('checked', true);
1303
+ });
1304
+ jQuery.each(data.draftActions.date, function (index, value) {
1305
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1306
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1307
+ });
1308
+ jQuery.each(data.draftActions.time, function (index, value) {
1309
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1310
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1311
+ });
1312
+ }
1313
+
1314
+ if (data.draftActions.post_relay == "1") {
1315
+ jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').attr('checked', true);
1316
+ jQuery('.b2s-post-item-details-relay[data-network-auth-id="' + data.networkAuthId + '"]').trigger('change');
1317
+
1318
+ jQuery.each(data.draftActions.post_relay_account, function (index, value) {
1319
+ if (index >= 1) {
1320
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + (index - 1) + '"]').trigger('click');
1321
+ }
1322
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1323
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1324
+ });
1325
+ jQuery.each(data.draftActions.post_relay_delay, function (index, value) {
1326
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').val(value);
1327
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="' + index + '"]').trigger('change');
1328
+ });
1329
+ }
1330
+
1331
+ while (jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').is(':visible')) {
1332
+ jQuery('.remove-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1333
+ }
1334
+ jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val('');
1335
+ jQuery.each(data.draftActions.tags, function (index, value) {
1336
+ if (index >= 1) {
1337
+ jQuery('.ad-tag-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
1338
+ }
1339
+ jQuery('.b2s-post-item-details-tag-input-elem[data-network-auth-id="' + data.networkAuthId + '"]').last().val(value);
1340
+ });
1341
+
1342
+ jQuery('.b2s-post-item-details-item-title-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.custom_title);
1343
+
1344
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.url);
1345
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('error');
1346
+
1347
+
1348
+ if (data.networkId == 1) {
1349
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_title);
1350
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.og_desc);
1351
+ }
1352
+
1353
+ if (data.networkId == 2) {
1354
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_title);
1355
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.draftActions.card_desc);
1356
+ }
1357
+
1358
+ if (data.draftActions.image_url == "") {
1359
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').hide();
1360
+ 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());
1361
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val("");
1362
+ } else {
1363
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').attr('src', data.draftActions.image_url);
1364
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"][data-network-count="-1"]').val(data.draftActions.image_url);
1365
+ }
1366
+ checkSchedDateTime(data.networkAuthId);
1367
+ }
1368
+
1369
+ //XING Groups
1370
+ if (data.networkId == 19 && data.networkType == 2) {
1371
+ if (jQuery('.networkKind[data-network-auth-id="' + data.networkAuthId + '"]').val() == '3') {
1372
+ jQuery('.marketplace_area[data-network-auth-id="' + data.networkAuthId + '"][data-network-id="' + data.networkId + '"]').show();
1373
+ }
1374
+ }
1375
+ //XING TOS Group
1376
+ if (data.networkId == 19) {
1377
+ jQuery('.b2s-content-info[data-network-auth-id="' + data.networkAuthId + '"').show();
1378
+ }
1379
+
1380
+ if (metaType == 'og' && currentOGImage != '') {
1381
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(currentOGImage);
1382
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', currentOGImage);
1383
+ }
1384
+
1385
+ } else {
1386
+ if (data.error == 'nonce') {
1387
+ jQuery('.b2s-nonce-check-fail').show();
1388
+ }
1389
+ //TOS XING Groups
1390
+ if (typeof data.reason !== "undefined") {
1391
+ if (data.reason == 'tos_xing_group_exists') {
1392
+ b2sTosXingGroupCount--;
1393
+ deactivatePortal(data.networkAuthId);
1394
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + data.networkAuthId + '"]').remove();
1395
+ jQuery('#b2s-tos-xing-group-modal').modal('show');
1396
+ return false;
1397
+ }
1398
+ }
1399
+ }
1400
+ checkGifAnimation(data.networkAuthId, data.networkId);
1401
+ }
1402
+ }
1403
+ });
1404
+ }
1405
+ } else {
1406
+ //TOS XING Groups
1407
+ if ((networkId == 8 || networkId == 19) && networkType == 2) {
1408
+ b2sTosXingGroupCount--;
1409
+ }
1410
+ deactivatePortal(networkAuthId);
1411
+ }
1412
+ }
1413
+ return false;
1414
+ });
1415
+ jQuery(document).on('click', '.b2s-post-item-details-url-image', function () {
1416
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
1417
+ var networkCountId = jQuery(this).attr("data-network-count");
1418
+ if (jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').is(":visible")) {
1419
+
1420
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1421
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr("data-network-id");
1422
+ var isMetaChecked = false;
1423
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1424
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1425
+ isMetaChecked = true;
1426
+ }
1427
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1428
+ isMetaChecked = true;
1429
+ }
1430
+
1431
+ if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Faceboo or Twitter
1432
+ jQuery('.meta-text').hide();
1433
+ if (!isMetaChecked) {
1434
+ if (networkId == "1") {
1435
+ jQuery('.isOgMetaChecked').show();
1436
+ } else {
1437
+ jQuery('.isCardMetaChecked').show();
1438
+ }
1439
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1440
+ return false;
1441
+ }
1442
+ }
1443
+
1444
+ jQuery('.b2s-select-image-modal-open[data-network-count="' + networkCountId + '"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1445
+ }
1446
+ return false;
1447
+ });
1448
+ jQuery(document).on('click', '.b2s-submit-btn-scroll', function () {
1449
+ jQuery('.b2s-submit-btn').trigger('click');
1450
+ });
1451
+ jQuery(document).on('click', '.b2s-post-ship-item-post-format', function () {
1452
+ if (jQuery('#user_version').val() >= 1) {
1453
+ jQuery('.b2s-user-network-settings-post-format-area').hide();
1454
+ jQuery('.b2s-user-network-settings-post-format-area[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1455
+ jQuery('#b2s-post-ship-item-post-format-network-title').html(jQuery('.b2s-user-network-settings-post-format-area[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').attr('data-network-title'));
1456
+ if (jQuery('#user_version').val() >= 2) {
1457
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').removeClass('b2s-settings-checked');
1458
+ var currentPostFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
1459
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + jQuery(this).attr('data-network-type') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"][data-post-format="' + currentPostFormat + '"]').addClass('b2s-settings-checked');
1460
+ jQuery('#b2s-post-ship-item-post-format-network-display-name').html(jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').text().toUpperCase());
1461
+ }
1462
+ jQuery('.b2s-post-format-settings-info').hide();
1463
+ jQuery('.b2s-post-format-settings-info[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1464
+ jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
1465
+ jQuery('.b2s-user-network-settings-post-format').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
1466
+ jQuery('.b2s-user-network-settings-post-format').attr('data-post-wp-type', jQuery(this).attr('data-post-wp-type'));
1467
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() == "1" && jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val() != currentOGImage && jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('data-meta-type') == 'og') {
1468
+ jQuery('.b2s-select-link-chang-image').show();
1469
+ } else {
1470
+ jQuery('.b2s-select-link-chang-image').hide();
1471
+ }
1472
+ } else {
1473
+ jQuery('#b2sInfoFormatModal').modal('show');
1474
+ }
1475
+ return false;
1476
+ });
1477
+ jQuery(document).on('click', '.b2s-btn-trigger-post-ship-item-post-format', function () {
1478
+ jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').trigger('click');
1479
+ return false;
1480
+ });
1481
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-days', function () {
1482
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1483
+ });
1484
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-time', function () {
1485
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1486
+ });
1487
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-date', function () {
1488
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('error');
1489
+ });
1490
+ jQuery('.b2s-network-details-mandant-select').change(function () {
1491
+ hideDuplicateAuths();
1492
+ chooseMandant();
1493
+ });
1494
+ jQuery(document).on('change', '.b2s-post-item-details-item-group-select', function () {
1495
+ if (jQuery(this).attr('data-change-network-display-name') == 'true') {
1496
+ var label = jQuery(this.options[this.selectedIndex]).closest('optgroup').prop('label');
1497
+ jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').html(label);
1498
+ jQuery('.b2s-post-ship-network-display-name[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(label);
1499
+ }
1500
+ //Xing groups
1501
+ if (jQuery(this).attr('data-network-id') == '19') {
1502
+ var option = jQuery('option:selected', this).attr('data-network-kind');
1503
+ if (option == '3') { //Marketplace
1504
+ jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
1505
+ } else {
1506
+ jQuery('.marketplace_area[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-id="' + jQuery(this).attr('data-network-id') + '"]').hide();
1507
+ }
1508
+ jQuery('.networkKind[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(option);
1509
+ }
1510
+
1511
+ return false;
1512
+ });
1513
+ //select recurrent sched interval mode
1514
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-interval-select', function () {
1515
+ var interval = jQuery(this).val();
1516
+ var selectorInput = '[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
1517
+ var dataCount = jQuery(this).attr('data-network-count');
1518
+ releaseChooseInterval(interval, selectorInput, dataCount);
1519
+ return false;
1520
+ });
1521
+ //select shipping mode
1522
+ jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select', function () {
1523
+ var dataNetworkCount = 0;
1524
+ if (jQuery(this).val() == 0) {
1525
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1526
+ if (jQuery(this).attr('data-network-id') == 2) {
1527
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1528
+ }
1529
+ }
1530
+ if (jQuery(this).val() == 2) {
1531
+ if (jQuery(this).attr('data-user-version') == 0) {
1532
+ jQuery('#b2s-sched-post-modal').modal('show');
1533
+ return false;
1534
+ } else {
1535
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1536
+ if (jQuery(this).attr('data-network-id') == 2) {
1537
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1538
+ }
1539
+
1540
+ for (var i = 1; i <= 2; i++) {
1541
+ 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 () {
1542
+ if (jQuery(this).prop('checked')) {
1543
+ dataNetworkCount = 1;
1544
+ }
1545
+ });
1546
+ }
1547
+ if (dataNetworkCount == 2) {
1548
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1549
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1550
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1551
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1552
+ } else if (dataNetworkCount == 1) {
1553
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1554
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1555
+ }
1556
+ }
1557
+ }
1558
+ if (jQuery(this).val() == 1) {
1559
+ if (jQuery(this).attr('data-user-version') == 0) {
1560
+ jQuery('#b2s-sched-post-modal').modal('show');
1561
+ return false;
1562
+ } else {
1563
+
1564
+ //TOS Twitter 032018 - none multiple accounts post same content to same time
1565
+ if (jQuery(this).attr('data-network-id') == 2) {
1566
+ jQuery('.b2s-network-tos-sched-warning[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1567
+ } else {
1568
+ //set orginal edit content for customize sched content
1569
+ 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();
1570
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(content);
1571
+
1572
+ }
1573
+
1574
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
1575
+ if (dataNetworkCount == 2) {
1576
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1577
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"]').hide();
1578
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').hide();
1579
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="2"').show();
1580
+ } else if (dataNetworkCount == 1) {
1581
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').hide();
1582
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="1"').show();
1583
+ }
1584
+ }
1585
+ }
1586
+ releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
1587
+ });
1588
+ jQuery(document).on('click', '#b2s-network-sched-post-info-ignore', function () {
1589
+ jQuery('#b2sSchedPostInfoIgnore').val("1");
1590
+ jQuery('.b2s-submit-btn').trigger("click");
1591
+ return false;
1592
+ });
1593
+ jQuery(document).on('click', '.b2s-re-share-btn', function () {
1594
+ jQuery('.panel-group').removeClass('b2s-border-color-warning');
1595
+ jQuery(".b2s-settings-user-sched-time-area").show();
1596
+ jQuery('#b2s-sidebar-wrapper').show();
1597
+ jQuery('.b2s-post-item-info-area').show();
1598
+ jQuery('.b2s-post-item-details-message-info').show();
1599
+ jQuery('.b2s-post-item-details-edit-area').show();
1600
+ jQuery('.b2s-post-item-details-message-result').hide();
1601
+ jQuery('.b2s-post-item-details-message-result').html("");
1602
+ jQuery(".b2s-post-area").show();
1603
+ jQuery('.b2s-publish-area').show();
1604
+ jQuery('.b2s-footer-menu').show();
1605
+ window.scrollTo(0, 0);
1606
+ jQuery('.b2s-reporting-btn-area').hide();
1607
+ jQuery('#b2sSchedPostInfoIgnore').val("0");
1608
+ //Calendar close for resfresh
1609
+ jQuery('.b2s-toogle-calendar-btn').each(function () {
1610
+ if (!jQuery(this).hasClass('hide')) {
1611
+ var toogleBtnText = jQuery(this).attr('data-toogle-text-btn');
1612
+ var currentBtnText = jQuery(this).text();
1613
+ jQuery(this).text(toogleBtnText);
1614
+ jQuery(this).attr('data-toogle-text-btn', currentBtnText);
1615
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1616
+ var calendar = jQuery('.b2s-post-item-calendar-area[data-network-auth-id="' + networkAuthId + '"]');
1617
+ calendar.removeClass('show');
1618
+ calendar.addClass('hide');
1619
+ jQuery('.b2s-calendar-filter-area[data-network-auth-id="' + networkAuthId + '"]').addClass('hide');
1620
+ }
1621
+ });
1622
+
1623
+ //TOS XING Group
1624
+ jQuery('.b2s-network-select-btn').each(function () {
1625
+ if (jQuery(this).children().hasClass('active')) {
1626
+ if (jQuery(this).attr('data-network-id') == "19" && jQuery(this).attr('data-network-type') == "2") {
1627
+ b2sTosXingGroupCount--;
1628
+ deactivatePortal(jQuery(this).attr('data-network-auth-id'));
1629
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').addClass('b2s-network-select-btn-deactivate');
1630
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
1631
+ }
1632
+ }
1633
+ });
1634
+
1635
+ return false;
1636
+ });
1637
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-add', function () {
1638
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1639
+ var netCount = jQuery(this).attr('data-network-count');
1640
+ var networkId = jQuery(this).attr('data-network-id');
1641
+ var networkType = jQuery(this).attr('data-network-type');
1642
+ var netCountNext = parseInt(netCount) + 1;
1643
+ var curMode = jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val();
1644
+ jQuery(this).hide();
1645
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]').hide();
1646
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1647
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1648
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1649
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1650
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1651
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1652
+
1653
+ if (curMode == 1) {
1654
+ //since 4.9.0 custom content
1655
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1656
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1657
+ }
1658
+ //recurrently
1659
+ if (curMode == 2) {
1660
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1661
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1662
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1663
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1664
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1665
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1666
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').val('1');
1667
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').show();
1668
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').removeAttr('disabled');
1669
+ //since 4.9.0 custom content
1670
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountNext + '"]').hide();
1671
+ }
1672
+
1673
+ return false;
1674
+ });
1675
+ jQuery(document).on('click', '.b2s-post-item-details-release-input-hide', function () {
1676
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1677
+ var netCount = jQuery(this).attr('data-network-count');
1678
+ var netCountBevor = parseInt(netCount) - 1;
1679
+ var selectorInput = '[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCount + '"]'
1680
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
1681
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1682
+ jQuery('.b2s-post-item-details-release-input-add[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + netCountBevor + '"]').show();
1683
+ //clean all fields
1684
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
1685
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
1686
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).val('');
1687
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
1688
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('checked', false);
1689
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
1690
+ //since 4.9.0 custom content
1691
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput).prop('disabled', true);
1692
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput).removeClass('error');
1693
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
1694
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
1695
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
1696
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
1697
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
1698
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled', true);
1699
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).val("1");
1700
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
1701
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled', true);
1702
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).val("1");
1703
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
1704
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
1705
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled', true);
1706
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).val("1");
1707
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
1708
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled', true);
1709
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).val("1");
1710
+ return false;
1711
+ });
1712
+ jQuery(document).on("keyup", ".complete_network_url", function () {
1713
+ var url = jQuery(this).val();
1714
+ jQuery(this).removeClass("error");
1715
+ if (url.length != "0") {
1716
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
1717
+ url = "http://" + url;
1718
+ jQuery(this).val(url);
1719
+ }
1720
+ } else if (jQuery(this).hasClass("required_network_url")) {
1721
+ 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
1722
+ url = jQuery("#b2sDefault_url").val();
1723
+ jQuery(this).val(url);
1724
+ }
1725
+ }
1726
+ });
1727
+ jQuery(document).on('click', '.scroll-to-top', function () {
1728
+ window.scrollTo(0, 0);
1729
+ return false;
1730
+ });
1731
+ jQuery(document).on('click', '.scroll-to-bottom', function () {
1732
+ window.scrollTo(0, document.body.scrollHeight);
1733
+ return false;
1734
+ });
1735
+ jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', function () {
1736
+ var re = new RegExp(/^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/);
1737
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1738
+ var url = jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').val();
1739
+ if (re.test(url)) {
1740
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
1741
+ jQuery(this).addClass('glyphicon-refresh-animate');
1742
+ jQuery('.b2s-server-connection-fail').hide();
1743
+ jQuery.ajax({
1744
+ url: ajaxurl,
1745
+ type: "POST",
1746
+ dataType: "json",
1747
+ cache: false,
1748
+ data: {
1749
+ 'action': 'b2s_ship_item_reload_url',
1750
+ 'networkId': jQuery(this).attr('data-network-id'),
1751
+ 'networkAuthId': networkAuthId,
1752
+ 'postId': jQuery('#b2sPostId').val(),
1753
+ 'defaultUrl': jQuery('#b2sDefault_url').val(),
1754
+ 'url': url,
1755
+ 'postType': jQuery('#b2sPostType').val(),
1756
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
1757
+ },
1758
+ error: function () {
1759
+ jQuery('.b2s-server-connection-fail').show();
1760
+ return false;
1761
+ },
1762
+ success: function (data) {
1763
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
1764
+ if (data.result == true) {
1765
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.title);
1766
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.description);
1767
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
1768
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1769
+ }
1770
+ if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '1') {
1771
+ if (data.image != "") {
1772
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1773
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(data.image);
1774
+ } else {
1775
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
1776
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('#b2sDefaultNoImage').val());
1777
+ }
1778
+ checkGifAnimation(data.networkAuthId, data.networkId);
1779
+ }
1780
+ } else {
1781
+ if (data.error == 'nonce') {
1782
+ jQuery('.b2s-nonce-check-fail').show();
1783
+ }
1784
+ }
1785
+ }
1786
+
1787
+ });
1788
+ } else {
1789
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
1790
+ }
1791
+ });
1792
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
1793
+ jQuery('.b2s-upload-image-invalid-extension').hide();
1794
+ jQuery('.b2s-image-change-meta-network').hide();
1795
+ jQuery('.b2s-image-change-this-network').show();
1796
+ var metaType = jQuery(this).attr('data-meta-type');
1797
+ var authId = jQuery(this).attr('data-network-auth-id');
1798
+ var countId = jQuery(this).attr('data-network-count');
1799
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + authId + ']').val();
1800
+ var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + authId + ']').attr("data-network-id");
1801
+ var isMetaChecked = false;
1802
+ var ogMetaNetworks = jQuery('#ogMetaNetworks').val().split(";");
1803
+ if (typeof networkId != 'undefined' && jQuery.inArray(networkId.toString(), ogMetaNetworks) != -1 && jQuery('#isOgMetaChecked').val() == "1") {
1804
+ isMetaChecked = true;
1805
+ }
1806
+ if (networkId == "2" && jQuery('#isCardMetaChecked').val() == "1") {
1807
+ isMetaChecked = true;
1808
+ }
1809
+
1810
+ if (postFormat == "0" && (networkId == "1" || networkId == "2")) { //isLinkPost for Facebook or Twitter
1811
+ jQuery('.meta-text').hide();
1812
+ if (!isMetaChecked) {
1813
+ if (networkId == "1") {
1814
+ jQuery('.isOgMetaChecked').show();
1815
+ } else {
1816
+ jQuery('.isCardMetaChecked').show();
1817
+ }
1818
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
1819
+ return false;
1820
+ }
1821
+ }
1822
+
1823
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId).attr('data-network-count', countId).attr('data-network-id', networkId);
1824
+ jQuery('.b2s-image-change-all-network').attr('data-network-count', countId).attr('data-network-id', networkId);
1825
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId).attr('data-network-count', countId);
1826
+ 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();
1827
+ jQuery('.b2s-selected-network-for-image-info').html(content);
1828
+ jQuery('#b2sInsertImageType').val("0");
1829
+ if (typeof metaType !== 'undefined') {
1830
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', metaType);
1831
+
1832
+ if (metaType == 'og' && postFormat != "1") {
1833
+ var activeMetaNetworks = {};
1834
+ var inactiveMetaNetworks = {};
1835
+ jQuery('.b2s-network-select-btn[data-meta-type="' + metaType + '"]').each(function () {
1836
+ if (jQuery(this).find('.active').length > 0) {
1837
+ activeMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1838
+ } else {
1839
+ inactiveMetaNetworks[jQuery(this).attr('data-network-auth-id')] = jQuery(this).attr('data-network-id');
1840
+ }
1841
+ });
1842
+
1843
+ jQuery('.b2s-change-meta-image-networks').html('');
1844
+ jQuery.each(activeMetaNetworks, function (key, value) {
1845
+ 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>');
1846
+ });
1847
+ jQuery.each(inactiveMetaNetworks, function (key, value) {
1848
+ 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>');
1849
+ });
1850
+ jQuery('.b2s-change-meta-image-info').show();
1851
+
1852
+ jQuery('.b2s-image-change-meta-network').show();
1853
+ jQuery('.b2s-image-change-this-network').hide();
1854
+
1855
+ jQuery(document).on('click', '.b2s-image-change-meta-network', function () {
1856
+ currentOGImage = jQuery('input[name=image_url]:checked').val();
1857
+ changedOGImage = true;
1858
+ if (jQuery('.b2s-input-hidden[name="action"][value="b2s_edit_save_post"]').length > 0) { //sched or calender view
1859
+ jQuery('.b2s-image-change-this-network').trigger('click');
1860
+ } else { //ship view
1861
+ jQuery.each(activeMetaNetworks, function (networkAuthId, networkId) {
1862
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1863
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1864
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1865
+ checkGifAnimation(networkAuthId, networkId);
1866
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1867
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1868
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1869
+ }
1870
+ }
1871
+ });
1872
+ jQuery.each(inactiveMetaNetworks, function (networkAuthId, networkId) {
1873
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val() != "1") {
1874
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentOGImage);
1875
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentOGImage);
1876
+ checkGifAnimation(networkAuthId, networkId);
1877
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1878
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
1879
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
1880
+ }
1881
+ }
1882
+ });
1883
+ }
1884
+ jQuery('#b2s-network-select-image').modal('hide');
1885
+ });
1886
+ } else {
1887
+ jQuery('.b2s-change-meta-image-info').hide();
1888
+ }
1889
+
1890
+ } else {
1891
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', "");
1892
+ jQuery('.b2s-change-meta-image-info').hide();
1893
+ }
1894
+ //set selected image
1895
+ var selImageVal = jQuery('.b2s-post-item-details-url-image[data-network-count="' + countId + '"][data-network-auth-id="' + authId + '"]').attr('src');
1896
+ jQuery('#b2s-network-select-image').modal('show');
1897
+ jQuery('.checkNetworkImage[data-src="' + selImageVal + '"]').attr('checked', 'checked');
1898
+ imageSize();
1899
+ return false;
1900
+ });
1901
+ jQuery(document).on('click', '.b2s-image-remove-btn', function () {
1902
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1903
+ var networkCountId = jQuery(this).attr('data-network-count');
1904
+ var defaultImage = jQuery('#b2sDefaultNoImage').val();
1905
+ //default
1906
+ if (networkCountId == -1) {
1907
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1908
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1909
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1910
+ } else {
1911
+ //customize sched content
1912
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1913
+ jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val("");
1914
+ jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').hide();
1915
+ }
1916
+
1917
+ //add check linkpost change meta tag image for this network
1918
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1919
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1920
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1921
+ if (postFormat == "0") { //if linkpost
1922
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1923
+ 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
1924
+ //override this image with current image
1925
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1926
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1927
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1928
+ }
1929
+ });
1930
+ if (jQuery('.b2s-select-image-modal-open[data-network-auth-id=' + networkAuthId + ']').attr('data-meta-type') == 'og') {
1931
+ jQuery('.b2s-select-image-modal-open[data-meta-type="og"]').each(function () {
1932
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val() == "0") {
1933
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1934
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1935
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1936
+ }
1937
+ });
1938
+ currentOGImage = '';
1939
+ changedOGImage = true;
1940
+ }
1941
+ //customize sched content
1942
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1943
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1944
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1945
+ }
1946
+ }
1947
+ return false;
1948
+ });
1949
+ jQuery(document).on('click', '.b2s-image-change-this-network', function () {
1950
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1951
+ var networkCountId = jQuery(this).attr('data-network-count');
1952
+ var networkId = jQuery(this).attr('data-network-id');
1953
+ var currentImage = jQuery('input[name=image_url]:checked').val();
1954
+ if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
1955
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
1956
+ sceditor.insert("<br /><img src='" + currentImage + "'/><br />");
1957
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage); //Torial
1958
+ } else {
1959
+ //default
1960
+ if (networkCountId == -1) {
1961
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1962
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1963
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1964
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1965
+ } else {
1966
+ //customize sched content
1967
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1968
+ jQuery('.b2s-post-item-details-url-image[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1969
+ jQuery('.b2s-image-url-hidden-field[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1970
+ jQuery('.b2s-image-remove-btn[data-network-count="' + networkCountId + '"][data-network-auth-id="' + networkAuthId + '"]').show();
1971
+ }
1972
+
1973
+ if (jQuery(this).attr('data-meta-type') == "og") {
1974
+ jQuery('#b2sChangeOgMeta').val("1");
1975
+ }
1976
+ if (jQuery(this).attr('data-meta-type') == "card") {
1977
+ jQuery('#b2sChangeCardMeta').val("1");
1978
+ }
1979
+
1980
+ //add check linkpost change meta tag image for this network
1981
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1982
+ var networkId = jQuery('.b2s-network-select-btn[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1983
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1984
+ if (networkId != 12) { // ignore for instagram
1985
+ if (postFormat == "0") { //if linkpost
1986
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1987
+ 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
1988
+ //override this image with current image
1989
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentImage);
1990
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
1991
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentImage);
1992
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1993
+ if (networkCountId >= 0) {
1994
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1995
+ }
1996
+ }
1997
+ });
1998
+ //customize sched content
1999
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
2000
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
2001
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
2002
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
2003
+ if (networkCountId >= 0) {
2004
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + networkAuthId + '"]').hide();
2005
+ }
2006
+ }
2007
+ }
2008
+ }
2009
+ }
2010
+ jQuery('.b2s-upload-image-invalid-extension').hide();
2011
+ jQuery('.b2s-upload-image-no-permission').hide();
2012
+ jQuery('.b2s-upload-image-free-version-info').hide();
2013
+ jQuery('#b2s-network-select-image').modal('hide');
2014
+ checkGifAnimation(networkAuthId, networkId);
2015
+ return false;
2016
+ });
2017
+ jQuery(document).on('change', '.b2s-post-item-details-relay', function () {
2018
+ if (jQuery(this).attr('data-user-version') == 0) {
2019
+ jQuery(this).prop("checked", false);
2020
+ jQuery('#b2sInfoPostRelayModal').modal('show');
2021
+ return false;
2022
+ }
2023
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2024
+ if (jQuery(this).is(":checked")) {
2025
+
2026
+ if (jQuery('#b2sRelayAccountData').val() != "") {
2027
+ jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
2028
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2029
+ 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();
2030
+ 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();
2031
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2032
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2033
+ 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');
2034
+ 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');
2035
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="0"]').show();
2036
+ //Relay Html Data
2037
+ 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) {
2038
+ var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2039
+ 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);
2040
+ }
2041
+
2042
+ } else {
2043
+ jQuery(this).prop("checked", false);
2044
+ }
2045
+
2046
+ } else {
2047
+ jQuery('.b2s-post-item-relay-area-details-ul[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2048
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2049
+ jQuery('.b2s-post-item-details-relay-area-label-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2050
+ jQuery('.b2s-post-item-details-relay-area-label-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2051
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2052
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
2053
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').prop('disabled', true);
2054
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2055
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
2056
+ }
2057
+ return false;
2058
+ });
2059
+ jQuery(document).on('click', '.b2s-post-item-details-relay-input-add', function () {
2060
+ var netCount = jQuery(this).attr('data-network-count');
2061
+ var netCountNext = parseInt(netCount) + 1;
2062
+ jQuery(this).hide();
2063
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2064
+ 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();
2065
+ 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();
2066
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2067
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2068
+ 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');
2069
+ 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');
2070
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2071
+ jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCountNext + '"]').show();
2072
+ //Relay Html Data
2073
+ 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) {
2074
+ var optionData = window.atob(jQuery('#b2sRelayAccountData').val());
2075
+ 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);
2076
+ }
2077
+
2078
+ return false;
2079
+ });
2080
+ jQuery(document).on('click', '.b2s-post-item-details-relay-input-hide', function () {
2081
+ var netCount = jQuery(this).attr('data-network-count');
2082
+ jQuery('.b2s-post-item-relay-area-details-row[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2083
+ 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();
2084
+ 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();
2085
+ jQuery('.b2s-post-item-details-relay-input-account[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2086
+ jQuery('.b2s-post-item-details-relay-input-delay[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2087
+ 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);
2088
+ 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);
2089
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide()
2090
+ jQuery('.b2s-post-item-details-relay-input-hide[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + netCount + '"]').hide();
2091
+ if (netCount >= 1) {
2092
+ var before = netCount - 1;
2093
+ jQuery('.b2s-post-item-details-relay-input-add[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"][data-network-count="' + before + '"]').show();
2094
+ }
2095
+
2096
+ return false;
2097
+ });
2098
+ jQuery(document).on('click', '.b2s-image-change-all-network', function () {
2099
+ jQuery('.b2s-post-item-details-item-message-input-allow-html').each(function () {
2100
+ var sce = jQuery(this).sceditor('instance');
2101
+ if (typeof sce !== 'undefined' && typeof sce.insert !== 'undefined') {
2102
+ if (sce.getBody().find(".b2s-post-item-details-image-html-src").length > 0) {
2103
+ sce.getBody().find(".b2s-post-item-details-image-html-src").attr('src', jQuery('input[name=image_url]:checked').val());
2104
+ } else {
2105
+ sce.insert("<br /><img class='b2s-post-item-details-image-html-src' src='" + jQuery('input[name=image_url]:checked').val() + "'/><br />");
2106
+ }
2107
+ }
2108
+ });
2109
+ var noGifs = '';
2110
+ if (typeof jQuery('input[name=image_url]:checked').val() !== typeof undefined) {
2111
+ var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1).toLowerCase();
2112
+ if (attachmenUrlExt == 'gif') {
2113
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2114
+ jQuery.each(networkNotAllowGif, function (key, value) {
2115
+ noGifs += ':not([data-network-id="' + value + '"])';
2116
+ });
2117
+ }
2118
+ }
2119
+ jQuery('.b2s-post-item-details-url-image[data-network-image-change="1"]' + noGifs).attr('src', jQuery('input[name=image_url]:checked').val());
2120
+ jQuery('#b2s_blog_default_image').val(jQuery('input[name=image_url]:checked').val());
2121
+ jQuery('.b2s-post-item-details-url-image' + noGifs).removeClass('b2s-img-required');
2122
+ jQuery('.b2s-image-url-hidden-field' + noGifs).val(jQuery('input[name=image_url]:checked').val());
2123
+ jQuery('.b2s-image-remove-btn' + noGifs).show();
2124
+ jQuery('.b2s-post-item-details-release-input-date-select' + noGifs).each(function () {
2125
+ if (jQuery(this).val() == 1) {
2126
+ jQuery('.b2s-image-remove-btn[data-network-count="-1"][data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]' + noGifs).hide();
2127
+ }
2128
+ });
2129
+
2130
+ jQuery('.b2s-upload-image-invalid-extension').hide();
2131
+ jQuery('.b2s-upload-image-no-permission').hide();
2132
+ jQuery('.b2s-upload-image-free-version-info').hide();
2133
+ jQuery('.b2sChangeOgMeta').val("1");
2134
+ jQuery('.b2sChangeCardMeta').val("1");
2135
+ jQuery('#b2s-network-select-image').modal('hide');
2136
+
2137
+ currentOGImage = jQuery('input[name=image_url]:checked').val();
2138
+ changedOGImage = true;
2139
+ if (typeof currentOGImage !== typeof undefined) {
2140
+ var attachmenUrlExt = currentOGImage.substr(currentOGImage.lastIndexOf('.') + 1);
2141
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
2142
+ if (attachmenUrlExt == 'gif') {
2143
+ jQuery('.b2s-image-url-hidden-field').each(function () {
2144
+ checkGifAnimation(jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-id'));
2145
+ });
2146
+ }
2147
+ }
2148
+ return false;
2149
+ });
2150
+ jQuery(document).on('click', '.b2s-upload-image', function () {
2151
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
2152
+ if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
2153
+ jQuery('#b2s-network-select-image').modal('hide');
2154
+ wpMedia = wp.media({
2155
+ title: jQuery('#b2s_wp_media_headline').val(),
2156
+ button: {
2157
+ text: jQuery('#b2s_wp_media_btn').val(),
2158
+ },
2159
+ multiple: false,
2160
+ library: {type: 'image'}
2161
+ });
2162
+ wpMedia.open();
2163
+ wpMedia.on('select', function () {
2164
+ var validExtensions = ['jpg', 'jpeg', 'png', 'gif'];
2165
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2166
+ var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2167
+ var attachment = wpMedia.state().get('selection').first().toJSON();
2168
+ var attachmenUrl = attachment.url;
2169
+ var attachmenUrlExt = attachmenUrl.substr(attachmenUrl.lastIndexOf('.') + 1);
2170
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
2171
+ if (jQuery.inArray(attachmenUrlExt, validExtensions) == -1 || (attachmenUrlExt == 'gif' && jQuery.inArray(networkId, networkNotAllowGif) != -1)) {
2172
+ jQuery('#b2s-network-select-image').modal('show');
2173
+ jQuery('.b2s-upload-image-invalid-extension').show();
2174
+ jQuery('#b2s-upload-image-invalid-extension-file-name').html('<span class="glyphicon glyphicon-ban-circle"></span> ' + attachment.name + '.' + attachmenUrlExt + '<br>');
2175
+ jQuery('.b2s-choose-image-no-image-info-text').hide();
2176
+ jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2177
+ return false;
2178
+ }
2179
+ var count = parseInt(jQuery('.b2s-choose-image-count').val());
2180
+ count = count + 1;
2181
+ jQuery('.b2s-choose-image-count').val(count);
2182
+ var content = '<div class="b2s-image-item">' +
2183
+ '<div class="b2s-image-item-thumb">' +
2184
+ '<label for="b2s-image-count-' + count + '">' +
2185
+ '<img class="img-thumbnail networkImage" alt="blogImage" src="' + attachment.url + '">' +
2186
+ '</label>' +
2187
+ '</div>' +
2188
+ '<div class="b2s-image-item-caption text-center">' +
2189
+ '<div class="b2s-image-item-caption-resolution clearfix small"></div>' +
2190
+ '<input type="radio" value="' + attachment.url + '" data-src="' + attachment.url + '" class="checkNetworkImage" name="image_url" id="b2s-image-count-' + count + '">' +
2191
+ '</div>' +
2192
+ '</div>';
2193
+ jQuery('.b2s-image-choose-area').html(jQuery('.b2s-image-choose-area').html() + content);
2194
+ // jQuery('.b2s-image-change-btn-area').show();
2195
+ jQuery('.b2s-choose-image-no-image-info-text').hide();
2196
+ jQuery('.b2s-choose-image-no-image-extra-btn').hide();
2197
+ jQuery('.b2s-upload-image-invalid-extension').hide();
2198
+ jQuery('input[name=image_url]:last').prop("checked", true);
2199
+ jQuery('#b2s-network-select-image').modal('show');
2200
+ imageSize();
2201
+ });
2202
+ wpMedia.on('close', function () {
2203
+ jQuery('#b2s-network-select-image').modal('show');
2204
+ });
2205
+ } else {
2206
+ jQuery('.b2s-upload-image-no-permission').show();
2207
+ }
2208
+ return false;
2209
+ });
2210
+ jQuery(document).on('change', '.checkNetworkImage', function () {
2211
+ var networkNotAllowGif = jQuery('#b2sNotAllowGif').val().split(";");
2212
+ var attachmenUrlExt = jQuery('input[name=image_url]:checked').val().substr(jQuery('input[name=image_url]:checked').val().lastIndexOf('.') + 1);
2213
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
2214
+ if (attachmenUrlExt == 'gif') {
2215
+ var networkAuthId = jQuery('.b2s-upload-image').attr('data-network-auth-id');
2216
+ var networkId = jQuery('input[name="b2s[' + networkAuthId + '][network_id]"]').val();
2217
+ if (jQuery.inArray(networkId, networkNotAllowGif) != -1) {
2218
+ jQuery('.b2s-image-change-this-network').attr('disabled', true);
2219
+ jQuery('.b2s-image-change-all-network').attr('disabled', true);
2220
+ jQuery('.b2s-upload-image-invalid-extension').show();
2221
+ jQuery('#b2s-upload-image-invalid-extension-file-name').html();
2222
+ } else {
2223
+ jQuery('.b2s-image-change-this-network').attr('disabled', false);
2224
+ jQuery('.b2s-image-change-all-network').attr('disabled', false);
2225
+ }
2226
+ jQuery('.b2s-gif-support-info').show();
2227
+ } else {
2228
+ jQuery('.b2s-image-change-this-network').attr('disabled', false);
2229
+ jQuery('.b2s-image-change-all-network').attr('disabled', false);
2230
+ jQuery('.b2s-gif-support-info').hide();
2231
+ }
2232
+ });
2233
+ jQuery('#b2s-network-select-image').on('shown.bs.modal', function () {
2234
+ jQuery('.checkNetworkImage').trigger('change');
2235
+ });
2236
+ jQuery(document).on('click', '.b2s-upload-image-free-version', function () {
2237
+ jQuery('.b2s-upload-image-free-version-info').show();
2238
+ });
2239
+ jQuery("#b2sNetworkSent").keypress(function (e) {
2240
+ if (e.keyCode == 13 && e.target.tagName == "INPUT")
2241
+ return false;
2242
+ });
2243
+ jQuery.validator.addMethod("checkUrl", function (value, element, regexp) {
2244
+ var re = new RegExp(regexp);
2245
+ return this.optional(element) || re.test(value);
2246
+ }, "Invalid Url");
2247
+ jQuery.validator.addClassRules("b2s-post-item-details-item-url-input", {
2248
+ checkUrl: /^(https?:\/\/)+[a-zA-Z0-99ÄÖÜöäü-]+(?:\.[a-zA-Z0-99ÄÖÜöäü-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=%.]+$/
2249
+ });
2250
+ //Twitter TOS 032018 - protected multiple accounts with same content to same time ( by all connections)
2251
+ jQuery.validator.addMethod("unique", function (value, element, params) {
2252
+ var curNetworkAuthId = jQuery(element).attr('data-network-auth-id');
2253
+ var curNetworkId = jQuery(element).attr('data-network-id');
2254
+ var prefix = params;
2255
+ var selector = jQuery.validator.format("[name!='{0}'][unique='{1}'][data-network-id='" + curNetworkId + "']", element.name, prefix);
2256
+ var matches = new Array();
2257
+
2258
+ jQuery('.b2s-unique-content[data-network-id="' + curNetworkId + '"]').hide();
2259
+ jQuery('.tw-textarea-input').removeClass('error');
2260
+
2261
+ jQuery(selector).each(function (index, item) {
2262
+ //none disabled elements || ignore default content if curSchedMode=1
2263
+ 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)) {
2264
+ return true;
2265
+ }
2266
+ if (jQuery.trim(value) == jQuery.trim(jQuery(item).val())) {
2267
+ jQuery('.b2s-unique-content[data-network-auth-id="' + jQuery(item).attr('data-network-auth-id') + '"]').show();
2268
+ matches.push(item);
2269
+ }
2270
+ });
2271
+ if (matches.length != 0) {
2272
+ jQuery('.b2s-unique-content[data-network-auth-id="' + curNetworkAuthId + '"]').show();
2273
+ }
2274
+ return true;
2275
+ });
2276
+
2277
+
2278
+ jQuery.validator.classRuleSettings.unique = {
2279
+ unique: true
2280
+ };
2281
+ jQuery.validator.addMethod("checkTags", function (value, element, test) {
2282
+ var allowed_tags = ['p', 'h1', 'h2', 'br', 'i', 'em', 'b', 'a', 'img'];
2283
+ var tags = value.match(/(<([^>]+)>)/ig);
2284
+ if (tags !== null && tags.length > 0) {
2285
+ if (jQuery(element).hasClass('b2s-post-item-details-item-message-input-allow-html')) {
2286
+ for (var i = 0; i < tags.length; i++) {
2287
+ var allowed_count = 0;
2288
+ for (var e = 0; e < allowed_tags.length; e++) {
2289
+ var regex = new RegExp("<\s*(\/)?" + allowed_tags[e] + "(( [^>]*>)|[>])");
2290
+ if (tags[i].match(regex) != null) {
2291
+ allowed_count = 1;
2292
+ }
2293
+ }
2294
+ if (allowed_count == 0) {
2295
+ return false;
2296
+ }
2297
+ }
2298
+ } else {
2299
+ return false;
2300
+ }
2301
+ }
2302
+ return true;
2303
+ });
2304
+ jQuery.validator.addClassRules('b2s-post-item-details-item-message-input', {'checkTags': true});
2305
+ jQuery.validator.addClassRules('b2s-post-item-details-release-input-date-select', {'checkSched': true});
2306
+ jQuery.validator.addClassRules('b2s-post-item-details-item-title-input', {required: true});
2307
+ jQuery.validator.addMethod('checkSched', function (value, element, rest) {
2308
+ if (jQuery(element).is(':not(:disabled)') && jQuery(element).val() != 0) {
2309
+ var networkAuthId = jQuery(element).attr('data-network-auth-id');
2310
+ if (jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2311
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2312
+ return false;
2313
+ } else {
2314
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2315
+ }
2316
+ if (jQuery(element).val() == 1) {
2317
+ if (jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').val() == "") {
2318
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').addClass('error');
2319
+ return false;
2320
+ } else {
2321
+ jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2322
+ }
2323
+
2324
+ } else {
2325
+ var maxCount = jQuery('.b2s-post-item-details-release-input-daySelect[data-network-auth-id="' + networkAuthId + '"]').length;
2326
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"]').removeClass('error');
2327
+ var daySelect = false;
2328
+ var daySelectErrorCount = 0;
2329
+ for (var count = 0; count < maxCount; count++) {
2330
+ if (jQuery('.b2s-post-item-details-release-input-lable-day-mo[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').is(':not(:disabled)')) {
2331
+ daySelect = false;
2332
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').each(function () {
2333
+ if (jQuery(this).is(':checked')) {
2334
+ daySelect = true;
2335
+ }
2336
+ });
2337
+ if (daySelect === false) {
2338
+ daySelectErrorCount += 1;
2339
+ jQuery('.b2s-post-item-details-release-input-days[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + count + '"]').addClass('error');
2340
+ }
2341
+ }
2342
+ }
2343
+ if (daySelectErrorCount != 0) {
2344
+ return false;
2345
+ }
2346
+ }
2347
+ }
2348
+ return true;
2349
+ });
2350
+ jQuery("#b2sNetworkSent").validate({
2351
+ ignore: "",
2352
+ errorPlacement: function () {
2353
+ return false;
2354
+ },
2355
+ submitHandler: function (form) {
2356
+ if (checkNetworkSelected() == false) {
2357
+ return false;
2358
+ }
2359
+ if (checkPostSchedOnBlog() == false) {
2360
+ return false;
2361
+ }
2362
+ if (checkImageByImageNetworks() == false) {
2363
+ return false;
2364
+ }
2365
+
2366
+ var userDate = new Date();
2367
+ var pubDate = userDate.getFullYear() + "-" + padDate(userDate.getMonth() + 1) + "-" + padDate(userDate.getDate()) + " " + padDate(userDate.getHours()) + ":" + padDate(userDate.getMinutes()) + ":" + padDate(userDate.getSeconds());
2368
+ jQuery('#publish_date').val(pubDate);
2369
+ jQuery(".b2s-loading-area").show();
2370
+ jQuery(".b2s-post-area").hide();
2371
+ jQuery(".b2s-settings-user-sched-time-area").hide();
2372
+ jQuery('#b2s-sidebar-wrapper').hide();
2373
+ jQuery('.b2s-post-item-info-area').hide();
2374
+ jQuery.xhrPool.abortAll();
2375
+ jQuery('.b2s-server-connection-fail').hide();
2376
+ jQuery.ajax({
2377
+ processData: false,
2378
+ url: ajaxurl,
2379
+ type: "POST",
2380
+ dataType: "json",
2381
+ cache: false,
2382
+ data: jQuery(form).serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val(),
2383
+ error: function () {
2384
+ jQuery('.b2s-server-connection-fail').show();
2385
+ return false;
2386
+ },
2387
+ success: function (data) {
2388
+ if (data.error == 'nonce') {
2389
+ jQuery('.b2s-nonce-check-fail').show();
2390
+ return false;
2391
+ }
2392
+ var content = data.content;
2393
+ jQuery(".b2s-loading-area").hide();
2394
+ for (var i = 0; i < content.length; i++) {
2395
+ jQuery('.b2s-post-item-details-message-info[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2396
+ jQuery('.b2s-post-item-details-edit-area[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').hide();
2397
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').show();
2398
+ jQuery('.b2s-post-item-details-message-result[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').html(content[i]['html']);
2399
+ jQuery('.b2s-content-info').hide();
2400
+ if (typeof content[i]['approve'] !== typeof undefined) {
2401
+ jQuery('.panel-group[data-network-auth-id="' + content[i]['networkAuthId'] + '"]').addClass('b2s-border-color-warning');
2402
+ }
2403
+ }
2404
+ jQuery(".b2s-post-area").show();
2405
+ jQuery('.b2s-publish-area').hide();
2406
+ jQuery('.b2s-footer-menu').hide();
2407
+ window.scrollTo(0, 0);
2408
+ jQuery('.b2s-empty-area').hide();
2409
+ jQuery('.b2s-reporting-btn-area').show();
2410
+ wp.heartbeat.connectNow();
2411
+ }
2412
+ });
2413
+ return false;
2414
+ }
2415
+ });
2416
+ jQuery('#b2s-network-list-modal').on('show.bs.modal', function (e) {
2417
+ jQuery('.b2s-network-list-modal-mandant').html(jQuery(".b2s-network-details-mandant-select option:selected").text());
2418
+ });
2419
+ jQuery(window).on("load", function () {
2420
+ var showMeridian = true;
2421
+ if (jQuery('#b2sUserLang').val() == 'de') {
2422
+ showMeridian = false;
2423
+ }
2424
+ jQuery('.b2s-settings-sched-item-input-time').timepicker({
2425
+ minuteStep: 30,
2426
+ appendWidgetTo: 'body',
2427
+ showSeconds: false,
2428
+ showMeridian: showMeridian,
2429
+ defaultTime: 'current'
2430
+ });
2431
+ });
2432
+
2433
+ jQuery(document).on('click', '.b2s-loading-area-save-profile-change', function () {
2434
+ var selectedAuth = new Array();
2435
+ jQuery('.b2s-network-list.active').each(function () {
2436
+ selectedAuth.push(jQuery(this).parents('.b2s-network-select-btn').attr('data-network-auth-id'));
2437
+ });
2438
+ jQuery('.b2s-server-connection-fail').hide();
2439
+ jQuery.ajax({
2440
+ url: ajaxurl,
2441
+ type: "POST",
2442
+ dataType: "json",
2443
+ cache: false,
2444
+ data: {
2445
+ 'action': 'b2s_ship_navbar_save_settings',
2446
+ 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
2447
+ 'selectedAuth': selectedAuth,
2448
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2449
+ },
2450
+ error: function () {
2451
+ jQuery('.b2s-server-connection-fail').show();
2452
+ return false;
2453
+ },
2454
+ success: function (data) {
2455
+ if (data.result == true) {
2456
+ jQuery('.b2s-ship-settings-save').show();
2457
+ window.scrollTo(0, 0);
2458
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
2459
+ jQuery('.b2s-network-list').each(function () {
2460
+ var jsonMandantIds = jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
2461
+ if (jsonMandantIds !== undefined) {
2462
+ var jsonMandantIds = jQuery.parseJSON(jsonMandantIds);
2463
+ if (jsonMandantIds.indexOf(mandantId) !== -1 && !jQuery(this).hasClass('active')) {
2464
+ //remove
2465
+ var newMandant = new Array();
2466
+ jQuery(jsonMandantIds).each(function (index, item) {
2467
+ if (item !== mandantId) {
2468
+ newMandant.push(item);
2469
+ }
2470
+ });
2471
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(newMandant));
2472
+ } else if (jsonMandantIds.indexOf(mandantId) == -1 && jQuery(this).hasClass('active')) {
2473
+ //add
2474
+ jsonMandantIds.push(mandantId);
2475
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id', JSON.stringify(jsonMandantIds));
2476
+ }
2477
+ }
2478
+ });
2479
+ } else {
2480
+ if (data.error == 'nonce') {
2481
+ jQuery('.b2s-nonce-check-fail').show();
2482
+ }
2483
+ }
2484
+ }
2485
+ });
2486
+ });
2487
+ window.addEventListener('message', function (e) {
2488
+ if (e.origin == jQuery('#b2sServerUrl').val()) {
2489
+ var data = JSON.parse(e.data);
2490
+ if (typeof data.action !== typeof undefined && data.action == 'approve') {
2491
+ 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>");
2492
+ jQuery.ajax({
2493
+ url: ajaxurl,
2494
+ type: "POST",
2495
+ cache: false,
2496
+ async: false,
2497
+ data: {
2498
+ 'action': 'b2s_update_approve_post',
2499
+ 'post_id': data.post_id,
2500
+ 'publish_link': data.publish_link,
2501
+ 'publish_error_code': data.publish_error_code,
2502
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2503
+ },
2504
+ success: function (data) {
2505
+ }
2506
+ });
2507
+ } else {
2508
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId, data.instant_sharing);
2509
+ }
2510
+ }
2511
+ });
2512
+
2513
+ jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
2514
+ var postId = jQuery('#b2s-approve-post-id').val();
2515
+ var networkAuthId = jQuery('#b2s-approve-network-auth-id').val();
2516
+ if (postId > 0) {
2517
+ 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>");
2518
+ jQuery('.b2s-publish-approve-modal').modal('hide');
2519
+ jQuery.ajax({
2520
+ url: ajaxurl,
2521
+ type: "POST",
2522
+ cache: false,
2523
+ async: false,
2524
+ data: {
2525
+ 'action': 'b2s_update_approve_post',
2526
+ 'post_id': postId,
2527
+ 'publish_link': "",
2528
+ 'publish_error_code': "",
2529
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
2530
+ },
2531
+ success: function (data) {
2532
+ }
2533
+ });
2534
+ }
2535
+ });
2536
+
2537
+
2538
+
2539
+ jQuery.xhrPool.abortAll = function () { // our abort function
2540
+ jQuery(this).each(function (idx, jqXHR) {
2541
+ jqXHR.abort();
2542
+ });
2543
+ jQuery.xhrPool.length = 0
2544
+ };
2545
+ function loadingDummyShow(networkAuthId, networkId) {
2546
+ jQuery('.b2s-post-item-connection-fail-dummy[data-network-auth-id="' + networkAuthId + '"]').remove();
2547
+ var html = '<div class="b2s-post-item b2s-post-item-loading-dummy" data-network-auth-id="' + networkAuthId + '">'
2548
+ + '<div class="panel panel-group">'
2549
+ + '<div class="panel-body">'
2550
+ + '<div class="b2s-post-item-area">'
2551
+ + '<div class="b2s-post-item-details">'
2552
+ + '<div class="b2s-loader-impulse b2s-loader-impulse-md b2s-post-item-loading-impulse-area">'
2553
+ + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2554
+ + '</div>'
2555
+ + '<div class="clearfix"></div>'
2556
+ + '<div class="text-center"><small>'
2557
+ + jQuery('#b2sJsTextLoading').val()
2558
+ + '</small></div>'
2559
+ + '</div>'
2560
+ + '</div>'
2561
+ + '</div>'
2562
+ + '</div>';
2563
+ var order = jQuery.parseJSON(jQuery('.b2s-network-navbar-order').val());
2564
+ var pos = order.indexOf(networkAuthId.toString());
2565
+ var add = false;
2566
+ for (var i = pos; i >= 0; i--) {
2567
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').length > 0) {
2568
+ jQuery('.b2s-post-item[data-network-auth-id="' + order[i] + '"]').after(html);
2569
+ i = -1;
2570
+ add = true;
2571
+ }
2572
+ }
2573
+ if (add == false) {
2574
+ jQuery('.b2s-post-list').prepend(html);
2575
+ }
2576
+ }
2577
+
2578
+ function loadingDummyConnectionFail(networkAuthId, networkId) {
2579
+ var html = '<div class="b2s-post-item b2s-post-item-connection-fail-dummy" data-network-auth-id="' + networkAuthId + '">'
2580
+ + '<div class="panel panel-group">'
2581
+ + '<div class="panel-body">'
2582
+ + '<div class="b2s-post-item-area">'
2583
+ + '<div class="b2s-post-item-details">'
2584
+ + '<div class="b2s-post-item-details-portal-img-area">'
2585
+ + '<img class="img-responsive" src="' + jQuery('#b2sPortalImagePath').val() + networkId + '_flat.png" alt="">'
2586
+ + '</div>'
2587
+ + '<div class="clearfix"></div>'
2588
+ + '<div class="text-center"><small>'
2589
+ + jQuery('#b2sJsTextConnectionFail').val()
2590
+ + '</small>'
2591
+ + '<br/>'
2592
+ + '<a class="btn btn-link btn-sm" target="_blank" href="' + jQuery('#b2sJsTextConnectionFailLink').val() + '">' + jQuery('#b2sJsTextConnectionFailLinkText').val() + '</a>'
2593
+ + '</div>'
2594
+ + '</div>'
2595
+ + '</div>'
2596
+ + '</div>'
2597
+ + '</div>';
2598
+ jQuery('.b2s-post-item-loading-dummy[data-network-auth-id="' + networkAuthId + '"]').replaceWith(html);
2599
+ }
2600
+
2601
+ function init(firstrun) {
2602
+ var dateFormat = "yyyy-mm-dd";
2603
+ var language = "en";
2604
+ var showMeridian = true;
2605
+ if (jQuery('#b2sUserLang').val() == "de") {
2606
+ dateFormat = "dd.mm.yyyy";
2607
+ language = "de";
2608
+ showMeridian = false;
2609
+ }
2610
+ var today = new Date();
2611
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
2612
+ today.setTime(jQuery('#b2sBlogPostSchedDate').val());
2613
+ }
2614
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
2615
+ format: dateFormat,
2616
+ language: language,
2617
+ maxViewMode: 2,
2618
+ todayHighlight: true,
2619
+ startDate: today,
2620
+ calendarWeeks: true,
2621
+ autoclose: true
2622
+ });
2623
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
2624
+ minuteStep: 15,
2625
+ appendWidgetTo: 'body',
2626
+ showSeconds: false,
2627
+ showMeridian: showMeridian,
2628
+ defaultTime: 'current',
2629
+ snapToStep: true
2630
+ });
2631
+ checkNetworkSelected();
2632
+ //imageCheck();
2633
+ if (firstrun == true) {
2634
+ jQuery(window).scroll(function () {
2635
+ submitArea();
2636
+ });
2637
+ jQuery('.b2s-post-item-details-release-input-date-select').each(function () {
2638
+ releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), 0);
2639
+ });
2640
+
2641
+ //V5.0.0 Content Curation set selected Profile
2642
+ if (jQuery(".b2s-network-details-mandant-select option[value='" + jQuery('#selProfile').val() + "']").length > 0) {
2643
+ jQuery('.b2s-network-details-mandant-select').val(jQuery('#selProfile').val());
2644
+ }
2645
+ hideDuplicateAuths();
2646
+ chooseMandant();
2647
+ }
2648
+ }
2649
+
2650
+
2651
+
2652
+ function initSceditor(networkAuthId) {
2653
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2654
+ if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2655
+ sceditor.destroy();
2656
+ }
2657
+ if (jQuery('.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]').data('network-id') == 14) {// Torial is only HTML Network that dose not support Emojis
2658
+ var toolbar = "h1,h2,bold,italic,link,unlink,custom-image|source";
2659
+ } else {
2660
+ var toolbar = "h1,h2,bold,italic,link,unlink,custom-image,custom-emoji|source";
2661
+ }
2662
+ jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor({
2663
+ plugins: 'xhtml',
2664
+ toolbar: toolbar,
2665
+ autoUpdate: true,
2666
+ emoticonsEnabled: false
2667
+ });
2668
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
2669
+ if (typeof sceditor !== 'undefined' && typeof sceditor.destroy == 'function') {
2670
+ sceditor.keyUp(function () {
2671
+ jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(jQuery(this).prev('.b2s-post-item-details-item-message-input').sceditor('instance').getBody().text().length);
2672
+ });
2673
+ jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').next('.sceditor-container').find('textarea').on('keyup', function () {
2674
+ var tmp = document.createElement("DIV");
2675
+ tmp.innerHTML = jQuery(this).val();
2676
+ jQuery(this).parents('.b2s-post-item-details').find('.b2s-post-item-countChar').html(tmp.innerText.length);
2677
+ });
2678
+ }
2679
+
2680
+
2681
+ }
2682
+
2683
+ function submitArea() {
2684
+ if (jQuery('.b2s-publish-area').length > 0) {
2685
+ if (jQuery(window).scrollTop() + jQuery(window.top).height() >= jQuery('.b2s-publish-area').offset().top) {
2686
+ jQuery(".b2s-footer-menu").hide();
2687
+ } else {
2688
+ jQuery(".b2s-footer-menu").show();
2689
+ }
2690
+ }
2691
+ }
2692
+
2693
+ function imageSize() {
2694
+ jQuery('.networkImage').each(function () {
2695
+ var width = this.naturalWidth;
2696
+ var height = this.naturalHeight;
2697
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
2698
+ if (width == 0)
2699
+ {
2700
+ setTimeout(function () {
2701
+ imageSize();
2702
+ }, 50);
2703
+ }
2704
+ });
2705
+ }
2706
+
2707
+ function navbarDeactivatePortal(reason) {
2708
+ if (reason == "image") {
2709
+ var portale = Array(6, 7, 12);
2710
+ for (var i = 0; i <= portale.length; i++) {
2711
+ jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').addClass('b2s-network-select-btn-deactivate');
2712
+ jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').show();
2713
+ }
2714
+ }
2715
+ }
2716
+
2717
+ function navbarActivatePortal(reason) {
2718
+ if (reason == "image") {
2719
+ var portale = Array(6, 7, 12);
2720
+ for (var i = 0; i <= portale.length; i++) {
2721
+ jQuery('.b2s-network-select-btn[data-network-id="' + portale[i] + '"]').removeClass('b2s-network-select-btn-deactivate');
2722
+ jQuery('.b2s-network-status-no-img[data-network-id="' + portale[i] + '"]').hide();
2723
+ }
2724
+ }
2725
+ }
2726
+
2727
+ function deactivatePortal(networkAuthId) {
2728
+ var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2729
+ jQuery(selector).hide();
2730
+ jQuery(selector).find('.form-control').each(function () {
2731
+ jQuery(this).attr("disabled", "disabled");
2732
+ });
2733
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
2734
+ checkNetworkSelected();
2735
+ submitArea();
2736
+ return true;
2737
+ }
2738
+
2739
+ function activatePortal(networkAuthId, check) {
2740
+ var selector = '.b2s-post-item[data-network-auth-id="' + networkAuthId + '"]';
2741
+ jQuery(selector).show();
2742
+ jQuery(selector).find('.form-control').each(function () {
2743
+
2744
+ if (!jQuery(this).hasClass('b2s-post-item-details-item-message-input')) {
2745
+ jQuery(this).removeAttr("disabled", "disabled");
2746
+ }
2747
+
2748
+ if ((jQuery(this).hasClass('b2s-post-item-details-release-input-weeks')) ||
2749
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-date')) ||
2750
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-time')) ||
2751
+ (jQuery(this).hasClass('b2s-post-item-details-release-input-days')) ||
2752
+ (jQuery(this).hasClass('b2s-post-item-details-relay-input-delay')) ||
2753
+ (jQuery(this).hasClass('b2s-post-item-details-relay-input-account'))) {
2754
+ if (!jQuery(this).is(':visible')) {
2755
+ jQuery(this).prop('disabled', true);
2756
+ }
2757
+ }
2758
+ });
2759
+ //Customize Content
2760
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + networkAuthId + '"]').val() == 1) {
2761
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').hide();
2762
+ jQuery(selector).find('.b2s-post-item-details-item-message-input').each(function () {
2763
+ if (jQuery(this).is(':visible')) {
2764
+ jQuery(this).removeAttr("disabled", "disabled");
2765
+ }
2766
+ });
2767
+ } else {
2768
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + networkAuthId + '"][data-network-count="-1"]').removeAttr("disabled", "disabled");
2769
+ }
2770
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').children().addClass('active').find('.b2s-network-hide').removeClass('b2s-network-hide');
2771
+ checkNetworkSelected();
2772
+ submitArea();
2773
+ }
2774
+
2775
+ function checkNetworkSelected() {
2776
+ //überprüfen ob mindestens ein PostItem vorhanden und sichtbar ist
2777
+ var visible = false;
2778
+ jQuery('.b2s-post-list').find('.b2s-post-item').each(function () {
2779
+ if (jQuery(this).is(":visible")) {
2780
+ visible = true;
2781
+ }
2782
+ });
2783
+ if (jQuery('.b2s-post-list').text().trim() == "" || visible == false) {
2784
+ jQuery('.b2s-publish-area').hide();
2785
+ jQuery('.b2s-footer-menu').hide();
2786
+ jQuery('.b2s-empty-area').show();
2787
+ return false;
2788
+ } else {
2789
+ jQuery('.b2s-publish-area').show();
2790
+ if (jQuery('.b2s-publish-area').length > 0) {
2791
+ if (jQuery(window).scrollTop() + jQuery(window.top).height() < jQuery('.b2s-publish-area').offset().top) {
2792
+ jQuery('.b2s-footer-menu').show();
2793
+ }
2794
+ }
2795
+ jQuery('.b2s-empty-area').hide();
2796
+ return true;
2797
+ }
2798
+ }
2799
+
2800
+ function checkPostSchedOnBlog() {
2801
+ if (jQuery('#b2sBlogPostSchedDate').length > 0 && jQuery('#b2sPostType').val() == "") {
2802
+ if (jQuery('#b2sSchedPostInfoIgnore').val() == "0") {
2803
+ if (jQuery('.b2s-post-item-details-release-input-date-select option[value="0"]:selected').length > 0) {
2804
+ jQuery('#b2s-network-sched-post-info').modal("show");
2805
+ return false;
2806
+ }
2807
+ }
2808
+ }
2809
+ return true;
2810
+ }
2811
+
2812
+ function checkImageByImageNetworks() {
2813
+ var result = true;
2814
+ jQuery('.b2sOnlyWithImage').each(function () {
2815
+ if (jQuery(this).is(":visible")) {
2816
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
2817
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]:visible').each(function () {
2818
+ if (jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"][data-network-count="' + jQuery(this).attr('data-network-count') + '"]').val() == "") {
2819
+ if (!jQuery('#b2s-network-select-image').hasClass('in')) {
2820
+ 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');
2821
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
2822
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
2823
+ jQuery('#b2s-network-select-image').modal('show');
2824
+ imageSize();
2825
+ window.scrollTo(0, (jQuery(this).offset().top - 45));
2826
+ return false;
2827
+ }
2828
+ result = false;
2829
+ }
2830
+ });
2831
+ }
2832
+ });
2833
+ return result;
2834
+ }
2835
+
2836
+
2837
+ function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
2838
+ var selectorInput = '[data-network-auth-id="' + dataNetworkAuthId + '"]';
2839
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2840
+ if (choose == 0) {
2841
+
2842
+ //since 4.8.0 customize content
2843
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2844
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2845
+ jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2846
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2847
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2848
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2849
+ jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2850
+ jQuery('.b2s-post-tool-area' + selectorInput).show();
2851
+ }
2852
+
2853
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2854
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2855
+ jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2856
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2857
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2858
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2859
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2860
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled', true);
2861
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2862
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2863
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2864
+ //monthly- duration month
2865
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2866
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2867
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2868
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2869
+ //monthly- publish day (select-day)
2870
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2871
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2872
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2873
+ //own period- duration times
2874
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2875
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2876
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2877
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2878
+ //own period- timespan
2879
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2880
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2881
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2882
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled');
2883
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2884
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).hide();
2885
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2886
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', true);
2887
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).hide();
2888
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2889
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2890
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2891
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).hide();
2892
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).hide();
2893
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2894
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2895
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2896
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
2897
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).hide();
2898
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2899
+ } else if (choose == 1) {
2900
+
2901
+ //since 4.8.0 customize content
2902
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2903
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').prop('disabled', true);
2904
+ jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').hide();
2905
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').hide();
2906
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').hide();
2907
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').hide();
2908
+ jQuery('.b2s-post-original-area' + selectorInput).removeClass('col-sm-7').removeClass('col-lg-9');
2909
+ jQuery('.b2s-post-tool-area' + selectorInput).hide();
2910
+ //TOS Network Twitter
2911
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-id') == "2") {
2912
+ jQuery('.b2s-post-ship-item-copy-original-text' + selectorInput + '[data-network-count="0"]').trigger('click');
2913
+ }
2914
+ }
2915
+
2916
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2917
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2918
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2919
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2920
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2921
+ for (var i = 0; i <= dataNetworkCount; i++) {
2922
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2923
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
2924
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2925
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
2926
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2927
+ //since 4.8.0 customize content
2928
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2929
+ jQuery('.b2s-post-item-details-item-message-input[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
2930
+ }
2931
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).hide();
2932
+ jQuery('.b2s-post-item-details-release-input-weeks' + selectorInput).prop('disabled');
2933
+ //monthly- duration month
2934
+ jQuery('.b2s-post-item-details-release-area-div-duration-month' + selectorInput).hide();
2935
+ jQuery('.b2s-post-item-details-release-area-label-duration-month' + selectorInput).hide();
2936
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).hide();
2937
+ jQuery('.b2s-post-item-details-release-input-months' + selectorInput).prop('disabled');
2938
+ //monthly- publish day (select-day)
2939
+ jQuery('.b2s-post-item-details-release-area-label-select-day' + selectorInput).hide();
2940
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).prop('disabled');
2941
+ jQuery('.b2s-post-item-details-release-input-select-day' + selectorInput).hide();
2942
+ //own period- duration times
2943
+ jQuery('.b2s-post-item-details-release-area-div-duration-time' + selectorInput).hide();
2944
+ jQuery('.b2s-post-item-details-release-area-label-duration-time' + selectorInput).hide();
2945
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).hide();
2946
+ jQuery('.b2s-post-item-details-release-input-times' + selectorInput).prop('disabled');
2947
+ //own period- timespan
2948
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan' + selectorInput).hide();
2949
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).hide();
2950
+ jQuery('.b2s-post-item-details-release-input-select-timespan' + selectorInput).prop('disabled');
2951
+ //new since v.4.5.0
2952
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).hide();
2953
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).hide();
2954
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).prop('disabled', true);
2955
+ jQuery('.b2s-post-item-details-release-input-interval-select' + selectorInput).val("0");
2956
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).hide();
2957
+ jQuery('.b2s-post-item-details-release-input-days' + selectorInput).prop('disabled', true);
2958
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2959
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2960
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2961
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).show();
2962
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).hide();
2963
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
2964
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
2965
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).hide();
2966
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).hide();
2967
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).hide();
2968
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).show();
2969
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
2970
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).hide();
2971
+ } else if (choose == 2) {
2972
+
2973
+ //since 4.8.0 customize content
2974
+ if (jQuery('.b2s-post-item-details-release-input-date-select' + selectorInput).attr('data-network-customize-content') == "1") {
2975
+ jQuery('.b2s-post-item-details-item-message-input' + selectorInput + '[data-network-count="-1"]').removeAttr('disabled');
2976
+ jQuery('.b2s-post-item-details-item-message-area' + selectorInput + '[data-network-count="-1"]').show();
2977
+ jQuery('.b2s-post-item-details-url-image' + selectorInput + '[data-network-count="-1"]').show();
2978
+ jQuery('.b2s-select-image-modal-open' + selectorInput + '[data-network-count="-1"]').show();
2979
+ jQuery('.b2s-image-remove-btn' + selectorInput + '[data-network-count="-1"]').show();
2980
+ jQuery('.b2s-post-original-area' + selectorInput).addClass('col-sm-7').addClass('col-lg-9');
2981
+ jQuery('.b2s-post-tool-area' + selectorInput).show();
2982
+ }
2983
+
2984
+ jQuery('.b2s-post-item-details-release-area-details-row' + selectorInput).hide();
2985
+ jQuery('.b2s-post-item-details-release-customize-sched-area-details-row' + selectorInput).hide();
2986
+ jQuery('.b2s-post-item-sched-customize-text' + selectorInput).prop('disabled', true);
2987
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).hide();
2988
+ jQuery('.b2s-post-item-details-release-input-date' + selectorInput).prop('disabled', true);
2989
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).hide();
2990
+ jQuery('.b2s-post-item-details-release-input-time' + selectorInput).prop('disabled', true);
2991
+ jQuery('.b2s-post-item-details-release-input-add' + selectorInput).show();
2992
+ jQuery('.b2s-post-item-details-release-input-daySelect' + selectorInput).show();
2993
+ jQuery('.b2s-post-item-details-release-area-details-ul' + selectorInput).show();
2994
+ jQuery('.b2s-post-item-details-release-save-settings' + selectorInput).prop('disabled', false);
2995
+ jQuery('.b2s-post-item-details-release-save-settings-label' + selectorInput).hide();
2996
+ for (var i = 0; i <= dataNetworkCount; i++) {
2997
+ jQuery('.b2s-post-item-details-release-area-details-row[data-network-count="' + i + '"]' + selectorInput).show();
2998
+ //new since v4.5.0
2999
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).show();
3000
+ jQuery('.b2s-post-item-details-release-input-interval-select[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3001
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).show();
3002
+ jQuery('.b2s-post-item-details-release-input-date[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3003
+ jQuery('.b2s-post-item-details-release-input-daySelect[data-network-count="' + i + '"]' + selectorInput).show();
3004
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).show();
3005
+ jQuery('.b2s-post-item-details-release-input-time[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3006
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).show();
3007
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3008
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + i + '"]' + selectorInput).removeAttr('disabled');
3009
+ }
3010
+ jQuery('.b2s-post-item-details-release-area-label-duration' + selectorInput).show();
3011
+ jQuery('.b2s-post-item-details-release-area-label-interval' + selectorInput).show();
3012
+ jQuery('.b2s-post-item-details-release-area-label-date' + selectorInput).show();
3013
+ jQuery('.b2s-post-item-details-release-area-label-time' + selectorInput).show();
3014
+ jQuery('.b2s-post-item-details-release-area-label-day' + selectorInput).show();
3015
+ jQuery('.b2s-post-item-details-release-area-div-duration' + selectorInput).show();
3016
+ jQuery('.b2s-post-item-details-release-area-div-interval' + selectorInput).show();
3017
+ jQuery('.b2s-post-item-details-release-area-div-date' + selectorInput).hide();
3018
+ jQuery('.b2s-post-item-details-release-area-div-time' + selectorInput).show();
3019
+ jQuery('.b2s-post-item-details-release-area-div-day' + selectorInput).show();
3020
+ }
3021
+
3022
+ var showMeridian = true;
3023
+ if (jQuery('#b2sUserLang').val() == 'de') {
3024
+ showMeridian = false;
3025
+ }
3026
+
3027
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
3028
+ minuteStep: 15,
3029
+ appendWidgetTo: 'body',
3030
+ showSeconds: false,
3031
+ showMeridian: showMeridian,
3032
+ defaultTime: 'current',
3033
+ snapToStep: true
3034
+ });
3035
+ }
3036
+
3037
+
3038
+ function releaseChooseInterval(interval, selectorInput, dataCount) {
3039
+ //change view
3040
+ if (interval == 0) { //weekly,default
3041
+ // show
3042
+ //select days
3043
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3044
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3045
+ //duration weeks
3046
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
3047
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).show();
3048
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).show();
3049
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3050
+ //hide
3051
+ //monthly- duration month
3052
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3053
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3054
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3055
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3056
+ //monthly- publish day (select-day)
3057
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3058
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3059
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3060
+ //own period- duration times
3061
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3062
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3063
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3064
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3065
+ //own period- timespan
3066
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3067
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3068
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3069
+ }
3070
+
3071
+ if (interval == 1) { //monthly
3072
+ // show
3073
+ //duration month
3074
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3075
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).show();
3076
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).show();
3077
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3078
+ //publish day (select-day)
3079
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3080
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3081
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).show();
3082
+ //hide
3083
+ //weekly - select days
3084
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3085
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3086
+ //weekly- duration weeks
3087
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3088
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3089
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3090
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3091
+ //own period- duration times
3092
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3093
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3094
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3095
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3096
+ //own period- timespan
3097
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3098
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3099
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3100
+ }
3101
+
3102
+ if (interval == 2) { //own period
3103
+ // show
3104
+ //duration times
3105
+ jQuery('.b2s-post-item-details-release-area-div-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3106
+ jQuery('.b2s-post-item-details-release-area-label-duration-time[data-network-count="' + dataCount + '"]' + selectorInput).show();
3107
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).show(); //select
3108
+ jQuery('.b2s-post-item-details-release-input-times[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled'); //select
3109
+ //timespan
3110
+ jQuery('.b2s-post-item-details-release-area-label-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3111
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).show();
3112
+ jQuery('.b2s-post-item-details-release-input-select-timespan[data-network-count="' + dataCount + '"]' + selectorInput).removeAttr('disabled');
3113
+ //hide
3114
+ //weekly - select days
3115
+ jQuery('.b2s-post-item-details-release-input-days[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled', true);
3116
+ jQuery('.b2s-post-item-details-release-area-label-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3117
+ //weekly- duration weeks
3118
+ jQuery('.b2s-post-item-details-release-area-div-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3119
+ jQuery('.b2s-post-item-details-release-area-label-duration[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3120
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3121
+ jQuery('.b2s-post-item-details-release-input-weeks[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3122
+ //monthly- duration month
3123
+ jQuery('.b2s-post-item-details-release-area-div-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3124
+ jQuery('.b2s-post-item-details-release-area-label-duration-month[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3125
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3126
+ jQuery('.b2s-post-item-details-release-input-months[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3127
+ //monthly- publish day (select-day)
3128
+ jQuery('.b2s-post-item-details-release-area-label-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3129
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).prop('disabled');
3130
+ jQuery('.b2s-post-item-details-release-input-select-day[data-network-count="' + dataCount + '"]' + selectorInput).hide();
3131
+ }
3132
+ }
3133
+
3134
+
3135
+
3136
+ function addTag(networkAuthId) {
3137
+ var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3138
+ 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][]">');
3139
+ jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3140
+ var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3141
+ if (typeof limit !== typeof undefined && limit !== false) {
3142
+ if (jQuery(selector).length >= limit) {
3143
+ jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3144
+ }
3145
+ }
3146
+ }
3147
+
3148
+ function removeTag(networkAuthId) {
3149
+ var selector = ".b2s-post-item-details-tag-input-elem[data-network-auth-id='" + networkAuthId + "']";
3150
+ jQuery(selector).last().remove();
3151
+ if (jQuery(selector).length === 1) {
3152
+ jQuery(".remove-tag-btn[data-network-auth-id='" + networkAuthId + "'").hide();
3153
+ }
3154
+ var limit = jQuery(".b2s-post-item-details-tag-limit[data-network-auth-id='" + networkAuthId + "']").val();
3155
+ if (typeof limit !== typeof undefined && limit !== false) {
3156
+ if (jQuery(selector).length < limit) {
3157
+ jQuery(".ad-tag-btn[data-network-auth-id='" + networkAuthId + "'").show();
3158
+ }
3159
+ }
3160
+ }
3161
+
3162
+ function networkLimitAll(networkAuthId, networkId, limit) {
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
+
3172
+ var regX = /(<([^>]+)>)/ig;
3173
+ var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3174
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3175
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3176
+ if (url.length != "0") {
3177
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3178
+ url = "http://" + url;
3179
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3180
+ }
3181
+ } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3182
+ 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
3183
+ url = jQuery("#b2sDefault_url").val();
3184
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3185
+ }
3186
+ }
3187
+
3188
+ var textLength = text.length;
3189
+ var newText = text;
3190
+ if (networkId == "2") { //twitter
3191
+ if (url.length != "0") {
3192
+ limit = limit - 24;
3193
+ }
3194
+ }
3195
+ if (networkId == "3") { //linkedin
3196
+ if (url.length != "0") {
3197
+ limit = limit - url.length;
3198
+ }
3199
+ }
3200
+ 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
3201
+ if (url.length != "0") {
3202
+ limit = limit - url.length;
3203
+ }
3204
+ }
3205
+ if (networkId == "12") { //instagram
3206
+ var matches = text.match(/(#[^# ]{1,})/g);
3207
+ if (matches != null && matches.length > 30) {
3208
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').show();
3209
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").addClass("warning");
3210
+ } else {
3211
+ jQuery('.b2s-content-info[data-network-auth-id="' + networkAuthId + '"]').hide();
3212
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").removeClass("warning");
3213
+ }
3214
+ }
3215
+
3216
+ if (textLength >= limit) {
3217
+ newText = text.substring(0, limit);
3218
+ var pos = getCaretPos(this);
3219
+ jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val(newText.replace(regX, ""));
3220
+ setCaretPos(this, pos);
3221
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3222
+ var textLength = text.length;
3223
+ }
3224
+ var newLen = limit - textLength;
3225
+ jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(newLen);
3226
+ }
3227
+
3228
+ function networkCount(networkAuthId) {
3229
+
3230
+ var networkCountId = -1; //default;
3231
+ if (jQuery(':focus').length > 0) {
3232
+ var attr = jQuery(':focus').attr('data-network-count');
3233
+ if (typeof attr !== typeof undefined && attr !== false) {
3234
+ networkCountId = attr;
3235
+ }
3236
+ }
3237
+ var url = jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val();
3238
+ var text = jQuery(".b2s-post-item-details-item-message-input[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").val();
3239
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").removeClass("error");
3240
+ if (url.length != "0") {
3241
+ if (url.indexOf("http://") == -1 && url.indexOf("https://") == -1) {
3242
+ url = "http://" + url;
3243
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3244
+ }
3245
+ } else if (jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").hasClass("required_network_url")) {
3246
+ 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
3247
+ url = jQuery("#b2sDefault_url").val();
3248
+ jQuery(".b2s-post-item-details-item-url-input[data-network-auth-id='" + networkAuthId + "']").val(url);
3249
+ }
3250
+ }
3251
+ var textLength = text.length;
3252
+ jQuery(".b2s-post-item-countChar[data-network-count='" + networkCountId + "'][data-network-auth-id='" + networkAuthId + "']").html(textLength);
3253
+ }
3254
+
3255
+
3256
+ function getCaretPos(domElem) {
3257
+ var pos;
3258
+ if (document.selection) {
3259
+ domElem.focus();
3260
+ var sel = document.selection.createRange();
3261
+ sel.moveStart("character", -domElem.value.length);
3262
+ pos = sel.text.length;
3263
+ } else if (domElem.selectionStart || domElem.selectionStart == "0")
3264
+ pos = domElem.selectionStart;
3265
+ return pos;
3266
+ }
3267
+
3268
+ function setCaretPos(domElem, pos) {
3269
+ if (domElem.setSelectionRange) {
3270
+ domElem.focus();
3271
+ domElem.setSelectionRange(pos, pos);
3272
+ } else if (domElem.createTextRange) {
3273
+ var range = domElem.createTextRange();
3274
+ range.collapse(true);
3275
+ range.moveEnd("character", pos);
3276
+ range.moveStart("character", pos);
3277
+ range.select();
3278
+ }
3279
+ }
3280
+
3281
+ function ucfirst(str) {
3282
+ str += '';
3283
+ return str.charAt(0).toUpperCase() + str.substr(1);
3284
+ }
3285
+
3286
+
3287
+ function hideDuplicateAuths() {
3288
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3289
+ jQuery(this).show();
3290
+ });
3291
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3292
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3293
+ if (jQuery(this).is(":visible")) {
3294
+ var dataNetworkDisplayName = jQuery(this).children('.b2s-network-select-btn').attr('data-network-display-name');
3295
+ var dataNetworkId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-id');
3296
+ var dataNetworkType = jQuery(this).children('.b2s-network-select-btn').attr('data-network-type');
3297
+ var dataNetworkAuthId = jQuery(this).children('.b2s-network-select-btn').attr('data-network-auth-id');
3298
+ 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 () {
3299
+ var selectedDataMandantId = jQuery.parseJSON(jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id'));
3300
+ if (jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-default-id') != mandantId && selectedDataMandantId.indexOf(mandantId) == -1) {
3301
+ jQuery(this).parents('.b2s-sidbar-wrapper-nav-li').hide();
3302
+ }
3303
+ });
3304
+ }
3305
+ });
3306
+ }
3307
+
3308
+ function chooseMandant() {
3309
+ //Laden abbrechen und anzeige zurück setzten
3310
+ jQuery.xhrPool.abortAll();
3311
+ jQuery('.b2s-post-item-loading-dummy').remove();
3312
+ jQuery('.b2s-network-status-img-loading').hide();
3313
+ jQuery('.b2s-network-select-btn-deactivate').removeClass('b2s-network-select-btn-deactivate');
3314
+ //imageCheck();
3315
+ //TOS XING Groups
3316
+ b2sTosXingGroupCount = 0;
3317
+ //expiredDate wieder setzten
3318
+ jQuery('.b2s-network-status-expiredDate').each(function () {
3319
+ if (jQuery(this).is(':visible')) {
3320
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"').addClass('b2s-network-select-btn-deactivate');
3321
+ }
3322
+ });
3323
+ jQuery('.b2s-network-select-btn-deactivate')
3324
+ var mandantId = jQuery('.b2s-network-details-mandant-select').val();
3325
+ jQuery('.b2s-post-item').hide();
3326
+ jQuery('.b2s-post-item').find('.form-control').each(function () {
3327
+ jQuery(this).attr("disabled", "disabled");
3328
+ jQuery(this).removeClass('error');
3329
+ });
3330
+ jQuery('.b2s-network-select-btn').children().removeClass('active').find('.b2s-network-status-img').addClass('b2s-network-hide');
3331
+ //Check IS RE-PUBLISH
3332
+ if (jQuery('#b2sSelectedNetworkAuthId').val() > 0 && jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").length > 0) { //exisits?
3333
+ jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").trigger('click');
3334
+ var mandantId = jQuery(".b2s-network-select-btn[data-network-auth-id='" + jQuery('#b2sSelectedNetworkAuthId').val() + "']").parent('.b2s-sidbar-wrapper-nav-li').attr('data-mandant-id');
3335
+ jQuery('.b2s-network-details-mandant-select').val(mandantId);
3336
+ jQuery('#b2sSelectedNetworkAuthId').val("0");
3337
+ } else {
3338
+ jQuery(".b2s-sidbar-wrapper-nav-li").each(function () {
3339
+ var mandantIds = jQuery.parseJSON(jQuery(this).attr('data-mandant-id'));
3340
+ if (mandantIds.indexOf(mandantId) != -1 && !jQuery(this).children('.b2s-network-select-btn').hasClass('b2s-network-select-btn-deactivate')) {
3341
+ jQuery(this).children('.b2s-network-select-btn').trigger('click');
3342
+ }
3343
+ });
3344
+ }
3345
+
3346
+ checkNetworkSelected();
3347
+ }
3348
+
3349
+ function padDate(n) {
3350
+ return ("0" + n).slice(-2);
3351
+ }
3352
+
3353
+ function wop(url, name) {
3354
+ jQuery('.b2s-network-auth-success').hide();
3355
+ var location = window.location.protocol + '//' + window.location.hostname;
3356
+ url = encodeURI(url + '&mandant_id=' + jQuery('.b2s-network-details-mandant-select').val() + '&location=' + location);
3357
+ 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");
3358
+ }
3359
+
3360
+
3361
+ function wopApprove(networkAuthId, postId, url, name) {
3362
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
3363
+ 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");
3364
+ if (postId > 0) {
3365
+ function checkIfWinClosed(intervalID) {
3366
+ if (win.closed) {
3367
+ clearInterval(intervalID);
3368
+ //Show Modal
3369
+ jQuery('.b2s-publish-approve-modal').modal('show');
3370
+ jQuery('#b2s-approve-post-id').val(postId);
3371
+ jQuery('#b2s-approve-network-auth-id').val(networkAuthId);
3372
+ }
3373
+ }
3374
+ var interval = setInterval(function () {
3375
+ checkIfWinClosed(interval);
3376
+ }, 500);
3377
+ }
3378
+ }
3379
+
3380
+
3381
+ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandandId, instant_sharing) {
3382
+ jQuery('.b2s-network-auth-success').show();
3383
+ jQuery('#b2s-network-list-modal').modal('hide');
3384
+ jQuery('#b2s-network-list-modal').hide();
3385
+ jQuery('body').removeClass('modal-open');
3386
+ jQuery('body').removeAttr('style');
3387
+ if (jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').length == 0) {
3388
+ jQuery('.b2s-server-connection-fail').hide();
3389
+ jQuery.ajax({
3390
+ url: ajaxurl,
3391
+ type: "POST",
3392
+ dataType: "json",
3393
+ cache: false,
3394
+ data: {
3395
+ 'action': 'b2s_ship_navbar_item',
3396
+ 'networkId': networkId,
3397
+ 'networkType': networkType,
3398
+ 'displayName': displayName,
3399
+ 'networkAuthId': networkAuthId,
3400
+ 'instant_sharing': instant_sharing,
3401
+ 'mandandId': mandandId,
3402
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3403
+ },
3404
+ error: function () {
3405
+ jQuery('.b2s-server-connection-fail').show();
3406
+ return false;
3407
+ },
3408
+ success: function (data) {
3409
+ if (data.result == true) {
3410
+ jQuery(data.content).insertAfter('.b2s-sidbar-network-auth-btn');
3411
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + data.networkAuthId + '"]').trigger('click');
3412
+ } else {
3413
+ if (data.error == 'nonce') {
3414
+ jQuery('.b2s-nonce-check-fail').show();
3415
+ }
3416
+ }
3417
+ }
3418
+ });
3419
+ } else {
3420
+ jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + networkAuthId + '"]').remove();
3421
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-network-select-btn-deactivate');
3422
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
3423
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').attr('data-network-display-name', displayName);
3424
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"] > .b2s-network-list > .b2s-network-details > h4').text(displayName);
3425
+ jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
3426
+ }
3427
+ jQuery('.b2s-network-select-btn[data-network-id="' + networkId + '"][data-network-type="' + networkType + '"][data-network-display-name="' + displayName.toLowerCase() + '"]').each(function () {
3428
+ jQuery('.b2s-network-status-expiredDate[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').remove();
3429
+ jQuery(this).removeClass('b2s-network-select-btn-deactivate');
3430
+ jQuery(this).removeAttr('onclick');
3431
+ });
3432
+ }
3433
+
3434
+ //jQuery(this).attr('data-network-auth-id')
3435
+ function checkSchedDateTime(dataNetworkAuthId) {
3436
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
3437
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
3438
+ var dateStr = jQuery(dateElement).val();
3439
+ var minStr = jQuery(timeElement).val();
3440
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
3441
+ if (jQuery('#b2sUserLang').val() == 'de') {
3442
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
3443
+ } else {
3444
+ var minParts = minStr.split(' ');
3445
+ var minParts2 = minParts[0].split(':');
3446
+ if (minParts[1] == 'PM') {
3447
+ minParts2[0] = parseInt(minParts2[0]) + 12;
3448
+ }
3449
+ minStr = minParts2[0] + ':' + minParts2[1];
3450
+ }
3451
+
3452
+ var minParts3 = minStr.split(':');
3453
+ if (minParts3[0] < 10) {
3454
+ minParts3[0] = '0' + minParts3[0];
3455
+ }
3456
+ var dateParts = dateStr.split('-');
3457
+ //utc current time
3458
+ var now = new Date();
3459
+ //offset between utc und user
3460
+ var offset = (parseInt(now.getTimezoneOffset() / 60)) * (-1);
3461
+ //enter hour to user time
3462
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
3463
+ //calculate datetime in utc
3464
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
3465
+ //compare enter date time with allowed user time
3466
+ if (enter.getTime() < now.getTime()) {
3467
+ //enter set on next 15 minutes and calculate on user timezone
3468
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
3469
+ jQuery(dateElement).datepicker('update', enter);
3470
+ jQuery(timeElement).timepicker('setTime', enter);
3471
+ }
3472
+
3473
+ //network deprecated
3474
+ if (jQuery(dateElement).attr('data-network-id') == '8') {
3475
+ var deprecatedDate = new Date('2019-03-30T23:59:59');
3476
+ var count = jQuery(dateElement).attr('data-network-count');
3477
+ if (enter.getTime() > deprecatedDate.getTime()) {
3478
+ jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3479
+ jQuery(dateElement).datepicker('update', now);
3480
+ jQuery(timeElement).timepicker('setTime', now);
3481
+ }
3482
+ }
3483
+
3484
+ //network deprecated
3485
+ if (jQuery(dateElement).attr('data-network-id') == '10') {
3486
+ var deprecatedDate = new Date('2019-04-01T23:59:59');
3487
+ var count = jQuery(dateElement).attr('data-network-count');
3488
+ if (enter.getTime() > deprecatedDate.getTime()) {
3489
+ jQuery('.network-tos-deprecated-warning[data-network-auth-id="' + dataNetworkAuthId + '"][data-network-count="' + count + '"]').show();
3490
+ jQuery(dateElement).datepicker('update', now);
3491
+ jQuery(timeElement).timepicker('setTime', now);
3492
+ }
3493
+ }
3494
+
3495
+ }
3496
+
3497
+ jQuery(document).on("click", ".b2s-draft-btn", function (event) {
3498
+ event.preventDefault();
3499
+ jQuery('.b2s-loader-btn-ship').css('display', 'inline-block');
3500
+ jQuery('.b2s-submit-btn').prop('disabled', true);
3501
+ jQuery('.b2s-submit-btn-scroll').prop('disabled', true);
3502
+ jQuery('.b2s-post-draft-saved-success').hide();
3503
+ jQuery('.b2s-post-draft-saved-fail').hide();
3504
+ jQuery('.b2s-server-connection-fail').hide();
3505
+
3506
+ jQuery.ajax({
3507
+ url: ajaxurl,
3508
+ type: "GET",
3509
+ cache: false,
3510
+ data: {
3511
+ action: 'b2s_check_draft_exists',
3512
+ postId: jQuery('#post_id').val(),
3513
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3514
+ },
3515
+ error: function () {
3516
+ saveDraft();
3517
+ return false;
3518
+ },
3519
+ success: function (data) {
3520
+ result = JSON.parse(data);
3521
+ if (result.result == true) {
3522
+ jQuery('#b2s-save-draft-modal').modal('show');
3523
+ return true;
3524
+ } else {
3525
+ if (result.error == 'nonce') {
3526
+ jQuery('.b2s-nonce-check-fail').show();
3527
+ }
3528
+ }
3529
+ saveDraft();
3530
+ return false;
3531
+ }
3532
+ });
3533
+
3534
+ });
3535
+
3536
+ jQuery(document).on('click', '.b2s-draft-btn-scroll', function () {
3537
+ jQuery('.b2s-draft-btn').trigger('click');
3538
+ });
3539
+
3540
+ function saveDraft() {
3541
+ jQuery('#action').val('b2s_save_draft_data');
3542
+ var data = jQuery('#b2sNetworkSent').serialize() + '&b2s_security_nonce=' + jQuery('#b2s_security_nonce').val();
3543
+ jQuery('#action').val('b2s_save_ship_data');
3544
+ jQuery.ajax({
3545
+ url: ajaxurl,
3546
+ type: "POST",
3547
+ cache: false,
3548
+ data: data,
3549
+ error: function () {
3550
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3551
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3552
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3553
+ jQuery('.b2s-server-connection-fail').show();
3554
+ window.scrollTo(0, 0);
3555
+ return false;
3556
+ },
3557
+ success: function (data) {
3558
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3559
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3560
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3561
+ result = JSON.parse(data);
3562
+ if (result.result == true) {
3563
+ jQuery('.b2s-post-draft-saved-success').show();
3564
+ window.setTimeout(function () {
3565
+ jQuery('.b2s-post-draft-saved-success').fadeOut();
3566
+ }, 5000);
3567
+ } else {
3568
+ if (result.error == 'nonce') {
3569
+ jQuery('.b2s-nonce-check-fail').show();
3570
+ }
3571
+ jQuery('.b2s-post-draft-saved-fail').show();
3572
+ window.setTimeout(function () {
3573
+ jQuery('.b2s-post-draft-saved-fail').fadeOut();
3574
+ }, 5000);
3575
+ }
3576
+ window.scrollTo(0, 0);
3577
+ return true;
3578
+ }
3579
+ });
3580
+ }
3581
+
3582
+ jQuery('#b2s-save-draft-modal').on('hidden.bs.modal', function () {
3583
+ jQuery('.b2s-loader-btn-ship').css('display', 'none');
3584
+ jQuery('.b2s-submit-btn').removeAttr('disabled');
3585
+ jQuery('.b2s-submit-btn-scroll').removeAttr('disabled');
3586
+ });
3587
+
3588
+ jQuery(document).on('click', '.b2s-save-draft-confirm-btn', function () {
3589
+ saveDraft();
3590
+ jQuery('#b2s-save-draft-modal').modal('hide');
3591
+ return true;
3592
+ });
3593
+
3594
+ jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3595
+ jQuery('body').addClass('modal-open');
3596
+ });
3597
+
3598
+ // START Pinterest
3599
+ jQuery(document).on('click', '.b2s-auth-network-6-login-btn', function () {
3600
+ jQuery('#b2s-auth-network-6-username').removeClass('error');
3601
+ jQuery('#b2s-auth-network-6-password').removeClass('error');
3602
+ var loginDataCheck = true;
3603
+ if (jQuery('#b2s-auth-network-6-username').val() == '') {
3604
+ jQuery('#b2s-auth-network-6-username').addClass('error');
3605
+ loginDataCheck = false;
3606
+ }
3607
+ if (jQuery('#b2s-auth-network-6-password').val() == '') {
3608
+ jQuery('#b2s-auth-network-6-password').addClass('error');
3609
+ loginDataCheck = false;
3610
+ }
3611
+ if (!loginDataCheck) {
3612
+ return false;
3613
+ }
3614
+ jQuery('.b2s-loading-area').show();
3615
+ jQuery('.b2s-auth-network-6-login-area').hide();
3616
+ jQuery('.b2s-auth-network-6-login-btn').hide();
3617
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
3618
+ jQuery('.b2s-auth-network-6-info').hide();
3619
+ jQuery.ajax({
3620
+ url: ajaxurl,
3621
+ type: "POST",
3622
+ dataType: "json",
3623
+ cache: false,
3624
+ data: {
3625
+ 'action': 'b2s_auth_network_login',
3626
+ 'username': jQuery('#b2s-auth-network-6-username').val(),
3627
+ 'password': jQuery('#b2s-auth-network-6-password').val(),
3628
+ 'location': jQuery('#b2s-auth-network-6-location').val(),
3629
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3630
+ },
3631
+ error: function (jqXHR) {
3632
+ jQuery('.b2s-loading-area').hide();
3633
+ jQuery('.b2s-auth-network-6-login-area').show();
3634
+ jQuery('.b2s-auth-network-6-login-btn').show();
3635
+ if (jqXHR.status == 403) {
3636
+ jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3637
+ } else {
3638
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3639
+ }
3640
+ return false;
3641
+ },
3642
+ success: function (data) {
3643
+ jQuery('.b2s-loading-area').hide();
3644
+ jQuery('.b2s-auth-network-6-login-area').show();
3645
+ if (data.result == true) {
3646
+ jQuery('#b2s-auth-network-6-board').html(data.boards);
3647
+ jQuery('#b2s-auth-network-6-ident-data').val(data.identData);
3648
+ jQuery('.b2s-auth-network-6-board-area').show();
3649
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
3650
+ jQuery('.b2s-auth-network-6-info[data-info="success"]').show();
3651
+ } else {
3652
+ jQuery('.b2s-auth-network-6-login-btn').show();
3653
+ if (data.error == 'nonce') {
3654
+ jQuery('.b2s-nonce-check-fail').show();
3655
+ }
3656
+ if (typeof data.error != 'undefined' && data.error != '') {
3657
+ jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3658
+ return false;
3659
+ }
3660
+ jQuery('.b2s-auth-network-6-info[data-info="login"]').show();
3661
+ }
3662
+ }
3663
+ });
3664
+ });
3665
+
3666
+ jQuery(document).on('click', '.b2s-auth-network-6-confirm-btn', function () {
3667
+ jQuery('.b2s-loading-area').show();
3668
+ jQuery('.b2s-auth-network-6-login-area').hide();
3669
+ jQuery('.b2s-auth-network-6-login-btn').hide();
3670
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
3671
+ jQuery.ajax({
3672
+ url: ajaxurl,
3673
+ type: "POST",
3674
+ dataType: "json",
3675
+ cache: false,
3676
+ data: {
3677
+ 'action': 'b2s_auth_network_confirm',
3678
+ 'username': jQuery('#b2s-auth-network-6-username').val(),
3679
+ 'password': jQuery('#b2s-auth-network-6-password').val(),
3680
+ 'boardId': jQuery('#b2s-auth-network-6-board').val(),
3681
+ 'identData': jQuery('#b2s-auth-network-6-ident-data').val(),
3682
+ 'mandantId': jQuery('.b2s-network-details-mandant-select').val(),
3683
+ 'networkAuthId': jQuery('#b2s-auth-network-6-auth-id').val(),
3684
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
3685
+ },
3686
+ error: function (jqXHR) {
3687
+ jQuery('.b2s-loading-area').hide();
3688
+ jQuery('.b2s-auth-network-6-login-area').show();
3689
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
3690
+ if (jqXHR.status == 403) {
3691
+ jQuery('.b2s-auth-network-6-info[data-info="error_code_403"]').show();
3692
+ } else {
3693
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3694
+ }
3695
+ return false;
3696
+ },
3697
+ success: function (data) {
3698
+ jQuery('.b2s-loading-area').hide();
3699
+ jQuery('.b2s-auth-network-6-login-area').show();
3700
+ jQuery('.b2s-auth-network-6-confirm-btn').show();
3701
+ if (data.result == true) {
3702
+ jQuery('#b2sAuthNetwork6Modal').modal('hide');
3703
+ loginSuccess(data.networkId, data.networkType, data.displayName, data.networkAuthId, data.mandandId);
3704
+ } else {
3705
+ if (data.error == 'nonce') {
3706
+ jQuery('.b2s-nonce-check-fail').show();
3707
+ }
3708
+ if (typeof data.error != 'undefined' && data.error != '') {
3709
+ jQuery('.b2s-auth-network-6-info[data-info="' + data.error + '"]').show();
3710
+ return false;
3711
+ }
3712
+ jQuery('.b2s-auth-network-6-info[data-info="default"]').show();
3713
+ }
3714
+ }
3715
+ });
3716
+ });
3717
+
3718
+ jQuery(document).on('click', '.b2s-network-list-add-btn[data-auth-method="client"]', function () {
3719
+ jQuery('#b2sAuthNetwork6Modal').modal('show');
3720
+ });
3721
+
3722
+ jQuery('#b2sAuthNetwork6Modal').on('hidden.bs.modal', function () {
3723
+ jQuery('.b2s-loading-area').hide();
3724
+ jQuery('.b2s-auth-network-6-login-area').show();
3725
+ jQuery('#b2s-auth-network-6-auth-id').val('');
3726
+ jQuery('#b2s-auth-network-6-board').html('');
3727
+ jQuery('#b2s-auth-network-6-ident-data').val('');
3728
+ jQuery('.b2s-auth-network-6-info').hide();
3729
+ jQuery('.b2s-auth-network-6-confirm-btn').hide();
3730
+ jQuery('.b2s-auth-network-6-login-btn').show();
3731
+ jQuery('.b2s-auth-network-6-board-area').hide();
3732
+ jQuery('#b2s-auth-network-6-username').val('');
3733
+ jQuery('#b2s-auth-network-6-password').val('');
3734
+ });
3735
+
3736
+ jQuery(".b2s-auth-network-6-reveal").mousedown(function () {
3737
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'text'));
3738
+ });
3739
+ jQuery(".b2s-auth-network-6-reveal").mouseup(function () {
3740
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3741
+ });
3742
+ jQuery(".b2s-auth-network-6-reveal").mouseout(function () {
3743
+ jQuery("#b2s-auth-network-6-password").replaceWith(jQuery('#b2s-auth-network-6-password').clone().attr('type', 'password'));
3744
+ });
3745
+ // END Pinterest
3746
+
3747
+ jQuery(document).on('click', '.b2sInfoPostRelayModalBtn', function () {
3748
+ jQuery('#b2sInfoPostRelayModal').modal('show');
3749
+ });
3750
+ jQuery(document).on('click', '.b2sInfoSchedTimesModalBtn', function () {
3751
+ jQuery('#b2sInfoSchedTimesModal').modal('show');
3752
+ });
3753
+ jQuery(document).on('click', '.b2s-network-setting-save-btn', function () {
3754
+ jQuery('#b2s-network-setting-save').modal('show');
3755
+ });
3756
+ jQuery(document).on('click', '.b2s-network-list-modal-btn', function () {
3757
+ jQuery('#b2s-network-list-modal').modal('show');
3758
+ });
3759
+ jQuery(document).on('click', '.b2s-re-share-info-btn', function () {
3760
+ jQuery('#b2s-re-share-info').modal('show');
3761
+ });
3762
+
3763
+ function checkGifAnimation(networkAuthId, networkId) {
3764
+ 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() != '') {
3765
+ 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);
3766
+ attachmenUrlExt = attachmenUrlExt.toLowerCase();
3767
+ if (attachmenUrlExt == 'gif') {
3768
+ var postFormat = 0;
3769
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').length > 0) {
3770
+ postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val();
3771
+ }
3772
+ var animatedGif = JSON.parse(jQuery('#b2sAnimateGif').val());
3773
+ if (typeof animatedGif[networkId] != "undefined" && animatedGif[networkId][postFormat] == true) {
3774
+ 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());
3775
+ } else {
3776
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').each(function () {
3777
+ var imgItem = this;
3778
+ window.setTimeout(function () {
3779
+ freeze_gif(imgItem);
3780
+ }, 1);
3781
+ });
3782
+ }
3783
+ } else {
3784
+ 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()) {
3785
+ 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());
3786
+ }
3787
+ }
3788
+ }
3789
+ return false;
3790
+ }
3791
+
3792
+ function freeze_gif(i) {
3793
+ var c = document.createElement('canvas');
3794
+ var w = c.width = i.width;
3795
+ var h = c.height = i.height;
3796
+ c.getContext('2d').drawImage(i, 0, 0, w, h);
3797
+ try {
3798
+ i.src = c.toDataURL("image/gif"); // if possible, retain all css aspects
3799
+ } catch (e) { // cross-domain -- mimic original with all its tag attributes
3800
+ for (var j = 0, a; a = i.attributes[j]; j++)
3801
+ c.setAttribute(a.name, a.value);
3802
+ i.parentNode.replaceChild(c, i);
3803
+ }
3804
+ return false;
3805
+ }
3806
+
3807
+ var currentEmojiNetworkAuthId = 0;
3808
+ var currentEmojiNetworkCount = -1;
3809
+ var emojiTranslation = JSON.parse(jQuery('#b2sEmojiTranslation').val());
3810
+ var picker = new EmojiButton({
3811
+ position: 'auto',
3812
+ autoHide: false,
3813
+ i18n: {
3814
+ search: emojiTranslation['search'],
3815
+ categories: {
3816
+ recents: emojiTranslation['recents'],
3817
+ smileys: emojiTranslation['smileys'],
3818
+ animals: emojiTranslation['animals'],
3819
+ food: emojiTranslation['food'],
3820
+ activities: emojiTranslation['activities'],
3821
+ travel: emojiTranslation['travel'],
3822
+ objects: emojiTranslation['objects'],
3823
+ symbols: emojiTranslation['symbols'],
3824
+ flags: emojiTranslation['flags']
3825
+ },
3826
+ notFound: emojiTranslation['notFound']
3827
+ }
3828
+ });
3829
+ picker.on('emoji', function (emoji) {
3830
+ if (currentEmojiNetworkAuthId > 0) {
3831
+ var text = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val();
3832
+ var start = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionStart');
3833
+ var end = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').attr('selectionEnd');
3834
+ if (typeof start == 'undefined' || typeof end == 'undefined') {
3835
+ start = text.length;
3836
+ end = text.length;
3837
+ }
3838
+ var newText = text.slice(0, start) + emoji + text.slice(end);
3839
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').val(newText);
3840
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').focus();
3841
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionStart", parseInt(start) + emoji.length);
3842
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').prop("selectionEnd", parseInt(start) + emoji.length);
3843
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + currentEmojiNetworkAuthId + '"][data-network-count="' + currentEmojiNetworkCount + '"]').trigger('keyup');
3844
+ }
3845
+ });
3846
+
3847
+ jQuery(document).on('click', '.b2s-post-item-details-item-message-emoji-btn', function () {
3848
+ if (picker.pickerVisible) {
3849
+ picker.hidePicker();
3850
+ } else {
3851
+ currentEmojiNetworkAuthId = jQuery(this).attr('data-network-auth-id');
3852
+ currentEmojiNetworkCount = jQuery(this).attr('data-network-count');
3853
+ picker.showPicker(jQuery(this));
3854
+ }
3855
+ });
3856
+
3857
+ jQuery(document).on('mousedown mouseup keydown keyup', '.b2s-post-item-details-item-message-input', function () {
3858
+ var tb = jQuery(this).get(0);
3859
+ jQuery(this).attr('selectionStart', tb.selectionStart);
3860
+ jQuery(this).attr('selectionEnd', tb.selectionEnd);
3861
+ });
3862
+
3863
+ var pickerHTML = new EmojiButton({
3864
+ position: 'auto',
3865
+ autoHide: false,
3866
+ i18n: {
3867
+ search: emojiTranslation['search'],
3868
+ categories: {
3869
+ recents: emojiTranslation['recents'],
3870
+ smileys: emojiTranslation['smileys'],
3871
+ animals: emojiTranslation['animals'],
3872
+ food: emojiTranslation['food'],
3873
+ activities: emojiTranslation['activities'],
3874
+ travel: emojiTranslation['travel'],
3875
+ objects: emojiTranslation['objects'],
3876
+ symbols: emojiTranslation['symbols'],
3877
+ flags: emojiTranslation['flags']
3878
+ },
3879
+ notFound: emojiTranslation['notFound']
3880
+ }
3881
+ });
3882
+ var currentPickerHTMLContent;
3883
+ pickerHTML.on('emoji', function (emoji) {
3884
+ currentPickerHTMLContent.insert(emoji);
3885
  });
assets/js/b2s/support.js CHANGED
@@ -1,140 +1,230 @@
1
- jQuery.noConflict();
2
-
3
-
4
- jQuery(document).ready(function () {
5
- getWidgetFaq();
6
- initTroubleshootTool();
7
- if (window.location.href.match('b2s-support-system-check') != null) {
8
- jQuery('.b2s-support-check-sytem').trigger('click');
9
- }
10
- if (window.location.href.match('b2s-support-sharing-debugger') != null) {
11
- jQuery('.b2s-support-sharing-debugger').trigger('click');
12
- }
13
- jQuery(document).on('click', '.b2s-btn-sharing-debugger', function () {
14
- var networkId = jQuery(this).attr('data-network-id');
15
- if (networkId != 2) {
16
- var url = jQuery(this).attr('b2s-url-query') + encodeURIComponent(jQuery('#b2s-debug-url[data-network-id="' + networkId + '"').val());
17
- } else {
18
- var url = jQuery(this).attr('b2s-url-query');
19
- }
20
- window.open(url, '_blank');
21
- return false;
22
- });
23
- });
24
-
25
- function getWidgetFaq() {
26
- jQuery('.b2s-faq-area').show();
27
- if (typeof wp.heartbeat == "undefined") {
28
- jQuery('#b2s-heartbeat-fail').show();
29
- }
30
- jQuery.ajax({
31
- url: ajaxurl,
32
- type: "POST",
33
- dataType: "json",
34
- cache: false,
35
- data: {
36
- 'action': 'b2s_get_faq_entries',
37
- 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
38
- },
39
- error: function () {
40
- jQuery('.b2s-faq-area').hide();
41
- return false;
42
- },
43
- success: function (data) {
44
- if (data.result == true) {
45
- jQuery('.b2s-loading-area-faq').hide();
46
- jQuery('.b2s-faq-content').html(data.content);
47
- } else {
48
- if (data.error == 'nonce') {
49
- jQuery('.b2s-nonce-check-fail').show();
50
- }
51
- jQuery('.b2s-faq-area').hide();
52
- }
53
- }
54
- });
55
- }
56
-
57
-
58
- function base64EncodeUnicode(str) {
59
- var utf8Bytes = encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
60
- return String.fromCharCode('0x' + p1);
61
- });
62
-
63
- return btoa(utf8Bytes);
64
- }
65
-
66
-
67
- function initTroubleshootTool() {
68
- firstClick = false;
69
- jQuery(document).on('click', '.b2s-support-check-sytem', function () {
70
- if (!firstClick) {
71
- jQuery('#b2s-reload-debug-btn').trigger('click');
72
- firstClick = true;
73
- }
74
- });
75
-
76
- jQuery(document).on('click', '#b2s-reload-debug-btn', function () {
77
- jQuery('.b2s-server-connection-fail').hide();
78
- jQuery('.b2s-support-fail').hide();
79
- jQuery('#b2s-main-debug').hide();
80
- jQuery('.b2s-loading-area').show();
81
-
82
- jQuery.ajax({
83
- url: ajaxurl,
84
- type: "GET",
85
- dataType: "json",
86
- cache: false,
87
- data: {'action': 'b2s_support_systemrequirements', 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()},
88
- error: function () {
89
- jQuery('.b2s-server-connection-fail').show();
90
- jQuery('.b2s-loading-area').hide();
91
- jQuery('#b2s-main-debug').show();
92
- return false;
93
- },
94
- success: function (data) {
95
- if (typeof data === 'undefined' || data === null) {
96
- jQuery('.b2s-server-connection-fail').show();
97
- jQuery('.b2s-loading-area').hide();
98
- jQuery('#b2s-main-debug').show();
99
- return false;
100
- } else if (data.result != true) {
101
- if (data.error == 'nonce') {
102
- jQuery('.b2s-nonce-check-fail').show();
103
- }
104
- if (data.error == 'admin') {
105
- jQuery('.b2s-loading-area').hide();
106
- jQuery('#b2s-support-no-admin').show();
107
- } else {
108
- jQuery('.b2s-server-connection-fail').show();
109
- jQuery('.b2s-loading-area').hide();
110
- jQuery('#b2s-main-debug').show();
111
- return false;
112
- }
113
- } else {
114
- if (typeof data.htmlData !== 'undefined') {
115
- jQuery('#b2s-debug-htmlData').html(data.htmlData);
116
- if (typeof data.blogData !== 'undefined') {
117
- jQuery('#b2s-debug-export').removeClass('b2s-support-link-not-active');
118
- jQuery('#b2s-debug-export').attr(
119
- "href", "data:application/octet-stream;charset=utf-8;base64," +
120
- base64EncodeUnicode(JSON.stringify(data.blogData, undefined, 2))
121
- );
122
- } else {
123
- jQuery('#b2s-debug-export').addClass('b2s-support-link-not-active');
124
- }
125
- jQuery('.b2s-loading-area').hide();
126
- jQuery('#b2s-main-debug').show();
127
- return true;
128
- } else {
129
- jQuery('.b2s-server-connection-fail').show();
130
- jQuery('.b2s-loading-area').hide();
131
- jQuery('#b2s-main-debug').show();
132
- return false;
133
- }
134
- }
135
-
136
- }
137
- });
138
-
139
- });
140
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+
3
+
4
+ jQuery(document).ready(function () {
5
+ getWidgetFaq();
6
+ initTroubleshootTool();
7
+ if (window.location.href.match('b2s-support-system-check') != null) {
8
+ jQuery('.b2s-support-check-sytem').trigger('click');
9
+ }
10
+ if (window.location.href.match('b2s-support-sharing-debugger') != null) {
11
+ jQuery('.b2s-support-sharing-debugger').trigger('click');
12
+ }
13
+ jQuery(document).on('click', '.b2s-btn-sharing-debugger', function () {
14
+ var networkId = jQuery(this).attr('data-network-id');
15
+ if (networkId != 2) {
16
+ var url = jQuery(this).attr('b2s-url-query') + encodeURIComponent(jQuery('#b2s-debug-url[data-network-id="' + networkId + '"').val());
17
+ } else {
18
+ var url = jQuery(this).attr('b2s-url-query');
19
+ }
20
+ window.open(url, '_blank');
21
+ return false;
22
+ });
23
+ });
24
+
25
+ function getWidgetFaq() {
26
+ jQuery('.b2s-faq-area').show();
27
+ if (typeof wp.heartbeat == "undefined") {
28
+ jQuery('#b2s-heartbeat-fail').show();
29
+ }
30
+ jQuery.ajax({
31
+ url: ajaxurl,
32
+ type: "POST",
33
+ dataType: "json",
34
+ cache: false,
35
+ data: {
36
+ 'action': 'b2s_get_faq_entries',
37
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
38
+ },
39
+ error: function () {
40
+ jQuery('.b2s-faq-area').hide();
41
+ return false;
42
+ },
43
+ success: function (data) {
44
+ if (data.result == true) {
45
+ jQuery('.b2s-loading-area-faq').hide();
46
+ jQuery('.b2s-faq-content').html(data.content);
47
+ } else {
48
+ if (data.error == 'nonce') {
49
+ jQuery('.b2s-nonce-check-fail').show();
50
+ }
51
+ jQuery('.b2s-faq-area').hide();
52
+ }
53
+ }
54
+ });
55
+ }
56
+
57
+
58
+ function base64EncodeUnicode(str) {
59
+ var utf8Bytes = encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
60
+ return String.fromCharCode('0x' + p1);
61
+ });
62
+
63
+ return btoa(utf8Bytes);
64
+ }
65
+
66
+
67
+ function initTroubleshootTool() {
68
+ firstClick = false;
69
+ jQuery(document).on('click', '.b2s-support-check-sytem', function () {
70
+ if (!firstClick) {
71
+ jQuery('#b2s-reload-debug-btn').trigger('click');
72
+ firstClick = true;
73
+ }
74
+ });
75
+
76
+ jQuery(document).on('click', '#b2s-reload-debug-btn', function () {
77
+ jQuery('.b2s-server-connection-fail').hide();
78
+ jQuery('.b2s-support-fail').hide();
79
+ jQuery('#b2s-main-debug').hide();
80
+ jQuery('.b2s-loading-area').show();
81
+
82
+ jQuery.ajax({
83
+ url: ajaxurl,
84
+ type: "GET",
85
+ dataType: "json",
86
+ cache: false,
87
+ data: {'action': 'b2s_support_systemrequirements', 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()},
88
+ error: function () {
89
+ jQuery('.b2s-server-connection-fail').show();
90
+ jQuery('.b2s-loading-area').hide();
91
+ jQuery('#b2s-main-debug').show();
92
+ return false;
93
+ },
94
+ success: function (data) {
95
+ if (typeof data === 'undefined' || data === null) {
96
+ jQuery('.b2s-server-connection-fail').show();
97
+ jQuery('.b2s-loading-area').hide();
98
+ jQuery('#b2s-main-debug').show();
99
+ return false;
100
+ } else if (data.result != true) {
101
+ if (data.error == 'nonce') {
102
+ jQuery('.b2s-nonce-check-fail').show();
103
+ }
104
+ if (data.error == 'admin') {
105
+ jQuery('.b2s-loading-area').hide();
106
+ jQuery('#b2s-support-no-admin').show();
107
+ } else {
108
+ jQuery('.b2s-server-connection-fail').show();
109
+ jQuery('.b2s-loading-area').hide();
110
+ jQuery('#b2s-main-debug').show();
111
+ return false;
112
+ }
113
+ } else {
114
+ if (typeof data.htmlData !== 'undefined') {
115
+ jQuery('#b2s-debug-htmlData').html(data.htmlData);
116
+ if (typeof data.blogData !== 'undefined') {
117
+ jQuery('#b2s-debug-export').removeClass('b2s-support-link-not-active');
118
+ jQuery('#b2s-debug-export').attr(
119
+ "href", "data:application/octet-stream;charset=utf-8;base64," +
120
+ base64EncodeUnicode(JSON.stringify(data.blogData, undefined, 2))
121
+ );
122
+ } else {
123
+ jQuery('#b2s-debug-export').addClass('b2s-support-link-not-active');
124
+ }
125
+ jQuery('.b2s-loading-area').hide();
126
+ jQuery('#b2s-main-debug').show();
127
+ return true;
128
+ } else {
129
+ jQuery('.b2s-server-connection-fail').show();
130
+ jQuery('.b2s-loading-area').hide();
131
+ jQuery('#b2s-main-debug').show();
132
+ return false;
133
+ }
134
+ }
135
+
136
+ }
137
+ });
138
+
139
+ });
140
+ }
141
+
142
+ jQuery(document).on('click', '#b2s-community-register', function() {
143
+ jQuery('#b2s-community-username').removeClass('error');
144
+ jQuery('#b2s-community-email').removeClass('error');
145
+ jQuery('#b2s-community-password').removeClass('error');
146
+ if(jQuery('#b2s-community-username').val().length < 1) {
147
+ jQuery('#b2s-community-username').addClass('error');
148
+ return false;
149
+ }
150
+ if(jQuery('#b2s-community-email').val().length < 1) {
151
+ jQuery('#b2s-community-email').addClass('error');
152
+ return false;
153
+ }
154
+ if(jQuery('#b2s-community-password').val().length < 1) {
155
+ jQuery('#b2s-community-password').addClass('error');
156
+ return false;
157
+ }
158
+
159
+ jQuery('.b2s-community-register-loading').show();
160
+ jQuery('.b2s-community-register-form').hide();
161
+ jQuery('.b2s-community-error').hide();
162
+ var username = jQuery('#b2s-community-username').val();
163
+ var email = jQuery('#b2s-community-email').val();
164
+ var password = jQuery('#b2s-community-password').val();
165
+
166
+ if(password.length < 8) {
167
+ jQuery('.b2s-community-error[data-error-type="invalid_password"]').show();
168
+ jQuery('#b2s-community-password').addClass('error');
169
+ jQuery('.b2s-community-register-loading').hide();
170
+ jQuery('.b2s-community-register-form').show();
171
+ return false;
172
+ }
173
+
174
+ jQuery.ajax({
175
+ url: ajaxurl,
176
+ type: "POST",
177
+ dataType: "json",
178
+ cache: false,
179
+ data: {
180
+ 'action': 'b2s_community_register',
181
+ 'username': username,
182
+ 'email': email,
183
+ 'password': password,
184
+ 'b2s_security_nonce': jQuery('#b2s_security_nonce').val()
185
+ },
186
+ error: function () {
187
+ jQuery('.b2s-community-error[data-error-type="invalid_data"]').show();
188
+ jQuery('.b2s-community-register-loading').hide();
189
+ jQuery('.b2s-community-register-form').show();
190
+ return false;
191
+ },
192
+ success: function (data) {
193
+ if (data.result == true) {
194
+ jQuery('.b2s-community-register-loading').hide();
195
+ jQuery('.b2s-community-register-success').show();
196
+ return true;
197
+ } else {
198
+ if(typeof data.error_reason == 'undefined' || data.error_reason.length < 1) {
199
+ jQuery('.b2s-community-error[data-error-type="invalid_data"]').show();
200
+ } else if(data.error_reason == 'nonce') {
201
+ jQuery('.b2s-nonce-check-fail').show();
202
+ } else {
203
+ jQuery('.b2s-community-error[data-error-type="'+data.error_reason+'"]').show();
204
+ }
205
+ }
206
+ jQuery('.b2s-community-register-loading').hide();
207
+ jQuery('.b2s-community-register-form').show();
208
+ return false;
209
+ }
210
+ });
211
+
212
+ });
213
+
214
+ jQuery(document).on('change', '#b2s-community-terms', function() {
215
+ if(jQuery(this).is(':checked')) {
216
+ jQuery('#b2s-community-register').prop("disabled", false);
217
+ } else {
218
+ jQuery('#b2s-community-register').prop("disabled", true);
219
+ }
220
+ });
221
+
222
+ jQuery(document).on('click', '.b2s-dashoard-btn-phone', function() {
223
+ if(jQuery('.b2s-support-phone-info').is(':visible')) {
224
+ jQuery('.b2s-support-phone-info').hide();
225
+ jQuery('.b2s-support-phone-number').show();
226
+ } else {
227
+ jQuery('.b2s-support-phone-number').hide();
228
+ jQuery('.b2s-support-phone-info').show();
229
+ }
230
+ });
blog2social.php CHANGED
@@ -6,12 +6,12 @@
6
  * Author: Blog2Social, Adenion
7
  * Text Domain: blog2social
8
  * Domain Path: /languages
9
- * Version: 6.2.0
10
  * Author URI: https://www.blog2social.com
11
  * License: GPL2+
12
  */
13
 
14
- define('B2S_PLUGIN_VERSION', '620');
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__));
6
  * Author: Blog2Social, Adenion
7
  * Text Domain: blog2social
8
  * Domain Path: /languages
9
+ * Version: 6.3.0
10
  * Author URI: https://www.blog2social.com
11
  * License: GPL2+
12
  */
13
 
14
+ define('B2S_PLUGIN_VERSION', '630');
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__));
includes/Ajax/Post.php CHANGED
@@ -1,2232 +1,2288 @@
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
- }
65
-
66
- public function curationDraft() {
67
- //save as blog post
68
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) { //0-24hours lifetime
69
- if (isset($_POST['postFormat'])) {
70
- if ((int) $_POST['postFormat'] > 0) { //Imagepost
71
- if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
72
- $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);
73
- } else {
74
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
75
- wp_die();
76
- }
77
- } else { //Linkpost
78
- if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
79
- $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);
80
- } else {
81
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
82
- wp_die();
83
- }
84
- }
85
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
86
- if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) {
87
- $data = array_merge($data, array('ID' => (int) $_POST['b2s-draft-id']));
88
- $curation = new B2S_Curation_Save($data);
89
- $source = (get_post_meta((int) $_POST['b2s-draft-id'], "b2s_source", true));
90
- $postId = $curation->updateContent($source);
91
- } else {
92
- $curation = new B2S_Curation_Save($data);
93
- $postId = $curation->insertContent();
94
- }
95
- if ($postId !== false) {
96
- if (isset($_POST['ship_type']) && isset($_POST['profile_select'])) {
97
- $draft_data = array(
98
- 'ship_type' => $_POST['ship_type'],
99
- 'profile_select' => $_POST['profile_select']
100
- );
101
- if ((int) $_POST['ship_type'] > 0 && isset($_POST['ship_date'])) {
102
- $draft_data['ship_date'] = $_POST['ship_date'];
103
- }
104
- if (isset($_POST['twitter_select'])) {
105
- $draft_data['twitter_select'] = $_POST['twitter_select'];
106
- }
107
- global $wpdb;
108
- if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}b2s_posts_drafts'") == $wpdb->prefix . 'b2s_posts_drafts') {
109
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
110
- $optionUserTimeZone = $options->_getOption('user_time_zone');
111
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
112
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
113
- $date = B2S_Util::getCustomLocaleDateTime($userTimeZoneOffset);
114
-
115
- $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);
116
- $draftEntry = $wpdb->get_var($sqlCheckDraft);
117
- if ($draftEntry !== NULL && (int) $draftEntry > 0) {
118
- $wpdb->update($wpdb->prefix . 'b2s_posts_drafts', array('data' => serialize($draft_data), 'last_save_date' => $date), array('id' => (int) $draftEntry));
119
- } else {
120
- $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));
121
- }
122
- }
123
- }
124
- echo json_encode(array('result' => true, 'postId' => $postId));
125
- wp_die();
126
- }
127
- }
128
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
129
- wp_die();
130
- } else {
131
- echo json_encode(array('result' => false, 'error' => 'nonce'));
132
- wp_die();
133
- }
134
- }
135
-
136
- public function curationShare() {
137
- //save as blog post
138
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
139
- if (isset($_POST['postFormat'])) {
140
- if ((int) $_POST['postFormat'] > 0) { //Imagepost
141
- if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
142
- $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);
143
- } else {
144
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
145
- wp_die();
146
- }
147
- } else { //Linkpost
148
- if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
149
- $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);
150
- } else {
151
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
152
- wp_die();
153
- }
154
- }
155
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
156
- $curation = new B2S_Curation_Save($data);
157
- $postId = (isset($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) ? (int) $_POST['b2s-draft-id'] : $curation->insertContent();
158
- if ($postId !== false) {
159
- //check Data
160
- if (isset($_POST['profile_select'])) {
161
- $profilId = (int) $_POST['profile_select'];
162
- if (isset($_POST['profile_data_' . $profilId]) && !empty($_POST['profile_data_' . $profilId])) {
163
- $networkData = json_decode(base64_decode($_POST['profile_data_' . $profilId]));
164
- if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
165
- $notAllowNetwork = array(4, 11, 14, 16, 18);
166
- $tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
167
- $allowNetworkOnlyImage = array(6, 7, 12, 21);
168
- $allowNetworkOnlyLink = array(9, 15);
169
- //TOS Twitter 032018 - none multiple Accounts - User select once
170
- $selectedTwitterProfile = (isset($_POST['twitter_select']) && !empty($_POST['twitter_select'])) ? (int) $_POST['twitter_select'] : '';
171
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/QuickPost.php');
172
- $quickPost = new B2S_QuickPost($data['content'], $data['title']);
173
- $defaultShareData = array('default_titel' => sanitize_text_field($data['title']),
174
- 'image_url' => (!empty($_POST['image_url'])) ? esc_url(trim(urldecode($_POST['image_url']))) : '',
175
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
176
- 'board' => '',
177
- 'group' => '',
178
- 'post_id' => $postId,
179
- 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
180
- 'tags' => array(),
181
- 'url' => ((isset($_POST['url']) && !empty($_POST['url'])) ? esc_url($_POST['url']) : ''),
182
- 'no_cache' => 0,
183
- 'token' => B2S_PLUGIN_TOKEN,
184
- 'user_timezone' => (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 ),
185
- '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')));
186
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Save.php');
187
- $b2sShipSend = new B2S_Ship_Save();
188
- $content = array();
189
- foreach ($networkData as $k => $value) {
190
- if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
191
- //TOS Twitter 032018 - none multiple Accounts - User select once
192
- if ((int) $value->networkId != 2 || ((int) $value->networkId == 2 && (empty($selectedTwitterProfile) || ((int) $selectedTwitterProfile == (int) $value->networkAuthId)))) {
193
- //Filter: image network
194
- if ((int) $_POST['postFormat'] == 0) {
195
- if (in_array($value->networkId, $allowNetworkOnlyImage)) {
196
- array_push($content, array('networkDisplayName' => $value->networkUserName, 'networkAuthId' => $value->networkAuthId, 'networkId' => $value->networkId, 'networkType' => $value->networkType, 'html' => $b2sShipSend->getItemHtml($value->networkId, 'IMAGE_FOR_CURATION')));
197
- continue;
198
- }
199
- } else {
200
- if (in_array($value->networkId, $allowNetworkOnlyLink)) {
201
- array_push($content, array('networkDisplayName' => $value->networkUserName, 'networkAuthId' => $value->networkAuthId, 'networkId' => $value->networkId, 'networkType' => $value->networkType, 'html' => $b2sShipSend->getItemHtml($value->networkId, 'LINK_FOR_CURATION')));
202
- continue;
203
- }
204
- }
205
- //Filter: Blog network
206
- if (in_array($value->networkId, $notAllowNetwork)) {
207
- continue;
208
- }
209
-
210
- //Filter: TOS Crossposting ignore
211
- if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
212
- continue;
213
- }
214
-
215
- //Filter: DeprecatedNetwork-8 31 march
216
- if ($value->networkId == 8) {
217
- if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date']) && strtotime($_POST['ship_date']) !== false) {
218
- if (date('Y-m-d', strtotime($_POST['ship_date'])) >= '2019-03-31') {
219
- //special case xing groups contains network_display_name
220
- global $wpdb;
221
- $networkDetailsId = 0;
222
- if ($value->networkType == 2) {
223
- $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)));
224
- } else {
225
- $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));
226
- }
227
- if (isset($networkDetailsIdSelect[0])) {
228
- $networkDetailsId = (int) $networkDetailsIdSelect[0];
229
- } else {
230
- $wpdb->insert($wpdb->prefix . 'b2s_posts_network_details', array(
231
- 'network_id' => (int) $value->networkId,
232
- 'network_type' => (int) $value->networkType,
233
- 'network_auth_id' => (int) $value->networkAuthId,
234
- 'network_display_name' => $value->networkUserName), array('%d', '%d', '%d', '%s'));
235
- $networkDetailsId = $wpdb->insert_id;
236
- }
237
- $timeZone = (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 );
238
- $wpdb->insert($wpdb->prefix . 'b2s_posts', array(
239
- 'post_id' => $postId,
240
- 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
241
- 'user_timezone' => $timeZone,
242
- 'publish_date' => date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate(gmdate('Y-m-d H:i:s'), $timeZone * (-1)))),
243
- 'publish_error_code' => 'DEPRECATED_NETWORK_8',
244
- 'network_details_id' => $networkDetailsId), array('%d', '%d', '%s', '%s', '%s', '%d'));
245
- continue;
246
- }
247
- }
248
- }
249
- $shareData = $quickPost->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType, $_POST['postFormat']);
250
- if ($shareData !== false) {
251
- $shareData['network_id'] = $value->networkId;
252
- $shareData['network_type'] = $value->networkType;
253
- $shareData['instant_sharing'] = ((isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0);
254
- $shareData['network_display_name'] = $value->networkUserName;
255
- $shareData['network_auth_id'] = $value->networkAuthId;
256
- $shareData = array_merge($shareData, $defaultShareData);
257
- //Type schedule
258
- if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date']) && strtotime($_POST['ship_date']) !== false) {
259
- $shipDateTime = array('date' => array(date('Y-m-d', strtotime($_POST['ship_date']))), 'time' => array(date('H:i', strtotime($_POST['ship_date']))));
260
- $schedData = array(
261
- 'date' => $shipDateTime['date'],
262
- 'time' => $shipDateTime['time'],
263
- 'releaseSelect' => 1,
264
- 'user_timezone' => (isset($_POST['b2s_user_timezone']) ? (int) $_POST['b2s_user_timezone'] : 0 ),
265
- 'saveSetting' => false);
266
- $schedRes = $b2sShipSend->saveSchedDetails($shareData, $schedData, array());
267
- $schedResult = array_merge($schedRes, array('networkDisplayName' => $value->networkUserName, 'networkId' => $value->networkId, 'networkType' => $value->networkType));
268
- $content = array_merge($content, array($schedResult));
269
- } else {
270
- //TYPE direct share
271
- $b2sShipSend->savePublishDetails($shareData, array(), true);
272
- }
273
- }
274
- }
275
- }
276
- }
277
- if (!empty($b2sShipSend->postDataApprove)) {
278
- $sendResult = $b2sShipSend->getShareApproveDetails(true);
279
- $content = array_merge($content, $sendResult);
280
- }
281
- if (!empty($b2sShipSend->postData)) {
282
- $sendResult = $b2sShipSend->postPublish(true);
283
- $content = array_merge($content, $sendResult);
284
- }
285
- //Render Ouput
286
- if (is_array($content) && !empty($content)) {
287
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/View.php');
288
- $view = new B2S_Curation_View();
289
- echo json_encode(array('result' => true, 'content' => $view->getResultListHtml($content)));
290
- wp_die();
291
- }
292
- }
293
- echo json_encode(array('result' => false, 'error' => 'NO_AUTH'));
294
- wp_die();
295
- }
296
- echo json_encode(array('result' => false, 'error' => 'NO_AUTH'));
297
- wp_die();
298
- }
299
- }
300
- }
301
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
302
- wp_die();
303
- } else {
304
- echo json_encode(array('result' => false, 'error' => 'nonce'));
305
- wp_die();
306
- }
307
- }
308
-
309
- public function curationCustomize() {
310
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
311
- if (isset($_POST['postFormat'])) {
312
- if ((int) $_POST['postFormat'] > 0) { //Imagepost
313
- if (isset($_POST['image_id']) && !empty($_POST['image_id']) && isset($_POST['comment_image']) && !empty($_POST['comment_image'])) {
314
- $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);
315
- $imgUrl = (isset($_POST['image_url']) && !empty($_POST['image_url'])) ? $_POST['image_url'] : '';
316
- } else {
317
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
318
- wp_die();
319
- }
320
- } else { //Linkpost
321
- if (isset($_POST['title']) && !empty($_POST['title']) && isset($_POST['comment']) && !empty($_POST['comment']) && isset($_POST['url']) && !empty($_POST['url'])) {
322
- $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);
323
- $imgUrl = (isset($_POST['link_image_url']) && !empty($_POST['link_image_url'])) ? $_POST['link_image_url'] : '';
324
- } else {
325
- echo json_encode(array('result' => false, 'error' => 'NO_DATA'));
326
- wp_die();
327
- }
328
- }
329
- if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id']) && (int) $_POST['b2s-draft-id'] > 0) {
330
- $data = array_merge($data, array('ID' => (int) $_POST['b2s-draft-id']));
331
- }
332
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Curation/Save.php');
333
- $curation = new B2S_Curation_Save($data);
334
- if (isset($data['ID']) && (int) $data['ID'] > 0) {
335
- $postId = $curation->updateContent();
336
- } else {
337
- $postId = $curation->insertContent();
338
- }
339
- if ($postId !== false) {
340
- $redirect_url = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=blog2social-ship&b2sPostType=ex&postId=' . $postId;
341
- if (isset($_POST['ship_type']) && (int) $_POST['ship_type'] == 1 && isset($_POST['ship_date']) && !empty($_POST['ship_date'])) {
342
- $sched_date_time = date('Y-m-d H:i:s', strtotime($_POST['ship_date']));
343
- if ($sched_date_time !== false) {
344
- $redirect_url .= '&schedDateTime=' . $sched_date_time;
345
- }
346
- }
347
- if (isset($_POST['profile_select']) && (int) $_POST['profile_select'] > 0) {
348
- $redirect_url .= '&profile=' . $_POST['profile_select'];
349
- }
350
- if (isset($imgUrl) && !empty($imgUrl)) {
351
- $redirect_url .= '&img=' . base64_encode($imgUrl);
352
- }
353
- if (isset($_POST['postFormat'])) {
354
- $redirect_url .= '&postFormat=' . $_POST['postFormat'];
355
- }
356
- echo json_encode(array('result' => true, 'redirect' => $redirect_url));
357
- wp_die();
358
- }
359
- }
360
- echo json_encode(array('result' => false));
361
- wp_die();
362
- } else {
363
- echo json_encode(array('result' => false, 'error' => 'nonce'));
364
- wp_die();
365
- }
366
- }
367
-
368
- public function b2sPluginDeactivate() {
369
- if (isset($_POST['b2s_deactivate_nonce']) && (int) wp_verify_nonce($_POST['b2s_deactivate_nonce'], 'b2s_deactivate_nonce') > 0) {
370
- if (isset($_POST['delete_sched_post']) && (int) $_POST['delete_sched_post'] == 1) {
371
- update_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST", 1, false);
372
- } else {
373
- delete_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST");
374
- }
375
- echo json_encode(array('result' => true));
376
- wp_die();
377
- } else {
378
- echo json_encode(array('result' => false, 'error' => 'nonce'));
379
- wp_die();
380
- }
381
- }
382
-
383
- public function prgShip() {
384
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
385
- 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) {
386
- $dataPost = $_POST;
387
- $type = $dataPost['publish'];
388
- $dataPost['status'] = ((int) $type == 1) ? 'hold' : 'open';
389
- unset($dataPost['confirm']);
390
- unset($dataPost['blog_user_id']);
391
- unset($dataPost['post_id']);
392
- unset($dataPost['publish']);
393
- unset($dataPost['b2s_security_nonce']);
394
- $result = json_decode(trim(PRG_Api_Post::post(B2S_PLUGIN_PRG_API_ENDPOINT . 'post.php', $dataPost)));
395
- if (is_object($result) && !empty($result) && isset($result->result) && (int) $result->result == 1 && isset($result->create) && (int) $result->create == 1) {
396
- //Contact
397
- global $wpdb;
398
- $sqlCheckUser = $wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}b2s_user_contact` WHERE `blog_user_id` = %d", (int) $_POST['blog_user_id']);
399
- $userEntry = $wpdb->get_var($sqlCheckUser);
400
- $userContact = array('name_mandant' => sanitize_text_field($_POST['name_mandant']),
401
- 'created' => date('Y-m-d H:i;s'),
402
- 'name_presse' => sanitize_text_field($_POST['name_presse']),
403
- 'anrede_presse' => sanitize_text_field($_POST['anrede_presse']),
404
- 'vorname_presse' => sanitize_text_field($_POST['vorname_presse']),
405
- 'nachname_presse' => sanitize_text_field($_POST['nachname_presse']),
406
- 'strasse_presse' => sanitize_text_field($_POST['strasse_presse']),
407
- 'nummer_presse' => sanitize_text_field($_POST['nummer_presse']),
408
- 'plz_presse' => sanitize_text_field($_POST['plz_presse']),
409
- 'ort_presse' => sanitize_text_field($_POST['ort_presse']),
410
- 'land_presse' => sanitize_text_field($_POST['land_presse']),
411
- 'email_presse' => sanitize_text_field($_POST['email_presse']),
412
- 'telefon_presse' => sanitize_text_field($_POST['telefon_presse']),
413
- 'fax_presse' => isset($_POST['fax_presse']) ? sanitize_text_field($_POST['fax_presse']) : '',
414
- 'url_presse' => esc_url($_POST['url_presse'])
415
- );
416
-
417
- if (!$userEntry) {
418
- $insertData = array_merge(array('blog_user_id' => (int) $_POST['blog_user_id']), $userContact);
419
- $wpdb->insert($wpdb->prefix . 'b2s_user_contact', $insertData);
420
- } else {
421
- $wpdb->update($wpdb->prefix . 'b2s_user_contact', $userContact, array('blog_user_id' => (int) $_POST['blog_user_id']));
422
- }
423
- echo json_encode(array('result' => true, 'error' => 0, 'type' => $type));
424
- wp_die();
425
- }
426
- echo json_encode(array('result' => false, 'error' => 2, 'type' => $type)); //NOTSHIP
427
- wp_die();
428
- }
429
- echo json_encode(array('result' => false, 'error' => 1, 'type' => $type)); //INVALIDDATA
430
- wp_die();
431
- } else {
432
- echo json_encode(array('result' => false, 'error' => 'nonce'));
433
- wp_die();
434
- }
435
- }
436
-
437
- public function lockAutoPostImport() {
438
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
439
- if (isset($_POST['userId']) && (int) $_POST['userId'] > 0) {
440
- update_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $_POST['userId'], 1, false);
441
- }
442
- echo json_encode(array('result' => true));
443
- wp_die();
444
- } else {
445
- echo json_encode(array('result' => false, 'error' => 'nonce'));
446
- wp_die();
447
- }
448
- }
449
-
450
- public function prgLogin() {
451
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
452
- if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
453
- $pubKey = json_decode(PRG_Api_Get::get(B2S_PLUGIN_PRG_API_ENDPOINT . 'auth.php?publicKey=true', array()));
454
- if (!empty($pubKey) && is_object($pubKey) && isset($pubKey->publicKey) && !empty($pubKey->publicKey) && function_exists('openssl_public_encrypt')) {
455
- $usernameCrypted = '';
456
- $passwordCrypted = '';
457
- openssl_public_encrypt(trim($_POST['username']), $usernameCrypted, $pubKey->publicKey);
458
- openssl_public_encrypt(trim($_POST['password']), $passwordCrypted, $pubKey->publicKey);
459
- $datas = array(
460
- 'action' => 'loginPRG',
461
- 'username' => base64_encode($usernameCrypted),
462
- 'password' => base64_encode($passwordCrypted),
463
- );
464
- $result = json_decode(trim(PRG_Api_Post::post(B2S_PLUGIN_PRG_API_ENDPOINT . 'auth.php', $datas)));
465
- if (!empty($result) && is_object($result) && isset($result->prg_token) && !empty($result->prg_token) && isset($result->prg_id) && !empty($result->prg_id)) {
466
- if ((int) $result->prg_id > 0) {
467
- $prgInfo = array('B2S_PRG_ID' => $result->prg_id,
468
- 'B2S_PRG_TOKEN' => $result->prg_token);
469
-
470
- update_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID, $prgInfo, false);
471
- echo json_encode(array('result' => true, 'error' => 0));
472
- wp_die();
473
- }
474
- }
475
- echo json_encode(array('result' => false, 'error' => 1));
476
- wp_die();
477
- }
478
- echo json_encode(array('result' => false, 'error' => 2)); //SSL ERRROR
479
- wp_die();
480
- }
481
- echo json_encode(array('result' => false, 'error' => 1));
482
- wp_die();
483
- } else {
484
- echo json_encode(array('result' => false, 'error' => 'nonce'));
485
- wp_die();
486
- }
487
- }
488
-
489
- public function prgLogout() {
490
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
491
- delete_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID);
492
- echo json_encode(array('result' => true));
493
- wp_die();
494
- } else {
495
- echo json_encode(array('result' => false, 'error' => 'nonce'));
496
- wp_die();
497
- }
498
- }
499
-
500
- public function saveShipData() {
501
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
502
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Save.php');
503
- $post = $_POST;
504
- $metaOg = false;
505
- $metaCard = false;
506
-
507
-
508
- if (!isset($post['b2s']) || !is_array($post['b2s']) || !isset($post['post_id']) || (int) $post['post_id'] == 0) {
509
- echo json_encode(array('result' => false));
510
- wp_die();
511
- }
512
-
513
- $b2sShipSend = new B2S_Ship_Save();
514
-
515
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $post['post_id']);
516
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $post['post_id']);
517
-
518
- $content = array();
519
- $schedResult = array();
520
- $defaultPostData = array('token' => B2S_PLUGIN_TOKEN,
521
- 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
522
- 'post_id' => (int) $post['post_id'],
523
- 'default_titel' => isset($post['default_titel']) ? sanitize_text_field($post['default_titel']) : '',
524
- 'no_cache' => 0, //default inactive , 1=active 0=not
525
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))));
526
-
527
- foreach ($post['b2s'] as $networkAuthId => $data) {
528
- if (!isset($data['url']) || !isset($data['network_id'])) {
529
- continue;
530
- }
531
-
532
- if ((int) $data['network_id'] == 1 || (int) $data['network_id'] == 3 || (int) $data['network_id'] == 19) {
533
- $linkNoCache = B2S_Tools::getNoCacheData(B2S_PLUGIN_BLOG_USER_ID);
534
- if (is_array($linkNoCache) && isset($linkNoCache[$data['network_id']]) && (int) $linkNoCache[$data['network_id']] > 0) {
535
- $defaultPostData['no_cache'] = $linkNoCache[$data['network_id']];
536
- }
537
- }
538
-
539
- //Change/Set MetaTags
540
- 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
541
- $metaOg = true;
542
- $meta = B2S_Meta::getInstance();
543
- $meta->getMeta((int) $post['post_id']);
544
- if (isset($data['og_title']) && !empty($data['og_title'])) {
545
- $meta->setMeta('og_title', sanitize_text_field($data['og_title']));
546
- }
547
- if (isset($data['og_desc']) && !empty($data['og_desc'])) {
548
- $meta->setMeta('og_desc', sanitize_text_field($data['og_desc']));
549
- }
550
- if (isset($data['image_url']) && !empty($data['image_url'])) {
551
- $meta->setMeta('og_image', trim(esc_url($data['image_url'])));
552
- }
553
- $meta->updateMeta((int) $post['post_id']);
554
- //TODO update scheds
555
- global $wpdb;
556
- $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')));
557
- foreach ($res as $key => $sched) {
558
- $schedData = unserialize($sched->sched_data);
559
- if ((isset($schedData['post_format']) && (int) $schedData['post_format'] == 0) || (!isset($schedData['post_format']) && isset($schedData['image_url']) && !empty($schedData['image_url']))) {
560
- $schedData['image_url'] = $data['image_url'];
561
- $wpdb->update($wpdb->prefix . 'b2s_posts_sched_details', array(
562
- 'sched_data' => serialize($schedData),
563
- 'image_url' => $data['image_url']
564
- ), array("id" => $sched->sched_details_id), array('%s', '%s', '%d'));
565
- }
566
- }
567
- }
568
-
569
- //Change/Set MetaTags
570
- if ((int) $data['network_id'] == 2 && $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
571
- $metaCard = true;
572
- $meta = B2S_Meta::getInstance();
573
- $meta->getMeta((int) $post['post_id']);
574
- if (isset($data['card_title']) && !empty($data['card_title'])) {
575
- $meta->setMeta('card_title', sanitize_text_field($data['card_title']));
576
- }
577
- if (isset($data['card_desc']) && !empty($data['card_desc'])) {
578
- $meta->setMeta('card_desc', sanitize_text_field($data['card_desc']));
579
- }
580
- if (isset($data['image_url']) && !empty($data['image_url'])) {
581
- $meta->setMeta('card_image', trim(esc_url($data['image_url'])));
582
- }
583
- $meta->updateMeta((int) $post['post_id']);
584
- }
585
-
586
- //TOS XING Group
587
- if (isset($data['network_tos_group_id']) && !empty($data['network_tos_group_id'])) {
588
- $options = new B2S_Options(0, 'B2S_PLUGIN_TOS_XING_GROUP_CROSSPOSTING');
589
- $options->_setOption((int) $post['post_id'], $data['network_tos_group_id'], true);
590
- }
591
-
592
- $sendData = array("board" => isset($data['board']) ? sanitize_text_field($data['board']) : '',
593
- "group" => isset($data['group']) ? sanitize_text_field($data['group']) : '',
594
- "custom_title" => isset($data['custom_title']) ? sanitize_text_field($data['custom_title']) : '',
595
- "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>') : '',
596
- 'url' => isset($data['url']) ? htmlspecialchars_decode(esc_url($data['url'])) : '',
597
- 'image_url' => isset($data['image_url']) ? trim(esc_url($data['image_url'])) : '',
598
- 'tags' => isset($data['tags']) ? $data['tags'] : array(),
599
- 'network_id' => isset($data['network_id']) ? (int) $data['network_id'] : 0,
600
- 'instant_sharing' => isset($data['instant_sharing']) ? (int) $data['instant_sharing'] : 0,
601
- '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'])) : '',
602
- 'network_type' => isset($data['network_type']) ? (int) $data['network_type'] : '',
603
- 'network_kind' => isset($data['network_kind']) ? (int) $data['network_kind'] : 0,
604
- 'marketplace_category' => isset($data['marketplace_category']) ? (int) $data['marketplace_category'] : 0,
605
- 'marketplace_type' => isset($data['marketplace_type']) ? (int) $data['marketplace_type'] : 0,
606
- 'network_display_name' => isset($data['network_display_name']) ? sanitize_text_field($data['network_display_name']) : '',
607
- 'network_auth_id' => $networkAuthId,
608
- 'post_format' => isset($data['post_format']) ? (int) $data['post_format'] : '',
609
- 'user_timezone' => isset($post['user_timezone']) ? (int) $post['user_timezone'] : 0,
610
- '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'))
611
- );
612
- //since V4.8.0 Check Relay and prepare Data
613
- $relayData = array();
614
- 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])) {
615
- $relayData = array('auth' => $data['post_relay_account'], 'delay' => $data['post_relay_delay']);
616
- }
617
-
618
- //mode: share now
619
- $schedData = array();
620
- if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 0) {
621
- $b2sShipSend->savePublishDetails(array_merge($defaultPostData, $sendData), $relayData);
622
- //mode: schedule custom once times
623
- } else if (isset($data['releaseSelect']) && (int) $data['releaseSelect'] == 1 && isset($data['date'][0]) && isset($data['time'][0])) {
624
- $schedData = array(
625
- 'date' => isset($data['date']) ? $data['date'] : array(),
626
- 'time' => isset($data['time']) ? $data['time'] : array(),
627
- 'sched_content' => isset($data['sched_content']) ? $data['sched_content'] : array(),
628
- 'sched_image_url' => isset($data['sched_image_url']) ? $data['sched_image_url'] : array(),
629
- 'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
630
- 'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
631
- 'saveSetting' => isset($data['saveSchedSetting']) ? true : false);
632
- $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
633
- $content = array_merge($content, $schedResult);
634
- //mode: recurrently schedule
635
- } else {
636
- $schedData = array(
637
- 'interval_select' => isset($data['intervalSelect']) ? $data['intervalSelect'] : array(),
638
- 'duration_month' => isset($data['duration_month']) ? $data['duration_month'] : array(),
639
- 'select_day' => isset($data['select_day']) ? $data['select_day'] : array(),
640
- 'duration_time' => isset($data['duration_time']) ? $data['duration_time'] : array(),
641
- 'select_timespan' => isset($data['select_timespan']) ? $data['select_timespan'] : array(),
642
- 'weeks' => isset($data['weeks']) ? $data['weeks'] : 0,
643
- 'date' => isset($data['date']) ? $data['date'] : array(),
644
- 'time' => isset($data['time']) ? $data['time'] : array(),
645
- 'mo' => isset($data['mo']) ? $data['mo'] : array(),
646
- 'di' => isset($data['di']) ? $data['di'] : array(),
647
- 'mi' => isset($data['mi']) ? $data['mi'] : array(),
648
- 'do' => isset($data['do']) ? $data['do'] : array(),
649
- 'fr' => isset($data['fr']) ? $data['fr'] : array(),
650
- 'sa' => isset($data['sa']) ? $data['sa'] : array(),
651
- 'so' => isset($data['so']) ? $data['so'] : array(),
652
- 'releaseSelect' => isset($data['releaseSelect']) ? $data['releaseSelect'] : 0,
653
- 'user_timezone' => isset($post['user_timezone']) ? $post['user_timezone'] : 0,
654
- 'saveSetting' => isset($data['saveSchedSetting']) ? true : false
655
- );
656
-
657
- $schedResult [] = $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, $relayData);
658
- $content = array_merge($content, $schedResult);
659
- }
660
- }
661
-
662
- if (!empty($b2sShipSend->postDataApprove)) {
663
- $sendResult = $b2sShipSend->getShareApproveDetails();
664
- $content = array_merge($content, $sendResult);
665
- }
666
-
667
- if (!empty($b2sShipSend->postData)) {
668
- $sendResult = $b2sShipSend->postPublish();
669
- $content = array_merge($content, $sendResult);
670
- }
671
-
672
- echo json_encode(array('result' => true, 'content' => $content));
673
- wp_die();
674
- } else {
675
- echo json_encode(array('result' => false, 'error' => 'nonce'));
676
- wp_die();
677
- }
678
- }
679
-
680
- public function saveSocialMetaTags() {
681
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
682
- $result = array('result' => true);
683
- if (isset($_POST['is_admin']) && (int) $_POST['is_admin'] == 1) {
684
-
685
- $options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
686
-
687
- $og_active = (!isset($_POST['b2s_og_active'])) ? 0 : 1;
688
- $options->_setOption('og_active', $og_active);
689
- $options->_setOption('og_default_title', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_og_default_title']) : ''));
690
- $options->_setOption('og_default_desc', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_og_default_desc']) : ''));
691
- $options->_setOption('og_default_image', ((B2S_PLUGIN_USER_VERSION >= 1) ? esc_url($_POST['b2s_og_default_image']) : ''));
692
-
693
- $card_active = (!isset($_POST['b2s_card_active'])) ? 0 : 1;
694
- $options->_setOption('card_active', $card_active);
695
- $options->_setOption('card_default_type', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_card_default_type']) : 0));
696
- $options->_setOption('card_default_title', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_card_default_title']) : ''));
697
- $options->_setOption('card_default_desc', ((B2S_PLUGIN_USER_VERSION >= 1) ? sanitize_text_field($_POST['b2s_card_default_desc']) : ''));
698
- $options->_setOption('card_default_image', ((B2S_PLUGIN_USER_VERSION >= 1) ? esc_url($_POST['b2s_card_default_image']) : ''));
699
-
700
- $meta = B2S_Meta::getInstance();
701
- $result['b2s'] = ($card_active == 1 || $og_active == 1) ? true : false;
702
- $result['yoast'] = $meta->is_yoast_seo_active();
703
- $result['aioseop'] = $meta->is_aioseop_active();
704
- $result['webdados'] = $meta->is_webdados_active();
705
- }
706
-
707
- echo json_encode($result);
708
- wp_die();
709
- } else {
710
- echo json_encode(array('result' => false, 'error' => 'nonce'));
711
- wp_die();
712
- }
713
- }
714
-
715
- public function resetSocialMetaTags() {
716
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
717
- global $wpdb;
718
- $sql = "DELETE FROM " . $wpdb->postmeta . " WHERE meta_key = %s";
719
- $sql = $wpdb->prepare($sql, "_b2s_post_meta");
720
- $wpdb->query($sql);
721
- echo json_encode(array('result' => true));
722
- wp_die();
723
- } else {
724
- echo json_encode(array('result' => false, 'error' => 'nonce'));
725
- wp_die();
726
- }
727
- }
728
-
729
- public function saveNetworkBoardAndGroup() {
730
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
731
- 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'])) {
732
- $post = array('token' => B2S_PLUGIN_TOKEN,
733
- 'action' => 'saveNetworkBoardAndGroup',
734
- 'networkAuthId' => (int) $_POST['networkAuthId'],
735
- 'networkType' => (int) $_POST['networkType'],
736
- 'networkId' => (int) $_POST['networkId'],
737
- 'boardAndGroup' => sanitize_text_field($_POST['boardAndGroup']),
738
- 'boardAndGroupName' => (isset($_POST['boardAndGroupName']) && !empty($_POST['boardAndGroupName'])) ? trim(sanitize_text_field($_POST['boardAndGroupName'])) : '',
739
- 'lang' => $_POST['lang']);
740
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
741
- if ($result->result == true) {
742
- echo json_encode(array('result' => true));
743
- wp_die();
744
- }
745
- }
746
- echo json_encode(array('result' => false));
747
- wp_die();
748
- } else {
749
- echo json_encode(array('result' => false, 'error' => 'nonce'));
750
- wp_die();
751
- }
752
- }
753
-
754
- public function saveUserNetworkSettings() {
755
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
756
- if (isset($_POST['short_url'])) {
757
- $post = array('token' => B2S_PLUGIN_TOKEN,
758
- 'action' => 'saveSettings',
759
- 'short_url' => (int) $_POST['short_url']);
760
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
761
- if ($result->result == true) {
762
- echo json_encode(array('result' => true, 'content' => (((int) $_POST['short_url'] >= 1) ? 0 : 1)));
763
- wp_die();
764
- }
765
-
766
- echo json_encode(array('result' => true, 'content' => (isset($_POST['short_url']) ? (int) $_POST['short_url'] : 0)));
767
- wp_die();
768
- }
769
-
770
-
771
- if (isset($_POST['shortener_account_auth_delete'])) {
772
- $post = array('token' => B2S_PLUGIN_TOKEN,
773
- 'action' => 'saveSettings',
774
- 'shortener_account_auth_delete' => (int) $_POST['shortener_account_auth_delete']);
775
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
776
- if ($result->result == true) {
777
- echo json_encode(array('result' => true));
778
- wp_die();
779
- }
780
- echo json_encode(array('result' => true));
781
- wp_die();
782
- }
783
-
784
- if (isset($_POST['allow_shortcode'])) {
785
- if ((int) $_POST['allow_shortcode'] == 1) {
786
- delete_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID);
787
- } else {
788
- update_option('B2S_PLUGIN_USER_ALLOW_SHORTCODE_' . B2S_PLUGIN_BLOG_USER_ID, 1, false);
789
- }
790
- echo json_encode(array('result' => true, 'content' => (((int) $_POST['allow_shortcode'] == 1) ? 0 : 1)));
791
- wp_die();
792
- }
793
-
794
- if (isset($_POST['user_time_zone']) && !empty($_POST['user_time_zone'])) {
795
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
796
- $options->_setOption('user_time_zone', sanitize_text_field($_POST['user_time_zone']));
797
- echo json_encode(array('result' => true));
798
- wp_die();
799
- }
800
-
801
- if (isset($_POST['allow_hashtag'])) {
802
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
803
- $options->_setOption('user_allow_hashtag', (int) $_POST['allow_hashtag']);
804
- echo json_encode(array('result' => true, 'content' => (((int) $_POST['allow_hashtag'] == 1) ? 0 : 1)));
805
- wp_die();
806
- }
807
- if (isset($_POST['legacy_mode'])) {
808
- $options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
809
- $options->_setOption('legacy_mode', (int) $_POST['legacy_mode']);
810
- echo json_encode(array('result' => true, 'content' => (((int) $_POST['legacy_mode'] == 1) ? 0 : 1)));
811
- wp_die();
812
- }
813
- echo json_encode(array('result' => false));
814
- wp_die();
815
- } else {
816
- echo json_encode(array('result' => false, 'error' => 'nonce'));
817
- wp_die();
818
- }
819
- }
820
-
821
- public function saveAutoPostSettings() {
822
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
823
- if (isset($_POST['b2s-import-auto-post']) && (int) $_POST['b2s-import-auto-post'] == 1 && !isset($_POST['b2s-import-auto-post-network-auth-id'])) {
824
- echo json_encode(array('result' => false, 'type' => 'no-auth-selected'));
825
- wp_die();
826
- }
827
-
828
-
829
- //Auto-Poster A
830
- $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();
831
- $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();
832
-
833
- $auto_post_import = array('active' => ((isset($_POST['b2s-import-auto-post']) && (int) $_POST['b2s-import-auto-post'] == 1) ? 1 : 0),
834
- 'network_auth_id' => $network_auth_id,
835
- 'ship_state' => ((isset($_POST['b2s-import-auto-post-time-state']) && (int) $_POST['b2s-import-auto-post-time-state'] == 1) ? 1 : 0),
836
- 'ship_delay_time' => (int) $_POST['b2s-import-auto-post-time-data'],
837
- 'post_filter' => ((isset($_POST['b2s-import-auto-post-filter']) && (int) $_POST['b2s-import-auto-post-filter'] == 1) ? 1 : 0),
838
- 'post_type_state' => ((isset($_POST['b2s-import-auto-post-type-state']) && (int) $_POST['b2s-import-auto-post-type-state'] == 1) ? 1 : 0),
839
- 'post_type' => $post_type);
840
-
841
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
842
- $options->_setOption('auto_post_import', $auto_post_import);
843
-
844
-
845
- //Auto-Poster M
846
- $active = ((isset($_POST['b2s-manuell-auto-post']) && (int) $_POST['b2s-manuell-auto-post'] == 1) ? 1 : 0);
847
- $best_times = ((isset($_POST['b2s-auto-post-best-times']) && (int) $_POST['b2s-auto-post-best-times'] == 1) ? 1 : 0);
848
- $profile = ((isset($_POST['b2s-auto-post-profil-dropdown']) && (int) $_POST['b2s-auto-post-profil-dropdown'] > 0) ? (int) $_POST['b2s-auto-post-profil-dropdown'] : 0);
849
- $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);
850
- $publish = isset($_POST['b2s-settings-auto-post-publish']) && is_array($_POST['b2s-settings-auto-post-publish']) ? $_POST['b2s-settings-auto-post-publish'] : array();
851
- $update = isset($_POST['b2s-settings-auto-post-update']) && is_array($_POST['b2s-settings-auto-post-update']) ? $_POST['b2s-settings-auto-post-update'] : array();
852
- $auto_post = array('active' => $active, 'profile' => $profile, 'twitter' => $twitter, 'publish' => $publish, 'update' => $update, 'best_times' => $best_times);
853
- $options->_setOption('auto_post', $auto_post);
854
- echo json_encode(array('result' => true));
855
- wp_die();
856
- } else {
857
- echo json_encode(array('result' => false, 'error' => 'nonce'));
858
- wp_die();
859
- }
860
- }
861
-
862
- public function saveUserMandant() {
863
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
864
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Save.php');
865
- $mandant = (isset($_POST['mandant']) && !empty($_POST['mandant'])) ? sanitize_text_field($_POST['mandant']) : '';
866
- if (empty($mandant)) {
867
- echo json_encode(array('result' => false, 'content' => ""));
868
- wp_die();
869
- }
870
- $mandantResult = B2S_Network_Save::saveUserMandant($mandant);
871
- echo json_encode(array('result' => $mandantResult['result'], 'mandantId' => $mandantResult['mandantId'], 'mandantName' => $mandantResult['mandantName'], 'content' => $mandantResult['content']));
872
- wp_die();
873
- } else {
874
- echo json_encode(array('result' => false, 'error' => 'nonce'));
875
- wp_die();
876
- }
877
- }
878
-
879
- public function deleteUserMandant() {
880
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
881
- if (isset($_POST['mandantId'])) {
882
- $post = array('token' => B2S_PLUGIN_TOKEN,
883
- 'action' => 'deleteUserMandant',
884
- 'mandantId' => (int) $_POST['mandantId']);
885
- $deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
886
- if ($deleteResult->result == true) {
887
- global $wpdb;
888
- $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'));
889
- echo json_encode(array('result' => true, 'mandantId' => (int) $_POST['mandantId']));
890
- wp_die();
891
- }
892
- }
893
- echo json_encode(array('result' => false, 'mandantId' => ''));
894
- wp_die();
895
- } else {
896
- echo json_encode(array('result' => false, 'error' => 'nonce'));
897
- wp_die();
898
- }
899
- }
900
-
901
- public function deleteUserAuth() {
902
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
903
- $assignList = array();
904
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Post/Tools.php');
905
- if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType'])) {
906
- global $wpdb;
907
- if (isset($_POST['deleteSchedPost']) && (int) $_POST['deleteSchedPost'] == 1) {
908
- $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'));
909
- if (is_array($res) && !empty($res)) {
910
- foreach ($res as $k => $row) {
911
- if (isset($row->id) && (int) $row->id > 0) {
912
- $hookAction = (isset($row->post_for_approve) && (int) $row->post_for_approve == 0) ? 3 : 0; //since 4.9.1 Facebook Instant Sharing
913
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => $hookAction, 'hide' => 1), array('id' => (int) $row->id));
914
- //is post for relay
915
- if ((int) $row->post_for_relay == 1) {
916
- $relay = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
917
- if (is_array($relay) && !empty($relay)) {
918
- foreach ($relay as $item) {
919
- if (isset($item->id) && (int) $item->id > 0) {
920
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $item->id));
921
- }
922
- }
923
- }
924
- }
925
- }
926
- }
927
- }
928
- //V5.5.0 Approve User > Business Version
929
- if (isset($_POST['assignList']) && !empty($_POST['assignList'])) {
930
- $assignList = unserialize($_POST['assignList']);
931
- if (is_array($assignList) && !empty($assignList)) {
932
- foreach ($assignList as $i => $assignAuthId) {
933
- $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'));
934
- if (is_array($res) && !empty($res)) {
935
- foreach ($res as $k => $row) {
936
- if (isset($row->id) && (int) $row->id > 0) {
937
- $hookAction = (isset($row->post_for_approve) && (int) $row->post_for_approve == 0) ? 3 : 0; //since 4.9.1 Facebook Instant Sharing
938
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => $hookAction, 'hide' => 1), array('id' => (int) $row->id));
939
- //is post for relay
940
- if ((int) $row->post_for_relay == 1) {
941
- $relay = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
942
- if (is_array($relay) && !empty($relay)) {
943
- foreach ($relay as $item) {
944
- if (isset($item->id) && (int) $item->id > 0) {
945
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $item->id));
946
- }
947
- }
948
- }
949
- }
950
- }
951
- }
952
- }
953
- }
954
- }
955
- }
956
- B2S_Heartbeat::getInstance()->deleteSchedPost();
957
- sleep(2);
958
- }
959
- $post = array('token' => B2S_PLUGIN_TOKEN,
960
- 'action' => 'deleteUserAuth',
961
- 'networkAuthId' => (int) $_POST['networkAuthId'],
962
- 'assignNetworkAuthId' => (isset($_POST['deleteAssignment']) && $_POST['deleteAssignment'] == 'all') ? $_POST['deleteAssignment'] : ((isset($_POST['assignNetworkAuthId']) && (int) $_POST['assignNetworkAuthId'] > 0) ? (int) $_POST['assignNetworkAuthId'] : 0));
963
- $deleteResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
964
- if ($deleteResult->result == true) {
965
- $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'));
966
- if (is_array($assignList) && !empty($assignList)) {
967
- foreach ($assignList as $blogUserId => $assignAuthId) {
968
- $wpdb->delete($wpdb->prefix . 'b2s_user_network_settings', array('network_auth_id' => $assignAuthId, 'blog_user_id' => $blogUserId), array('%d', '%d'));
969
- }
970
- }
971
- 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'])));
972
- wp_die();
973
- }
974
- }
975
- echo json_encode(array('result' => false, 'networkId' => 0, 'networkAuthId' => 0));
976
- wp_die();
977
- } else {
978
- echo json_encode(array('result' => false, 'error' => 'nonce'));
979
- wp_die();
980
- }
981
- }
982
-
983
- public function updateUserVersion() {
984
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
985
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
986
- if (isset($_POST['key']) && !empty($_POST['key'])) {
987
- $isCurrentUser = true;
988
- if (isset($_POST['user_id']) && !empty($_POST['user_id']) && (int) $_POST['user_id'] != B2S_PLUGIN_BLOG_USER_ID) {
989
- $user_id = (int) $_POST['user_id'];
990
- $user_token = B2S_Tools::getTokenById($user_id);
991
- $isCurrentUser = false;
992
- } else {
993
- $user_id = B2S_PLUGIN_BLOG_USER_ID;
994
- $user_token = B2S_PLUGIN_TOKEN;
995
- }
996
- if ($user_token != false) {
997
- $post = array('token' => $user_token,
998
- 'action' => 'updateUserVersion',
999
- 'version' => B2S_PLUGIN_VERSION,
1000
- 'key' => sanitize_text_field($_POST['key']));
1001
- $keyResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1002
- if (isset($keyResult->result) && $keyResult->result == true) {
1003
- if ($isCurrentUser) {
1004
- $option = get_option('B2S_PLUGIN_USER_VERSION_' . $user_id);
1005
- $option['B2S_PLUGIN_USER_VERSION'] = $keyResult->version;
1006
- update_option('B2S_PLUGIN_USER_VERSION_' . $user_id, $option, false);
1007
- $licenseName = unserialize(B2S_PLUGIN_VERSION_TYPE);
1008
- $printName = (isset($keyResult->trail) && $keyResult->trail == true) ? 'FREE-TRIAL' : $licenseName[$keyResult->version];
1009
- } else {
1010
- $tokenInfo['B2S_PLUGIN_USER_VERSION'] = (isset($keyResult->version) ? $keyResult->version : 0);
1011
- $tokenInfo['B2S_PLUGIN_VERSION'] = B2S_PLUGIN_VERSION;
1012
- if (isset($keyResult->trail) && $keyResult->trail == true && isset($keyResult->trailEndDate) && $keyResult->trailEndDate != "") {
1013
- $tokenInfo['B2S_PLUGIN_TRAIL_END'] = $keyResult->trailEndDate;
1014
- }
1015
- if (!isset($keyResult->version)) {
1016
- define('B2S_PLUGIN_NOTICE', 'CONNECTION');
1017
- } else {
1018
- $tokenInfo['B2S_PLUGIN_USER_VERSION_NEXT_REQUEST'] = time() + 3600;
1019
- update_option('B2S_PLUGIN_USER_VERSION_' . $user_id, $tokenInfo, false);
1020
- }
1021
- $printName = false;
1022
- }
1023
- echo json_encode(array('result' => true, 'licenseName' => $printName));
1024
- wp_die();
1025
- } else if (isset($keyResult->reason)) {
1026
- echo json_encode(array('result' => false, 'reason' => $keyResult->reason));
1027
- wp_die();
1028
- }
1029
- } else {
1030
- echo json_encode(array('result' => false, 'reason' => 2));
1031
- wp_die();
1032
- }
1033
- }
1034
- echo json_encode(array('result' => false, 'reason' => 0));
1035
- wp_die();
1036
- } else {
1037
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1038
- wp_die();
1039
- }
1040
- }
1041
-
1042
- public function acceptPrivacyPolicy() {
1043
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1044
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1045
- if (isset($_POST['accept'])) {
1046
- $post = array('token' => B2S_PLUGIN_TOKEN,
1047
- 'action' => 'updatePrivacyPolicy',
1048
- 'version' => B2S_PLUGIN_VERSION);
1049
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1050
- if ($result->result == true) {
1051
- echo json_encode(array('result' => true));
1052
- delete_option('B2S_PLUGIN_PRIVACY_POLICY_USER_ACCEPT_' . B2S_PLUGIN_BLOG_USER_ID);
1053
- wp_die();
1054
- }
1055
- }
1056
- echo json_encode(array('result' => false));
1057
- wp_die();
1058
- } else {
1059
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1060
- wp_die();
1061
- }
1062
- }
1063
-
1064
- public function createTrail() {
1065
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1066
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1067
- 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'])) {
1068
- $data = array('token' => B2S_PLUGIN_TOKEN,
1069
- 'action' => 'createTrail',
1070
- 'vorname' => sanitize_text_field($_POST['vorname']),
1071
- 'nachname' => sanitize_text_field($_POST['nachname']),
1072
- 'email' => sanitize_text_field($_POST['email']),
1073
- 'url' => esc_url($_POST['url']),
1074
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))));
1075
- $trailResult = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data));
1076
- if ($trailResult->result == true) {
1077
- B2S_Tools::setUserDetails();
1078
- $lizenzName = unserialize(B2S_PLUGIN_VERSION_TYPE);
1079
- $printName = 'FREE-TRIAL (' . $lizenzName[$trailResult->version] . ')';
1080
- echo json_encode(array('result' => true, 'lizenzName' => esc_html($printName)));
1081
- wp_die();
1082
- }
1083
- }
1084
- echo json_encode(array('result' => false));
1085
- wp_die();
1086
- } else {
1087
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1088
- wp_die();
1089
- }
1090
- }
1091
-
1092
- public function deleteUserPublishPost() {
1093
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1094
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1095
- if (isset($_POST['postId']) && !empty($_POST['postId'])) {
1096
- $postIds = explode(',', $_POST['postId']);
1097
- if (is_array($postIds) && !empty($postIds)) {
1098
- echo json_encode(B2S_Post_Tools::deleteUserPublishPost($postIds));
1099
- wp_die();
1100
- }
1101
- }
1102
- echo json_encode(array('result' => false));
1103
- wp_die();
1104
- } else {
1105
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1106
- wp_die();
1107
- }
1108
- }
1109
-
1110
- public function deleteUserApprovePost() {
1111
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1112
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1113
- if (isset($_POST['postId']) && !empty($_POST['postId'])) {
1114
- $postIds = explode(',', $_POST['postId']);
1115
- if (is_array($postIds) && !empty($postIds)) {
1116
- echo json_encode(B2S_Post_Tools::deleteUserApprovePost($postIds));
1117
- wp_die();
1118
- }
1119
- }
1120
- echo json_encode(array('result' => false));
1121
- wp_die();
1122
- } else {
1123
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1124
- wp_die();
1125
- }
1126
- }
1127
-
1128
- public function deleteUserCcDraftPost() {
1129
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1130
- if (isset($_POST['postId']) && !empty($_POST['postId']) && (int) $_POST['postId'] > 0) {
1131
- $res = wp_update_post(array('ID' => (int) $_POST['postId'], 'post_status' => 'trash'), true);
1132
- if ((int) $res > 0) {
1133
- echo json_encode(array('result' => true, 'postId' => (int) $_POST['postId']));
1134
- wp_die();
1135
- }
1136
- }
1137
- echo json_encode(array('result' => false));
1138
- wp_die();
1139
- } else {
1140
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1141
- wp_die();
1142
- }
1143
- }
1144
-
1145
- public function sendTrailFeedback() {
1146
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1147
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1148
- if (isset($_POST['feedback']) && !empty($_POST['feedback'])) {
1149
- $post = array('token' => B2S_PLUGIN_TOKEN,
1150
- 'action' => 'sendTrailFeedback',
1151
- 'feedback' => sanitize_textarea_field($_POST['feedback']));
1152
- $result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post));
1153
- if ($result->result == true) {
1154
- echo json_encode(array('result' => true));
1155
- wp_die();
1156
- }
1157
- }
1158
- echo json_encode(array('result' => false));
1159
- wp_die();
1160
- } else {
1161
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1162
- wp_die();
1163
- }
1164
- }
1165
-
1166
- //NEW V5.1.0
1167
- public function saveUserTimeSettings() {
1168
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1169
- 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'])) {
1170
- foreach ($_POST['b2s-user-sched-data']['time'] as $k => $v) {
1171
- $_POST['b2s-user-sched-data']['time'][$k] = date('H:i', strtotime(date('Y-m-d') . ' ' . $v));
1172
- }
1173
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
1174
- $options->_setOption('auth_sched_time', array('delay_day' => $_POST['b2s-user-sched-data']['delay_day'], 'time' => $_POST['b2s-user-sched-data']['time']));
1175
- echo json_encode(array('result' => true));
1176
- wp_die();
1177
- }
1178
- echo json_encode(array('result' => false));
1179
- wp_die();
1180
- } else {
1181
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1182
- wp_die();
1183
- }
1184
- }
1185
-
1186
- public function b2sShipNavbarSaveSettings() {
1187
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1188
- if (isset($_POST['mandantId'])) {
1189
- global $wpdb;
1190
-
1191
- $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'));
1192
- if (isset($_POST['selectedAuth']) && is_array($_POST['selectedAuth'])) {
1193
- foreach ($_POST['selectedAuth'] as $k => $networkAuthId) {
1194
- $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'));
1195
- }
1196
- }
1197
- echo json_encode(array('result' => true));
1198
- wp_die();
1199
- }
1200
- echo json_encode(array('result' => false));
1201
- wp_die();
1202
- } else {
1203
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1204
- wp_die();
1205
- }
1206
- }
1207
-
1208
- public function saveAuthToSettings() {
1209
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1210
- 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'])) {
1211
- global $wpdb;
1212
- $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']));
1213
- if (!isset($networkDetailsIdSelect[0])) {
1214
- $wpdb->insert($wpdb->prefix . 'b2s_posts_network_details', array(
1215
- 'network_id' => (int) $_POST['networkId'],
1216
- 'network_type' => (int) $_POST['networkType'],
1217
- 'network_auth_id' => (int) $_POST['networkAuthId'],
1218
- 'network_display_name' => $_POST['displayName']), array('%d', '%d', '%d', '%s'));
1219
- }
1220
- $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));
1221
- if ($mandantCount > 0) {
1222
- $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'));
1223
- }
1224
- echo json_encode(array('result' => true));
1225
- wp_die();
1226
- }
1227
- echo json_encode(array('result' => false));
1228
- wp_die();
1229
- } else {
1230
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1231
- wp_die();
1232
- }
1233
- }
1234
-
1235
- public function b2sPostMailUpdate() {
1236
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1237
- if (isset($_POST['email']) && !empty($_POST['email'])) {
1238
- require_once (B2S_PLUGIN_DIR . '/includes/Tools.php');
1239
- $post = array('action' => 'updateMail',
1240
- 'email' => sanitize_text_field($_POST['email']),
1241
- 'lang' => $_POST['lang']);
1242
- B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $post);
1243
- update_option('B2S_UPDATE_MAIL_' . B2S_PLUGIN_BLOG_USER_ID, sanitize_text_field($post['email']), false);
1244
- }
1245
- echo json_encode(array('result' => true));
1246
- wp_die();
1247
- } else {
1248
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1249
- wp_die();
1250
- }
1251
- }
1252
-
1253
- public function updateApprovePost() {
1254
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1255
- //post_id
1256
- if (is_numeric($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
1257
- global $wpdb;
1258
- require_once (B2S_PLUGIN_DIR . '/includes/Options.php');
1259
- require_once (B2S_PLUGIN_DIR . '/includes/Util.php');
1260
- $option = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
1261
- $optionUserTimeZone = $option->_getOption('user_time_zone');
1262
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
1263
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
1264
-
1265
- $sql = "UPDATE {$wpdb->prefix}b2s_posts "
1266
- . "SET sched_date = '0000-00-00 00:00:00', "
1267
- . "sched_date_utc = '0000-00-00 00:00:00', "
1268
- . "publish_date = '" . B2S_Util::getbyIdentLocalDate($userTimeZoneOffset) . "', "
1269
- . "publish_link = '" . ((isset($_POST['publish_link']) && !empty($_POST['publish_link'])) ? esc_url($_POST['publish_link']) : '') . "', "
1270
- . "publish_error_code = '" . ((isset($_POST['publish_error_code']) && !empty($_POST['publish_error_code'])) ? addslashes(sanitize_text_field($_POST['publish_error_code'])) : '') . "', "
1271
- . "post_for_approve = 0 "
1272
- . "WHERE id = " . (int) $_POST['post_id'];
1273
- $wpdb->query($sql);
1274
- echo json_encode(array('result' => true));
1275
- wp_die();
1276
- }
1277
- } else {
1278
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1279
- wp_die();
1280
- }
1281
- }
1282
-
1283
- public function b2sCalendarMovePost() {
1284
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1285
- global $wpdb;
1286
- if (is_numeric($_POST['b2s_id']) && is_string($_POST['sched_date']) && isset($_POST['user_timezone'])) {
1287
-
1288
- //since V4.9.1 Instant Share Approve - Facebook Profile
1289
- $shareApprove = (isset($_POST['post_for_approve']) && (int) $_POST['post_for_approve'] == 1) ? 1 : 0;
1290
- $sql = "UPDATE {$wpdb->prefix}b2s_posts "
1291
- . "SET sched_date = '" . date('Y-m-d H:i:s', strtotime($_POST['sched_date'])) . "', "
1292
- . "user_timezone = '" . (int) $_POST['user_timezone'] . "', "
1293
- . "publish_date = '0000-00-00 00:00:00' ,"
1294
- . "sched_date_utc = '" . B2S_Util::getUTCForDate($_POST['sched_date'], (int) $_POST['user_timezone'] * -1) . "', "
1295
- . "hook_action = " . (($shareApprove == 0) ? 2 : 0)
1296
- . " WHERE id = " . $_POST['b2s_id'];
1297
-
1298
- $wpdb->query($sql);
1299
-
1300
- //is post for relay?
1301
- if (isset($_POST['post_for_relay']) && (int) $_POST['post_for_relay'] == 1) {
1302
- $res = $this->getAllRelayByPrimaryPostId($_POST['b2s_id']);
1303
- if (is_array($res) && !empty($res)) {
1304
- foreach ($res as $item) {
1305
- if (isset($item->id) && (int) $item->id > 0 && isset($item->relay_delay_min) && (int) $item->relay_delay_min > 0) {
1306
- $relay_sched_date = date('Y-m-d H:i:00', strtotime("+" . $item->relay_delay_min . " minutes", strtotime($_POST['sched_date'])));
1307
- $relay_sched_date_utc = date('Y-m-d H:i:00', strtotime(B2S_Util::getUTCForDate($relay_sched_date, (int) $_POST['user_timezone'] * (-1))));
1308
- $wpdb->update($wpdb->prefix . 'b2s_posts', array(
1309
- 'user_timezone' => (int) $_POST['user_timezone'],
1310
- 'publish_date' => "0000-00-00 00:00:00",
1311
- 'sched_date' => $relay_sched_date,
1312
- 'sched_date_utc' => $relay_sched_date_utc,
1313
- 'hook_action' => 2
1314
- ), array("id" => $item->id), array('%s', '%s', '%s', '%s', '%d'));
1315
- }
1316
- }
1317
- }
1318
- }
1319
- }
1320
- echo json_encode(array('result' => true));
1321
- wp_die();
1322
- } else {
1323
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1324
- wp_die();
1325
- }
1326
- }
1327
-
1328
- public function deleteUserSchedPost() {
1329
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1330
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1331
-
1332
- if (isset($_POST['postId']) && !empty($_POST['postId'])) {
1333
- $postIds = explode(',', $_POST['postId']);
1334
- if (is_array($postIds) && !empty($postIds)) {
1335
- echo json_encode(B2S_Post_Tools::deleteUserSchedPost($postIds));
1336
- wp_die();
1337
- }
1338
- }
1339
- echo json_encode(array('result' => false));
1340
- wp_die();
1341
- } else {
1342
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1343
- wp_die();
1344
- }
1345
- }
1346
-
1347
- public function b2sDeletePost() {
1348
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1349
- require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
1350
- global $wpdb;
1351
- if (isset($_POST['b2s_id']) && (int) $_POST['b2s_id'] > 0 && isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
1352
- $sql = $wpdb->prepare("SELECT id,post_id,post_for_approve,post_for_relay FROM {$wpdb->prefix}b2s_posts WHERE id =%d AND publish_date = %s", (int) $_POST['b2s_id'], "0000-00-00 00:00:00");
1353
- $row = $wpdb->get_row($sql);
1354
- if (isset($row->id) && (int) $row->id == (int) $_POST['b2s_id']) {
1355
- $hookAction = (isset($row->post_for_approve) && (int) $row->post_for_approve == 0) ? 3 : 0; //since 4.9.1 Facebook Instant Sharing
1356
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => $hookAction, 'hide' => 1), array('id' => (int) $_POST['b2s_id']));
1357
- //is post for relay
1358
- if ((int) $row->post_for_relay == 1) {
1359
- $res = B2S_Post_Tools::getAllRelayByPrimaryPostId($row->id);
1360
- if (is_array($res) && !empty($res)) {
1361
- foreach ($res as $item) {
1362
- if (isset($item->id) && (int) $item->id > 0) {
1363
- $wpdb->update($wpdb->prefix . 'b2s_posts', array('hook_action' => 3, 'hide' => 1), array('id' => $item->id));
1364
- }
1365
- }
1366
- }
1367
- }
1368
- }
1369
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . (int) $_POST['b2s_id']);
1370
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $_POST['post_id']);
1371
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $_POST['post_id']);
1372
- }
1373
- echo json_encode(array('result' => true));
1374
- wp_die();
1375
- } else {
1376
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1377
- wp_die();
1378
- }
1379
- }
1380
-
1381
- public function b2sEditSavePost() {
1382
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1383
- global $wpdb;
1384
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Calendar/Save.php');
1385
-
1386
- $post = $_POST;
1387
- $metaOg = false;
1388
- $metaCard = false;
1389
- $sched_date = '';
1390
-
1391
- if (!isset($post['post_id']) || (int) $post['post_id'] == 0) {
1392
- echo json_encode(array('result' => false));
1393
- wp_die();
1394
- }
1395
-
1396
- $b2sids = array($post['b2s_id']);
1397
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $post['post_id']);
1398
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $post['post_id']);
1399
-
1400
- foreach ($b2sids as $b2s_id) {
1401
- $b2sShipSend = new B2S_Calendar_Save();
1402
-
1403
- $defaultPostData = array(
1404
- 'original_blog_user_id' => (int) $post['original_blog_user_id'],
1405
- 'last_edit_blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
1406
- 'post_id' => (int) $post['post_id'],
1407
- 'b2s_id' => (int) $b2s_id,
1408
- 'default_titel' => isset($post['default_titel']) ? sanitize_text_field($post['default_titel']) : '',
1409
- 'no_cache' => 0, //default inactive , 1=active 0=not
1410
- 'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))));
1411
-
1412
-
1413
- //is relay post?
1414
- if (isset($post['relay_primary_post_id']) && (int) $post['relay_primary_post_id'] > 0 && (int) $b2s_id > 0) {
1415
- if (isset($post['relay_primary_sched_date']) && !empty($post['relay_primary_sched_date']) && isset($post['network_auth_id']) && (int) $post['network_auth_id'] > 0) {
1416
- if (isset($post['b2s'][$post['network_auth_id']]['post_relay_delay'][0]) && (int) $post['b2s'][$post['network_auth_id']]['post_relay_delay'][0] > 0) {
1417
- $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'])));
1418
- $sched_date_utc = date('Y-m-d H:i:00', strtotime(B2S_Util::getUTCForDate($sched_date, (int) $post['user_timezone'] * (-1))));
1419
- $wpdb->update($wpdb->prefix . 'b2s_posts', array(
1420
- 'user_timezone' => (int) $post['user_timezone'],
1421
- 'publish_date' => "0000-00-00 00:00:00",
1422
- 'sched_date' => $sched_date,
1423
- 'sched_date_utc' => $sched_date_utc,
1424
- 'hook_action' => 2
1425
- ), array("id" => $b2s_id), array('%s', '%s', '%s', '%s', '%d'));
1426
- $sched_date = B2S_Util::getCustomDateFormat(date('Y-m-d H:i:00', strtotime($sched_date)), substr(B2S_LANGUAGE, 0, 2));
1427
- }
1428
- }
1429
- } else {
1430
-
1431
- foreach ($post['b2s'] as $networkAuthId => $data) {
1432
- if (!isset($data['url']) || !isset($data['content']) || !isset($data['network_id'])) {
1433
- continue;
1434
- }
1435
-
1436
- if ((int) $data['network_id'] == 1 || (int) $data['network_id'] == 3 || (int) $data['network_id'] == 19) {
1437
- $linkNoCache = B2S_Tools::getNoCacheData(B2S_PLUGIN_BLOG_USER_ID);
1438
- if (is_array($linkNoCache) && isset($linkNoCache[$data['network_id']]) && (int) $linkNoCache[$data['network_id']] > 0) {
1439
- $defaultPostData['no_cache'] = $linkNoCache[$data['network_id']];
1440
- }
1441
- }
1442
-
1443
- //Change/Set MetaTags
1444
- 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
1445
- $metaOg = true;
1446
- $meta = B2S_Meta::getInstance();
1447
- $res = $meta->getMeta((int) $post['post_id']);
1448
- if (isset($data['og_title']) && !empty($data['og_title'])) {
1449
- $meta->setMeta('og_title', sanitize_text_field($data['og_title']));
1450
- }
1451
- if (isset($data['og_desc']) && !empty($data['og_desc'])) {
1452
- $meta->setMeta('og_desc', sanitize_text_field($data['og_desc']));
1453
- }
1454
- if (isset($data['image_url']) && !empty($data['image_url'])) {
1455
- $meta->setMeta('og_image', trim(esc_url($data['image_url'])));
1456
- }
1457
- $meta->updateMeta((int) $post['post_id']);
1458
- //TODO Update scheds
1459
- global $wpdb;
1460
- $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')));
1461
- foreach ($res as $key => $sched) {
1462
- $schedData = unserialize($sched->sched_data);
1463
- if ((isset($schedData['post_format']) && (int) $schedData['post_format'] == 0) || (!isset($schedData['post_format']) && isset($schedData['image_url']) && !empty($schedData['image_url']))) {
1464
- $schedData['image_url'] = $data['image_url'];
1465
- $wpdb->update($wpdb->prefix . 'b2s_posts_sched_details', array(
1466
- 'sched_data' => serialize($schedData),
1467
- 'image_url' => $data['image_url']
1468
- ), array("id" => $sched->sched_details_id), array('%s', '%s', '%d'));
1469
- }
1470
- }
1471
- }
1472
-
1473
- //Change/Set MetaTags
1474
- if ((int) $data['network_id'] == 2 && $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
1475
- $metaCard = true;
1476
- $meta = B2S_Meta::getInstance();
1477
- $meta->getMeta((int) $post['post_id']);
1478
- if (isset($data['card_title']) && !empty($data['card_title'])) {
1479
- $meta->setMeta('card_title', sanitize_text_field($data['card_title']));
1480
- }
1481
- if (isset($data['card_desc']) && !empty($data['card_desc'])) {
1482
- $meta->setMeta('card_desc', sanitize_text_field($data['card_desc']));
1483
- }
1484
- if (isset($data['image_url']) && !empty($data['image_url'])) {
1485
- $meta->setMeta('card_image', trim(esc_url($data['image_url'])));
1486
- }
1487
- $meta->updateMeta((int) $post['post_id']);
1488
- }
1489
-
1490
- $sendData = array("board" => isset($data['board']) ? sanitize_text_field($data['board']) : '',
1491
- "group" => isset($data['group']) ? sanitize_text_field($data['group']) : '',
1492
- "custom_title" => isset($data['custom_title']) ? sanitize_text_field($data['custom_title']) : '',
1493
- "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>') : '',
1494
- 'url' => isset($data['url']) ? htmlspecialchars_decode(esc_url($data['url'])) : '',
1495
- 'image_url' => isset($data['image_url']) ? trim(esc_url($data['image_url'])) : '',
1496
- 'tags' => isset($data['tags']) ? $data['tags'] : array(),
1497
- 'network_id' => isset($data['network_id']) ? (int) $data['network_id'] : '',
1498
- 'network_type' => isset($data['network_type']) ? (int) $data['network_type'] : '',
1499
- 'network_tos_group_id' => (isset($data['network_tos_group_id']) && !empty($data['network_tos_group_id'])) ? sanitize_text_field($data['network_tos_group_id']) : '',
1500
- 'network_kind' => isset($data['network_kind']) ? (int) $data['network_kind'] : 0,
1501
- 'marketplace_category' => isset($data['marketplace_category']) ? (int) $data['marketplace_category'] : 0,
1502
- 'marketplace_type' => isset($data['marketplace_type']) ? (int) $data['marketplace_type'] : 0,
1503
- 'network_display_name' => isset($data['network_display_name']) ? sanitize_text_field($data['network_display_name']) : '',
1504
- 'network_auth_id' => (int) $networkAuthId,
1505
- 'post_format' => isset($data['post_format']) ? (int) $data['post_format'] : '',
1506
- 'post_for_approve' => isset($post['post_for_approve']) ? (int) $post['post_for_approve'] : 0,
1507
- 'user_timezone' => isset($post['user_timezone']) ? (int) $post['user_timezone'] : 0,
1508
- 'sched_details_id' => isset($post['sched_details_id']) ? (int) $post['sched_details_id'] : null,
1509
- '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'))
1510
- );
1511
-
1512
- if (isset($data['date'][0]) && isset($data['time'][0])) {
1513
- $sched_date = B2S_Util::getCustomDateFormat(date('Y-m-d H:i:00', strtotime($data['date'][0] . ' ' . $data['time'][0])), substr(B2S_LANGUAGE, 0, 2));
1514
- $schedData = array(
1515
- 'date' => isset($data['date']) ? $data['date'] : array(),
1516
- 'time' => isset($data['time']) ? $data['time'] : array(),
1517
- 'releaseSelect' => ((isset($post['sched_type']) && (int) $post['sched_type'] > 0) ? (int) $post['sched_type'] : 1),
1518
- 'user_timezone' => isset($post['user_timezone']) ? (int) $post['user_timezone'] : 0,
1519
- 'saveSetting' => isset($data['saveSchedSetting']) ? true : false
1520
- );
1521
-
1522
- $b2sShipSend->saveSchedDetails(array_merge($defaultPostData, $sendData), $schedData, array());
1523
-
1524
- //is post for relay ?
1525
- //get all relays in primary post id by b2s id & change sched_date + utc
1526
- if (isset($post['post_for_relay']) && (int) $post['post_for_relay'] == 1 && isset($data['date'][0]) && isset($data['time'][0]) && (int) $b2s_id > 0) {
1527
- $res = $this->getAllRelayByPrimaryPostId($b2s_id);
1528
- if (is_array($res) && !empty($res)) {
1529
- foreach ($res as $item) {
1530
- if (isset($item->id) && (int) $item->id > 0 && isset($item->relay_delay_min) && (int) $item->relay_delay_min > 0) {
1531
- $relay_sched_date = date('Y-m-d H:i:00', strtotime("+" . $item->relay_delay_min . " minutes", strtotime($data['date'][0] . ' ' . $data['time'][0])));
1532
- $relay_sched_date_utc = date('Y-m-d H:i:00', strtotime(B2S_Util::getUTCForDate($relay_sched_date, (int) $post['user_timezone'] * (-1))));
1533
- $wpdb->update($wpdb->prefix . 'b2s_posts', array(
1534
- 'user_timezone' => (int) $post['user_timezone'],
1535
- 'publish_date' => "0000-00-00 00:00:00",
1536
- 'sched_date' => $relay_sched_date,
1537
- 'sched_date_utc' => $relay_sched_date_utc,
1538
- 'hook_action' => 2
1539
- ), array("id" => $item->id), array('%s', '%s', '%s', '%s', '%d'));
1540
- }
1541
- }
1542
- }
1543
- }
1544
- }
1545
- }
1546
-
1547
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $b2s_id);
1548
- }
1549
- }
1550
- echo json_encode(array('result' => true, 'date' => $sched_date));
1551
- wp_die();
1552
- } else {
1553
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1554
- wp_die();
1555
- }
1556
- }
1557
-
1558
- public function getAllRelayByPrimaryPostId($primary_post_id = 0) {
1559
- global $wpdb;
1560
- $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);
1561
- return $wpdb->get_results($sqlData);
1562
- }
1563
-
1564
- public function releaseLocks() {
1565
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1566
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1567
- $options = new B2S_Options(get_current_user_id());
1568
- $lock = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
1569
-
1570
- if (isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
1571
- delete_option('B2S_PLUGIN_POST_META_TAGES_TWITTER_' . (int) $_POST['post_id']);
1572
- delete_option('B2S_PLUGIN_POST_META_TAGES_OG_' . (int) $_POST['post_id']);
1573
- }
1574
- if ($lock) {
1575
- delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $lock);
1576
- $options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", false);
1577
- }
1578
- } else {
1579
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1580
- wp_die();
1581
- }
1582
- }
1583
-
1584
- public function hideRating() {
1585
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1586
- $forever = (isset($_POST['forever']) && $_POST['forever'] === true) ? true : false;
1587
- B2S_Rating::hide($forever);
1588
- } else {
1589
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1590
- wp_die();
1591
- }
1592
- }
1593
-
1594
- public function hidePremiumMessage() {
1595
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1596
- update_option("B2S_HIDE_PREMIUM_MESSAGE", true, false);
1597
- } else {
1598
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1599
- wp_die();
1600
- }
1601
- }
1602
-
1603
- public function hideTrailMessage() {
1604
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1605
- update_option("B2S_HIDE_TRAIL_MESSAGE", true, false);
1606
- } else {
1607
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1608
- wp_die();
1609
- }
1610
- }
1611
-
1612
- public function hideTrailEndedMessage() {
1613
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1614
- update_option("B2S_HIDE_TRAIL_ENDED", true, false);
1615
- } else {
1616
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1617
- wp_die();
1618
- }
1619
- }
1620
-
1621
- public function moveUserAuthToProfile() {
1622
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1623
- if (isset($_POST['mandantId']) && isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
1624
- $data = array('action' => 'moveUserAuthToProfile', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => (int) $_POST['networkAuthId'], 'mandantId' => (int) $_POST['mandantId']);
1625
- $moveUserAuth = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30));
1626
- if ($moveUserAuth->result == true) {
1627
- global $wpdb;
1628
- $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']);
1629
- $networkAuthIdExist = $wpdb->get_row($sql);
1630
- if (!empty($networkAuthIdExist) && isset($networkAuthIdExist->id)) {
1631
- $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']);
1632
- $wpdb->query($sqlUpdateNetworkAuthId);
1633
- }
1634
- echo json_encode(array('result' => true));
1635
- wp_die();
1636
- }
1637
- }
1638
- echo json_encode(array('result' => false));
1639
- wp_die();
1640
- } else {
1641
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1642
- wp_die();
1643
- }
1644
- }
1645
-
1646
- public function assignNetworkUserAuth() {
1647
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1648
- if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0 && isset($_POST['assignBlogUserId']) && (int) $_POST['assignBlogUserId'] > 0) {
1649
- $assignToken = B2S_Tools::getTokenById($_POST['assignBlogUserId']);
1650
- $data = array('action' => 'approveUserAuth', 'token' => B2S_PLUGIN_TOKEN, 'networkAuthId' => (int) $_POST['networkAuthId'], 'assignToken' => $assignToken, 'tokenBlogUserId' => B2S_PLUGIN_BLOG_USER_ID, 'assignTokenBlogUserId' => $_POST['assignBlogUserId']);
1651
- $assignUserAuth = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $data, 30), true);
1652
- if (isset($assignUserAuth['result']) && $assignUserAuth['result'] == true && isset($assignUserAuth['assign_network_auth_id']) && (int) $assignUserAuth['assign_network_auth_id'] > 0) {
1653
- global $wpdb;
1654
- $sql = $wpdb->prepare("SELECT * FROM `{$wpdb->prefix}b2s_posts_network_details` WHERE `network_auth_id` = %d", (int) $assignUserAuth['assign_network_auth_id']);
1655
- $networkAuthIdExist = $wpdb->get_row($sql);
1656
- if (empty($networkAuthIdExist) || !isset($networkAuthIdExist->id)) {
1657
- //Insert
1658
- $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']);
1659
- $wpdb->query($sqlInsertNetworkAuthId);
1660
- } else {
1661
- //Update
1662
- $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']);
1663
- $wpdb->query($sqlUpdateNetworkAuthId);
1664
- }
1665
- $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'));
1666
-
1667
- $options = new B2S_Options((int) B2S_PLUGIN_BLOG_USER_ID);
1668
- if (isset($_POST['optionBestTimes']) && filter_var($_POST['optionBestTimes'], FILTER_VALIDATE_BOOLEAN) == true) {
1669
- $userSchedData = $options->_getOption('auth_sched_time');
1670
- if (isset($userSchedData['delay_day'][$_POST['networkAuthId']]) && isset($userSchedData['time'][$_POST['networkAuthId']])) {
1671
- $assignUserOptions = new B2S_Options((int) $_POST['assignBlogUserId']);
1672
- $assignUserSchedData = $assignUserOptions->_getOption('auth_sched_time');
1673
- if ($assignUserSchedData != false && isset($assignUserSchedData['delay_day']) && isset($assignUserSchedData['time'])) {
1674
- $assignUserSchedData['delay_day'][$assignUserAuth['assign_network_auth_id']] = $userSchedData['delay_day'][$_POST['networkAuthId']];
1675
- $assignUserSchedData['time'][$assignUserAuth['assign_network_auth_id']] = $userSchedData['time'][$_POST['networkAuthId']];
1676
- } else {
1677
- $assignUserSchedData = array(
1678
- 'delay_day' => array($assignUserAuth['assign_network_auth_id'] => $userSchedData['delay_day'][$_POST['networkAuthId']]),
1679
- 'time' => array($assignUserAuth['assign_network_auth_id'] => $userSchedData['time'][$_POST['networkAuthId']])
1680
- );
1681
- }
1682
- $assignUserOptions->_setOption('auth_sched_time', $assignUserSchedData);
1683
- }
1684
- }
1685
-
1686
- if (isset($_POST['optionPostingTemplate']) && filter_var($_POST['optionPostingTemplate'], FILTER_VALIDATE_BOOLEAN) == true) {
1687
- $userTemplateData = $options->_getOption('post_template');
1688
- if (isset($userTemplateData[$assignUserAuth['assign_network_id']][$assignUserAuth['assign_network_type']])) {
1689
- $assignUserOptions = new B2S_Options((int) $_POST['assignBlogUserId']);
1690
- $assignUserTemplateData = $assignUserOptions->_getOption('post_template');
1691
- if ($assignUserTemplateData == false || !isset($assignUserTemplateData[$assignUserAuth['assign_network_id']])) {
1692
- $defaultTemplate = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT);
1693
- if (isset($defaultTemplate[$assignUserAuth['assign_network_id']])) {
1694
- $assignUserTemplateData = array($assignUserAuth['assign_network_id'] => $defaultTemplate[$assignUserAuth['assign_network_id']]);
1695
- } else {
1696
- $assignUserTemplateData[$assignUserAuth['assign_network_id']] = $userTemplateData[$assignUserAuth['assign_network_id']];
1697
- }
1698
- }
1699
- $assignUserTemplateData[$assignUserAuth['assign_network_id']][$assignUserAuth['assign_network_type']] = $userTemplateData[$assignUserAuth['assign_network_id']][$assignUserAuth['assign_network_type']];
1700
- $assignUserOptions->_setOption('post_template', $assignUserTemplateData);
1701
- }
1702
- }
1703
-
1704
- if (isset($_POST['optionUrlParameter']) && filter_var($_POST['optionUrlParameter'], FILTER_VALIDATE_BOOLEAN) == true) {
1705
- $sql = $wpdb->prepare("SELECT data FROM `{$wpdb->prefix}b2s_posts_network_details` WHERE `network_auth_id` = %d", (int) $_POST['networkAuthId']);
1706
- $rawOriginalData = $wpdb->get_row($sql);
1707
- $originalData = unserialize($rawOriginalData->data);
1708
- if ($originalData != false && $originalData != NULL && is_array($originalData) && isset($originalData) && !empty($originalData) && isset($originalData['url_parameter'])) {
1709
- $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']);
1710
- $wpdb->query($sqlUpdateNetworkAuthId);
1711
- }
1712
- }
1713
-
1714
- $optionUserTimeZone = $options->_getOption('user_time_zone');
1715
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
1716
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
1717
- $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)));
1718
- $displayName = stripslashes(get_user_by('id', $_POST['assignBlogUserId'])->display_name);
1719
- $newListEntry = '<li class="b2s-network-item-auth-list-li">';
1720
- $newListEntry .= '<div class="pull-left" style="padding-top: 5px;"><span>' . esc_html(((empty($displayName) || $displayName == false) ? __("Unknown username", "blog2social") : $displayName)) . '</span></div>';
1721
- $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>';
1722
- $newListEntry .= '<div class="clearfix"></div></li>';
1723
- echo json_encode(array('result' => true, 'newListEntry' => $newListEntry));
1724
- wp_die();
1725
- } else if (isset($assignUserAuth['error_reason'])) {
1726
- echo json_encode(array('result' => false, 'error_reason' => $assignUserAuth['error_reason']));
1727
- wp_die();
1728
- } else {
1729
- echo json_encode(array('result' => false, 'error_reason' => 'invalid_data'));
1730
- wp_die();
1731
- }
1732
- }
1733
- echo json_encode(array('result' => false, 'error_reason' => 'default'));
1734
- wp_die();
1735
- } else {
1736
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1737
- wp_die();
1738
- }
1739
- }
1740
-
1741
- public function savePostTemplate() {
1742
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1743
- if (isset($_POST['template_data']) && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0) {
1744
- require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
1745
- $options = new B2S_Options(get_current_user_id());
1746
-
1747
- $post_template_result = false;
1748
- $link_no_cache_option = false;
1749
-
1750
- if (B2S_PLUGIN_USER_VERSION >= 1) {
1751
- $post_template = $options->_getOption("post_template");
1752
-
1753
- if ($post_template == false) {
1754
- $post_template = array();
1755
- }
1756
-
1757
- $new_template = array();
1758
- foreach ($_POST['template_data'] as $type => $data) {
1759
- $limit = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['short_text']['limit'];
1760
- $range_max = ((int) $limit != 0 && (int) $data['range_max'] > (int) $limit) ? (int) $limit : (int) $data['range_max'];
1761
- $excerpt_range_max = ((int) $limit != 0 && (int) $data['excerpt_range_max'] > (int) $limit) ? (int) $limit : (int) $data['excerpt_range_max'];
1762
- $new_template[$type] = array(
1763
- 'format' => (isset($data['format'])) ? $data['format'] : false,
1764
- 'content' => (isset($data['content'])) ? sanitize_textarea_field($data['content']) : unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['content'],
1765
- 'short_text' => array(
1766
- 'active' => 0,
1767
- 'range_min' => (($range_max >= (int) unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['short_text']['range_max']) ? (int) unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['short_text']['range_min'] : ($range_max / 2)),
1768
- 'range_max' => $range_max,
1769
- 'excerpt_range_min' => (($excerpt_range_max >= (int) unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['short_text']['excerpt_range_max']) ? (int) unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']][$type]['short_text']['excerpt_range_min'] : ($range_max / 2)),
1770
- 'excerpt_range_max' => $excerpt_range_max,
1771
- 'limit' => $limit
1772
- )
1773
- );
1774
- }
1775
-
1776
- $post_template[$_POST['networkId']] = $new_template;
1777
- $post_template_result = $options->_setOption("post_template", $post_template);
1778
- }
1779
-
1780
- if (((int) $_POST['networkId'] == 1 || (int) $_POST['networkId'] == 3 || (int) $_POST['networkId'] == 19) && isset($_POST['link_no_cache'])) {
1781
- $linkNoCache = B2S_Tools::getNoCacheData(B2S_PLUGIN_BLOG_USER_ID);
1782
- if(is_array($linkNoCache) && !empty($linkNoCache)) {
1783
- $linkNoCache[(int) $_POST['networkId']] = (int) $_POST['link_no_cache'];
1784
- $options->_setOption('link_no_cache', $linkNoCache);
1785
- $link_no_cache_option = true;
1786
- }
1787
- }
1788
-
1789
- if ($post_template_result == true || $link_no_cache_option == true) {
1790
- echo json_encode(array('result' => true));
1791
- wp_die();
1792
- } else {
1793
- echo json_encode(array('result' => false));
1794
- wp_die();
1795
- }
1796
- }
1797
-
1798
- echo json_encode(array('result' => false));
1799
- wp_die();
1800
- } else {
1801
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1802
- wp_die();
1803
- }
1804
- }
1805
-
1806
- public function loadDefaultPostTemplate() {
1807
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1808
- if (isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networkType']) && isset(unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']])) {
1809
- $default = unserialize(B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT)[$_POST['networkId']];
1810
- require_once B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php';
1811
- $networkItem = new B2S_Network_Item();
1812
- $html = $networkItem->getEditTemplateFormContent($_POST['networkId'], $_POST['networkType'], $default);
1813
- echo json_encode(array('result' => true, 'html' => $html));
1814
- wp_die();
1815
- }
1816
- echo json_encode(array('result' => false));
1817
- wp_die();
1818
- } else {
1819
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1820
- wp_die();
1821
- }
1822
- }
1823
-
1824
- public function saveDraftData() {
1825
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1826
- if (isset($_POST['post_id']) && (int) $_POST['post_id'] > 0) {
1827
- global $wpdb;
1828
- if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}b2s_posts_drafts'") == $wpdb->prefix . 'b2s_posts_drafts') {
1829
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
1830
- $optionUserTimeZone = $options->_getOption('user_time_zone');
1831
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
1832
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
1833
- $date = B2S_Util::getCustomLocaleDateTime($userTimeZoneOffset);
1834
-
1835
- $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']);
1836
- $draftEntry = $wpdb->get_var($sqlCheckDraft);
1837
- if ($draftEntry !== NULL && (int) $draftEntry > 0) {
1838
- $wpdb->update($wpdb->prefix . 'b2s_posts_drafts', array('data' => serialize($_POST), 'last_save_date' => $date), array('id' => (int) $draftEntry));
1839
- } else {
1840
- $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));
1841
- }
1842
-
1843
- echo json_encode(array('result' => true));
1844
- wp_die();
1845
- }
1846
- }
1847
- echo json_encode(array('result' => false));
1848
- wp_die();
1849
- } else {
1850
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1851
- wp_die();
1852
- }
1853
- }
1854
-
1855
- public function deleteDraft() {
1856
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1857
- if (isset($_POST['draftId']) && (int) $_POST['draftId'] > 0) {
1858
- global $wpdb;
1859
- $wpdb->delete($wpdb->prefix . 'b2s_posts_drafts', array('id' => (int) $_POST['draftId'], 'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID), array('%d', '%d'));
1860
- echo json_encode(array('result' => true));
1861
- wp_die();
1862
- }
1863
- echo json_encode(array('result' => false));
1864
- wp_die();
1865
- } else {
1866
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1867
- wp_die();
1868
- }
1869
- }
1870
-
1871
- public function authNetworkLogin() {
1872
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1873
- if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
1874
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Network/Pinterest.php');
1875
- $location = 'en';
1876
- if (isset($_POST['location']) && !empty($_POST['location'])) {
1877
- $location = $_POST['location'];
1878
- }
1879
- $pt = new B2S_Api_Network_Pinterest($location);
1880
- $authorize = $pt->authorize(sanitize_text_field($_POST['username']), sanitize_text_field($_POST['password']));
1881
- if (isset($authorize['error']) && (int) $authorize['error'] == 0 && isset($authorize['identData']) && !empty($authorize['identData'])) {
1882
- $getBoards = $pt->getPinBoards();
1883
- if (isset($getBoards['error']) && (int) $getBoards['error'] == 0 && isset($getBoards['data']) && !empty($getBoards['data'])) {
1884
- $html = '';
1885
- foreach ($getBoards['data'] as $k => $v) {
1886
- $html .= '<option value="' . esc_attr($v['board_id']) . '">' . esc_html($v['name']) . '</option>';
1887
- }
1888
- echo json_encode(array('result' => true, 'boards' => $html, 'identData' => base64_encode($authorize['identData'])));
1889
- wp_die();
1890
- }
1891
- if (isset($getBoards['error']) && (int) $getBoards['error'] == 3) {
1892
- echo json_encode(array('result' => false, 'error' => 'board'));
1893
- wp_die();
1894
- } elseif (isset($getBoards['error']) && (int) $getBoards['error'] == 2) {
1895
- echo json_encode(array('result' => false, 'error' => 'access'));
1896
- wp_die();
1897
- } else {
1898
- echo json_encode(array('result' => false, 'error' => ((isset($getBoards['error_code'])) ? $getBoards['error_code'] : '')));
1899
- wp_die();
1900
- }
1901
- } else {
1902
- echo json_encode(array('result' => false, 'error' => ((isset($authorize['error_code'])) ? $authorize['error_code'] : '')));
1903
- wp_die();
1904
- }
1905
- }
1906
- echo json_encode(array('result' => false));
1907
- wp_die();
1908
- } else {
1909
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1910
- wp_die();
1911
- }
1912
- }
1913
-
1914
- public function authNetworkConfirm() {
1915
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1916
- if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password']) && isset($_POST['boardId']) && !empty($_POST['boardId']) && isset($_POST['identData']) && !empty($_POST['identData'])) {
1917
- $mandantId = ((isset($_POST['mandantId']) && (int) $_POST['mandantId'] >= 0) ? $_POST['mandantId'] : 0);
1918
- $publicKey = B2S_PLUGIN_DIR . '/includes/B2S/Api/Network/public_key.pem';
1919
- if (function_exists('openssl_public_encrypt') && file_exists($publicKey)) {
1920
- $getPublicKey = file_get_contents($publicKey);
1921
- openssl_public_encrypt(sanitize_text_field($_POST['username']), $username, $getPublicKey);
1922
- openssl_public_encrypt(sanitize_text_field($_POST['password']), $password, $getPublicKey);
1923
- openssl_public_encrypt(sanitize_text_field($_POST['boardId']), $boardId, $getPublicKey);
1924
- $data = array('username' => base64_encode($username), 'password' => base64_encode($password), 'boardId' => base64_encode($boardId), 'identData' => sanitize_text_field(base64_decode($_POST['identData'])));
1925
- $postData = array('action' => 'authorizeNetwork', 'token' => B2S_PLUGIN_TOKEN, 'networkId' => 6, 'networkType' => 'profile', 'mandantId' => sanitize_text_field($mandantId), 'version' => B2S_PLUGIN_VERSION, 'data' => $data);
1926
- if (isset($_POST['networkAuthId']) && (int) $_POST['networkAuthId'] > 0) {
1927
- $postData = array_merge($postData, array('networkAuthId' => sanitize_text_field($_POST['networkAuthId'])));
1928
- }
1929
- $repsonse = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $postData, 15), true);
1930
- if (isset($repsonse['result']) && $repsonse['result'] != false && isset($repsonse['networkAuthId']) && (int) $repsonse['networkAuthId'] > 0) {
1931
- 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)));
1932
- wp_die();
1933
- } else {
1934
- if (isset($repsonse['error_reason']) && !empty($repsonse['error_reason'])) {
1935
- echo json_encode(array('result' => false, 'error' => $repsonse['error_reason']));
1936
- wp_die();
1937
- }
1938
- echo json_encode(array('result' => false));
1939
- wp_die();
1940
- }
1941
- }
1942
- }
1943
- echo json_encode(array('result' => false));
1944
- wp_die();
1945
- } else {
1946
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1947
- wp_die();
1948
- }
1949
- }
1950
-
1951
- public function changeFavoriteStatus() {
1952
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1953
- if (isset($_POST['postId']) && (int) $_POST['postId'] > 0 && isset($_POST['setStatus']) && (int) $_POST['setStatus'] >= 0) {
1954
- global $wpdb;
1955
- if ((int) $_POST['setStatus'] == 1) {
1956
- $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']);
1957
- $favoriteEntry = $wpdb->get_var($sqlCheckFavorite);
1958
- if ($favoriteEntry == NULL) {
1959
- $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')));
1960
- }
1961
- } else {
1962
- $wpdb->delete($wpdb->prefix . 'b2s_posts_favorites', array('blog_user_id' => B2S_PLUGIN_BLOG_USER_ID, 'post_id' => (int) $_POST['postId']), array('%d', '%d'));
1963
- }
1964
- echo json_encode(array('result' => true));
1965
- wp_die();
1966
- }
1967
- echo json_encode(array('result' => false));
1968
- wp_die();
1969
- } else {
1970
- echo json_encode(array('result' => false, 'error' => 'nonce'));
1971
- wp_die();
1972
- }
1973
- }
1974
-
1975
- public function saveUrlParameter() {
1976
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
1977
- if (isset($_POST['originNetworkAuthId']) && (int) $_POST['originNetworkAuthId'] > 0 && isset($_POST['networkId']) && (int) $_POST['networkId'] > 0 && isset($_POST['networks']) && !empty($_POST['networks']) && isset($_POST['urlParameter'])) {
1978
- $inputParams = json_decode(stripslashes_deep($_POST['urlParameter']), true);
1979
- if ($inputParams === false) {
1980
- echo json_encode(array('result' => false));
1981
- wp_die();
1982
- }
1983
- $newParams = array();
1984
- foreach ($inputParams as $key => $value) {
1985
- $key = urlencode(str_replace(" ", "", $key));
1986
- $value = urlencode($value);
1987
- $newParams[$key] = $value;
1988
- }
1989
- global $wpdb;
1990
- if (is_array($_POST['networks'])) {
1991
- foreach ($_POST['networks'] as $network) {
1992
- if (isset($network['networkAuthId']) && (int) $network['networkAuthId'] > 0) {
1993
- $sqlGetData = $wpdb->prepare("SELECT `id`, `data` FROM `{$wpdb->prefix}b2s_posts_network_details` WHERE `network_auth_id` = %d", (int) $network['networkAuthId']);
1994
- $result = $wpdb->get_results($sqlGetData);
1995
- if (!empty($result) && isset($result[0])) {
1996
- if ($result[0]->data !== NULL && !empty($result[0]->data)) {
1997
- $data = unserialize($result[0]->data);
1998
- if ($data != false && is_array($data)) {
1999
- $data['url_parameter'][0]['name'] = 'default';
2000
- $data['url_parameter'][0]['querys'] = $newParams;
2001
- } else {
2002
- $data = array('url_parameter' => array(0 => array('name' => 'default', 'querys' => $newParams)));
2003
- }
2004
- } else {
2005
- $data = array('url_parameter' => array(0 => array('name' => 'default', 'querys' => $newParams)));
2006
- }
2007
- $wpdb->update($wpdb->prefix . 'b2s_posts_network_details', array('data' => serialize($data)), array('network_auth_id' => (int) $network['networkAuthId']));
2008
- } else {
2009
- if (isset($network['networkId']) && isset($network['networkType']) && isset($network['networkAuthId']) && isset($network['displayName'])) {
2010
- $data = array('url_parameter' => array(0 => array('name' => 'default', 'querys' => $newParams)));
2011
- $wpdb->insert($wpdb->prefix . 'b2s_posts_network_details', array(
2012
- 'network_id' => (int) $network['networkId'],
2013
- 'network_type' => (int) $network['networkType'],
2014
- 'network_auth_id' => (int) $network['networkAuthId'],
2015
- 'network_display_name' => $network['displayName'],
2016
- 'data' => serialize($data)), array('%d', '%d', '%d', '%s', '%s')
2017
- );
2018
- }
2019
- }
2020
- }
2021
- }
2022
- }
2023
-
2024
- require_once (B2S_PLUGIN_DIR . 'includes/B2S/Network/Item.php');
2025
- $networkItem = new B2S_Network_Item();
2026
- $newHtml = $networkItem->getUrlParameterSettings((int) $_POST['originNetworkAuthId'], (int) $_POST['networkId']);
2027
- echo json_encode(array('result' => true, 'html' => $newHtml));
2028
- wp_die();
2029
- }
2030
- echo json_encode(array('result' => false));
2031
- wp_die();
2032
- } else {
2033
- echo json_encode(array('result' => false, 'error' => 'nonce'));
2034
- wp_die();
2035
- }
2036
- }
2037
-
2038
- public function rePostSubmit() {
2039
- if (isset($_POST['b2s_security_nonce']) && (int) wp_verify_nonce($_POST['b2s_security_nonce'], 'b2s_security_nonce') > 0) {
2040
- 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']])) {
2041
- $networkData = json_decode(base64_decode($_POST['b2s-re-post-profil-data-' . $_POST['b2s-re-post-profil-dropdown']]));
2042
- if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
2043
-
2044
- //Select Posts for Queue
2045
- $limit = 5;
2046
- $versionLimit = unserialize(B2S_PLUGIN_RE_POST_LIMIT);
2047
- if(isset($_POST['b2s-re-post-limit']) && (int) $_POST['b2s-re-post-limit'] >= 1) {
2048
- $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'];
2049
- if(isset($_POST['b2s-re-post-queue-count']) && (int) $_POST['b2s-re-post-queue-count'] >= 1) {
2050
- if((int) $_POST['b2s-re-post-queue-count'] + (int) $_POST['b2s-re-post-limit'] > (int) $versionLimit[B2S_PLUGIN_USER_VERSION]) {
2051
- $limit = (int) $versionLimit[B2S_PLUGIN_USER_VERSION] - (int) $_POST['b2s-re-post-queue-count'];
2052
- }
2053
- }
2054
- }
2055
- if($limit <= 0) {
2056
- echo json_encode(array('result' => false, 'error' => 'limit'));
2057
- wp_die();
2058
- }
2059
- global $wpdb;
2060
- $where = ' AND b2s.post_id IS NULL';
2061
- $join = " LEFT JOIN (SELECT 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.") AS b2s ON b2s.post_id = posts.ID";
2062
- if(isset($_POST['b2s-re-post-settings-option']) && (int) $_POST['b2s-re-post-settings-option'] == 1) {
2063
- //custom settings
2064
- //posttypes
2065
- 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'])) {
2066
- $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']) . "') ";
2067
- }
2068
- //author
2069
- 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'])) {
2070
- $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']) . "') ";
2071
- }
2072
- //Start/End Date
2073
- 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'])) {
2074
- //Case Startdate higher then Enddate => Switch Dates
2075
- if($_POST['b2s-re-post-date-start'] > $_POST['b2s-re-post-date-end']) {
2076
- $start = date('Y-m-d', strtotime($_POST['b2s-re-post-date-end']));
2077
- $end = date('Y-m-d', strtotime($_POST['b2s-re-post-date-start']));
2078
- } else {
2079
- $start = date('Y-m-d', strtotime($_POST['b2s-re-post-date-start']));
2080
- $end = date('Y-m-d', strtotime($_POST['b2s-re-post-date-end']));
2081
- }
2082
- $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' ";
2083
- $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 ');
2084
- $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') ";
2085
- }
2086
- //categories
2087
- 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'])) {
2088
- $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";
2089
- $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 ";
2090
- }
2091
- //include only favorites
2092
- if(isset($_POST['b2s-re-post-favorites-active']) && (int) $_POST['b2s-re-post-favorites-active'] == 1) {
2093
- $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 ";
2094
- $where .= " AND favorites.post_id IS NOT NULL ";
2095
- }
2096
- }
2097
-
2098
- $allowedPostTypes = get_post_types(array('public' => true));
2099
- $postTypeIn = "(";
2100
- foreach ($allowedPostTypes as $k => $v) {
2101
- $postTypeIn .= "'".$v."',";
2102
- }
2103
- $postTypeIn = substr($postTypeIn, 0, -1) . ")";
2104
-
2105
- $sql = "SELECT ID, post_title FROM $wpdb->posts as posts " . $join . " WHERE post_status = 'publish' AND post_type IN " . $postTypeIn . " " . $where;
2106
-
2107
- $sql .= " ORDER BY post_date ASC ";
2108
- $sql .= " LIMIT " . $limit;
2109
- $result = $wpdb->get_results($sql);
2110
- if(!is_array($result) || empty($result)) {
2111
- echo json_encode(array('result' => false, 'error' => 'no_content'));
2112
- wp_die();
2113
- } else {
2114
- //Time Settings
2115
- if (isset($_POST['b2s-re-post-share-option'])) {
2116
- $options = new B2S_Options(B2S_PLUGIN_BLOG_USER_ID);
2117
- $bestTimes = array();
2118
- if (isset($_POST['b2s-re-post-best-times-active']) && (int) $_POST['b2s-re-post-best-times-active'] > 0) {
2119
- $bestTimes = $options->_getOption('auth_sched_time');
2120
- }
2121
- $optionUserTimeZone = $options->_getOption('user_time_zone');
2122
- $userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
2123
- $userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
2124
- $userLang = (isset($_POST['b2s-user-lang']) && $_POST['b2s-user-lang'] != 'en') ? $_POST['b2s-user-lang'] : 'en';
2125
- $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'] : '';
2126
- require_once(B2S_PLUGIN_DIR . 'includes/B2S/RePost/Save.php');
2127
-
2128
- if ((int) $_POST['b2s-re-post-share-option'] < 1) {
2129
- //share every x days at [Mo][Thu]...
2130
- $shareOptionType = 0;
2131
- $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);
2132
- $weekday = array(
2133
- 0 => ((isset($_POST['b2s-re-post-weekday-0']) && (int) $_POST['b2s-re-post-weekday-0'] >= 1) ? true : false), //Sun
2134
- 1 => ((isset($_POST['b2s-re-post-weekday-1']) && (int) $_POST['b2s-re-post-weekday-1'] >= 1) ? true : false), //Mon
2135
- 2 => ((isset($_POST['b2s-re-post-weekday-2']) && (int) $_POST['b2s-re-post-weekday-2'] >= 1) ? true : false), //Tue
2136
- 3 => ((isset($_POST['b2s-re-post-weekday-3']) && (int) $_POST['b2s-re-post-weekday-3'] >= 1) ? true : false), //Wed
2137
- 4 => ((isset($_POST['b2s-re-post-weekday-4']) && (int) $_POST['b2s-re-post-weekday-4'] >= 1) ? true : false), //Thu
2138
- 5 => ((isset($_POST['b2s-re-post-weekday-5']) && (int) $_POST['b2s-re-post-weekday-5'] >= 1) ? true : false), //Fri
2139
- 6 => ((isset($_POST['b2s-re-post-weekday-6']) && (int) $_POST['b2s-re-post-weekday-6'] >= 1) ? true : false) //Sat
2140
- );
2141
- $timeInput = (isset($_POST['b2s-re-post-input-time-0']) && !empty($_POST['b2s-re-post-input-time-0'])) ? $_POST['b2s-re-post-input-time-0'] : '';
2142
- } else {
2143
- //share every x [Monday]
2144
- $shareOptionType = 1;
2145
- $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);
2146
- $weekday = (isset($_POST['b2s-re-post-weekday-select']) && !empty($_POST['b2s-re-post-weekday-select'])) ? $_POST['b2s-re-post-weekday-select'] : 'monday';
2147
- $timeInput = (isset($_POST['b2s-re-post-input-time-1']) && !empty($_POST['b2s-re-post-input-time-1