1jQuery(function($) { 2 if (typeof ngg_pro_proofing_i18n != 'undefined') { 3 $('#npl_content').on('npl_ready', function (e, data) { 4 var methods = data.methods; 5 var self = data.galleria_theme; 6 methods.thumbnails.proofing = { 7 init: function() {}, 8 9 proofing_button: $('<i/>') 10 .addClass('nggpl-toolbar-button-proofing fa fa-star') 11 .attr({'title': ngg_pro_proofing_i18n.nggpl_title}), 12 13 get_active_color: function() { 14 var retval = '#ffff00'; 15 if (typeof ngg_proofing_settings !== 'undefined') { 16 retval = ngg_proofing_settings.active_color; 17 } 18 return retval; 19 }, 20 21 events: { 22 bind: function() { 23 if (typeof ngg_image_proofing !== 'undefined') { 24 self.bind('npl_init', this.npl_init); 25 self.bind('image', this.image); 26 } 27 }, 28 29 is_proofing_enabled: function() { 30 return methods.galleria.get_displayed_gallery_setting('ngg_proofing_display', false); 31 }, 32 33 is_image_proofed: function() { 34 var image_id = methods.galleria.get_current_image_id(); 35 var gallery_id = $.nplModal('get_state').gallery_id; 36 var proofed_list = ngg_image_proofing.getList(gallery_id); 37 var index = proofed_list.indexOf(image_id.toString()); 38 39 return (index > -1); 40 }, 41 42 image: function() { 43 if (methods.thumbnails.proofing.events.is_proofing_enabled()) { 44 var btn = $('.galleria-nextgen-buttons .nggpl-toolbar-button-proofing'); 45 if (methods.thumbnails.proofing.events.is_image_proofed()) { 46 btn.css({color: methods.thumbnails.proofing.get_active_color()}); 47 } else { 48 // If there's no custom icon color then setting the color attribute to '' will not 49 // remove our above color attribute. Remove the style attribute entirely and reset 50 btn.removeAttr('style'); 51 } 52 } 53 }, 54 55 npl_init: function() { 56 if (methods.thumbnails.proofing.events.is_proofing_enabled()) { 57 methods.thumbnails.register_button( 58 methods.thumbnails.proofing.proofing_button, 59 function(event) { 60 methods.thumbnails.proofing.events.button_clicked(event); 61 } 62 ); 63 } 64 }, 65 66 button_clicked: function (event) { 67 var state = $.nplModal('get_state'); 68 ngg_image_proofing.addOrRemoveImage(state.gallery_id, state.image_id); 69 methods.thumbnails.proofing.events.image(); 70 event.preventDefault(); 71 } 72 } 73 }; 74 75 methods.thumbnails.proofing.events.bind(); 76 }); 77}});
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.