1(function () { 2 'use strict'; 3 4 var IOClass = function (options) { 5 this.init(options); 6 }; 7 8 IOClass.DEFAULTS = { 9 baseUrl: '', 10 ioUrl: '' 11 }; 12 13 IOClass.prototype = { 14 15 constructor: IOClass, 16 17 init: function (options) { 18 this.options = $.extend({}, IOClass.DEFAULTS, options); 19 }, 20 21 call: function (name, params, context, callback) { 22 var data = {'name': name, 'params': params}; 23 this.request(data, context, callback); 24 }, 25 26 request: function (req, context, callback) { 27 var that = this; 28 29 $.evo.trigger('load.io.request', { req: req }); 30 31 return $.ajax({ 32 type: "POST", 33 dataType: "json", 34 url: this.options.ioUrl, 35 data: {'io': JSON.stringify(req)}, 36 success: function (data, textStatus, jqXHR) { 37 that.handleResponse(data, context); 38 if (typeof callback === 'function') { 39 callback(false, context); 40 } 41 }, 42 error: function (jqXHR, textStatus, errorThrown) { 43 that.handleError(textStatus, errorThrown); 44 if (typeof callback === 'function') { 45 callback(true, textStatus); 46 } 47 }, 48 complete: function (jqXHR, textStatus) { 49 $.evo.trigger('loaded.io.request', { 50 req: req, 51 status: textStatus 52 }); 53 } 54 }); 55 }, 56 57 handleResponse: function (data, context) { 58 if (data.domAssigns) { 59 data.domAssigns.forEach(item => { 60 let $item = $('#' + item.target); 61 62 if ($item.length > 0) { 63 $item[0][item.attr] = item.data; 64 } 65 }); 66 } 67 68 if (!context) { 69 context = this; 70 } 71 72 if (data.debugLogLines) { 73 data.debugLogLines.forEach(line => { 74 if (line[1]) { 75 console.groupCollapsed(...line[0]); 76 } else if (line[2]) { 77 console.groupEnd(); 78 } else { 79 console.log(...line[0]); 80 } 81 }); 82 } 83 84 if (data.evoProductCalls) { 85 data.evoProductCalls.forEach(([name, args]) => { 86 $.evo.article()[name](...args); 87 }); 88 } 89 90 if (data.varAssigns) { 91 data.varAssigns.forEach(assign => { 92 context[assign.name] = assign.value; 93 }); 94 } 95 96 if (data.windowLocationHref) { 97 window.location.href = data.windowLocationHref; 98 } 99 }, 100 101 handleError: function (textStatus, errorThrown) { 102 $.evo.error('handleError', textStatus, errorThrown); 103 }, 104 105 getFormValues: function (parent) { 106 return $('#' + parent).serializeObject(); 107 }, 108 }; 109 110 // PLUGIN DEFINITION 111 // ================= 112 113 $.evo.io = function () { 114 return new IOClass({ 115 'ioUrl': $('#jtl-io-path').data('path') + '/io' 116 }); 117 }; 118})(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.