// combobox.js // External Javascript to extend some HTML like combobox.html allowing for a dynamically created HTML div element "combobox" (ie. dropdown + div contenteditable=true) // November, 2020 // Called via ... // // ... or dropdown populated example as per ... // class Droptext { constructor(combobox) { this.ele = document.createElement('div'); this.ele.id = ('' + combobox).split(';')[0]; if (('' + combobox).indexOf(';') != -1) { this.ele.setAttribute('data-dropinnards', ('' + combobox).split(';')[1]); this.ele.setAttribute('data-optionval', ""); this.ele.setAttribute('data-focusaway', ""); this.ele.setAttribute('contenteditable', true); this.ele.className = "combobox"; this.ele.innerHTML = ('' + combobox).split(';')[1]; // + ""; } } present() { return this.ele.outerHTML.replace('>").split(','); if ((document.head.innerHTML + document.body.innerHTML).replace(/\&ddlist\=/g,'?ddlist=').indexOf('?ddlist=') != -1) { ihs = decodeURIComponent((document.head.innerHTML + document.body.innerHTML).replace(/\&ddlist\=/g,'?ddlist=').split('?ddlist=')[iqw].split('&')[0].split('"')[0].split("'")[0]); // + ','; if (ihs.trim() != '') { selconts = ihs.split(','); } if (ihsobs.length > 2) { isokay = false; if (iqw > 1) { selconts = ihs.split(','); } if (1 == 1 || document.URL.indexOf('ddlist=' + encodeURIComponent(ihsobs[1].split('&')[0].split('"')[0].split("'")[0])) != -1) { isokay=true; } } } if (isokay) { console.log('yay ' + ioff + ' ' + ihsobs.length + ' ' + document.URL); } else { console.log('oops ' + ioff + ' ' + ihsobs.length + ' ' + document.URL + ' versus ' + 'ddlist=' + encodeURIComponent(ihsobs[1].split('&')[0].split('"')[0].split("'")[0])); } if (isokay) { if (selconts[0].indexOf('").replace(" name=selcombo>", " name=selcombo0>"); selcont = ("'; obody = document.getElementById('demo' + ihsuff); } } eval('obody.innerHTML += mycombobox' + ihsuff + '.show()'); document.title+=' '; } ihsuff='' + eval(0 + iqw); }