Blog2Social: Social Media Auto Post & Scheduler - Version 5.7.0

Version Description

Save your social media posts as drafts

Download this release

Release Info

Developer Blog2Social
Plugin Icon 128x128 Blog2Social: Social Media Auto Post & Scheduler
Version 5.7.0
Comparing to
See all releases

Code changes from version 5.6.1 to 5.7.0

Files changed (45) hide show
  1. assets/css/b2s/network.css +57 -2
  2. assets/css/b2s/post.draft.css +3 -0
  3. assets/css/b2s/ship.css +31 -19
  4. assets/css/general.css +8 -0
  5. assets/images/settings/b2s-post-format-19-1-de.png +0 -0
  6. assets/images/settings/b2s-post-format-19-1-en.png +0 -0
  7. assets/images/settings/b2s-post-format-19-2-de.png +0 -0
  8. assets/images/settings/b2s-post-format-19-2-en.png +0 -0
  9. assets/images/settings/like-icons-19.png +0 -0
  10. assets/js/b2s/calendar.js +693 -653
  11. assets/js/b2s/curation.draft.js +51 -0
  12. assets/js/b2s/general.js +3 -0
  13. assets/js/b2s/network.js +2 -0
  14. assets/js/b2s/post.js +958 -888
  15. assets/js/b2s/ship.js +3476 -3143
  16. blog2social.php +3 -3
  17. includes/Ajax/Get.php +578 -543
  18. includes/Ajax/Post.php +73 -17
  19. includes/B2S/AutoPost.php +277 -279
  20. includes/B2S/Calendar/Item.php +1 -1
  21. includes/B2S/Curation/View.php +1 -1
  22. includes/B2S/Network/Item.php +53 -2
  23. includes/B2S/Post/Filter.php +2 -2
  24. includes/B2S/Post/Item.php +60 -9
  25. includes/B2S/PostBox.php +1 -1
  26. includes/B2S/Settings/Item.php +2 -2
  27. includes/B2S/Ship/Item.php +71 -53
  28. includes/B2S/Ship/Navbar.php +22 -11
  29. includes/Loader.php +1549 -1511
  30. includes/System.php +40 -0
  31. includes/Tools.php +4 -0
  32. languages/blog2social-de_DE.mo +0 -0
  33. languages/blog2social-de_DE.po +385 -345
  34. languages/blog2social.pot +347 -300
  35. readme.txt +7 -2
  36. views/b2s/curation.draft.php +22 -1
  37. views/b2s/dashboard.php +25 -21
  38. views/b2s/html/header.phtml +111 -94
  39. views/b2s/html/post.navbar.phtml +2 -1
  40. views/b2s/html/sidebar.phtml +73 -52
  41. views/b2s/html/sidebar.ship.phtml +35 -22
  42. views/b2s/network.php +1 -1
  43. views/b2s/post.draft.php +85 -0
  44. views/b2s/premium.php +154 -150
  45. views/b2s/ship.php +600 -566
