1(function (window) { 2 3if (!!window.JCCatalogCompareList) 4{ 5 return; 6} 7 8window.JCCatalogCompareList = function (params) 9{ 10 this.obCompare = null; 11 this.obAdminPanel = null; 12 this.visual = params.VISUAL; 13 this.visual.LIST = this.visual.ID + '_tbl'; 14 this.visual.ROW = this.visual.ID + '_row_'; 15 this.visual.COUNT = this.visual.ID + '_count'; 16 this.ajax = params.AJAX; 17 this.position = params.POSITION; 18 19 BX.ready(BX.proxy(this.init, this)); 20}; 21 22window.JCCatalogCompareList.prototype.init = function() 23{ 24 this.obCompare = BX(this.visual.ID); 25 if (!!this.obCompare) 26 { 27 BX.addCustomEvent(window, "OnCompareChange", BX.proxy(this.reload, this)); 28 BX.bindDelegate(this.obCompare, 'click', {tagName : 'a'}, BX.proxy(this.deleteCompare, this)); 29 if (this.position.fixed && this.position.align.vertical === 'top') 30 { 31 this.obAdminPanel = BX('bx-panel'); 32 if (!!this.obAdminPanel) 33 { 34 this.setVerticalAlign(); 35 BX.addCustomEvent(window, 'onTopPanelCollapse', BX.proxy(this.setVerticalAlign, this)); 36 } 37 } 38 $(this.obCompare).find('#'+ this.visual.LIST).scrollbar({}); 39 } 40}; 41 42window.JCCatalogCompareList.prototype.reload = function() 43{ 44 //BX.showWait(this.obCompare);
45 BX.ajax.post( 46 this.ajax.url, 47 this.ajax.params, 48 BX.proxy(this.reloadResult, this) 49 ); 50}; 51 52window.JCCatalogCompareList.prototype.reloadResult = function(result) 53{ 54 BX.closeWait(this.obCompare); 55 this.obCompare.innerHTML = result; 56 BX.style(this.obCompare, 'display', 'block'); 57 $(this.obCompare).find('#'+ this.visual.LIST).scrollbar({}); 58}; 59 60window.JCCatalogCompareList.prototype.deleteCompare = function() 61{ 62 var target = BX.proxy_context, 63 itemID, 64 url; 65 66 if (!!target && target.hasAttribute('data-id')) 67 { 68 itemID = parseInt(target.getAttribute('data-id'), 10); 69 if (!isNaN(itemID)) 70 { 71 BX.showWait(this.obCompare); 72 url = this.ajax.url + this.ajax.templates.delete + itemID.toString(); 73 BX.ajax.loadJSON( 74 url, 75 this.ajax.params, 76 BX.proxy(this.deleteCompareResult, this) 77 ); 78 } 79 } 80}; 81 82window.JCCatalogCompareList.prototype.deleteCompareResult = function(result) 83{ 84 var tbl, 85 i, 86 deleteID, 87 cnt, 88 newCount; 89 90 BX.closeWait(this.obCompare); 91 if (typeof result === 'object') 92 { 93 if (!!result.STATUS && result.STATUS === 'OK' && !!result.ID) 94 { 95 96 tbl = BX(this.visual.LIST); 97 if (tbl) 98 { 99 var rows = BX.findChild(tbl, {}, false, true); 100 if (rows.length > 1) 101 { 102 deleteID = this.visual.ROW + result.ID; 103 104 for (i = 0; i < rows.length; i++) 105 { 106 if (rows[i].id === deleteID) 107 { 108 BX.remove(rows[i]); 109 } 110 } 111 112 tbl = null; 113 if (!!result.COUNT) 114 { 115 newCount = parseInt(result.COUNT, 10); 116 if (!isNaN(newCount)) 117 { 118 cnt = BX(this.visual.COUNT); 119 if (!!cnt) 120 { 121 cnt.innerHTML = newCount.toString(); 122 cnt = null; 123 } 124 BX.style(this.obCompare, 'display', (newCount > 0 ? 'block' : 'none')); 125 } 126 } 127 } 128 else 129 { 130 this.reload(); 131 } 132 } 133 } 134 } 135}; 136 137window.JCCatalogCompareList.prototype.setVerticalAlign = function() 138{ 139 var topSize; 140 if (!!this.obCompare && !!this.obAdminPanel) 141 { 142 topSize = parseInt(this.obAdminPanel.offsetHeight, 10); 143 if (isNaN(topSize)) 144 { 145 topSize = 0; 146 } 147 topSize +=5; 148 BX.style(this.obCompare, 'top', topSize.toString()+'px'); 149 } 150}; 151 152})(window);
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.