Cara Pasang Parse dan Unparse HTML Tools
"Dibawah ini CatatanDroid berikan blogtools yang dapat dipakai untuk Parse dan Unparse kode iklan maupun kode lainnya kedalam format XML."
Sebagai penulis dan pengelola blog maupun website tentu kita dituntut untuk mengerti proses parse kode dan unparse kembali kode iklan maupun kode HTML lain sebelum digunakan.
Sebagai syarat agar kita dapat menempatkan kode iklan maupun kode html lain ke dalam template blog khususnya blogger blogspot, terkadang kita diharuskan memparsing terlebih dahulu agar kode tidak error.
Hal ini seringkali dihadapi saat kita menanam kode HTML seperti kode verifikasi meta, kode iklan Adsense, maupun kode iklan dari Advertiser lainnya yang langsung ditanamkan ke dalam mode HTML Template.
Apa itu Encode dan Decode?
Encoding HTML yaitu proses konversi dokumen yang berisi karakter khusus diatas kisaran normal seven-bit ASCII ke dalam bentuk standar. Jenis kode yang digunakan yaitu dengan mengirimkan ke server berbentuk informasi header, sehingga browser dapat dengan mudah mengurai kode tsb.
Sedangkan HTML decoding adalah kebalikan dari encoding. Dalam decoding proses karakter dikodekan khusus dan dikonversi kembali ke dalam bentuk aslinya.
Dibawah ini CatatanDroid berikan tutorial pemasangan blogtools yang dapat dipakai untuk Parse dan Unparse kode iklan maupun kode lainnya di blog sendiri. Yuk langsung praktek!
Cara Membuat Tools Parse Unparse Code
- Buka Blogger dan login dengan akun kalian
- Pada Dashboard utama pilih Pages (Halaman) lanjut pilih +New Page (+Halaman Baru)
- Ubah editor ke dalam mode edit HTML
- Masukan keseluruhan kode dibawah ini
<style type="text/css"> .parseUnparse{align-items:center;display:flex;justify-content:center} .ctd-bt{margin: 0.5rem 0 1rem;width: -webkit-fill-available;justify-content:space-between;} .ctd-bt,.ctd-bt-kiri,.ctd-bt-kanan{display:inline-flex;} .ctd-pu{border-radius:0 0 5px 5px;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;text-align:center} .ctd-puA{width:-webkit-fill-available;height:200px;padding:1rem;border:0;box-shadow:inset 0 0 5px 1px rgba(0,0,0,.05);border-radius:.5rem;resize:none;color:gray;background:#fafafa;} .ctd-btP,.ctd-btU,.ctd-btR,.ctd-btC{color:#fff!important;font-weight:700;background:#07ACEC;padding:1rem;border-radius:.25rem;border:none;outline:0;box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);transition:all .4s ease-in-out;text-transform:uppercase;margin:0 .25rem;cursor: pointer;} .ctd-btP span, .ctd-btU span, .ctd-btR span, .ctd-btC span{align-self:center} </style> <div class="parseUnparse"> <div class="ctd-pu"> <textarea class="ctd-puA" id="ctd-boxPU" placeholder="<!- Input kode yang akan di-Parse atau di-Unparse ->"></textarea> <div class="ctd-bt"> <div class="ctd-bt-kiri"> <div class="ctd-btP" id="ctdP-HTML" onclick="convert();" type="button"><span>Parse</span></div> <div class="ctd-btU" id="ctdU-HTML" onclick="convert();" type="button"><span>Unparse</span></div> </div> <div class="ctd-bt-kanan"> <div class="ctd-btR" onclick="document.getElementById('ctd-boxPU').value = '', document.getElementById('ctd-boxO').value = ''" type="button"><svg preserveaspectratio="xMidYMid meet" style="height: 20px; vertical-align: -0.125rem; width: 20px;" viewbox="0 0 24 24"><path d="M2.586 15.408l4.299 4.299a.996.996 0 0 0 .707.293h12.001v-2h-6.958l7.222-7.222c.78-.779.78-2.049 0-2.828L14.906 3a2.003 2.003 0 0 0-2.828 0l-4.75 4.749l-4.754 4.843a2.007 2.007 0 0 0 .012 2.816zM13.492 4.414l4.95 4.95l-2.586 2.586L10.906 7l2.586-2.586zM8.749 9.156l.743-.742l4.95 4.95l-4.557 4.557a1.026 1.026 0 0 0-.069.079h-1.81l-4.005-4.007l4.748-4.837z" fill="currentColor"></path></svg></div> <div class="ctd-btC" onclick="cpO()" type="button"><svg preserveaspectratio="xMidYMid meet" style="height: 20px; vertical-align: -0.125rem; width: 20px;" viewbox="0 0 24 24"><path d="M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z" fill="currentColor"></path></svg></div> </div> </div> <textarea class="ctd-puA" id="ctd-boxO" placeholder="<!- Output kode... ->" readonly=""></textarea> </div> </div> <script type="text/javascript"> function encodeString(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/¡/g,"¡").replace(/¢/g,"¢").replace(/£/g,"£").replace(/¤/g,"¤").replace(/¥/g,"¥").replace(/¦/g,"¦").replace(/§/g,"§").replace(/¨/g,"¨").replace(/©/g,"©").replace(/ª/g,"ª").replace(/«/g,"«").replace(/¬/g,"¬").replace(/®/g,"®").replace(/¯/g,"¯").replace(/°/g,"°").replace(/±/g,"±").replace(/²/g,"²").replace(/³/g,"³").replace(/´/g,"´").replace(/µ/g,"µ").replace(/¶/g,"¶").replace(/·/g,"·").replace(/¸/g,"¸").replace(/¹/g,"¹").replace(/º/g,"º").replace(/»/g,"»").replace(/¼/g,"¼").replace(/½/g,"½").replace(/¾/g,"¾").replace(/¿/g,"¿").replace(/×/g,"×").replace(/÷/g,"÷").replace(/À/g,"À").replace(/Á/g,"Á").replace(/Â/g,"Â").replace(/Ã/g,"Ã").replace(/Ä/g,"Ä").replace(/Å/g,"Å").replace(/Æ/g,"Æ").replace(/Ç/g,"Ç").replace(/È/g,"È").replace(/É/g,"É").replace(/Ê/g,"Ê").replace(/Ë/g,"Ë").replace(/Ì/g,"Ì").replace(/Í/g,"Í").replace(/Î/g,"Î").replace(/Ï/g,"Ï").replace(/Ð/g,"Ð").replace(/Ñ/g,"Ñ").replace(/Ò/g,"Ò").replace(/Ó/g,"Ó").replace(/Ô/g,"Ô").replace(/Õ/g,"Õ").replace(/Ö/g,"Ö").replace(/Ø/g,"Ø").replace(/Ù/g,"Ù").replace(/Ú/g,"Ú").replace(/Û/g,"Û").replace(/Ü/g,"Ü").replace(/Ý/g,"Ý").replace(/Þ/g,"Þ").replace(/ß/g,"ß").replace(/à/g,"à").replace(/á/g,"á").replace(/â/g,"â").replace(/ã/g,"ã").replace(/ä/g,"ä").replace(/å/g,"å").replace(/æ/g,"æ").replace(/ç/g,"ç").replace(/è/g,"è").replace(/é/g,"é").replace(/ê/g,"ê").replace(/ë/g,"ë").replace(/ì/g,"ì").replace(/í/g,"í").replace(/î/g,"î").replace(/ï/g,"ï").replace(/ð/g,"ð").replace(/ñ/g,"ñ").replace(/ò/g,"ò").replace(/ó/g,"ó").replace(/ô/g,"ô").replace(/õ/g,"õ").replace(/ö/g,"ö").replace(/ø/g,"ø").replace(/ù/g,"ù").replace(/ú/g,"ú").replace(/û/g,"û").replace(/ü/g,"ü").replace(/ý/g,"ý").replace(/þ/g,"þ").replace(/ÿ/g,"ÿ")}function decodeString(e){return e.replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/¡/g,"¡").replace(/¢/g,"¢").replace(/£/g,"£").replace(/¤/g,"¤").replace(/¥/g,"¥").replace(/¦/g,"¦").replace(/§/g,"§").replace(/¨/g,"¨").replace(/©/g,"©").replace(/ª/g,"ª").replace(/«/g,"«").replace(/¬/g,"¬").replace(/®/g,"®").replace(/¯/g,"¯").replace(/°/g,"°").replace(/±/g,"±").replace(/²/g,"²").replace(/³/g,"³").replace(/´/g,"´").replace(/µ/g,"µ").replace(/¶/g,"¶").replace(/·/g,"·").replace(/¸/g,"¸").replace(/¹/g,"¹").replace(/º/g,"º").replace(/»/g,"»").replace(/¼/g,"¼").replace(/½/g,"½").replace(/¾/g,"¾").replace(/¿/g,"¿").replace(/×/g,"×").replace(/÷/g,"÷").replace(/À/g,"À").replace(/Á/g,"Á").replace(/Â/g,"Â").replace(/Ã/g,"Ã").replace(/Ä/g,"Ä").replace(/Å/g,"Å").replace(/Æ/g,"Æ").replace(/Ç/g,"Ç").replace(/È/g,"È").replace(/É/g,"É").replace(/Ê/g,"Ê").replace(/Ë/g,"Ë").replace(/Ì/g,"Ì").replace(/Í/g,"Í").replace(/Î/g,"Î").replace(/Ï/g,"Ï").replace(/Ð/g,"Ð").replace(/Ñ/g,"Ñ").replace(/Ò/g,"Ò").replace(/Ó/g,"Ó").replace(/Ô/g,"Ô").replace(/Õ/g,"Õ").replace(/Ö/g,"Ö").replace(/Ø/g,"Ø").replace(/Ù/g,"Ù").replace(/Ú/g,"Ú").replace(/Û/g,"Û").replace(/Ü/g,"Ü").replace(/Ý/g,"Ý").replace(/Þ/g,"Þ").replace(/ß/g,"ß").replace(/à/g,"à").replace(/á/g,"á").replace(/â/g,"â").replace(/ã/g,"ã").replace(/ä/g,"ä").replace(/å/g,"å").replace(/æ/g,"æ").replace(/ç/g,"ç").replace(/è/g,"è").replace(/é/g,"é").replace(/ê/g,"ê").replace(/ë/g,"ë").replace(/ì/g,"ì").replace(/í/g,"í").replace(/î/g,"î").replace(/ï/g,"ï").replace(/ð/g,"ð").replace(/ñ/g,"ñ").replace(/ò/g,"ò").replace(/ó/g,"ó").replace(/ô/g,"ô").replace(/õ/g,"õ").replace(/ö/g,"ö").replace(/ø/g,"ø").replace(/ù/g,"ù").replace(/ú/g,"ú").replace(/û/g,"û").replace(/ü/g,"ü").replace(/ý/g,"ý").replace(/þ/g,"þ").replace(/ÿ/g,"ÿ").replace(/&/g,"&")}function cpO(){var e=document.getElementById("ctd-boxO");e.select(),e.setSelectionRange(0,99999),document.execCommand("copy")}var encode=document.getElementById("ctdP-HTML"),decode=document.getElementById("ctdU-HTML"),input=document.getElementById("ctd-boxPU"),output=document.getElementById("ctd-boxO");encode.addEventListener("click",function(){output.value=encodeString(input.value)}),decode.addEventListener("click",function(){output.value=decodeString(input.value)}); </script>
- Berikan judul yang sesuai, misal: HTML Parse Tools, HTML Decode Tools, Code Parsing Tools, dsb
- Publish page dan lihat hasilnya.
Penutup dan Kesimpulan
CatatanDroid mendapatkan inspirasi artikel ini dari blog jagoanredesign dengan beberapa perubahan tampilan agar menyesuaikan template yang CatatanDroid gunakan.
Jika sobat ingin mencoba tampilan yang berbeda silahkan menuju postingan artikel milik jagoanredesign.
Akhir kata semoga tutorial tips blog singkat cara pasang tools html parser diatas dapat bermanfaat bagi sobat yang membutuhkan. Terima kasih dan Selamat mencoba! CatatanDroid