Showing posts with label Tips Pemrograman. Show all posts
Showing posts with label Tips Pemrograman. Show all posts

Monday, February 23, 2026

Membuat beckend di google apps script

Membuat backend dengan Google Sheet melibatkan penggunaan Google Sheets sebagai database dan Google Apps Script (GAS) sebagai serverless backend untuk mengolah data (CRUD: Create, Read, Update, Delete) melalui API. Anda bisa membuat aplikasi sederhana tanpa coding via AppSheet atau membuat REST API khusus menggunakan Apps Script untuk terhubung dengan frontend web/aplikasi.
Berikut langkah-langkah membuat backend sederhana dengan Google Sheets dan Apps Script:
1. Persiapan Database (Google Sheets)
  • Buat spreadsheet baru dan berikan nama judul kolom pada baris pertama (misal: ID, Nama, Pesan, Tanggal).
  • Isi beberapa data contoh.
  • Buka menu Ekstensi > Apps Script.

Saturday, February 21, 2026

Membuat Dropdown Menu pada Blogger

 To restructure an HTML list in JavaScript by making certain li elements a child of another li based on a specific character, you can iterate through the list items and use DOM manipulation methods like appendChild().

JavaScript Code Example
This example assumes the li elements to be nested contain a specific character (e.g., '-') at the beginning of their text content, and should be nested under the preceding li that does not have the character.
javascript
function nestListItems(ulSelector, markerChar) {
    const ul = document.querySelector(ulSelector);
    if (!ul) return;

    // Select all direct child li elements of the ul
    const items = Array.from(ul.children);
    let parentItem = null;

    items.forEach(item => {
        // Check if the current li contains the specific character
        if (item.textContent.trim().startsWith(markerChar)) {
            // If a parent li has been established, move the current item into it
            if (parentItem) {
                // Remove the item from its current position in the DOM
                ul.removeChild(item); 
                
                // Create a new nested ul if one doesn't exist in the parent
                let nestedUl = parentItem.querySelector('ul');
                if (!nestedUl) {
                    nestedUl = document.createElement('ul');
                    parentItem.appendChild(nestedUl);
                }
                
                // Append the current item (which is now a new node) to the nested ul
                nestedUl.appendChild(item);
                                Array.from(nestedUl.children).forEach(itemtext => {
      		    itemtext.querySelector('a').innerHTML=itemtext.textContent.substring(2);
      				
      		 });
            }
        } else {
            // If it doesn't have the marker, it becomes a potential new parent
            parentItem = item;
        }
    });
}

// Usage: Call the function for your specific UL and marker
nestListItems('#myList', '-');