1jQuery(document).ready(function($) { 2 'use strict'; 3 4 $(document).ready(function () { 5 var $modal = $("#bptk-report-modal"); 6 var $modalOverlay = $("#bptk-report-modal-overlay"); 7 var $closeButton = $("#bptk-report-close-button"); 8 var $openButton = $(".bptk-report-button"); 9 10 $(document).on('click', '.bptk-report-button', function (e) { 11 e.preventDefault(); 12 13 if ($(this).hasClass("bptk-report-member-button")) { 14 $("#bptk-activity-type").val('member'); 15 $('#bptk-item-id').val($(this).data('reported')); 16 } else if ($(this).hasClass("bptk-report-activity-button")) { 17 $("#bptk-activity-type").val('activity'); 18 var li = $(this).closest('li'); 19 var item_id = li.attr('id').substr(9, li.attr('id').length); 20 $('#bptk-item-id').val(item_id); 21 } else if ($(this).hasClass("bptk-report-activity-comment-button")) { 22 $("#bptk-activity-type").val('activity-comment'); 23 var li = $(this).closest('li'); 24 var item_id = li.attr('id').substr(9, li.attr('id').length); 25 $('#bptk-item-id').val(item_id); 26 } else if ($(this).hasClass("bptk-report-group-button")) { 27 $("#bptk-activity-type").val('group'); 28 $('#bptk-item-id').val($(this).data('id')); 29 } else if ($(this).hasClass("bptk-report-comment-button")) { 30 $("#bptk-activity-type").val('comment'); 31 $('#bptk-item-id').val($(this).data('id')); 32 } else if ($(this).hasClass("bptk-report-message-button")) { 33 $("#bptk-activity-type").val('message'); 34 $('#bptk-item-id').val($(this).data('thread')); 35 } else if ($(this).hasClass("bptk-report-forum-topic-button")) { 36 $("#bptk-activity-type").val('forum-topic'); 37 // Try and get item ID from the closest article. If not, try and find it in the reply form 38 if ($(this).closest('article').length) { 39 var article = $(this).closest('article'); 40 var item_id = article.attr('id').substr(5, article.attr('id').length); 41 } else if ($('.bbp-reply-form').length) { 42 var article = $('.bbp-reply-form'); 43 var item_id = article.attr('id').substr(10, article.attr('id').length); 44 } 45 $('#bptk-item-id').val(item_id); 46 } else if ($(this).hasClass("bptk-report-forum-reply-button")) { 47 $("#bptk-activity-type").val('forum-reply'); 48 if ($(this).closest('.bbp-reply-header').length) { 49 var div = $(this).closest('.bbp-reply-header'); 50 } else if ($(this).closest('.bs-reply-list-item').length) { 51 var div = $(this).closest('.bs-reply-list-item'); 52 } 53 var item_id = div.attr('id').substr(5, div.attr('id').length); 54 $('#bptk-item-id').val(item_id); 55 } else if ($(this).hasClass("bptk-report-rtmedia-button")) { 56 $("#bptk-activity-type").val('rtmedia'); 57 $('#bptk-item-id').val($(this).data('media')); 58 } 59 60 $("#bptk-reported-id").val($(this).data('reported')); 61 $("#bptk-link").val($(this).data('link')); 62 $("#bptk-meta").val($(this).data('meta')); 63 64 // if rtMedia detected, close popup to prevent inability to type in report box. 65 if ($('.mfp-wrap').length) { 66 var magnificPopup = $.magnificPopup.instance; 67 // save instance in magnificPopup variable 68 magnificPopup.close(); 69 // Close popup that is currently opened 70 } 71 72 $modal.toggleClass("bptk-report-closed", "new"); 73 $modalOverlay.toggleClass("bptk-report-closed", "new"); 74 }); 75 76 $modalOverlay.click(function (e) { 77 78 $modal.toggleClass("bptk-report-closed"); 79 $modalOverlay.toggleClass("bptk-report-closed"); 80
81 $("#bptk-reported-id").val(''); 82 $("#bptk-activity-type").val(''); 83 $("#bptk-report-type").val(-1).change(); 84 $("#bptk-desc").val(''); 85 $("#bptk-link").val(''); 86 $("#bptk-meta").val(''); 87 $('#bptk-report-modal-response').hide(); 88 $("#bptk-report-submit").show(); 89 $("#bptk-report-submit").text('Send'); 90 }); 91 92 $closeButton.click(function (e) { 93 e.preventDefault(); 94 95 $modal.toggleClass("bptk-report-closed"); 96 $modalOverlay.toggleClass("bptk-report-closed"); 97 98 $("#bptk-reported-id").val(''); 99 $("#bptk-activity-type").val(''); 100 $("#bptk-report-type").val(-1).change(); 101 $("#bptk-desc").val(''); 102 $("#bptk-link").val(''); 103 $("#bptk-meta").val(''); 104 $('#bptk-report-modal-response').hide(); 105 $("#bptk-report-submit").show(); 106 $("#bptk-report-submit").text('Send'); 107 108 }); 109 110 $("#bptk-report-submit").click(function () { 111 112 var $initial = $('#bptk-desc').css('border'); 113 114 if ($('#bptk-desc').val().length === 0) { 115 $('#bptk-desc').css('border', '1px solid red'); 116 return false; 117 } else { 118 $('#bptk-desc').css('border', $initial); 119 $("#bptk-report-submit").text('...'); 120 } 121 122 // Check what component button is for, and find an item ID 123 124 var data = { 125 'action': 'process_form', 126 'reported': $("#bptk-reported-id").val(), 127 'reporter': $("#bptk-reporter-id").val(), 128 'nonce': $(this).data('nonce'), 129 'activity_type': $("#bptk-activity-type").val(), 130 'report_type': $("#bptk-report-type").val(), 131 'details': $("#bptk-desc").val(), 132 'link': $("#bptk-link").val(), 133 'meta': $("#bptk-meta").val(), 134 'item_id': $('#bptk-item-id').val() 135 }; 136 137 $.post(bptk_ajax_settings.ajaxurl, data, function (response) { 138 139 if (response.success == true) { 140 141 $("#bptk-report-submit").hide(); 142 $('#bptk-report-modal-response').show(); 143 $('#bptk-report-modal-response').text(response.data); 144 145 } else { 146 147 $("#bptk-report-submit").hide(); 148 $('#bptk-report-modal-response').show(); 149 $('#bptk-report-modal-response').text(response.error); 150 } 151 152 }); 153 }); 154 }); 155 156 $(document).ready(function () { 157 158 if ($('.youzify-group').length) { 159 160 $(".bptk-report-group-button").appendTo(".youzify-usermeta ul"); 161 $(".bptk-report-group-button").css({ 162 'display': 'inline-block', 163 'cursor': 'pointer' 164 }); 165 } else if ($('.youzify-forum').length) { 166 167 $(".bptk-report-forum-topic-button").appendTo(".youzify-bbp-topic-head-meta"); 168 $(".bptk-report-forum-topic-button").show(); 169 } else { 170 171 } 172 }); 173 174 $(document).ready(function () { 175 $(document).on('click', '.bptk-report-button-disabled', function (e) { 176 e.preventDefault(); 177 }); 178 }); 179 180 $(function () { 181 182 $('#bptk-frontend-moderation-panel .button').click(function (e) { 183 e.preventDefault(); 184 process_panel(this); 185 }); 186 187 function process_panel(obj) { 188 var nonce = $('#bptk-frontend-moderation-panel-nonce').val(); 189 var type = $(obj).attr('id'); 190 var id = $(obj).data('id'); 191 var post = $(obj).data('post'); 192 var activity = $(obj).data('activity'); 193 $(obj).toggleClass("bptk-button-true"); 194 var active = $(obj).hasClass("bptk-button-true"); 195 196 jQuery.ajax({ 197 type: "post", 198 dataType: "html", 199 url: ajaxurl, 200 data: { 201 action: "process_panel", 202 type: type, 203 status: active, 204 id: id, 205 post: post, 206 activity: activity, 207 nonce: nonce 208 }, 209 success: function (msg) { 210 211 }, 212 error: function (jqXHR, textStatus, errorThrown) { 213 console.log(jqXHR, textStatus, errorThrown); 214 } 215 }); 216 } 217 218 });
219 220 $( 'body' ).on( 221 'click', 222 '.bptk-moderate-button', 223 function () { 224 unmoderate_activity( this ); 225 return false; 226 } 227 ); 228 229 function unmoderate_activity( el ) { 230 let activity_id = $( el ).attr('data-id'); 231 let nonce = $( el ).attr('data-nonce'); 232 233 $.ajax({ 234 type: 'POST', 235 dataType: 'JSON', 236 url: bptk_ajax_settings.ajaxurl, 237 data: { 238 activity_id: activity_id, 239 nonce: nonce, 240 action: 'unmoderate_activity' 241 }, 242 success: function (response) { 243 if ( ! response.success ) { 244 console.log( response ); 245 } else { 246 console.log( response ); 247 let activity = $( '#activity-' + response.data.id ); 248 $( activity ).removeClass( 'moderated' ); 249 $( el ).parent().hide(); 250 } 251 } 252 }); 253 } 254 255 if ( $('.activity-list').length > 0 ) { 256 console.log('init'); 257 258 } 259 260 $(document).ready(function(){ 261 if ( $('.activity-list').length > 0 ) { 262 console.log('init'); 263 264 } 265 266 $('li').each(function() { 267 // console.log( $(this) ); 268 269 }); 270 }) 271});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.