1$(function () { 2 $(function () { // these methods execute after all other methods registered to document.ready 3 tAjaxStructuredData.render(); 4 }); 5}); 6 7var tAjaxStructuredData = { 8 elem: null, 9 register: function (key, value) { 10 if (typeof cpsys == "undefined") cpsys = new Object(); 11 if (!cpsys.StructuredData) cpsys.StructuredData = new Object(); 12 cpsys.StructuredData[key] = value; 13 //console.log("register", key, value); 14 }, 15 render: function () { 16 if (typeof cpsys == "undefined") return; 17 if (!cpsys.StructuredData) return; 18 19 if (!this.elem) { 20 this.elem = document.createElement('script'); 21 this.elem.type = 'application/ld+json'; 22 } 23 24 var data = []; 25 $.each(cpsys.StructuredData, function (key, value) { 26 if (value && (value.length > 0)) 27 data = data.concat(value); 28 }); 29 30 if (data.length <= 0) { 31 this.elem.text = ""; 32 } else if (data.length == 1) { 33 this.elem.text = JSON.stringify(data[0]) 34 } else { 35 this.elem.text = JSON.stringify(data) 36 } 37 38 if (this.elem.text && !this.elem.parentElement) 39 $("head").append(this.elem); 40 else if (!this.elem.text && this.elem.parentElement) 41 $(this.elem).remove(); 42 } 43}
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.