1/** 2 * @namespace WPGMZA 3 * @module WPGMZA.CategoryPicker 4 * @requires WPGMZA 5 */ 6jQuery(function($) { 7 8 WPGMZA.CategoryPicker = function(element) 9 { 10 var self = this; 11 var data = JSON.parse( $(element).attr("data-js-tree-data") ); 12 13 this.element = element; 14 this.input = $(this.element).find("input.wpgmza-category-picker-input"); 15 16 $(this.element).jstree({ 17 "core": { 18 "data": data 19 }, 20 "plugins": [ 21 "checkbox" 22 ] 23 }).on("loaded.jstree", function() { 24 $(self.element).jstree("open_all"); 25 }); 26 27 $(this.element).after(this.input); 28 29 $(this.element).on("changed.jstree", function(e, data) { 30 31 self.input.val(self.getSelection().join(",")); 32 33 }); 34 } 35 36 WPGMZA.CategoryPicker.prototype.getSelection = function() 37 { 38 return $(this.element).jstree("get_selected"); 39 } 40 41 WPGMZA.CategoryPicker.prototype.setSelection = function(arr) 42 { 43 $(this.element).jstree("deselect_all"); 44 45 if(!arr) 46 return; 47 48 $(this.element).jstree("select_node", arr); 49 } 50 51});
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.