1(function($) { 2 if (typeof acf !== 'undefined') { 3 var kamra_relationship_field = acf.models.RelationshipField.extend({ 4 type: 'relationship', 5 events: { 6 'keypress [data-filter]': 'onKeypressFilter', 7 'change [data-filter]': 'onChangeFilter', 8 'keyup [data-filter]': 'onChangeFilter', 9 'click .choices-list .acf-rel-item': 'onClickAdd', 10 'click [data-name="remove_item"]': 'onClickRemove', 11 'click [data-name="show_image"]': 'fetchMMImage', 12 }, 13 fetchMMImage: function (id, $el) { 14 if($el.parent().find('.acf-details-image').length) { 15 $el.parent().find('.acf-details-image').remove(); 16 $el.removeClass('-cancel'); 17 $el.addClass('-plus'); 18 $el.attr('title', 'predogled slike'); 19 return; 20 } 21 jQuery.ajax({ 22 type: 'POST', 23 url:kamraadmin_ajax.ajax_url, 24 data:'action=kamra_mm_image_preview_ajax&post_id='+$el.data('id'), 25 beforeSend: function() { 26 $el.removeClass('-plus'); 27 $el.addClass('-cancel'); 28 $el.attr('title', 'zapri'); 29 $el.parent().find('.acf-details-image').remove(); 30 $el.parent().append('<span class="acf-details-image"><em>...nalagam...</em></span>'); 31 }, 32 success: function(html) { 33 $el.parent().find('.acf-details-image').remove(); 34 $el.parent().append(html); 35 }, 36 error: function() { 37 $el.parent().find('.acf-details-image').remove(); 38 $el.parent().append('<span class="acf-details-image" style="color:#b32d2e"><em>Napaka</em></span>'); 39 } 40 }); 41 }, 42 walkChoices: function (data) { 43 // walker 44 var walk = function (data, name) { 45 // vars 46 var html = ''; // is array 47 if ($.isArray(data)) { 48 data.map(function (item) { 49 html += walk(item, name); 50 }); // is item 51 } else if ($.isPlainObject(data)) { 52 // group 53 if (data.children !== undefined) { 54 html += '<li><span class="acf-rel-label">' + acf.escHtml(data.text) + '</span><ul class="acf-bl">'; 55 html += walk(data.children, name); 56 html += '</ul></li>'; // single 57 } else { 58 if (name == 'kamra_mm_elementi') { 59 html += '<li><span class="acf-rel-item" data-id="' + acf.escAttr(data.id) + '">' + acf.escHtml(data.text) + '</span><a href="#" title="predogled slike" class="acf-icon -plus small dark" data-name="show_image" data-id="' + acf.escAttr(data.id) + '"></a></li>'; 60 } else { 61 html += '<li><span class="acf-rel-item" data-id="' + acf.escAttr(data.id) + '">' + acf.escHtml(data.text) + '</span></li>'; 62 } 63 } 64 } // return 65 66 67 return html; 68 }; 69 70 return walk(data, this.get('name')); 71 } 72 }); 73 acf.registerFieldType( kamra_relationship_field ); 74 } 75})(jQuery);
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.