assets/css/b2s/network.css CHANGED
@@ -169,8 +169,8 @@ ul.b2s-network-item-auth-list li:last-child{
169
font: 18px/1 Arial,sans-serif;
170
font-weight: 700;
171
line-height: 30px;
172
- padding: 0 2px
173
- ;min-width: 28px;
174
text-align: center;
175
border: 0 !important;
176
width: 2% !important;
@@ -548,4 +548,59 @@ ul.b2s-network-item-auth-list li:last-child{
548
}
549
.b2s-info-character-limit-text{
550
margin: 0 0 10px;
551
}
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;
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
}
assets/css/b2s/post.draft.css ADDED
@@ -0,0 +1,3 @@
1
+ .deleteDraftBtn {
2
+ margin-right: 10px;
3
+ }
assets/css/b2s/ship.css CHANGED
@@ -1,4 +1,4 @@
1
- /** Navbar */
2
#b2s-wrapper {
3
padding-right: 0;
4
-webkit-transition: all 0.5s ease;
@@ -24,10 +24,10 @@
24
width: 100% !important;
25
}
26
.b2s-network-thumb{
27
- width:20% !important;
28
}
29
.b2s-network-details{
30
- width: 60% !important;
31
}
32
.b2s-network-status{
33
width: 15% !important;
@@ -50,7 +50,7 @@
50
}
51
52
.b2s-network-details-legend{
53
- color:#FFFFFF;
54
text-align: center;
55
opacity: 0.6;
56
}
@@ -246,7 +246,7 @@
246
color: #fff;
247
font-weight: 400;
248
text-transform: uppercase;
249
- margin-top:3px;
250
margin-bottom: 5px;
251
}
252
@@ -277,7 +277,7 @@
277
float: left;
278
}
279
.b2s-post-item-thumb{
280
- width: 5%;
281
margin-right: 8px;
282
}
283
@@ -312,7 +312,7 @@
312
}
313
.b2s-post-item-details p{
314
font-size: 12px;
315
- margin: 0px 3px;
316
317
}
318
@@ -331,7 +331,7 @@
331
332
.b2s-post-item-details-item-message-input-allow-html{
333
min-height: 200px;
334
- }
335
.b2s-post-item-message-info{
336
margin-left:15px !important;
337
font-weight: 600;
@@ -357,7 +357,7 @@
357
358
.b2s-no-image-area{
359
margin-left: 15px;
360
- }
361
.b2s-no-image-area-text{
362
font-size: 12px;
363
margin-left: 2px;
@@ -392,7 +392,7 @@
392
}
393
.b2s-post-item-details-release-area{
394
float: left;
395
- width: 100%;
396
}
397
398
.b2s-post-item-details-release-area-details, .b2s-post-item-relay-area-details{
@@ -400,7 +400,7 @@
400
width: 100%;
401
}
402
.b2s-post-item-details-release-input-daySelect input{
403
- margin-right: 15px;
404
}
405
406
.b2s-post-item-details-tag-input{
@@ -513,7 +513,7 @@ input[type="checkbox"], input[type="radio"] {
513
margin:0px 4px 0px 4px;
514
}
515
.ad-tag-btn:hover,.remove-tag-btn:hover{
516
- color:#000;
517
}
518
519
.b2s-post-details{
@@ -663,7 +663,7 @@ input[type="checkbox"], input[type="radio"] {
663
}
664
665
.xing-url-title{
666
- margin-top: 0px;
667
margin-bottom: 4px;
668
font-size: 18px;
669
font-weight: normal;
@@ -759,17 +759,17 @@ input[type="checkbox"], input[type="radio"] {
759
margin-right: 5px !important;
760
}
761
.b2s-img-required{
762
- border-color: #d9534f !important;
763
}
764
.b2s-post-item-details-url-image{
765
cursor: pointer;
766
}
767
768
- .b2s-user-network-settings-post-format-area label > input{
769
- visibility: hidden;
770
- position: absolute;
771
}
772
- .b2s-user-network-settings-post-format-area label > input + img{
773
cursor:pointer;
774
border:2px solid transparent;
775
}
@@ -832,4 +832,16 @@ input[type="number"]{
832
833
.b2s-sidebar-menu-item{
834
font-weight: 600 !important;
835
- }
1
+ /** Navbar */
2
#b2s-wrapper {
3
padding-right: 0;
4
-webkit-transition: all 0.5s ease;
24
width: 100% !important;
25
}
26
.b2s-network-thumb{
27
+ width:20% !important;
28
}
29
.b2s-network-details{
30
+ width: 60% !important;
31
}
32
.b2s-network-status{
33
width: 15% !important;
50
}
51
52
.b2s-network-details-legend{
53
+ color:#FFFFFF;
54
text-align: center;
55
opacity: 0.6;
56
}
246
color: #fff;
247
font-weight: 400;
248
text-transform: uppercase;
249
+ margin-top:3px;
250
margin-bottom: 5px;
251
}
252
277
float: left;
278
}
279
.b2s-post-item-thumb{
280
+ width: 5%;
281
margin-right: 8px;
282
}
283
312
}
313
.b2s-post-item-details p{
314
font-size: 12px;
315
+ margin: 0px 3px;
316
317
}
318
331
332
.b2s-post-item-details-item-message-input-allow-html{
333
min-height: 200px;
334
+ }
335
.b2s-post-item-message-info{
336
margin-left:15px !important;
337
font-weight: 600;
357
358
.b2s-no-image-area{
359
margin-left: 15px;
360
+ }
361
.b2s-no-image-area-text{
362
font-size: 12px;
363
margin-left: 2px;
392
}
393
.b2s-post-item-details-release-area{
394
float: left;
395
+ width: 100%;
396
}
397
398
.b2s-post-item-details-release-area-details, .b2s-post-item-relay-area-details{
400
width: 100%;
401
}
402
.b2s-post-item-details-release-input-daySelect input{
403
+ margin-right: 15px;
404
}
405
406
.b2s-post-item-details-tag-input{
513
margin:0px 4px 0px 4px;
514
}
515
.ad-tag-btn:hover,.remove-tag-btn:hover{
516
+ color:#000;
517
}
518
519
.b2s-post-details{
663
}
664
665
.xing-url-title{
666
+ margin-top: 0px;
667
margin-bottom: 4px;
668
font-size: 18px;
669
font-weight: normal;
759
margin-right: 5px !important;
760
}
761
.b2s-img-required{
762
+ border-color: #d9534f !important;
763
}
764
.b2s-post-item-details-url-image{
765
cursor: pointer;
766
}
767
768
+ .b2s-user-network-settings-post-format-area label > input{
769
+ visibility: hidden;
770
+ position: absolute;
771
}
772
+ .b2s-user-network-settings-post-format-area label > input + img{
773
cursor:pointer;
774
border:2px solid transparent;
775
}
832
833
.b2s-sidebar-menu-item{
834
font-weight: 600 !important;
835
+ }
836
+
837
+ .b2s-submit-btn {
838
+ margin-left: 5px;
839
+ }
840
+
841
+ .b2s-loader-btn-ship{
842
+ height: 24px;
843
+ width: 24px;
844
+ margin-top: -10px !important;
845
+ margin-bottom: -6px !important;
846
+ display: none;
847
+ }
assets/css/general.css CHANGED
@@ -7589,4 +7589,12 @@ CSS CheckBOX
7589
7590
.b2s-padding-bottom-5{
7591
padding-bottom: 5px;
7592
}
7589
7590
.b2s-padding-bottom-5{
7591
padding-bottom: 5px;
7592
+ }
7593
+
7594
+ .b2s-left-border-success {
7595
+ border-left: 4px solid #79B232;
7596
+ }
7597
+
7598
+ .b2s-left-border-danger {
7599
+ border-left: 4px solid #a94442;
7600
}
assets/images/settings/b2s-post-format-19-1-de.png ADDED
Binary file
assets/images/settings/b2s-post-format-19-1-en.png ADDED
Binary file
assets/images/settings/b2s-post-format-19-2-de.png ADDED
Binary file
assets/images/settings/b2s-post-format-19-2-en.png ADDED
Binary file
assets/images/settings/like-icons-19.png ADDED
Binary file
assets/js/b2s/calendar.js CHANGED
@@ -1,653 +1,693 @@
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';
5
- var newSource = new Array();
6
-
7
- jQuery(document).ready(function () {
8
- jQuery('#b2s_calendar').fullCalendar({
9
- editable: b2s_has_premium,
10
- locale: b2s_calendar_locale,
11
- eventLimit: 2,
12
- timeFormat: 'H:mm',
13
- eventSources: [curSource[0]],
14
- eventRender: function (event, element) {
15
- show = true;
16
- $header = jQuery("<div>").addClass("b2s-calendar-header").attr('data-b2s-id', event.b2s_id);
17
- $isRelayPost = '';
18
- $isCuratedPost = '';
19
- if (event.post_type == 'b2s_ex_post') {
20
- $isCuratedPost = ' (Curated Post)';
21
- }
22
- if (event.relay_primary_post_id > 0) {
23
- $isRelayPost = ' (Retweet)';
24
- }
25
- $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
26
- element.find(".fc-time").after($network_name);
27
- element.html(element.html());
28
- $parent = element.parent();
29
- $header.append(element.find(".fc-content"));
30
- element.append($header);
31
- $body = jQuery("<div>").addClass("b2s-calendar-body");
32
- $body.append(event.avatar);
33
- if (event.status == "error") {
34
- $body.append(jQuery('<i>').addClass('glyphicon glyphicon-warning-sign glyphicon-danger'));
35
- }
36
- $body.append(element.find(".fc-title"));
37
- $body.append(jQuery("<br>"));
38
- var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
39
- $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;' />")
40
- $em.append(event.network_name);
41
- $em.append(jQuery("<span>").text(": " + event.profile));
42
- $body.append($em);
43
- element.append($body);
44
- if (event.status != "scheduled") {
45
- event.editable = false;
46
- }
47
- },
48
- dayRender: function (date, element) {
49
- //TODO state to load
50
- if (!jQuery(element[0]).hasClass('fc-past')) {
51
- var date = jQuery(element[0]).attr('data-date');
52
- var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
53
- $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddPost").val() + "</span>").addClass("b2s-calendar-sched-new-post-btn").attr('href', '#');
54
- sel_element.append($header);
55
- }
56
- },
57
- eventDrop: function (event, delta, revertFunc) {
58
- jQuery.ajax({
59
- url: ajaxurl,
60
- type: "POST",
61
- dataType: "json",
62
- cache: false,
63
- data: {
64
- 'action': 'b2s_calendar_move_post',
65
- 'b2s_id': event.b2s_id,
66
- 'user_timezone': event.user_timezone,
67
- 'sched_date': event.start.format(),
68
- 'post_for_relay': event.post_for_relay,
69
- 'post_for_approve': event.post_for_approve,
70
- 'network_type': event.network_type,
71
- 'nework_id': event.network_id
72
- },
73
- success: function (data) {
74
- refreshCalender();
75
- wp.heartbeat.connectNow();
76
- }
77
- });
78
- },
79
- eventAllow: function (dropLocation, draggedEvent) {
80
- return dropLocation.start.isAfter(b2s_calendar_date) && draggedEvent.start.isAfter(b2s_calendar_datetime);
81
- },
82
- eventClick: function (calEvent, jsEvent, view) {
83
- if (calEvent.status == "scheduled") {
84
- 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);
85
- } else {
86
- if (calEvent.publish_link != "") {
87
- window.open(calEvent.publish_link, '_blank');
88
- }
89
- }
90
- },
91
- loading: function (bool) {
92
- if (!bool) {
93
- //Routing from Dashboard - loading edit post preview
94
- var rfd = jQuery('#b2s_rfd').val();
95
- if (rfd == 1) {
96
- jQuery('#b2s_rfd').val("0");
97
- jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
98
- }
99
- }
100
- }
101
-
102
- });
103
- jQuery(".b2s-loading-area").hide();
104
- });
105
-
106
-
107
- function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
108
- if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
109
- {
110
- jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
111
- }
112
- b2s_current_post_id = post_id;
113
- jQuery("#b2sPostId").val(post_id);
114
- var $modal = jQuery("<div>");
115
- jQuery.ajax({
116
- url: ajaxurl,
117
- type: "POST",
118
- cache: false,
119
- async: false,
120
- data: {
121
- 'action': 'b2s_get_post_edit_modal',
122
- 'id': b2s_id
123
- },
124
- success: function (data) {
125
- $modal = $modal.html(data);
126
- }
127
- });
128
- jQuery("body").append($modal);
129
- jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
130
- jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
131
- activatePortal(network_auth_id);
132
- initSceditor(network_auth_id);
133
- networkCount(network_auth_id);
134
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
135
- var postFormatText = b2s_calendar_formats;
136
- var isSetPostFormat = false;
137
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
138
- //is set post format => override current condidtions by user settings for this post
139
- if (post_format !== null) {
140
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
141
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
142
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
143
- //edit modal select post format
144
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
145
- 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');
146
- } else {
147
- 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()]);
148
- 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());
149
- }
150
-
151
- //if linkpost then show btn meta tags
152
- var isMetaChecked = false;
153
- if (network_id == "1" && jQuery('#isOgMetaChecked').val() == "1") {
154
- isMetaChecked = true;
155
- }
156
- if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
157
- isMetaChecked = true;
158
- }
159
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
160
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
161
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
162
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
163
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
164
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
165
- if (dataMetaType == "og") {
166
- jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
167
- } else {
168
- jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
169
- }
170
-
171
-
172
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
173
- if (network_id == 1 && network_type == 0) {
174
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
175
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').show();
176
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').show();
177
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
178
- }
179
-
180
-
181
- } else {
182
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
183
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
184
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
185
-
186
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
187
- if (network_id == 1 && network_type == 0) {
188
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
189
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').hide();
190
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').hide();
191
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
192
- }
193
- }
194
-
195
- //Content Curation
196
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
197
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
198
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
199
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
200
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
201
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
202
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
203
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
204
- } else {
205
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
206
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
207
- }
208
- }
209
-
210
- }
211
- var today = new Date();
212
- var dateFormat = "yyyy-mm-dd";
213
- var language = "en";
214
- var showMeridian = true;
215
- if (jQuery('#b2sUserLang').val() == "de") {
216
- dateFormat = "dd.mm.yyyy";
217
- language = "de";
218
- showMeridian = false;
219
- }
220
-
221
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
222
- format: dateFormat,
223
- language: language,
224
- maxViewMode: 2,
225
- todayHighlight: true,
226
- startDate: today,
227
- calendarWeeks: true,
228
- autoclose: true
229
- });
230
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
231
- minuteStep: 15,
232
- appendWidgetTo: 'body',
233
- showSeconds: false,
234
- showMeridian: showMeridian,
235
- defaultTime: 'current',
236
- snapToStep: true
237
- });
238
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
239
- checkSchedDateTime(network_auth_id);
240
- });
241
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
242
- checkSchedDateTime(network_auth_id);
243
- });
244
- init();
245
-
246
- //is relay post?
247
- if (relay_primary_post_id > 0) {
248
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
249
- 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')) {
250
- jQuery(this).prop("disabled", true);
251
- }
252
- });
253
- }
254
-
255
- if (!b2s_has_premium)
256
- {
257
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
258
- if (!jQuery(this).hasClass('b2s-modal-close')) {
259
- jQuery(this).prop("disabled", true);
260
- }
261
- });
262
- }
263
- }
264
-
265
- jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
266
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
267
- newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=' + filter_status;
268
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
269
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
270
- curSource[0] = newSource[0];
271
-
272
- jQuery('.b2s-calendar-filter-network-account-list').html("");
273
- jQuery('.b2s-calendar-filter-network-account-list').hide();
274
- if (jQuery(this).val() != 'all') {
275
- jQuery.ajax({
276
- url: ajaxurl,
277
- type: "POST",
278
- dataType: "json",
279
- cache: false,
280
- async: false,
281
- data: {
282
- 'action': 'b2s_get_calendar_filter_network_auth',
283
- 'network_id': jQuery(this).val()
284
- },
285
- success: function (data) {
286
- if (data.result == true) {
287
- jQuery(".b2s-calendar-filter-network-account-list").show();
288
- jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
289
- }
290
- }
291
- });
292
- }
293
- return false;
294
- });
295
-
296
-
297
- jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
298
- var filter_network_details_auth_id = jQuery(this).val();
299
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
300
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
301
- 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;
302
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
303
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
304
- curSource[0] = newSource[0];
305
-
306
- return false;
307
-
308
- });
309
-
310
- jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
311
- var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
312
- var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
313
- if (typeof filter_network_details_auth_id == 'undefined') {
314
- filter_network_details_auth_id = 'all';
315
- }
316
- var filter_status = jQuery('#b2s-calendar-filter-status').val();
317
- 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;
318
- jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
319
- jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
320
- curSource[0] = newSource[0];
321
-
322
- return false;
323
-
324
- });
325
-
326
-
327
- //Modal Edit Post close
328
- jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
329
- jQuery(jQuery(this).attr('data-modal-name')).remove();
330
- return false;
331
- });
332
-
333
-
334
- jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
335
- jQuery('#b2sPagination').val("1");
336
- b2sSortFormSubmit();
337
- return false;
338
- });
339
-
340
- jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
341
- if (event.keyCode == 13) { //Hide Enter
342
- return false;
343
- }
344
- });
345
-
346
- jQuery(document).on('click', '.b2s-pagination-btn', function () {
347
- jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
348
- b2sSortFormSubmit();
349
- return false;
350
- });
351
-
352
- jQuery(document).on('change', '.b2s-select', function () {
353
- jQuery('#b2sPagination').val("1");
354
- b2sSortFormSubmit();
355
- return false;
356
- });
357
-
358
- jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
359
- jQuery('#b2sPagination').val("1");
360
- jQuery('#b2sSortPostTitle').val("");
361
- jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
362
- jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
363
- jQuery('#b2sSortPostType').prop('selectedIndex', 0);
364
- jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
365
- jQuery('#b2sShowByDate').val("");
366
- jQuery('#b2sUserAuthId').val("");
367
- jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
368
- jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
369
- b2sSortFormSubmit();
370
- return false;
371
- });
372
-
373
- jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
374
- if (jQuery('#user_version').val() == 0) {
375
- jQuery('#b2s-sched-post-modal').modal('show');
376
- return false;
377
- }
378
- jQuery('#b2s-show-post-type-modal').modal('show');
379
- var selSchedDate = jQuery(this).parent('td').attr('data-date');
380
- jQuery('#b2sSelSchedDate').val(selSchedDate);
381
- return false;
382
- });
383
-
384
- jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
385
- jQuery('#b2s-show-post-type-modal').modal('hide');
386
- jQuery('#b2s-show-post-all-modal').modal('show');
387
- if (!jQuery('#b2sSelSchedDate').length > 0) {
388
- jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
389
- }
390
- b2sSortFormSubmit();
391
- return false;
392
- });
393
-
394
- jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
395
- window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
396
- return false;
397
- });
398
-
399
- function showFilter(typ) {
400
- if (typ == 'show') {
401
- jQuery('.filterShow').hide();
402
- jQuery('.form-inline').show();
403
- jQuery('.filterHide').show();
404
- } else {
405
- jQuery('.filterShow').show();
406
- jQuery('.form-inline').hide();
407
- jQuery('.filterHide').hide();
408
- }
409
- }
410
-
411
- //b2sSortForm
412
- function b2sSortFormSubmit() {
413
- jQuery(".b2s-loading-area").show();
414
- jQuery('.b2s-sort-result-item-area').html('');
415
- jQuery('.b2s-sort-pagination-area').html('');
416
-
417
- var data = {
418
- 'action': 'b2s_sort_data',
419
- 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
420
- 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
421
- 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
422
- 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
423
- 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
424
- 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
425
- 'b2sType': jQuery('#b2sType').val(),
426
- 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
427
- 'b2sPagination': jQuery('#b2sPagination').val(),
428
- 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
429
- 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
430
- 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
431
- 'b2sUserLang': jQuery('#b2sUserLang').val(),
432
- 'b2sSchedDate': jQuery('#b2sSelSchedDate').val()
433
- };
434
-
435
- if (jQuery('#b2sPostsPerPage').length > 0) {
436
- data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
437
- }
438
-
439
- jQuery.ajax({
440
- url: ajaxurl,
441
- type: "POST",
442
- dataType: "json",
443
- cache: false,
444
- data: data,
445
- error: function () {
446
- jQuery('.b2s-server-connection-fail').show();
447
- return false;
448
- },
449
- success: function (data) {
450
- if (typeof data === 'undefined' || data === null) {
451
- jQuery('.b2s-server-connection-fail').show();
452
- return false;
453
- }
454
- if (data.result == true) {
455
- jQuery('.b2s-loading-area').hide();
456
- jQuery('.b2s-sort-result-item-area').html(data.content).show();
457
- jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
458
- } else {
459
- jQuery('.b2s-server-connection-fail').show();
460
- return false;
461
- }
462
- }
463
- });
464
- return false;
465
- }
466
- //Overlay second modal
467
- jQuery('#b2s-show-post-type-modal').on('hidden.bs.modal', function () {
468
- jQuery('body').addClass('modal-open');
469
- });
470
-
471
- //Overlay second modal
472
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
473
- jQuery('body').addClass('modal-open');
474
- });
475
-
476
- //Overlay second modal
477
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
478
- jQuery('body').addClass('modal-open');
479
- });
480
-
481
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
482
- jQuery('.b2s-network-select-image-content').html("");
483
- jQuery.ajax({
484
- url: ajaxurl,
485
- type: "POST",
486
- cache: false,
487
- async: false,
488
- data: {
489
- 'action': 'b2s_get_image_modal',
490
- 'id': jQuery(this).data('post-id'),
491
- 'image_url': jQuery(this).data('image-url')
492
- },
493
- success: function (data) {
494
- jQuery(".b2s-network-select-image-content").html(data);
495
- }
496
- });
497
- var authId = jQuery(this).data('network-auth-id');
498
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
499
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
500
- 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();
501
- jQuery('.b2s-selected-network-for-image-info').html(content);
502
- jQuery('#b2sInsertImageType').val("0");
503
- jQuery('.networkImage').each(function () {
504
- var width = this.naturalWidth;
505
- var height = this.naturalHeight;
506
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
507
- });
508
- jQuery('#b2s-network-select-image').modal('show');
509
- return false;
510
- });
511
- jQuery(document).on("click", ".b2s-edit-post-delete", function () {
512
- var id = jQuery(this).data("b2s-id");
513
- var post_id = jQuery(this).data("post-id");
514
- var post_for_relay = jQuery(this).data("data-post-for-relay");
515
- var post_for_approve = jQuery(this).data("data-post-for-approve");
516
- jQuery.ajax({
517
- url: ajaxurl,
518
- type: "POST",
519
- dataType: "json",
520
- cache: false,
521
- data: {
522
- 'action': 'b2s_delete_post',
523
- 'b2s_id': id,
524
- 'post_id': post_id,
525
- 'post_for_relay': post_for_relay,
526
- 'post_for_approve': post_for_approve
527
- },
528
- success: function (data) {
529
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
530
- refreshCalender();
531
- wp.heartbeat.connectNow();
532
- }
533
- });
534
- });
535
-
536
- /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
537
- jQuery('#save_method').val("apply-all");
538
- e.preventDefault();
539
- var id = jQuery(this).data("b2s-id");
540
- jQuery.ajax({
541
- url: ajaxurl,
542
- type: "POST",
543
- dataType: "json",
544
- cache: false,
545
- data: jQuery(this).closest("form").serialize(),
546
- success: function (data) {
547
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
548
- refreshCalender();
549
- jQuery('#b2s-edit-event-modal-' + id).remove();
550
- wp.heartbeat.connectNow();
551
- }
552
- });
553
- });*/
554
-
555
- jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
556
- e.preventDefault();
557
- jQuery('#save_method').val("apply-this");
558
- var id = jQuery(this).data("b2s-id");
559
- jQuery.ajax({
560
- url: ajaxurl,
561
- type: "POST",
562
- dataType: "json",
563
- cache: false,
564
- data: jQuery(this).closest("form").serialize(),
565
- success: function (data) {
566
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
567
- refreshCalender();
568
- jQuery('#b2s-edit-event-modal-' + id).remove();
569
- jQuery('body').removeClass('modal-open');
570
- jQuery('body').removeAttr('style');
571
- wp.heartbeat.connectNow();
572
- }
573
- });
574
- });
575
- jQuery(document).on("click", ".release_locks", function () {
576
- jQuery.ajax({
577
- url: ajaxurl,
578
- type: "POST",
579
- cache: false,
580
- async: false,
581
- data: {
582
- 'action': 'b2s_get_calendar_release_locks',
583
- 'post_id': jQuery('#post_id').val()
584
- },
585
- success: function (data) {
586
- wp.heartbeat.connectNow();
587
- }
588
- });
589
- });
590
- function refreshCalender() {
591
- jQuery('#b2s_calendar').fullCalendar('refetchEvents');
592
- }
593
-
594
- jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
595
- jQuery('body').addClass('modal-open');
596
- });
597
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
598
- jQuery('body').addClass('modal-open');
599
- });
600
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
601
- jQuery('body').addClass('modal-open');
602
- });
603
- jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
604
- jQuery('body').addClass('modal-open');
605
- });
606
- //jQuery(this).attr('data-network-auth-id')
607
- function checkSchedDateTime(dataNetworkAuthId) {
608
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
609
- var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
610
- var dateStr = jQuery(dateElement).val();
611
- var minStr = jQuery(timeElement).val();
612
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
613
- if (jQuery('#b2sUserLang').val() == 'de') {
614
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
615
- } else {
616
- var minParts = minStr.split(' ');
617
- var minParts2 = minParts[0].split(':');
618
- if (minParts[1] == 'PM') {
619
- minParts2[0] = parseInt(minParts2[0]) + 12;
620
- }
621
- minStr = minParts2[0] + ':' + minParts2[1];
622
- }
623
-
624
- var minParts3 = minStr.split(':');
625
- if (minParts3[0] < 10) {
626
- minParts3[0] = '0' + minParts3[0];
627
- }
628
- var dateParts = dateStr.split('-');
629
- //utc current time
630
- var now = new Date();
631
- //offset between utc und user
632
- var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
633
- //enter hour to user time
634
- var hour = parseInt(minParts3[0]) + timeZone + offset;
635
- //calculate datetime in utc
636
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
637
- //compare enter date time with allowed user time
638
- if (enter.getTime() < now.getTime()) {
639
- //enter set on next 15 minutes and calculate on user timezone
640
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
641
- jQuery(dateElement).datepicker('update', enter);
642
- jQuery(timeElement).timepicker('setTime', enter);
643
- }
644
- }
645
-
646
-
647
- function printDateFormat(dataNetworkAuthId) {
648
- var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
649
- var dateStr = jQuery(dateElement).val();
650
- dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
651
- jQuery(dateElement).val(dateStr);
652
- }
653
-
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';
5
+ var newSource = new Array();
6
+
7
+ jQuery(document).ready(function () {
8
+ jQuery('#b2s_calendar').fullCalendar({
9
+ editable: b2s_has_premium,
10
+ locale: b2s_calendar_locale,
11
+ eventLimit: 2,
12
+ timeFormat: 'H:mm',
13
+ eventSources: [curSource[0]],
14
+ eventRender: function (event, element) {
15
+ show = true;
16
+ $header = jQuery("<div>").addClass("b2s-calendar-header").attr('data-b2s-id', event.b2s_id);
17
+ $isRelayPost = '';
18
+ $isCuratedPost = '';
19
+ if (event.post_type == 'b2s_ex_post') {
20
+ $isCuratedPost = ' (Curated Post)';
21
+ }
22
+ if (event.relay_primary_post_id > 0) {
23
+ $isRelayPost = ' (Retweet)';
24
+ }
25
+ $network_name = jQuery("<span>").text(event.author + $isRelayPost + $isCuratedPost).addClass("network-name").css("display", "block");
26
+ element.find(".fc-time").after($network_name);
27
+ element.html(element.html());
28
+ $parent = element.parent();
29
+ $header.append(element.find(".fc-content"));
30
+ element.append($header);
31
+ $body = jQuery("<div>").addClass("b2s-calendar-body");
32
+ $body.append(event.avatar);
33
+ if (event.status == "error") {
34
+ $body.append(jQuery('<i>').addClass('glyphicon glyphicon-warning-sign glyphicon-danger'));
35
+ }
36
+ $body.append(element.find(".fc-title"));
37
+ $body.append(jQuery("<br>"));
38
+ var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
39
+ $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;' />")
40
+ $em.append(event.network_name);
41
+ $em.append(jQuery("<span>").text(": " + event.profile));
42
+ $body.append($em);
43
+ element.append($body);
44
+ if (event.status != "scheduled") {
45
+ event.editable = false;
46
+ }
47
+ },
48
+ dayRender: function (date, element) {
49
+ //TODO state to load
50
+ if (!jQuery(element[0]).hasClass('fc-past')) {
51
+ var date = jQuery(element[0]).attr('data-date');
52
+ var sel_element = jQuery(element[0]).closest('div').next('div').find('td[data-date="' + date + '"]');
53
+ $header = jQuery("<a>").html("+ <span class=\"hidden-sm hidden-xs\">" + jQuery("#b2sJSTextAddPost").val() + "</span>").addClass("b2s-calendar-sched-new-post-btn").attr('href', '#');
54
+ sel_element.append($header);
55
+ }
56
+ },
57
+ eventDrop: function (event, delta, revertFunc) {
58
+ jQuery.ajax({
59
+ url: ajaxurl,
60
+ type: "POST",
61
+ dataType: "json",
62
+ cache: false,
63
+ data: {
64
+ 'action': 'b2s_calendar_move_post',
65
+ 'b2s_id': event.b2s_id,
66
+ 'user_timezone': event.user_timezone,
67
+ 'sched_date': event.start.format(),
68
+ 'post_for_relay': event.post_for_relay,
69
+ 'post_for_approve': event.post_for_approve,
70
+ 'network_type': event.network_type,
71
+ 'nework_id': event.network_id
72
+ },
73
+ success: function (data) {
74
+ refreshCalender();
75
+ wp.heartbeat.connectNow();
76
+ }
77
+ });
78
+ },
79
+ eventAllow: function (dropLocation, draggedEvent) {
80
+ return dropLocation.start.isAfter(b2s_calendar_date) && draggedEvent.start.isAfter(b2s_calendar_datetime);
81
+ },
82
+ eventClick: function (calEvent, jsEvent, view) {
83
+ if (calEvent.status == "scheduled") {
84
+ 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);
85
+ } else {
86
+ if (calEvent.publish_link != "") {
87
+ window.open(calEvent.publish_link, '_blank');
88
+ }
89
+ }
90
+ },
91
+ loading: function (bool) {
92
+ if (!bool) {
93
+ //Routing from Dashboard - loading edit post preview
94
+ var rfd = jQuery('#b2s_rfd').val();
95
+ if (rfd == 1) {
96
+ jQuery('#b2s_rfd').val("0");
97
+ jQuery('.b2s-calendar-header[data-b2s-id="' + jQuery('#b2s_rfd_b2s_id').val() + '"]').parent().trigger('click');
98
+ }
99
+ }
100
+ }
101
+
102
+ });
103
+ jQuery(".b2s-loading-area").hide();
104
+ });
105
+
106
+
107
+ function showEditSchedCalendarPost(b2s_id, post_id, network_auth_id, network_type, network_id, post_format, relay_primary_post_id) {
108
+ if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
109
+ {
110
+ jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
111
+ }
112
+ b2s_current_post_id = post_id;
113
+ jQuery("#b2sPostId").val(post_id);
114
+ var $modal = jQuery("<div>");
115
+ jQuery.ajax({
116
+ url: ajaxurl,
117
+ type: "POST",
118
+ cache: false,
119
+ async: false,
120
+ data: {
121
+ 'action': 'b2s_get_post_edit_modal',
122
+ 'id': b2s_id
123
+ },
124
+ success: function (data) {
125
+ $modal = $modal.html(data);
126
+ }
127
+ });
128
+ jQuery("body").append($modal);
129
+ jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
130
+ jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
131
+ activatePortal(network_auth_id);
132
+ initSceditor(network_auth_id);
133
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
134
+ var postFormatText = b2s_calendar_formats;
135
+ var isSetPostFormat = false;
136
+ var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
137
+ //is set post format => override current condidtions by user settings for this post
138
+ if (post_format !== null) {
139
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
140
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
141
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
142
+ //edit modal select post format
143
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
144
+ 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');
145
+ } else {
146
+ 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()]);
147
+ 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());
148
+ }
149
+
150
+ //if linkpost then show btn meta tags
151
+ var isMetaChecked = false;
152
+ if (network_id == "1" && jQuery('#isOgMetaChecked').val() == "1") {
153
+ isMetaChecked = true;
154
+ }
155
+ if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
156
+ isMetaChecked = true;
157
+ }
158
+ if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
159
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
160
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
161
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
162
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
163
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
164
+ if (dataMetaType == "og") {
165
+ jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
166
+ } else {
167
+ jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
168
+ }
169
+
170
+
171
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
172
+ if (network_id == 1 && network_type == 0) {
173
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
174
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').show();
175
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').show();
176
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
177
+ }
178
+
179
+
180
+ } else {
181
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
182
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
183
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
184
+
185
+ //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
186
+ if (network_id == 1 && network_type == 0) {
187
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
188
+ jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').hide();
189
+ jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').hide();
190
+ jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
191
+ }
192
+ }
193
+
194
+ //Content Curation
195
+ if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
196
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
197
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
198
+ jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
199
+ jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
200
+ if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
201
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
202
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
203
+ } else {
204
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
205
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
206
+ }
207
+ }
208
+
209
+
210
+ if (network_id == "3") {
211
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
212
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').show();
213
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').trigger("click");
214
+ jQuery('.linkedin-url-title[data-network-auth-id="' + network_auth_id + '"]').show();
215
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide(); //not showing on linkedin
216
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
217
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
218
+ } else {
219
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').hide();
220
+ jQuery('.linkedin-url-title[data-network-auth-id="' + network_auth_id + '"]').hide();
221
+ jQuery('.linkedin-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide();
222
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
223
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
224
+ }
225
+ }
226
+
227
+ if (network_id == "19" && network_type == "0") {
228
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
229
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').show();
230
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').trigger("click");
231
+ jQuery('.xing-url-title[data-network-auth-id="' + network_auth_id + '"]').show();
232
+ jQuery('.xing-url-desc[data-network-auth-id="' + network_auth_id + '"]').show();
233
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
234
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
235
+ } else {
236
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + network_auth_id + '"]').hide();
237
+ jQuery('.xing-url-title[data-network-auth-id="' + network_auth_id + '"]').hide();
238
+ jQuery('.xing-url-desc[data-network-auth-id="' + network_auth_id + '"]').hide();
239
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
240
+ jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
241
+ }
242
+ }
243
+
244
+ }
245
+ 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');
246
+ if (textLimit != "0") {
247
+ networkLimitAll(network_auth_id, network_id, textLimit);
248
+ } else {
249
+ networkCount(network_auth_id);
250
+ }
251
+ var today = new Date();
252
+ var dateFormat = "yyyy-mm-dd";
253
+ var language = "en";
254
+ var showMeridian = true;
255
+ if (jQuery('#b2sUserLang').val() == "de") {
256
+ dateFormat = "dd.mm.yyyy";
257
+ language = "de";
258
+ showMeridian = false;
259
+ }
260
+
261
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
262
+ format: dateFormat,
263
+ language: language,
264
+ maxViewMode: 2,
265
+ todayHighlight: true,
266
+ startDate: today,
267
+ calendarWeeks: true,
268
+ autoclose: true
269
+ });
270
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
271
+ minuteStep: 15,
272
+ appendWidgetTo: 'body',
273
+ showSeconds: false,
274
+ showMeridian: showMeridian,
275
+ defaultTime: 'current',
276
+ snapToStep: true
277
+ });
278
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
279
+ checkSchedDateTime(network_auth_id);
280
+ });
281
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
282
+ checkSchedDateTime(network_auth_id);
283
+ });
284
+ init();
285
+
286
+ //is relay post?
287
+ if (relay_primary_post_id > 0) {
288
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
289
+ 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')) {
290
+ jQuery(this).prop("disabled", true);
291
+ }
292
+ });
293
+ }
294
+
295
+ if (!b2s_has_premium)
296
+ {
297
+ jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
298
+ if (!jQuery(this).hasClass('b2s-modal-close')) {
299
+ jQuery(this).prop("disabled", true);
300
+ }
301
+ });
302
+ }
303
+ }
304
+
305
+ jQuery(document).on('change', '.b2s-calendar-filter-network-btn', function () {
306
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
307
+ newSource[0] = ajaxurl + '?action=b2s_get_calendar_events&filter_network_auth=all&filter_network=' + jQuery(this).val() + '&filter_status=' + filter_status;
308
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
309
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
310
+ curSource[0] = newSource[0];
311
+
312
+ jQuery('.b2s-calendar-filter-network-account-list').html("");
313
+ jQuery('.b2s-calendar-filter-network-account-list').hide();
314
+ if (jQuery(this).val() != 'all') {
315
+ jQuery.ajax({
316
+ url: ajaxurl,
317
+ type: "POST",
318
+ dataType: "json",
319
+ cache: false,
320
+ async: false,
321
+ data: {
322
+ 'action': 'b2s_get_calendar_filter_network_auth',
323
+ 'network_id': jQuery(this).val()
324
+ },
325
+ success: function (data) {
326
+ if (data.result == true) {
327
+ jQuery(".b2s-calendar-filter-network-account-list").show();
328
+ jQuery(".b2s-calendar-filter-network-account-list").html(data.content);
329
+ }
330
+ }
331
+ });
332
+ }
333
+ return false;
334
+ });
335
+
336
+
337
+ jQuery(document).on('change', '#b2s-calendar-filter-network-auth-sel', function () {
338
+ var filter_network_details_auth_id = jQuery(this).val();
339
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
340
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
341
+ 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;
342
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
343
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
344
+ curSource[0] = newSource[0];
345
+
346
+ return false;
347
+
348
+ });
349
+
350
+ jQuery(document).on('change', '#b2s-calendar-filter-status', function () {
351
+ var filter_network_id = jQuery('.b2s-calendar-filter-network-btn:checked').val();
352
+ var filter_network_details_auth_id = jQuery('#b2s-calendar-filter-network-auth-sel').val();
353
+ if (typeof filter_network_details_auth_id == 'undefined') {
354
+ filter_network_details_auth_id = 'all';
355
+ }
356
+ var filter_status = jQuery('#b2s-calendar-filter-status').val();
357
+ 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;
358
+ jQuery('#b2s_calendar').fullCalendar('removeEventSource', curSource[0]);
359
+ jQuery('#b2s_calendar').fullCalendar('addEventSource', newSource[0]);
360
+ curSource[0] = newSource[0];
361
+
362
+ return false;
363
+
364
+ });
365
+
366
+
367
+ //Modal Edit Post close
368
+ jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
369
+ jQuery(jQuery(this).attr('data-modal-name')).remove();
370
+ return false;
371
+ });
372
+
373
+
374
+ jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
375
+ jQuery('#b2sPagination').val("1");
376
+ b2sSortFormSubmit();
377
+ return false;
378
+ });
379
+
380
+ jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
381
+ if (event.keyCode == 13) { //Hide Enter
382
+ return false;
383
+ }
384
+ });
385
+
386
+ jQuery(document).on('click', '.b2s-pagination-btn', function () {
387
+ jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
388
+ b2sSortFormSubmit();
389
+ return false;
390
+ });
391
+
392
+ jQuery(document).on('change', '.b2s-select', function () {
393
+ jQuery('#b2sPagination').val("1");
394
+ b2sSortFormSubmit();
395
+ return false;
396
+ });
397
+
398
+ jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
399
+ jQuery('#b2sPagination').val("1");
400
+ jQuery('#b2sSortPostTitle').val("");
401
+ jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
402
+ jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
403
+ jQuery('#b2sSortPostType').prop('selectedIndex', 0);
404
+ jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
405
+ jQuery('#b2sShowByDate').val("");
406
+ jQuery('#b2sUserAuthId').val("");
407
+ jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
408
+ jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
409
+ b2sSortFormSubmit();
410
+ return false;
411
+ });
412
+
413
+ jQuery(document).on('click', '.b2s-calendar-sched-new-post-btn', function () {
414
+ if (jQuery('#user_version').val() == 0) {
415
+ jQuery('#b2s-sched-post-modal').modal('show');
416
+ return false;
417
+ }
418
+ jQuery('#b2s-show-post-type-modal').modal('show');
419
+ var selSchedDate = jQuery(this).parent('td').attr('data-date');
420
+ jQuery('#b2sSelSchedDate').val(selSchedDate);
421
+ return false;
422
+ });
423
+
424
+ jQuery(document).on('click', '#b2s-btn-select-blog-post', function () {
425
+ jQuery('#b2s-show-post-type-modal').modal('hide');
426
+ jQuery('#b2s-show-post-all-modal').modal('show');
427
+ if (!jQuery('#b2sSelSchedDate').length > 0) {
428
+ jQuery('.b2sSortForm input:first').after('<input value="' + jQuery('#b2sSelSchedDate').val() + '" id="b2sSelSchedDate" name="b2sSelSchedDate" type="hidden">');
429
+ }
430
+ b2sSortFormSubmit();
431
+ return false;
432
+ });
433
+
434
+ jQuery(document).on('click', '#b2s-btn-select-content-curation', function () {
435
+ window.location.href = jQuery('#b2sRedirectUrlContentCuration').val() + '&schedDate=' + jQuery('#b2sSelSchedDate').val();
436
+ return false;
437
+ });
438
+
439
+ function showFilter(typ) {
440
+ if (typ == 'show') {
441
+ jQuery('.filterShow').hide();
442
+ jQuery('.form-inline').show();
443
+ jQuery('.filterHide').show();
444
+ } else {
445
+ jQuery('.filterShow').show();
446
+ jQuery('.form-inline').hide();
447
+ jQuery('.filterHide').hide();
448
+ }
449
+ }
450
+
451
+ //b2sSortForm
452
+ function b2sSortFormSubmit() {
453
+ jQuery(".b2s-loading-area").show();
454
+ jQuery('.b2s-sort-result-item-area').html('');
455
+ jQuery('.b2s-sort-pagination-area').html('');
456
+
457
+ var data = {
458
+ 'action': 'b2s_sort_data',
459
+ 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
460
+ 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
461
+ 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
462
+ 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
463
+ 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
464
+ 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
465
+ 'b2sType': jQuery('#b2sType').val(),
466
+ 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
467
+ 'b2sPagination': jQuery('#b2sPagination').val(),
468
+ 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
469
+ 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
470
+ 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
471
+ 'b2sUserLang': jQuery('#b2sUserLang').val(),
472
+ 'b2sSchedDate': jQuery('#b2sSelSchedDate').val()
473
+ };
474
+
475
+ if (jQuery('#b2sPostsPerPage').length > 0) {
476
+ data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
477
+ }
478
+
479
+ jQuery.ajax({
480
+ url: ajaxurl,
481
+ type: "POST",
482
+ dataType: "json",
483
+ cache: false,
484
+ data: data,
485
+ error: function () {
486
+ jQuery('.b2s-server-connection-fail').show();
487
+ return false;
488
+ },
489
+ success: function (data) {
490
+ if (typeof data === 'undefined' || data === null) {
491
+ jQuery('.b2s-server-connection-fail').show();
492
+ return false;
493
+ }
494
+ if (data.result == true) {
495
+ jQuery('.b2s-loading-area').hide();
496
+ jQuery('.b2s-sort-result-item-area').html(data.content).show();
497
+ jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
498
+ } else {
499
+ jQuery('.b2s-server-connection-fail').show();
500
+ return false;
501
+ }
502
+ }
503
+ });
504
+ return false;
505
+ }
506
+ //Overlay second modal
507
+ jQuery('#b2s-show-post-type-modal').on('hidden.bs.modal', function () {
508
+ jQuery('body').addClass('modal-open');
509
+ });
510
+
511
+ //Overlay second modal
512
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
513
+ jQuery('body').addClass('modal-open');
514
+ });
515
+
516
+ //Overlay second modal
517
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
518
+ jQuery('body').addClass('modal-open');
519
+ });
520
+
521
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
522
+ jQuery('.b2s-network-select-image-content').html("");
523
+ jQuery.ajax({
524
+ url: ajaxurl,
525
+ type: "POST",
526
+ cache: false,
527
+ async: false,
528
+ data: {
529
+ 'action': 'b2s_get_image_modal',
530
+ 'id': jQuery(this).data('post-id'),
531
+ 'image_url': jQuery(this).data('image-url')
532
+ },
533
+ success: function (data) {
534
+ jQuery(".b2s-network-select-image-content").html(data);
535
+ }
536
+ });
537
+ var authId = jQuery(this).data('network-auth-id');
538
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
539
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
540
+ 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();
541
+ jQuery('.b2s-selected-network-for-image-info').html(content);
542
+ jQuery('#b2sInsertImageType').val("0");
543
+ jQuery('.networkImage').each(function () {
544
+ var width = this.naturalWidth;
545
+ var height = this.naturalHeight;
546
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
547
+ });
548
+ jQuery('#b2s-network-select-image').modal('show');
549
+ return false;
550
+ });
551
+ jQuery(document).on("click", ".b2s-edit-post-delete", function () {
552
+ var id = jQuery(this).data("b2s-id");
553
+ var post_id = jQuery(this).data("post-id");
554
+ var post_for_relay = jQuery(this).data("data-post-for-relay");
555
+ var post_for_approve = jQuery(this).data("data-post-for-approve");
556
+ jQuery.ajax({
557
+ url: ajaxurl,
558
+ type: "POST",
559
+ dataType: "json",
560
+ cache: false,
561
+ data: {
562
+ 'action': 'b2s_delete_post',
563
+ 'b2s_id': id,
564
+ 'post_id': post_id,
565
+ 'post_for_relay': post_for_relay,
566
+ 'post_for_approve': post_for_approve
567
+ },
568
+ success: function (data) {
569
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
570
+ refreshCalender();
571
+ wp.heartbeat.connectNow();
572
+ }
573
+ });
574
+ });
575
+
576
+ /*jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
577
+ jQuery('#save_method').val("apply-all");
578
+ e.preventDefault();
579
+ var id = jQuery(this).data("b2s-id");
580
+ jQuery.ajax({
581
+ url: ajaxurl,
582
+ type: "POST",
583
+ dataType: "json",
584
+ cache: false,
585
+ data: jQuery(this).closest("form").serialize(),
586
+ success: function (data) {
587
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
588
+ refreshCalender();
589
+ jQuery('#b2s-edit-event-modal-' + id).remove();
590
+ wp.heartbeat.connectNow();
591
+ }
592
+ });
593
+ });*/
594
+
595
+ jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
596
+ e.preventDefault();
597
+ jQuery('#save_method').val("apply-this");
598
+ var id = jQuery(this).data("b2s-id");
599
+ jQuery.ajax({
600
+ url: ajaxurl,
601
+ type: "POST",
602
+ dataType: "json",
603
+ cache: false,
604
+ data: jQuery(this).closest("form").serialize(),
605
+ success: function (data) {
606
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
607
+ refreshCalender();
608
+ jQuery('#b2s-edit-event-modal-' + id).remove();
609
+ jQuery('body').removeClass('modal-open');
610
+ jQuery('body').removeAttr('style');
611
+ wp.heartbeat.connectNow();
612
+ }
613
+ });
614
+ });
615
+ jQuery(document).on("click", ".release_locks", function () {
616
+ jQuery.ajax({
617
+ url: ajaxurl,
618
+ type: "POST",
619
+ cache: false,
620
+ async: false,
621
+ data: {
622
+ 'action': 'b2s_get_calendar_release_locks',
623
+ 'post_id': jQuery('#post_id').val()
624
+ },
625
+ success: function (data) {
626
+ wp.heartbeat.connectNow();
627
+ }
628
+ });
629
+ });
630
+ function refreshCalender() {
631
+ jQuery('#b2s_calendar').fullCalendar('refetchEvents');
632
+ }
633
+
634
+ jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
635
+ jQuery('body').addClass('modal-open');
636
+ });
637
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
638
+ jQuery('body').addClass('modal-open');
639
+ });
640
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
641
+ jQuery('body').addClass('modal-open');
642
+ });
643
+ jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
644
+ jQuery('body').addClass('modal-open');
645
+ });
646
+ //jQuery(this).attr('data-network-auth-id')
647
+ function checkSchedDateTime(dataNetworkAuthId) {
648
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
649
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
650
+ var dateStr = jQuery(dateElement).val();
651
+ var minStr = jQuery(timeElement).val();
652
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
653
+ if (jQuery('#b2sUserLang').val() == 'de') {
654
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
655
+ } else {
656
+ var minParts = minStr.split(' ');
657
+ var minParts2 = minParts[0].split(':');
658
+ if (minParts[1] == 'PM') {
659
+ minParts2[0] = parseInt(minParts2[0]) + 12;
660
+ }
661
+ minStr = minParts2[0] + ':' + minParts2[1];
662
+ }
663
+
664
+ var minParts3 = minStr.split(':');
665
+ if (minParts3[0] < 10) {
666
+ minParts3[0] = '0' + minParts3[0];
667
+ }
668
+ var dateParts = dateStr.split('-');
669
+ //utc current time
670
+ var now = new Date();
671
+ //offset between utc und user
672
+ var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
673
+ //enter hour to user time
674
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
675
+ //calculate datetime in utc
676
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
677
+ //compare enter date time with allowed user time
678
+ if (enter.getTime() < now.getTime()) {
679
+ //enter set on next 15 minutes and calculate on user timezone
680
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
681
+ jQuery(dateElement).datepicker('update', enter);
682
+ jQuery(timeElement).timepicker('setTime', enter);
683
+ }
684
+ }
685
+
686
+
687
+ function printDateFormat(dataNetworkAuthId) {
688
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
689
+ var dateStr = jQuery(dateElement).val();
690
+ dateStr = dateStr.substring(8, 10) + '.' + dateStr.substring(5, 7) + '.' + dateStr.substring(0, 4);
691
+ jQuery(dateElement).val(dateStr);
692
+ }
693
+
assets/js/b2s/curation.draft.js CHANGED
@@ -84,6 +84,57 @@ function b2sSortFormSubmit() {
84
});
85
}
86
87
jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
88
jQuery('#b2sPagination').val("1");
89
jQuery('#b2sSortPostTitle').val("");
84
});
85
}
86
87
+ jQuery(document).on('click', '.deleteCcDraftBtn', function () {
88
+ jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-blog-post-id'));
89
+ jQuery('.b2s-delete-cc-draft-modal').modal('show');
90
+ jQuery('.b2s-delete-cc-draft-confirm-btn').prop('disabeld', false);
91
+
92
+ });
93
+
94
+ jQuery(document).on('click', '.b2s-delete-cc-draft-confirm-btn', function () {
95
+ jQuery('.b2s-post-remove-fail').hide();
96
+ jQuery('.b2s-post-remove-success').hide();
97
+ jQuery('.b2s-delete-cc-draft-confirm-btn').prop('disabeld', true);
98
+ jQuery('.b2s-server-connection-fail').hide();
99
+ jQuery.ajax({
100
+ url: ajaxurl,
101
+ type: "POST",
102
+ dataType: "json",
103
+ cache: false,
104
+ data: {
105
+ 'action': 'b2s_delete_user_cc_draft_post',
106
+ 'postId': jQuery('#b2s-delete-confirm-post-id').val()
107
+ },
108
+ error: function () {
109
+ jQuery('.b2s-server-connection-fail').show();
110
+ return false;
111
+ },
112
+ success: function (data) {
113
+ jQuery('.b2s-delete-cc-draft-modal').modal('hide');
114
+ if (data.result == true) {
115
+ jQuery('.b2s-list-cc-draft[data-blog-post-id="'+data.postId+'"').remove();
116
+ /*var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html());
117
+ var newCount = count - data.postCount;
118
+ jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
119
+ if (newCount >= 1) {
120
+ jQuery.each(data.postId, function (i, id) {
121
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + id + '"]').remove();
122
+ });
123
+ } else {
124
+ jQuery('.b2s-post-approve-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
125
+ }*/
126
+ jQuery('.b2s-post-remove-success').show();
127
+ } else {
128
+ jQuery('.b2s-post-remove-fail').show();
129
+ }
130
+
131
+ return true;
132
+ }
133
+ });
134
+ });
135
+
136
+
137
+
138
jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
139
jQuery('#b2sPagination').val("1");
140
jQuery('#b2sSortPostTitle').val("");
assets/js/b2s/general.js CHANGED
@@ -319,3 +319,6 @@ jQuery(document).on("click", ".b2s-scroll-modal-down", function (e) {
319
return false;
320
});
321
319
return false;
320
});
321
322
+ jQuery(document).on('click', '.b2s-network-auth-info-close', function() {
323
+ jQuery(this).closest('.b2s-network-auth-info').hide();
324
+ });
assets/js/b2s/network.js CHANGED
@@ -1025,6 +1025,7 @@ jQuery(window).on("load", function () {
1025
var newText = text.slice(0, start) + jQuery(this).html() + text.slice(end);
1026
jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val(newText);
1027
jQuery('.b2s-edit-template-post-content').focus();
1028
event.preventDefault();
1029
return false;
1030
});
@@ -1033,6 +1034,7 @@ jQuery(window).on("load", function () {
1033
var networkType = jQuery(this).attr('data-network-type');
1034
jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val("");
1035
jQuery('.b2s-edit-template-post-content').focus();
1036
event.preventDefault();
1037
return false;
1038
});
1025
var newText = text.slice(0, start) + jQuery(this).html() + text.slice(end);
1026
jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val(newText);
1027
jQuery('.b2s-edit-template-post-content').focus();
1028
+ jQuery('.b2s-edit-template-post-content').trigger('keyup');
1029
event.preventDefault();
1030
return false;
1031
});
1034
var networkType = jQuery(this).attr('data-network-type');
1035
jQuery('.b2s-edit-template-post-content[data-network-type="' + networkType + '"]').val("");
1036
jQuery('.b2s-edit-template-post-content').focus();
1037
+ jQuery('.b2s-edit-template-post-content').trigger('keyup');
1038
event.preventDefault();
1039
return false;
1040
});
assets/js/b2s/post.js CHANGED
@@ -1,888 +1,958 @@
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
- jQuery('#b2sPagination').val("1");
11
- b2sSortFormSubmit();
12
-
13
- /*if (jQuery('#b2sType').val() != "sched") {
14
- jQuery('.b2s-sched-calendar-btn').hide();
15
- }*/
16
- jQuery('#b2s-sched-calendar-area').hide();
17
-
18
- });
19
-
20
-
21
- function wopApprove(blogPostId, postId, url, name) {
22
- var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
23
- 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");
24
- if (postId > 0) {
25
- function checkIfWinClosed(intervalID) {
26
- if (win.closed) {
27
- clearInterval(intervalID);
28
- //Show Modal
29
- jQuery('.b2s-publish-approve-modal').modal('show');
30
- jQuery('#b2s-approve-post-id').val(postId);
31
- jQuery('#b2s-approve-blog-post-id').val(blogPostId);
32
- }
33
- }
34
- var interval = setInterval(function () {
35
- checkIfWinClosed(interval);
36
- }, 500);
37
- }
38
- }
39
-
40
-
41
- jQuery(document).on('click', '.b2s-sched-calendar-btn', function () {
42
- if (jQuery('#b2s-sched-calendar-area').is(":visible")) {
43
- jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-show-calendar-btn-title'));
44
- jQuery('#b2s-sched-calendar-area').hide();
45
- } else {
46
- jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-hide-calendar-btn-title'));
47
- jQuery('#b2s-sched-calendar-area').show();
48
- }
49
- });
50
-
51
- //Overlay second modal
52
- jQuery('#b2s-network-select-image').on('hidden.bs.modal', function () {
53
- jQuery('body').addClass('modal-open');
54
- });
55
- //Overlay second modal
56
- jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function () {
57
- jQuery('body').addClass('modal-open');
58
- });
59
- jQuery('#b2s-info-change-meta-tag-modal').on('hidden.bs.modal', function () {
60
- jQuery('body').addClass('modal-open');
61
- });
62
-
63
-
64
- jQuery(document).on('click', '.b2sDetailsPublishPostBtn', function () {
65
- var postId = jQuery(this).attr('data-post-id');
66
- var showByDate = jQuery(this).attr('data-search-date');
67
- if (!jQuery(this).find('i').hasClass('isload')) {
68
- jQuery('.b2s-server-connection-fail').hide();
69
- jQuery.ajax({
70
- url: ajaxurl,
71
- type: "POST",
72
- dataType: "json",
73
- cache: false,
74
- data: {
75
- 'action': 'b2s_publish_post_data',
76
- 'postId': postId,
77
- 'type': jQuery('#b2sType').val(),
78
- 'showByDate': showByDate
79
- },
80
- error: function () {
81
- jQuery('.b2s-server-connection-fail').show();
82
- return false;
83
- },
84
- success: function (data) {
85
- if (data.result == true) {
86
- jQuery('.b2s-post-publish-area[data-post-id="' + data.postId + '"]').html(data.content);
87
- }
88
- wp.heartbeat.connectNow();
89
- }
90
- });
91
- jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
92
- } else {
93
- if (jQuery(this).find('i').hasClass('isShow')) {
94
- jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').hide();
95
- jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
96
- } else {
97
- jQuery('.b2s-post-publish-area[data-post-id="' + postId + '"]').show();
98
- jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
99
- }
100
- }
101
- });
102
-
103
- jQuery(document).on('click', '.b2sDetailsApprovePostBtn', function () {
104
- var postId = jQuery(this).attr('data-post-id');
105
- var showByDate = jQuery(this).attr('data-search-date');
106
- if (!jQuery(this).find('i').hasClass('isload')) {
107
- jQuery('.b2s-server-connection-fail').hide();
108
- jQuery.ajax({
109
- url: ajaxurl,
110
- type: "POST",
111
- dataType: "json",
112
- cache: false,
113
- data: {
114
- 'action': 'b2s_approve_post_data',
115
- 'postId': postId,
116
- 'showByDate': showByDate
117
- },
118
- error: function () {
119
- jQuery('.b2s-server-connection-fail').show();
120
- return false;
121
- },
122
- success: function (data) {
123
- if (data.result == true) {
124
- jQuery('.b2s-post-approve-area[data-post-id="' + data.postId + '"]').html(data.content);
125
- }
126
- }
127
- });
128
- jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
129
- } else {
130
- if (jQuery(this).find('i').hasClass('isShow')) {
131
- jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').hide();
132
- jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
133
- } else {
134
- jQuery('.b2s-post-approve-area[data-post-id="' + postId + '"]').show();
135
- jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
136
- }
137
- }
138
- });
139
-
140
-
141
- jQuery(document).on('click', '#b2s-sort-submit-btn', function () {
142
- jQuery('#b2sPagination').val("1");
143
- b2sSortFormSubmit();
144
- return false;
145
- });
146
-
147
-
148
- jQuery(document).on('keypress', '#b2sSortPostTitle', function (event) {
149
- if (event.keyCode == 13) { //Hide Enter
150
- return false;
151
- }
152
- });
153
-
154
- jQuery(document).on('click', '.b2s-pagination-btn', function () {
155
- jQuery('#b2sPagination').val(jQuery(this).attr('data-page'));
156
- b2sSortFormSubmit();
157
- return false;
158
- });
159
-
160
- jQuery(document).on('change', '.b2s-select', function () {
161
- jQuery('#b2sPagination').val("1");
162
- b2sSortFormSubmit();
163
- return false;
164
- });
165
-
166
- jQuery(document).on('click', '#b2s-sort-reset-btn', function () {
167
- jQuery('#b2sPagination').val("1");
168
- jQuery('#b2sSortPostTitle').val("");
169
- jQuery('#b2sSortPostAuthor').prop('selectedIndex', 0);
170
- jQuery('#b2sSortPostCat').prop('selectedIndex', 0);
171
- jQuery('#b2sSortPostType').prop('selectedIndex', 0);
172
- jQuery('#b2sSortPostSchedDate').prop('selectedIndex', 0);
173
- jQuery('#b2sShowByDate').val("");
174
- jQuery('#b2sUserAuthId').val("");
175
- jQuery('#b2sPostBlogId').val("");
176
- jQuery('#b2sShowByNetwork').val("0");
177
- jQuery('#b2sSortPostStatus').prop('selectedIndex', 0);
178
- jQuery('#b2sSortPostShareStatus').prop('selectedIndex', 0);
179
- jQuery('#b2sSortPostPublishDate').prop('selectedIndex', 0);
180
- b2sSortFormSubmit();
181
- return false;
182
- });
183
-
184
-
185
- function b2sSortFormSubmit(sched_dates) {
186
- jQuery('.b2s-server-connection-fail').hide();
187
- jQuery('.b2s-loading-area').show();
188
- jQuery('.b2s-sort-result-area').hide();
189
- jQuery('.b2s-sort-result-item-area').html("").hide();
190
- jQuery('.b2s-sort-pagination-area').html("").hide();
191
-
192
- var currentType = jQuery('#b2sType').val();
193
- if (currentType != "undefined") {
194
- jQuery('.b2s-post-btn').removeClass('btn-primary').addClass('btn-link');
195
- jQuery('.b2s-post-' + currentType).removeClass('btn-link').addClass('btn-primary');
196
- }
197
-
198
- var data = {
199
- 'action': 'b2s_sort_data',
200
- 'b2sSortPostTitle': jQuery('#b2sSortPostTitle').val(),
201
- 'b2sSortPostAuthor': jQuery('#b2sSortPostAuthor').val(),
202
- 'b2sSortPostCat': jQuery('#b2sSortPostCat').val(),
203
- 'b2sSortPostType': jQuery('#b2sSortPostType').val(),
204
- 'b2sSortPostSchedDate': jQuery('#b2sSortPostSchedDate').val(),
205
- 'b2sUserAuthId': jQuery('#b2sUserAuthId').val(),
206
- 'b2sPostBlogId': jQuery('#b2sPostBlogId').val(),
207
- 'b2sType': jQuery('#b2sType').val(),
208
- 'b2sShowByDate': jQuery('#b2sShowByDate').val(),
209
- 'b2sShowByNetwork': jQuery('#b2sShowByNetwork').val(),
210
- 'b2sPagination': jQuery('#b2sPagination').val(),
211
- 'b2sShowPagination': jQuery('#b2sShowPagination').length > 0 ? jQuery('#b2sShowPagination').val() : 1,
212
- 'b2sSortPostStatus': jQuery('#b2sSortPostStatus').val(),
213
- 'b2sSortPostShareStatus': jQuery('#b2sSortPostShareStatus').val(),
214
- 'b2sSortPostPublishDate': jQuery('#b2sSortPostPublishDate').val(),
215
- 'b2sUserLang': jQuery('#b2sUserLang').val()
216
- };
217
-
218
- if (jQuery('#b2sPostsPerPage').length > 0) {
219
- data['b2sPostsPerPage'] = jQuery('#b2sPostsPerPage').val();
220
- }
221
-
222
- var legacyMode = true;
223
- if (jQuery('#isLegacyMode').val() !== undefined) {
224
- if (jQuery('#isLegacyMode').val() == "1") {
225
- legacyMode = false; // loading is sync (stack)
226
- }
227
- }
228
-
229
-
230
- jQuery.ajax({
231
- url: ajaxurl,
232
- type: "POST",
233
- dataType: "json",
234
- async: legacyMode,
235
- cache: false,
236
- data: data,
237
- error: function () {
238
- jQuery('.b2s-server-connection-fail').show();
239
- return false;
240
- },
241
- success: function (data) {
242
- if (typeof data === 'undefined' || data === null) {
243
- jQuery('.b2s-server-connection-fail').show();
244
- return false;
245
- }
246
- if (data.result == true) {
247
- jQuery('.b2s-loading-area').hide();
248
- jQuery('.b2s-sort-result-area').show();
249
- jQuery('.b2s-sort-result-item-area').html(data.content).show();
250
- jQuery('.b2s-sort-pagination-area').html(data.pagination).show();
251
-
252
- //extern - Routing from dashboard
253
- if (jQuery('#b2sPostBlogId').val() !== undefined) {
254
- if (jQuery('#b2sPostBlogId').val() != "") {
255
- jQuery('.b2sDetailsSchedPostBtn[data-post-id="' + jQuery('#b2sPostBlogId').val() + '"]').trigger('click');
256
- }
257
- }
258
- } else {
259
- jQuery('.b2s-server-connection-fail').show();
260
- return false;
261
- }
262
- }
263
- });
264
- }
265
-
266
- jQuery(document).on('click', '.b2sDetailsSchedPostBtn', function () {
267
- var postId = jQuery(this).attr('data-post-id');
268
- var showByDate = jQuery(this).attr('data-search-date');
269
- var showByNetwork = jQuery(this).attr('data-search-network');
270
- var userAuthId = jQuery('#b2sUserAuthId').val();
271
- if (!jQuery(this).find('i').hasClass('isload')) {
272
- jQuery('.b2s-server-connection-fail').hide();
273
- jQuery.ajax({
274
- url: ajaxurl,
275
- type: "POST",
276
- dataType: "json",
277
- cache: false,
278
- data: {
279
- 'action': 'b2s_sched_post_data',
280
- 'postId': postId,
281
- 'showByDate': showByDate,
282
- 'showByNetwork': showByNetwork,
283
- 'userAuthId': userAuthId
284
- },
285
- error: function () {
286
- jQuery('.b2s-server-connection-fail').show();
287
- return false;
288
- },
289
- success: function (data) {
290
- if (data.result == true) {
291
- jQuery('.b2s-post-sched-area[data-post-id="' + data.postId + '"]').html(data.content);
292
- }
293
- }
294
- });
295
- jQuery(this).find('i').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up').addClass('isload').addClass('isShow');
296
- } else {
297
- if (jQuery(this).find('i').hasClass('isShow')) {
298
- jQuery('.b2s-post-sched-area[data-post-id="' + postId + '"]').hide();
299
- jQuery(this).find('i').removeClass('isShow').addClass('isHide').removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down');
300
- } else {
301
- jQuery('.b2s-post-sched-area[data-post-id="' + postId + '"]').show();
302
- jQuery(this).find('i').removeClass('isHide').addClass('isShow').removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up');
303
- }
304
- }
305
-
306
- });
307
- jQuery(document).on('click', '.b2sDetailsPublishPostTriggerLink', function () {
308
- jQuery(this).parent().prev().find('button').trigger('click');
309
- return false;
310
- });
311
-
312
- jQuery(document).on('click', '.b2sDetailsApprovePostTriggerLink', function () {
313
- jQuery(this).parent().prev().find('button').trigger('click');
314
- return false;
315
- });
316
-
317
- jQuery(document).on('click', '.b2sDetailsSchedPostTriggerLink', function () {
318
- if (jQuery('#b2s-redirect-url-sched-post').val() == undefined || jQuery('#b2s-redirect-url-sched-post').val() === null) {
319
- //self page blog2social-sched
320
- jQuery(this).parent().prev().find('button').trigger('click');
321
- } else {
322
- //extern - routing from dashboard
323
- if (jQuery(this).children('span').attr('data-post-id').length > 0) {
324
- window.location.href = jQuery('#b2s-redirect-url-sched-post').val() + "&b2sPostBlogId=" + jQuery(this).children('span').attr('data-post-id');
325
- }
326
- }
327
- return false;
328
- });
329
- jQuery(document).on('click', '.checkbox-all', function () {
330
- if (jQuery('.checkbox-all').is(":checked")) {
331
- jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]').prop("checked", true);
332
- } else {
333
- jQuery('.checkboxes[data-blog-post-id="' + jQuery('.checkbox-all').attr('data-blog-post-id') + '"]').prop("checked", false);
334
- }
335
- });
336
- jQuery(document).on('click', '.checkbox-post-sched-all-btn', function () {
337
- var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
338
- if (checkboxes.length > 0) {
339
- var items = [];
340
- jQuery(checkboxes).each(function (i, selected) {
341
- items[i] = jQuery(selected).val();
342
- });
343
- jQuery('#b2s-delete-confirm-post-id').val(items.join());
344
- jQuery('#b2s-delete-confirm-post-count').html(items.length);
345
- jQuery('.b2s-delete-sched-modal').modal('show');
346
- jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', false);
347
- }
348
- });
349
- jQuery(document).on('click', '.b2s-post-sched-area-drop-btn', function () {
350
- jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
351
- jQuery('#b2s-delete-confirm-post-count').html('1');
352
- jQuery('.b2s-delete-sched-modal').modal('show');
353
- jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', false);
354
- });
355
- jQuery(document).on('click', '.b2s-sched-delete-confirm-btn', function () {
356
- jQuery('.b2s-post-remove-fail').hide();
357
- jQuery('.b2s-post-remove-success').hide();
358
- jQuery('.b2s-sched-delete-confirm-btn').prop('disabeld', true);
359
- jQuery('.b2s-server-connection-fail').hide();
360
- jQuery.ajax({
361
- url: ajaxurl,
362
- type: "POST",
363
- dataType: "json",
364
- cache: false,
365
- data: {
366
- 'action': 'b2s_delete_user_sched_post',
367
- 'postId': jQuery('#b2s-delete-confirm-post-id').val()
368
- },
369
- error: function () {
370
- jQuery('.b2s-server-connection-fail').show();
371
- return false;
372
- },
373
- success: function (data) {
374
- jQuery('.b2s-delete-sched-modal').modal('hide');
375
- if (data.result == true) {
376
- var count = parseInt(jQuery('.b2s-sched-count[data-post-id="' + data.blogPostId + '"]').html());
377
- var newCount = count - data.postCount;
378
- jQuery('.b2s-sched-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
379
- if (newCount >= 1) {
380
- jQuery.each(data.postId, function (i, id) {
381
- jQuery('.b2s-post-sched-area-li[data-post-id="' + id + '"]').remove();
382
- });
383
- } else {
384
- jQuery('.b2s-post-sched-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
385
- }
386
- jQuery('.b2s-post-remove-success').show();
387
- } else {
388
- jQuery('.b2s-post-remove-fail').show();
389
- }
390
- wp.heartbeat.connectNow();
391
- return true;
392
- }
393
- });
394
- });
395
-
396
- jQuery(document).on('click', '.checkbox-post-publish-all-btn', function () {
397
- var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
398
- if (checkboxes.length > 0) {
399
- var items = [];
400
- jQuery(checkboxes).each(function (i, selected) {
401
- items[i] = jQuery(selected).val();
402
- });
403
- jQuery('#b2s-delete-confirm-post-id').val(items.join());
404
- jQuery('#b2s-delete-confirm-post-count').html(items.length);
405
- jQuery('.b2s-delete-publish-modal').modal('show');
406
- jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
407
- }
408
- });
409
-
410
-
411
- jQuery(document).on('click', '.checkbox-post-approve-all-btn', function () {
412
- var checkboxes = jQuery('.checkboxes[data-blog-post-id="' + jQuery(this).attr('data-blog-post-id') + '"]:checked');
413
- if (checkboxes.length > 0) {
414
- var items = [];
415
- jQuery(checkboxes).each(function (i, selected) {
416
- items[i] = jQuery(selected).val();
417
- });
418
- jQuery('#b2s-delete-confirm-post-id').val(items.join());
419
- jQuery('#b2s-delete-confirm-post-count').html(items.length);
420
- jQuery('.b2s-delete-approve-modal').modal('show');
421
- jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
422
- }
423
- });
424
-
425
- jQuery(document).on('click', '.b2s-approve-publish-confirm-btn', function () {
426
- jQuery('.b2s-post-remove-fail').hide();
427
- jQuery('.b2s-post-remove-success').hide();
428
- jQuery('.b2s-server-connection-fail').hide();
429
-
430
- var postId = jQuery('#b2s-approve-post-id').val();
431
- var blogPostId = jQuery('#b2s-approve-blog-post-id').val();
432
- if (postId > 0) {
433
- var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + blogPostId + '"]').html());
434
- var newCount = count - 1;
435
- jQuery('.b2s-approve-count[data-post-id="' + blogPostId + '"]').html(newCount);
436
- if (newCount >= 1) {
437
- jQuery('.b2s-post-approve-area-li[data-post-id="' + postId + '"]').remove();
438
- } else {
439
- jQuery('.b2s-post-approve-area-li[data-post-id="' + postId + '"]').closest('ul').closest('li').remove();
440
- }
441
- jQuery('.b2s-publish-approve-modal').modal('hide');
442
- jQuery.ajax({
443
- url: ajaxurl,
444
- type: "POST",
445
- cache: false,
446
- async: false,
447
- data: {
448
- 'action': 'b2s_update_approve_post',
449
- 'post_id': postId,
450
- 'publish_link': "",
451
- 'publish_error_code': "",
452
- },
453
- success: function (data) {
454
- }
455
- });
456
- }
457
- });
458
-
459
-
460
- jQuery(document).on('click', '.b2s-approve-delete-confirm-btn', function () {
461
- jQuery('.b2s-post-remove-fail').hide();
462
- jQuery('.b2s-post-remove-success').hide();
463
- jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', true);
464
- jQuery('.b2s-server-connection-fail').hide();
465
- jQuery.ajax({
466
- url: ajaxurl,
467
- type: "POST",
468
- dataType: "json",
469
- cache: false,
470
- data: {
471
- 'action': 'b2s_delete_user_approve_post',
472
- 'postId': jQuery('#b2s-delete-confirm-post-id').val()
473
- },
474
- error: function () {
475
- jQuery('.b2s-server-connection-fail').show();
476
- return false;
477
- },
478
- success: function (data) {
479
- jQuery('.b2s-delete-approve-modal').modal('hide');
480
- if (data.result == true) {
481
- var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html());
482
- var newCount = count - data.postCount;
483
- jQuery('.b2s-approve-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
484
- if (newCount >= 1) {
485
- jQuery.each(data.postId, function (i, id) {
486
- jQuery('.b2s-post-approve-area-li[data-post-id="' + id + '"]').remove();
487
- });
488
- } else {
489
- jQuery('.b2s-post-approve-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
490
- }
491
- jQuery('.b2s-post-remove-success').show();
492
- } else {
493
- jQuery('.b2s-post-remove-fail').show();
494
- }
495
- wp.heartbeat.connectNow();
496
- return true;
497
- }
498
- });
499
- });
500
-
501
- //Modal Edit Post close
502
- jQuery(document).on('click', '.b2s-modal-close-edit-post', function (e) {
503
- jQuery(jQuery(this).attr('data-modal-name')).remove();
504
- return false;
505
- });
506
-
507
- jQuery(document).on('click', '.b2s-post-approve-area-drop-btn', function () {
508
- jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
509
- jQuery('#b2s-delete-confirm-post-count').html('1');
510
- jQuery('.b2s-delete-approve-modal').modal('show');
511
- jQuery('.b2s-approve-delete-confirm-btn').prop('disabeld', false);
512
- });
513
-
514
- jQuery(document).on('click', '.b2s-post-publish-area-drop-btn', function () {
515
- jQuery('#b2s-delete-confirm-post-id').val(jQuery(this).attr('data-post-id'));
516
- jQuery('#b2s-delete-confirm-post-count').html('1');
517
- jQuery('.b2s-delete-publish-modal').modal('show');
518
- jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', false);
519
- });
520
-
521
- jQuery(document).on('click', '.b2s-publish-delete-confirm-btn', function () {
522
- jQuery('.b2s-post-remove-fail').hide();
523
- jQuery('.b2s-post-remove-success').hide();
524
- jQuery('.b2s-publish-delete-confirm-btn').prop('disabeld', true);
525
- jQuery('.b2s-server-connection-fail').hide();
526
- jQuery.ajax({
527
- url: ajaxurl,
528
- type: "POST",
529
- dataType: "json",
530
- cache: false,
531
- data: {
532
- 'action': 'b2s_delete_user_publish_post',
533
- 'postId': jQuery('#b2s-delete-confirm-post-id').val()
534
- },
535
- error: function () {
536
- jQuery('.b2s-server-connection-fail').show();
537
- return false;
538
- },
539
- success: function (data) {
540
- jQuery('.b2s-delete-publish-modal').modal('hide');
541
- if (data.result == true) {
542
- var count = parseInt(jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html());
543
- var newCount = count - data.postCount;
544
- jQuery('.b2s-publish-count[data-post-id="' + data.blogPostId + '"]').html(newCount);
545
- if (newCount >= 1) {
546
- jQuery.each(data.postId, function (i, id) {
547
- jQuery('.b2s-post-publish-area-li[data-post-id="' + id + '"]').remove();
548
- });
549
- } else {
550
- jQuery('.b2s-post-publish-area-li[data-post-id="' + data.postId[0] + '"]').closest('ul').closest('li').remove();
551
- }
552
- jQuery('.b2s-post-remove-success').show();
553
- } else {
554
- jQuery('.b2s-post-remove-fail').show();
555
- }
556
- wp.heartbeat.connectNow();
557
- return true;
558
- }
559
- });
560
- });
561
-
562
-
563
- jQuery(document).on('click', '.b2s-post-edit-sched-btn', function () {
564
- showEditSchedPost(jQuery(this).attr('data-b2s-id'), jQuery(this).attr('data-post-id'), jQuery(this).attr('data-network-auth-id'), jQuery(this).attr('data-network-type'), jQuery(this).attr('data-network-id'), jQuery(this).attr('data-relay-primary-post-id'));
565
-
566
- });
567
-
568
- //Customize
569
- function showEditSchedPost(b2s_id, post_id, network_auth_id, network_type, network_id, relay_primary_post_id) {
570
- if (jQuery('#b2s-edit-event-modal-' + b2s_id).length == 1)
571
- {
572
- jQuery('#b2s-edit-event-modal-' + b2s_id).remove();
573
- }
574
- jQuery("#b2sPostId").val(post_id);
575
- var $modal = jQuery("<div>");
576
- jQuery.ajax({
577
- url: ajaxurl,
578
- type: "POST",
579
- cache: false,
580
- async: false,
581
- data: {
582
- 'action': 'b2s_get_post_edit_modal',
583
- 'id': b2s_id
584
- },
585
- success: function (data) {
586
- $modal = $modal.html(data);
587
- }
588
- });
589
- b2s_current_post_id = post_id;
590
- jQuery("body").append($modal);
591
- jQuery(".b2s-edit-post-delete").hide();
592
- jQuery('#b2sUserTimeZone').val(jQuery('#user_timezone').val());
593
- jQuery('#b2s-edit-event-modal-' + b2s_id).modal('show');
594
- var post_format = jQuery('#b2sCurrentPostFormat').val();
595
- activatePortal(network_auth_id);
596
- initSceditor(network_auth_id);
597
- networkCount(network_auth_id);
598
- if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').length > 0) {
599
- var postFormatText = b2s_post_formats;
600
- var isSetPostFormat = false;
601
- var postFormatType = jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').attr('data-post-format-type');
602
- //is set post format => override current condidtions by user settings for this post
603
- if (post_format !== null) {
604
- jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val(post_format);
605
- jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + network_auth_id + '"]').html(postFormatText[postFormatType][post_format]);
606
- jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val(post_format);
607
- //edit modal select post format
608
- jQuery('.b2s-user-network-settings-post-format[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').removeClass('b2s-settings-checked');
609
- 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');
610
- } else {
611
- 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()]);
612
- 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());
613
- }
614
-
615
- //if linkpost then show btn meta tags
616
- var isMetaChecked = false;
617
- if (network_id == "1" && jQuery('#isOgMetaChecked').val() == "1") {
618
- isMetaChecked = true;
619
- }
620
- if (network_id == "2" && jQuery('#isCardMetaChecked').val() == "1") {
621
- isMetaChecked = true;
622
- }
623
- if (isMetaChecked && jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + network_type + '"][data-network-id="' + network_id + '"]').val() == "0") {
624
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
625
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
626
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').show();
627
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').trigger("click");
628
- var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').attr("data-meta-type");
629
- if (dataMetaType == "og") {
630
- jQuery('.b2sChangeOgMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
631
- } else {
632
- jQuery('.b2sChangeCardMeta[data-network-auth-id="' + network_auth_id + '"]').val("1");
633
- }
634
-
635
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
636
- if (network_id == 1 && network_type == 0) {
637
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", false);
638
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').show();
639
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').show();
640
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').hide();
641
- }
642
-
643
- } else {
644
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
645
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
646
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + network_id + '"]').hide();
647
-
648
- //Facebook TOS 072018 - Instant Sharing - Image post without Text > set to readonly
649
- if (network_id == 1 && network_type == 0) {
650
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
651
- jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + network_auth_id + '"]').hide();
652
- jQuery('.b2s-post-item-info-area[data-network-auth-id="' + network_auth_id + '"]').hide();
653
- jQuery('.b2s-post-approve-info[data-network-auth-id="' + network_auth_id + '"]').show();
654
- }
655
- }
656
-
657
- //Content Curation
658
- if (jQuery('.b2s-post-ship-item-post-format[data-network-auth-id="' + network_auth_id + '"]').attr('data-post-wp-type') == 'ex') {
659
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
660
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
661
- jQuery('.b2s-post-item-details-item-url-input[data-network-auth-id="' + network_auth_id + '"]').prop("readonly", true);
662
- jQuery('.b2s-load-info-meta-tag-modal[data-network-auth-id="' + network_auth_id + '"]').attr("style", "display:none !important");
663
- if (jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + network_auth_id + '"]').val() == 0) {
664
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').hide();
665
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').hide();
666
- } else {
667
- jQuery('.b2s-select-image-modal-open[data-network-auth-id="' + network_auth_id + '"]').show();
668
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + network_auth_id + '"]').show();
669
- }
670
- }
671
-
672
- }
673
- var today = new Date();
674
- var dateFormat = "yyyy-mm-dd";
675
- var language = "en";
676
- var showMeridian = true;
677
- if (jQuery('#b2sUserLang').val() == "de") {
678
- dateFormat = "dd.mm.yyyy";
679
- language = "de";
680
- showMeridian = false;
681
- }
682
-
683
- jQuery(".b2s-post-item-details-release-input-date").datepicker({
684
- format: dateFormat,
685
- language: language,
686
- maxViewMode: 2,
687
- todayHighlight: true,
688
- startDate: today,
689
- calendarWeeks: true,
690
- autoclose: true
691
- });
692
- jQuery('.b2s-post-item-details-release-input-time').timepicker({
693
- minuteStep: 15,
694
- appendWidgetTo: 'body',
695
- showSeconds: false,
696
- showMeridian: showMeridian,
697
- defaultTime: 'current',
698
- snapToStep: true
699
- });
700
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
701
- checkSchedDateTime(network_auth_id);
702
- });
703
- jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
704
- checkSchedDateTime(network_auth_id);
705
- });
706
- init();
707
-
708
- //is relay post?
709
- if (relay_primary_post_id > 0) {
710
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
711
- 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')) {
712
- jQuery(this).prop("disabled", true);
713
- }
714
- });
715
- }
716
-
717
- if (!b2s_has_premium)
718
- {
719
- jQuery('#b2s-edit-event-modal-' + b2s_id).find("input, textarea, button").each(function () {
720
- if (!jQuery(this).hasClass('b2s-modal-close')) {
721
- jQuery(this).prop("disabled", true);
722
- }
723
- });
724
- }
725
- }
726
-
727
- jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
728
- jQuery('.b2s-network-select-image-content').html("");
729
- jQuery.ajax({
730
- url: ajaxurl,
731
- type: "POST",
732
- cache: false,
733
- async: false,
734
- data: {
735
- 'action': 'b2s_get_image_modal',
736
- 'id': jQuery(this).data('post-id'),
737
- 'image_url': jQuery(this).data('image-url')
738
- },
739
- success: function (data) {
740
- jQuery(".b2s-network-select-image-content").html(data);
741
- }
742
- });
743
- var authId = jQuery(this).data('network-auth-id');
744
- jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
745
- jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
746
- 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();
747
- jQuery('.b2s-selected-network-for-image-info').html(content);
748
- jQuery('#b2sInsertImageType').val("0");
749
- jQuery('.networkImage').each(function () {
750
- var width = this.naturalWidth;
751
- var height = this.naturalHeight;
752
- jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
753
- });
754
- jQuery('#b2s-network-select-image').modal('show');
755
- return false;
756
- });
757
-
758
- jQuery(document).on("click", ".b2s-edit-post-save-this", function (e) {
759
- e.preventDefault();
760
- jQuery('#save_method').val("apply-this");
761
- var id = jQuery(this).data("b2s-id");
762
- jQuery.ajax({
763
- url: ajaxurl,
764
- type: "POST",
765
- dataType: "json",
766
- cache: false,
767
- data: jQuery(this).closest("form").serialize(),
768
- success: function (data) {
769
- jQuery('#b2s-edit-event-modal-' + id).modal('hide');
770
- jQuery('#b2s-edit-event-modal-' + id).remove();
771
- jQuery('body').removeClass('modal-open');
772
- jQuery('body').removeAttr('style');
773
- if (data.date != "") {
774
- jQuery('.b2s-post-sched-area-sched-time[data-post-id="' + id + '"]').html(data.date);
775
- }
776
- jQuery('.b2s-post-edit-success').show();
777
- wp.heartbeat.connectNow();
778
- }
779
- });
780
- });
781
- jQuery(document).on("click", ".release_locks", function () {
782
- jQuery.ajax({
783
- url: ajaxurl,
784
- type: "POST",
785
- cache: false,
786
- async: false,
787
- data: {
788
- 'action': 'b2s_get_calendar_release_locks',
789
- 'post_id': jQuery('#post_id').val()
790
- },
791
- success: function (data) {
792
- wp.heartbeat.connectNow();
793
- }
794
- });
795
- });
796
-
797
-
798
-
799
- function showFilter(typ) {
800
- if (typ == 'show') {
801
- jQuery('.filterShow').hide();
802
- jQuery('.form-inline').show();
803
- jQuery('.filterHide').show();
804
- } else {
805
- jQuery('.filterShow').show();
806
- jQuery('.form-inline').hide();
807
- jQuery('.filterHide').hide();
808
- }
809
- }
810
-
811
- function padDate(n) {
812
- return ("0" + n).slice(-2);
813
- }
814
-
815
-
816
- function checkSchedDateTime() {
817
- var dateElement = '#b2s-change-date';
818
- var timeElement = '#b2s-change-time';
819
- var dateStr = jQuery(dateElement).val();
820
- var minStr = jQuery(timeElement).val();
821
- var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
822
-
823
- if (jQuery('#b2sUserLang').val() == 'de') {
824
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
825
- } else {
826
- var minParts = minStr.split(' ');
827
- var minParts2 = minParts[0].split(':');
828
- if (minParts[1] == 'PM') {
829
- minParts2[0] = parseInt(minParts2[0]) + 12;
830
- }
831
- minStr = minParts2[0] + ':' + minParts2[1];
832
- }
833
-
834
- var minParts3 = minStr.split(':');
835
- if (minParts3[0] < 10) {
836
- minParts3[0] = '0' + minParts3[0];
837
- }
838
- var dateParts = dateStr.split('-');
839
-
840
- //utc current time
841
- var now = new Date();
842
- //offset between utc und user
843
- var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
844
- //enter hour to user time
845
- var hour = parseInt(minParts3[0]) + timeZone + offset;
846
- //calculate datetime in utc
847
- var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
848
- //compare enter date time with allowed user time
849
- if (enter.getTime() < now.getTime()) {
850
- //enter set on next 15 minutes and calculate on user timezone
851
- enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
852
- jQuery(dateElement).datepicker('update', enter);
853
- jQuery(timeElement).timepicker('setTime', enter);
854
- }
855
- }
856
-
857
-
858
- window.addEventListener('message', function (e) {
859
- if (e.origin == jQuery('#b2sServerUrl').val()) {
860
- var data = JSON.parse(e.data);
861
- if (data.action == 'approve') {
862
- var count = parseInt(jQuery('.b2s-approve-count[data-post-id="' + data.blog_post_id + '"]').html());
863
- var newCount = count - 1;
864
- jQuery('.b2s-approve-count[data-post-id="' + data.blog_post_id + '"]').html(newCount);
865
- if (newCount >= 1) {
866
- jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').remove();
867
- } else {
868
- jQuery('.b2s-post-approve-area-li[data-post-id="' + data.post_id + '"]').closest('ul').closest('li').remove();
869
- }
870
- jQuery.ajax({
871
- url: ajaxurl,
872
- type: "POST",
873
- cache: false,
874
- async: false,
875
- data: {
876
- 'action': 'b2s_update_approve_post',
877
- 'post_id': data.post_id,
878
- 'publish_link': data.publish_link,
879
- 'publish_error_code': data.publish_error_code,
880
- },
881
- success: function (data) {
882
-
883
- }
884
- });
885
- }
886
- }
887
- });
888
-
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
+ jQuery('#b2sPagination').val("1");
11
+ b2sSortFormSubmit();
12
+
13
+ /*if (jQuery('#b2sType').val() != "sched") {
14
+ jQuery('.b2s-sched-calendar-btn').hide();
15
+ }*/
16
+ jQuery('#b2s-sched-calendar-area').hide();
17
+
18
+ });
19
+
20
+
21
+ function wopApprove(blogPostId, postId, url, name) {
22
+ var location = encodeURI(window.location.protocol + '//' + window.location.hostname);
23
+ 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");
24
+ if (postId > 0) {
25
+ function checkIfWinClosed(intervalID) {
26
+ if (win.closed) {
27
+ clearInterval(intervalID);
28
+ //Show Modal
29
+ jQuery('.b2s-publish-approve-modal').modal('show');
30
+ jQuery('#b2s-approve-post-id').val(postId);
31
+ jQuery('#b2s-approve-blog-post-id').val(blogPostId);
32
+ }
33
+ }
34
+ var interval = setInterval(function () {
35
+ checkIfWinClosed(interval);
36
+ }, 500);
37
+ }
38
+ }
39
+
40
+
41
+ jQuery(document).on('click', '.b2s-sched-calendar-btn', function () {
42
+ if (jQuery('#b2s-sched-calendar-area').is(":visible")) {
43
+ jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-show-calendar-btn-title'));
44
+ jQuery('#b2s-sched-calendar-area').hide();
45
+ } else {
46
+ jQuery('#b2s-sched-calendar-btn-text').text(jQuery(this).attr('data-hide-calendar-btn-title'));
47
+ jQuery('#b2s-sched-calendar-area').show();
48