1class wpdevart_org_chart_front{ 2 constructor(container, options = {} ){ 3 var def_options = { 4 mobile_frendly:'mobile', 5 mobile_size: 450, 6 def_scroll: 0, 7 } 8 this.options = Object.assign(def_options, options); 9 var self = this; 10 this.container=document.getElementById( container ); 11 this.container_id = this.container.getAttribute( "id" ); 12 this.container_width = this.container.clientWidth; 13 if(options.mobile_frendly == 'mobile' || options.mobile_frendly == 'mob_view_only_on_mob'){ 14 window.addEventListener('resize', function(){ 15 self.set_mobile_class(); 16 self.create_tree_line_mobile_css(); 17 }); 18 self.container_width = self.container.clientWidth; 19 self.set_mobile_class(); 20 self.create_tree_line_mobile_css(); 21 }else{ 22 23 self.create_tree_line_mobile_css(); 24 } 25 self.set_def_scroll(); 26 } 27 28 set_mobile_class(){ 29 var self = this, check_only_mob = true, elementAfterMobile = document.getElementsByClassName('has_children chart_wpda_mobile_before'); 30 self.mob_width = Math.min( window.innerWidth, self.container.parentElement.parentElement.clientWidth ); 31 if(this.options.mobile_frendly == 'mob_view_only_on_mob'){ 32 check_only_mob = (window.innerWidth <= this.options.mobile_size) 33 } 34 if(self.mob_width <= self.container_width && check_only_mob){ 35 self.container.classList.add('wpda_mobile'); 36 self.container.setAttribute('style',''); 37 38 39 }else{ 40 self.container.classList.remove( 'wpda_mobile' ); 41 self.container.style.marginTop = "0"; 42 43 } 44 } 45 46 checkElementParentsHasClassName(element,nameOfClass){ 47 if (element.className.split(' ').indexOf(nameOfClass)>=0) 48 return true; 49 return element.parentElement && this.checkElementParentsHasClassName(element.parentElement, nameOfClass); 50 } 51 52 set_def_scroll(){ 53 var self = this, scroll_pixels = 0, diff = 0; 54 diff = (self.container.parentElement.parentElement.clientWidth - self.container_width) 55 if(diff >= 0){ 56 return; 57 } 58 scroll_pixels = parseInt( Math.abs( diff ) * self.options.def_scroll / 100 ); 59 self.container.parentElement.scrollTo( scroll_pixels, 0); 60 } 61 62 create_tree_line_mobile_css(){ 63 let self = this; 64 if(self.container.classList.contains( 'first_child_hidden' ) && self.container.classList.contains( 'wpda_mobile' )){ 65 let firstElementHeight = self.container.getElementsByTagName( 'ul' )[0].getElementsByTagName( 'li' )[0].getElementsByTagName( 'ul' )[0].getElementsByTagName('li')[0].getElementsByClassName( 'wpda_tree_item_container' )[0].offsetHeight; 66 let line_css = document.getElementById(self.container_id + "_line_css"); 67 if(line_css == null){ 68 line_css = document.createElement("style"); 69 line_css.setAttribute("id", self.container_id + "_line_css"); 70 line_css.innerHTML = '.wpda_mobile.first_child_hidden#' + self.container_id + ' > ul > li > ul > li:first-child::before{top: ' + parseInt(firstElementHeight / 2) + 'px; height: calc(100% - ' + parseInt( firstElementHeight / 2 ) + 'px); }'; 71 document.getElementsByTagName('body')[0].appendChild( line_css ); 72 }else{ 73 line_css.innerHTML = '.wpda_mobile.first_child_hidden#' + self.container_id + ' > ul > li > ul > li:first-child::before{top: ' + parseInt(firstElementHeight/2) + 'px; height: calc(100% - ' + parseInt(firstElementHeight/2) + 'px); }'; 74 } 75 } 76 } 77}
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.