1export default class NiuBase{ 2 constructor(wrapper = false) { 3 this.wrapper = wrapper 4 this.initialized = false 5 } 6 static Selectors = { 7 wrapper:(id='')=>{return'[data-niu-generic'+(id!==''?'='+id:'')+']'} 8 9 } 10 11 static Scan(settings = null){ 12 if (!this.Selectors || typeof this.Selectors.wrapper !== 'function') { 13 console.warn('Scan called without wrapper'); 14 return; 15 } 16 17 let wrappers = document.querySelectorAll(this.Selectors.wrapper()) 18 wrappers.forEach(wrapper=>{ 19 if(!('dzmInit' in wrapper.dataset)){ 20 (new this(wrapper)).init(settings) 21 }else{ 22 /*console.log('alreadyInit')*/ 23 } 24 }) 25 } 26 init(){ 27 this.wrapper.dataset.dzmInit = '' 28 this.initialized = true 29 } 30 static listenTo(events, f,wrapper=false){ 31 events.forEach(event=>{ 32 dzm.dispatcher.on(event,f,wrapper) 33 }) 34 } 35 36 37 38 dispatch(e,d){ 39 dzm.dispatcher.dispatch(e,d) 40 } 41 42 static selectorToAttribute(selector){ 43 let parts = selector.replace('[','').replace(']','').split('-'); 44 let attribute = ''; 45 parts.forEach((p,k)=>{ 46 if(k === 1){ 47 attribute +=p 48 }else if(k > 1){ 49 attribute += p.charAt(0).toUpperCase() + p.slice(1) 50 } 51 }) 52 return attribute 53 } 54 static select(selector){ 55 return this.selectorToAttribute(selector) 56 } 57 58 log(){ 59 if(dzm.dispatcher.debug){ 60 console.log('ð',...arguments); 61 } 62 } 63 warn(){ 64 if(dzm.dispatcher.debug){ 65 console.log('ð« ',...arguments); 66 } 67 } 68 error(){ 69 console.error('ð¤¬',...arguments); 70 } 71 72}
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.