1(function(root){ 2 var pending; 3 root.BCatalogLabels=function(){ 4 if(pending)return pending; 5 var controller=new AbortController(),timer=setTimeout(function(){controller.abort();},12000); 6 async function get(url){var r=await fetch(url,{signal:controller.signal,credentials:'same-origin'});if(!r.ok)throw new Error('Metadata HTTP '+r.status);return r;} 7 pending=(async function(){ 8 var categories=await(await get('/exec/front/Product/SubCategory')).json(),names={},memberships={}; 9 categories.forEach(function(c){names[c.cate_no]=c.name;}); 10 for(var page=1;page<=40;page++){ 11 var text=await(await get('/magazine/catalog-labels-v2.html?page='+page)).text(); 12 var doc=new DOMParser().parseFromString(text,'text/html'),container=doc.querySelector('#catalog-labels'); 13 if(!container)throw new Error('Invalid labels'); 14 var more=false; 15 container.querySelectorAll('[data-category]').forEach(function(group){ 16 var ids=group.querySelectorAll('[data-id]');if(ids.length===200)more=true; 17 ids.forEach(function(node){var id=Number(node.getAttribute('data-id'));if(id)memberships[id]=Number(group.getAttribute('data-category'));}); 18 }); 19 if(!more)break; 20 } 21 return {names:names,memberships:memberships}; 22 })().finally(function(){clearTimeout(timer);}); 23 pending.catch(function(){pending=null;});return pending; 24 }; 25})(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.