var chapters=document.getElementsByTagName('a'); var anchorContainer= document.createElement("div"); var anchorImage= document.createElement("img"); var anchor= document.createElement("div"); var currentHeight= 0; // Remove Header number appended by plugin function removeHeaders(){ var head2 = document.getElementsByTagName('h2'); var head3 = document.getElementsByTagName('h3'); var head4 = document.getElementsByTagName('h4'); for(var i=0; i 830){ anchor.style= "position: fixed; right: 50px;top: 178px"; } else if(currentHeight< 830 && currentHeight> 725){ anchor.style= "position: fixed; right: 50px;top: 88px"; } else if(currentHeight< 725){ anchor.style= "position: fixed; right: 50px;top: 30px"; } if(window.location.href.includes("Components.html")){ if(window.location.href.includes("#Components") || window.location.href.includes("#ref-components")){ anchorImage.style= "width: 0px; height: 0px;" } if(window.innerWidth < 1650) { document.getElementsByClassName('page-wrapper')[0].style.width= '70%'; } else if(window.innerWidth > 1650) { document.getElementsByClassName('page-wrapper')[0].style.width= '75%'; } } // Set Anchor background Phone image with button changes if(androidSelected){ anchorContainer.style= "background: url(https://docs.nativebase.io/docs/assets/android.png) no-repeat; padding: 42px 0px 68px 10px; width: 292px; height: 600px;" } else if(!androidSelected){ anchorContainer.style= "background: url(https://docs.nativebase.io/docs/assets/iosphone.png) no-repeat;padding: 63px 20px 100px 15px; width: 292px; height: 600px;"; } // Hide useless buttons for our big pages var nowHref= window.location.href; if(nowHref.includes("Customize.html")){ $('#goTop').hide(); $('.navigation-next').hide(); $('.navigation-prev').hide(); } if(nowHref.includes("Example.html") || nowHref.includes("Examples.html")){ $('#goTop').hide(); $('.navigation-next').hide(); $('.navigation-prev').hide(); } if(nowHref.includes("Components.html")){ $('#goTop').hide(); $('.navigation-next').hide(); $('.navigation-prev').hide(); // Fetch Image ID from URL and set respective image var hash= nowHref.indexOf("#"); var length= nowHref.length; var pointer= nowHref.substring(hash+1,length); this.setImage(pointer); } },200); // set image according to pointer received. function setImage(pointer){ if(androidSelected){ for(var i=0;i< filterListAndroid.length;i++){ if(filterListAndroid[i].alt.includes(pointer)){ if(anchorImage.src !== filterListAndroid[i].src){ anchorImage.src= filterListAndroid[i].src; anchorImage.style="width: 270px; height: 470px" anchorContainer.appendChild(anchorImage); } } } } else if(!androidSelected){ for(var i=0;i< filterListIos.length;i++){ if(filterListIos[i].alt.includes(pointer)){ if(anchorImage.src !== filterListIos[i].src){ anchorImage.src= filterListIos[i].src; anchorImage.style="width: 256px; height: 453px" anchorContainer.appendChild(anchorImage); } } } } } require(['gitbook', 'jQuery'], function(gitbook, $) { gitbook.events.bind("page.change", function(e, config) { removeHeaders(); // Useless buttons removed appended by plugins $('#book-search-input').hide(); $('.navigation-prev').hide(); $('#anchors-navbar').hide(); $('#goTop').hide(); var and=0; var ios=0; // Making summary.md image clickable for(var i=0; i< chapters.length; i++){ if(chapters[i].href.includes("http://nativebase.io/")){ chapters[i].style= "height: 80px"; } } // Populate our filter image arrays var list=document.getElementsByTagName("img"); for(var i=0; i< list.length; i++){ if(list[i].alt.includes("Preview")){ list[i].style.display= "none"; if(list[i].alt.includes("android")){ filterListAndroid[and]= list[i]; and++; } else if(list[i].alt.includes("ios")){ filterListIos[ios]= list[i]; ios++; } } } // set anchor visible for Components page if(window.location.href.includes("Components.html")){ if(anchorImage.src != '' && anchorImage.src != undefined){ $('.page-wrapper').append(anchor); $("#anchor").show(); } // Also show children from summary table for(var i=0; i< chapters.length; i++){ if(chapters[i].href.includes("Components.html")){ chapters[i].style.display= "inherit"; } } } // Remove anchor for other pages else if(!(window.location.href.includes("Components.html"))){ $("#anchor").hide(); for(var i=0; i< chapters.length; i++){ if(chapters[i].href.includes("Components.html") && !(chapters[i].href.includes('#Components'))){ chapters[i].style.display= "none"; } } } // Display children from summary table if(window.location.href.includes("Customize.html")){ for(var i=0; i< chapters.length; i++){ if(chapters[i].href.includes("Customize.html")){ chapters[i].style.display= "inherit"; }} } // Hide children from summary table else if(!(window.location.href.includes("Customize.html"))){ for(var i=0; i< chapters.length; i++){ if(chapters[i].href.includes("Customize.html") && !(chapters[i].href.includes('#Customize'))){ chapters[i].style.display= "none"; }} } // Display children from summary table if(window.location.href.includes("Examples.html") || window.location.href.includes("Example.html")){ for(var i=0; i< chapters.length; i++){ if(chapters[i].href.includes("Example.html")){ chapters[i].style.display= "inherit"; }} } // Hide children from summary table else if(!(window.location.href.includes("Examples.html")) && !(window.location.href.includes("Example.html"))){ for(var i=0; i< chapters.length; i++){ if(chapters[i].href.includes("Example.html")){ chapters[i].style.display= "none"; }} } }); });