1Selectize.define('getall_button', function (options) { 2 /** 3 * Escapes a string for use within HTML. 4 * 5 * @param {string} str 6 * @returns {string} 7 */ 8 var escape_html = function (str) { 9 return (str + '') 10 .replace(/&/g, '&') 11 .replace(/</g, '<') 12 .replace(/>/g, '>') 13 .replace(/"/g, '"'); 14 }; 15 16 options = $.extend({ 17 label: '×', 18 title: 'Remove', 19 className: 'clearAll', 20 url: 'http://localhost:53014/admin/Applications/GetResultsJson?Implementer=Core.Repositories.ProvisionRepository&coreModuleId=2', 21 append: true 22 }, options); 23 24 var self = this, 25 html = '<span class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</span>'; 26 27 28 this.setup = (function () { 29 var original = self.setup; 30 return function () { 31 // override the item rendering method to add the button to each 32 original.apply(this, arguments); 33 34 this.$wrapper.append(html); 35 36 // add event listener 37 this.$wrapper.on('click', '.' + options.className, function (e) { 38 e.preventDefault(); 39 $.ajax({
40 contentType: 'application/json; charset=utf-8', 41 dataType: 'json', 42 url: options.url, 43 type: 'GET', 44 error: function () { 45 this.callback(); 46 }, 47 success: function (items) { 48 //debugger; 49 this.callback(items); 50 } 51 }); 52 }); 53 54 }; 55 })(); 56 57 58});
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.