From 7512227ea3f6da1eb473258131332ab4cb5e4c88 Mon Sep 17 00:00:00 2001 From: Tim Payne <47423639+ma7tcsp@users.noreply.github.com> Date: Wed, 22 Nov 2023 13:25:21 +0000 Subject: [PATCH] Delete lib directory --- lib/advanced.js | 262 ------------------------------------------------ lib/config.js | 9 -- 2 files changed, 271 deletions(-) delete mode 100644 lib/advanced.js delete mode 100644 lib/config.js diff --git a/lib/advanced.js b/lib/advanced.js deleted file mode 100644 index 6abebd2..0000000 --- a/lib/advanced.js +++ /dev/null @@ -1,262 +0,0 @@ -// YOU DON'T NEED TO WORRY ABOUT THIS -//Few explaination on each -var layout=""; -window.onresize = function(e){ - var wd=document.querySelector('body').clientWidth; - if(wd<800 && layout!="phone"){ - layout="phone"; - viz.getCurrentUrlAsync().then (function(current_url){ - var index=tab_server.indexOf(current_url.split("?")[0]); - loadVizByIndex(index,true,layout); - }) - } - if(wd>=800 && layout!=""){ - layout=""; - viz.getCurrentUrlAsync().then (function(current_url){ - var index=tab_server.indexOf(current_url.split("?")[0]); - loadVizByIndex(index,true,layout); - }) - } -}; -function showFilterBox(el){ - document.querySelector(`div[mid='${el}']`).classList.toggle("show"); - document.querySelectorAll(`.dropdown-content`).forEach((dd)=>{if(dd.getAttribute("mid")!=el)dd.classList.remove("show")}); -} -function populateFilterMenu(fil){ - var links=""; - if(fil.getAppliedValues()==null){ - console.log("this filter as no applied values :"+fil.getFieldName()); - return; - } - fil.getAppliedValues().map((val)=>{ - var found=false; - document.querySelectorAll(`[filName="${fil.getFieldName()}"]`).forEach((el)=>{ - console.log(); - if(el.text==val.value.toString()) - found=true; - }) - if(!found ){ - links+=`${val.value}`; - } - }) - var list=` - -
${fil.getFieldName()}
- -
` - if(document.querySelector(`div[mid='${fil.getFieldName()}']`)==null){ - document.getElementsByClassName("filter-container")[0].innerHTML=list+document.getElementsByClassName("filter-container")[0].innerHTML; - } - else{ - document.querySelector(`div[mid='${fil.getFieldName()}']`).innerHTML+=links; - } -} -function populateParameterMenu(param){ - var links=""; - if(param.getAllowableValues()==null){ - console.log("this param as no allowable values :"+param.getName()); - return; - } - param.getAllowableValues().map((val)=>{ - var found=false; - document.querySelectorAll(`[paramName="${param.getName()}"]`).forEach((el)=>{ - if(el.text==val.value) - found=true; - }) - if(!found ){ - links+=`${val.formattedValue}`; - } - }) - var list=` - -
${param.getName()}
- -
` - if(document.querySelector(`div[mid='${param.getName()}']`)==null){ - document.getElementsByClassName("filter-container")[0].innerHTML=list+document.getElementsByClassName("filter-container")[0].innerHTML; - } - else{ - document.querySelector(`div[mid='${param.getName()}']`).innerHTML+=links; - } -} -function getParametersForViz(index){ - workbook.getParametersAsync().then((current_param)=>{ - if(typeof(tab_all_params)!="undefined")tab_all_params[index]={parameters:current_param,viz:viz}; - current_param.map((f)=>{ - tab_param[index].map((cf)=>{ - if(cf==f.getName()){ - populateParameterMenu(f); - } - }) - }) - window.parent.restoreTexts(); - }) -} -function getFiltersForViz(index){ - activeSheet.getFiltersAsync().then((current_filter)=>{ - if(typeof(tab_all_filters)!="undefined") { - tab_all_filters[index].filters=[]; - current_filter.map((fl)=>{ - var found=false; - tab_all_filters[index].filters.map(tb=>{ - if(tb.getFieldName()==fl.getFieldName()) - found=true; - }) - if(found==false) - tab_all_filters[index].filters.push(fl) - - }) - tab_all_filters[index].viz=viz; - } - current_filter.map((f)=>{ - tab_filter[index].map((cf)=>{ - if(cf==f.getFieldName()){ - populateFilterMenu(f); - } - }) - }) - window.parent.restoreTexts(); - }) -} -function hideDropDownList(filterName){ - document.querySelector(`div[mid='${filterName}']`).classList.remove("show") -} -function hideEditAskButton(){ - document.getElementsByClassName("webedit")[0].style.display = "none"; - document.getElementsByClassName("askdata")[0].style.display = "none"; -} -function hideEditButton(){ - document.getElementsByClassName("webedit")[0].style.display = "none"; -} -function hideActionButton(){ - document.getElementsByClassName("action")[0].style.display = "none"; -} -function showActionIfExist(index){ - var ids; - tab_action.map((el,id)=>{ - if(el.key==String(index)) - ids=el; - }) - if(ids && ids.val && ids.val=="true") - document.getElementsByClassName("action")[0].style.display = "inline-flex"; -} -function showWebEditIfExist(index){ - var ids; - tab_web.map((el,id)=>{ - if(el.key==String(index)) - ids=el; - }) - if(ids && ids.val && ids.val=="true") - document.getElementsByClassName("webedit")[0].style.display = "inline-flex"; -} -function showAskButtonIfExist(index){ - var ids; - tab_ask.map((el,id)=>{ - if(el.key==String(index)) - ids=el; - }) - if(ids && ids.val && ids.val!=""){ - document.getElementsByClassName("askdata")[0].style.display = "inline-flex"; - } -} -function getElementIndexByIndex(arr,index){ - var ids=-1; - arr.map((el,id)=>{ - if(el.key==String(index)) - ids=id; - }) - return ids -} -function navigateToSheet(workbook,sheetName,index){ - workbook.activateSheetAsync(sheetName).then(()=>{ - activeSheet=workbook.getActiveSheet(); - const removeElements = (elms) => elms.forEach(el => el.remove()); - removeElements( document.querySelectorAll(".filter_dropdown") ); - getFiltersForViz(index); - getParametersForViz(index); - showWebEditIfExist(index); - showActionIfExist(index); - showAskButtonIfExist(index); - // viz.addEventListener(tableau.TableauEventName.MARKS_SELECTION, onMarksSelection); - }); -} -function getOnlyText(from, to){ - from.map((el)=>{ - if(isNaN(el) && !/^(\d+|(\.\d+))(\.\d+)?%$/.test(el)){ - if(!to.includes(el)) - to.push(el); - } - }) - return to; -} -function clearFiltersMenu(){ - const removeElements = (elms) => elms.forEach(el => el.remove()); - removeElements( document.querySelectorAll(".filter_dropdown") ); -} -function restoreImgs(){ - tab_img.map((el)=>{ - if(document.getElementById(el.key)) - document.getElementById(el.key).setAttribute('src',el.val); - }) -} -function restoreTexts(){ - tab_text.map((el)=>{ - if(document.getElementById(el.key)) - document.getElementById(el.key).innerHTML=decodeURIComponent(el.val); - }) -} -function lengthInUtf8Bytes(str) { - var m = encodeURIComponent(str).match(/%[89ABab]/g); - return str.length + (m ? m.length : 0); -} -function setViewMenuVisibility(){ - var firstIndex=[]; - tab_server.map((s,ind)=>{ - if(s==""){ - document.querySelector(`.viz[index='${ind+1}']`).style.display='none'; - } - else{ - document.querySelector(`.viz[index='${ind+1}']`).style.display='inline-flex'; - firstIndex.push(ind); - } - }) - var lower=1000; - firstIndex.map((el)=>{ - lower=Math.min(lower,el) - }) - return lower; -} -function storeLastPageload(index){ - localStorage.setItem("lastpageloaded-grid",index); -} -function getLastPageload(index){ - var id=localStorage.getItem("lastpageloaded-grid"); - if(id!=null) - return parseInt(id); - return null; - -} -function getIndexFromViz(viz){ - return new Promise((resolve,reject)=>{ - viz.getCurrentUrlAsync().then (function(current_url){ - var index=tab_server.findIndex(element => element.includes(current_url.split("?")[0])); - resolve(index); - }) - }) -} -function findElement(arr,keyVal){ - var found = arr.filter(function(item) { return item.key === keyVal.toString(); }); - return found[0] || null; -} -function initialize(){ - if(typeof(tab_img)!="undefined"){ - restoreImgs(); - restoreTexts(); - if(title_index) - document.querySelector("head title").text=title_index; - } -} \ No newline at end of file diff --git a/lib/config.js b/lib/config.js deleted file mode 100644 index a1795f3..0000000 --- a/lib/config.js +++ /dev/null @@ -1,9 +0,0 @@ -var tab_server = ["https://public.tableau.com/views/VS-EventsDashboard-Sustainability/ProductConversion?:showVizHome=no&:embed=true","https://public.tableau.com/views/VS-EventsDashboard-SentimentAnalysis/SentimentAnalysis?:showVizHome=no&:embed=true","",""]; - var tab_filter=[["Topic","User Level"],[],[],[]]; - var tab_web=[{"key":"1","val":"false"},{"key":"2","val":"false"},{"key":"0","val":"false"},{"key":"3","val":"false"}]; - var tab_ask=[{"key":"3","val":""},{"key":"0","val":""},{"key":"1","val":""},{"key":"2","val":""}]; - var tab_param=[[],[],[],[]]; - var tab_text=[{"key":"User-text","val":"User%20"},{"key":"Download-Data-text","val":"Download%20Data%20"},{"key":"Action-text","val":"Action%20"},{"key":"Viz-1-text","val":"Event%20Conversion"},{"key":"Filter-text-Topic","val":"Topic"},{"key":"WebEdit-text","val":"Web%20Edit%20"},{"key":"Filter-text-User Level","val":"User%20Level"},{"key":"Terms-text","val":"Terms%20%26%20Conditions%20"},{"key":"Viz-4-text","val":"Viz%204%20"},{"key":"Reset-Viz-text","val":"Reset%20Viz%20"},{"key":"AskData-text","val":"Ask%20data%20"},{"key":"PrivacyPolicy-text","val":"Privacy%20Policy%20"},{"key":"Viz-3-text","val":"Viz%203%20"},{"key":"Viz-2-text","val":"Sentiment%20Analysis"}]; - var tab_img=[{"key":"img-logo","val":"https://tab-se.github.io/demobuilderportals/assets/TABlogo_wht.png"},{"key":"img-avatar","val":"https://ih1.redbubble.net/image.4909169013.4062/flat,750x,075,f-pad,750x1000,f8f8f8.webp"}]; - var tab_action=[{"key":"2","val":"false"},{"key":"1","val":"false"},{"key":"0","val":"false"},{"key":"3","val":"false"}]; - var title_index="Vertical"; \ No newline at end of file