📄 Documenter
Api App
Merhaba Burası Bir Panel
# 💻 Usage ```html <script src="//hasandelibas.github.io/documenter/documenter.js"></script>
📄 Documenter
Api App
``` ```html <!-- disable-style --> <script src="//apps.asenax.com/documenter/documenter.js?disable-style=true"></script> <!-- disable-html --> <script src="//apps.asenax.com/documenter/documenter.js?disable-html=true"></script> <!-- only-base-css --> <script src="//apps.asenax.com/documenter/documenter.js?only-base-css=true"></script> ``` # 📄 Documenter A light document application + Mobile Support + One File + Header Bar + Code View with hljs * **development** : https://apps.asenax.com/documenter/ * **relase** : https://hasandelibas.github.io/documenter/ # ✅ Task + #documenter-tab-0 + documenter.message multiple + [back-button] inner html svg + .tab-system + .enable-error-messages + .hide-header + .show-header + .hide-opener + .show-opener + Mobile container padding fix + Pre Code fix + left Menu click fix + Make pre code 14px + light theme input problem # 🔨 Options We can change options in header tag with **body-class** attribute ## hide-menu * hide-menu * show-menu ```html
``` ## hide-header * hide-header * show-header ```html
``` ## bottom-header * bottom-header * top-header ```html
``` ## theme-dark * theme-light * theme-dark ```html
``` ## theme-round * theme-round make inputs and buttos round ```html
``` ## tab-system * link-system (default) * tab-system ```html
``` ## disable-error * enable-error (default) * disable-error ```html
``` ## hide-opener * show-opener (default) * hide-opener ```html
``` ## documenter-admin ```html
``` # HTML Elements ## icons Example: ```html ``` https://fonts.google.com/icons
## dropdown
Turkish
English
German
French
Italian
Spanish
Portuguese
Mandarin Chinese
Japanese
Russian
Arabic
```
Turkish
English
German
French
Italian
Spanish
Portuguese
Mandarin Chinese
Japanese
Russian
Arabic
``` ## dropdown multiple
Turkish
English
German
French
Italian
Spanish
Portuguese
Mandarin Chinese
Japanese
Russian
Arabic
```
Turkish
English
German
French
Italian
Spanish
Portuguese
Mandarin Chinese
Japanese
Russian
Arabic
``` ## panel
This is an example panel. Dark Theme:
This is an example panel.
This is an example panel.
This is an example panel.
This is an example panel.
```
This is an example panel.
``` ## [tooltip] [tooltip-right] :
```html
``` [tooltip-bottom] :
```html
``` [tooltip-left] :
```html
``` [tooltip-top] :
```html
``` [tooltip-right-start] :
```html
``` [tooltip-bottom-start] :
```html
``` [tooltip-left-start] :
```html
``` [tooltip-top-start] :
```html
``` [tooltip-right-end] :
```html
``` [tooltip-bottom-end] :
```html
``` [tooltip-left-end] :
```html
``` [tooltip-top-end] :
```html
``` ## [mobile-style] width < 600 ```html <div mobile-style="margin-top:20px;"> Example <div> ``` ## [mobile-tablet-style] 600 < width < 900 ```html <div mobile-tablet-style="margin-top:20px;"> Example <div> ``` ## [tablet-style] 600 < width < 900 ```html <div table-style="margin-top:20px;"> Example <div> ``` ## [tablet-desktop-style] 600 < width ```html <div tablet-desktop-style="margin-top:20px;"> Example <div> ``` ## [desktop-style] 900 < width ```html <div desktop-style="margin-top:20px;"> Example <div> ``` ## [hover-style] ```html <div hover-style="color:red;"> Example <div> ``` ## .hover
.underline
.hover
.light
```
.underline
.hover
.light
.underline
.hover
.light
``` ## input checkbox: ```html ``` switch: ```html ``` # ⚙️ documenter ## .loading(number|null) ``` documenter.loading() documenter.loading(10) documenter.loading(50) ``` ## .success() ``` documenter.loading(100) documenter.success() ``` ## .load(url, config) Like fetch ``` documenter.load("url").then(e=>e.text()) documenter.load("url").then(e=>e.json()) documenter.load("url").then(e=>e.blob()) documenter.load("url",{method:'GET',data:{name:'John'}}).then(e=>e.json()) ``` ``` documenter.load("documenter.js").then(e=>e.text()).then( console.log ) documenter.load("https://www.getmidas.com/wp-json/midas-api/v1/midas_table_data",{method:"POST"}).then(e=>e.json()).then( console.log ) documenter.load("world_map.pdf").then(e=>e.blob()).then(function(text){ document.download(text,"file.pdf") }) ``` ## .post(url, data: FormData | Object | string) ``` documenter.post("url",{name:'John'}).then(e=>e.text()) ``` ## .submit(HTMLFormElement) ``` documenter.submit(HTMLFormElement) ``` Or you can add ``documenter-submit`` attribute in ``form`` element. ```html <button documenter-submit>Save</button> ``` ## .download(string|blob,filename) ``` documenter.download("Hello World","test.txt") ``` ## .info(string) : HTMLDivElement ## .message(string) : HTMLDivElement ``` documenter.message("Hello World!") ``` ## .modal(text) : HTMLDivElement ```js documenter.modal("Title <br> This is modal text."") ``` ## .readText() : Promise(e:String) Select file and read as text. ```js documenter.readText().then(text=>console.log(text)) ``` ## .readImage() : Promise(e:String) Select file and read as text. ```js documenter.readImage().then(src=>$('#read-image').src=src) ``` ## .table( object ) : HTMLTableElement
Create table object ```js let table = documenter.table([ {name:"John",surname:"Doe",age:26}, {name:"Mary",surname:"Doe",age:25} ]) main.appendChild(table) ``` ## .render(html) : HTMLDivElement ```js documenter.render("
Hello World!
") ``` ## .on(event,selector,function) ``` documenter.on("click","pre",function(e){ console.log(this.innerText); console.log("Event:",e) }) ``` ## .on(event,function) ``` documenter.on("ready",function(e){ console.log("I am ready"); }) ``` ## .when(".selector",function, order=0, type="on") Triggered every time. ``` documenter.when("h2",function(e){ console.log(e); }) ``` ## .see(selector, process, order=0) Triggered only one time. ``` documenter.see("dropdown",function(e){ console.log(e); }) ``` ## .csv.parse(data:string) ``` documenter.csv.parse(string) ``` ``` documenter.readText().then(e=>{ main.appendChild(documenter.table( documenter.csv.parse(e) )) }) ``` ## .select(selector|Element|Element[]) jQuery like selector ```js documenter.select("td").parent("table") documenter.select(el).attr("style","color:red") documenter.select("tr").list() documenter.select("table").find("th").map(e=>console.log(e)) ``` ## .TextInput(element,{language:""})
TextInput
Convert element like input element with contenteditable * single line * no style ```js documenter.TextInput(el) // only text ``` ## .TextArea(element, config={})
TextArea
Convert element like with contenteditable * allowedElements default is all elements * allowedAttributes is default all * allowedProperties is default all * language is default "" ```js documenter.TextArea(el, { allowedElements : ["br","div","span","img","b","i","u","ul","li","ol","strike","sup","sub"], allowedAttributes: ["style","src","alt"], allowedProperties: ["font-weight","text-decoration","color"], language : "en", }) // only font-weight and color ``` ## .TextEditor(textarea, config={}) Convert textarea element to TextEditor ```js let textEditor = documenter.TextEditor(document.querySelector("textarea"),{ toolbar : ["formatBlock","bold","italic","underline","strikeThrough","justifyLeft","justifyCenter","justifyRight","justifyFull","insertUnorderedList","insertOrderedList","space"], head : "", // default "" allowedAttributes : ["style","src","alt"], // for all make null allowedProperties : ["text-align","font-weight","color"], // for all make null language : "en", // default "en" }) ``` **Global TextEditor options** ```js documenter.TextEditor.head = "" documenter.TextEditor.toolbar = ["formatBlock","bold","italic","underline","strikeThrough","justifyLeft","justifyCenter","justifyRight","justifyFull","insertUnorderedList","insertOrderedList","space"] documenter.TextEditor.allowedProperties = ["font-weight","font-style"] documenter.TextEditor.allowedAttributes = ["style","src","alt"] documenter.TextEditor.language = "en" ``` **Custom Toolbar Item ** with ``texteditor.toolbar`` ```js let listen=document.createElement("button") listen.innerText = "Listen" listen.onclick = function(){ let recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)(); recognition.language = "tr" recognition.interimResults = true; let last = document.createElement("span") textEditor.body.appendChild(last) recognition.onresult = (e)=>{ last.innerText = e.results[0][0].transcript; } recognition.start() } textEditor.toolbar.appendChild( listen ) ``` **Get Value** ```js textEditor.value // set or get ``` ## .lss( css_code ) ```js documenter.lss(" @mobile{ body{ background:#000; *{ color:#222; } h2{ color:#333; } } } ") ``` ## .markdown( markdown ) ```js documenter.markdown("# Hello World \n __italic__ and **bold** text here.") ```
## .translate(text,source='en-US',target="tr-TR") ```js documenter.translate("Merhaba","tr","en").then(e=>console.log(e)) ``` ## .emitter(obj) ``` documenter.emitter(window) // listen every time window.on("click",console.log) // listen one time window.one("click",console.log) // listen any event window.any((event,arg)=>console.log(event,arg)) window.emit("click",{target:document}) window.emit("test",1) ``` ## svg to base64image
```css ```