script pour établir une bdd Ãà partir d'un tsv avec différent format - retour accueil
git clone git://bebou.netlib.re/laradb
Log | Files | Refs |
cssVarFilledCookies.js (1349B)
1 function filterEntriesWithCSSVariables(obj) { 2 return Object.entries(obj).filter(([key, value]) => { 3 return typeof value === 'string' && value.startsWith('--'); 4 }); 5 } 6 const style = getComputedStyle(document.documentElement) 7 const cssVars = filterEntriesWithCSSVariables(style).map((v) => v[1]); 8 9 const container = document.createElement('section') 10 container.innerHTML = '<p></p>' 11 container.setAttribute('id','cvfc') 12 document.body.appendChild(container) 13 const table = document.createElement('table') 14 container.appendChild(table) 15 16 cssVars.reverse().forEach((cssVar) => { 17 let val = style.getPropertyValue(cssVar) 18 document.body.style.setProperty(cssVar,localStorage.getItem(cssVar) || val) 19 20 const tr = document.createElement('tr') 21 22 const key = document.createElement('td') 23 const value = document.createElement('td') 24 25 const value_textArea = document.createElement('textarea') 26 value_textArea.setAttribute('rows',1) 27 value_textArea.addEventListener("input", function(){ 28 localStorage.setItem(cssVar, this.value); 29 document.body.style.setProperty(cssVar, this.value); 30 }); 31 32 value_textArea.innerHTML = localStorage.getItem(cssVar) || val 33 value.appendChild(value_textArea) 34 35 key.innerHTML = cssVar 36 37 tr.appendChild(key) 38 tr.appendChild(value) 39 40 table.appendChild(tr) 41 }) 42 43