Tuesday, February 25, 2025

} } Responsive Text Editor

Responsive Text Editor

/* Google Font */ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap'); body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #FF6B6B, #556270); color: white; text-align: center; padding: 20px; } .editor-container { background: rgba(255, 255, 255, 0.1); padding: 20px; border-radius: 10px; max-width: 700px; margin: auto; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); } h2 { margin-bottom: 10px; } .toolbar { background: rgba(0, 0, 0, 0.2); padding: 10px; border-radius: 5px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; } .toolbar button, .toolbar input, .toolbar select { padding: 8px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; } .toolbar button { background: white; color: black; } .toolbar input { width: 40px; height: 30px; border: none; cursor: pointer; } .toolbar select { background: white; color: black; } .toolbar button:hover { background: #FF6B6B; color: white; } .text-area { min-height: 200px; background: white; color: black; padding: 15px; margin-top: 10px; border-radius: 5px; border: 1px solid #ccc; overflow-y: auto; text-align: left; } @media (max-width: 600px) { .toolbar { flex-direction: column; } .toolbar button { width: 100%; } } // Function to format text (bold, italic, underline, etc.) function formatText(command) { document.execCommand(command, false, null); } // Function to change font color function changeColor(color) { document.execCommand("foreColor", false, color); } // Function to change font size function changeFontSize(size) { document.execCommand("fontSize", false, size); } // Function to undo last action function undo() { document.execCommand("undo", false, null); } // Function to redo last undone action function redo() { document.execCommand("redo", false, null); } // Function to clear the text area function clearText() { document.getElementById("editor").innerHTML = ""; } // Function to download text as .txt file function downloadText() { let text = document.getElementById("editor").innerText; let blob = new Blob([text], { type: "text/plain" }); let anchor = document.createElement("a"); anchor.href = URL.createObjectURL(blob); anchor.download = "text-editor-content.txt"; anchor.click(); }
} } Text to PDF Converter

Text to PDF Converter

/* General Styles */ body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #ff9a9e, #fad0c4, #fad0c4, #ffdde1); height: 100vh; display: flex; justify-content: center; align-items: center; text-align: center; margin: 0; } /* Container */ .container { background: white; padding: 20px; border-radius: 10px; box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2); max-width: 400px; width: 100%; } /* Heading */ h1 { color: #ff6b81; font-size: 24px; } function generatePDF() { const { jsPDF } = window.jspdf; let doc = new jsPDF(); let text = document.getElementById("textInput").value; if (text.trim() === "") { alert("Please enter some text!"); return; } doc.setFont("helvetica", "bold"); doc.setFontSize(14); doc.text("Converted Text to PDF", 10, 10); doc.setFont("times", "normal"); doc.setFontSize(12); doc.text(text, 10, 20, { maxWidth: 180 }); doc.save("converted.pdf"); } /* Textarea */ textarea { width: 100%; height: 150px; padding: 10px; border: 2px solid #ff6b81; border-radius: 5px; resize: none; font-size: 16px; outline: none; } /* Button */ button { background: #ff6b81; color: white; border: none; padding: 10px 15px; font-size: 16px; cursor: pointer; border-radius: 5px; margin-top: 10px; transition: 0.3s; } button:hover { background: #ff4757; } /* Responsive */ @media (max-width: 500px) { .container { width: 90%; } }
OPML to JSON Converter

OPML to JSON Converter

Convert your OPML file to JSON with ease!

* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Roboto', sans-serif; background-color: #f3f4f6; color: #333; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background-color: #fff; padding: 2rem; border-radius: 10px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); width: 100%; max-width: 600px; text-align: center; } header h1 { color: #0073e6; margin-bottom: 10px; } header p { font-size: 1rem; color: #555; margin-bottom: 30px; } .input-area, .output-area, .download-area { margin-bottom: 20px; } .upload-label { font-size: 1.1rem; color: #333; display: block; margin-bottom: 10px; text-align: left; } input[type="file"] { width: 100%; padding: 10px; border: 2px solid #0073e6; border-radius: 5px; background-color: #f1f8ff; cursor: pointer; } .convert-btn { padding: 10px 20px; font-size: 1rem; color: #fff; background-color: #0073e6; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; } .convert-btn:hover { background-color: #005bb5; } textarea { width: 100%; height: 200px; padding: 15px; border: 2px solid #0073e6; border-radius: 5px; font-family: 'Roboto', sans-serif; background-color: #f1f8ff; color: #333; font-size: 1rem; resize: none; box-sizing: border-box; } .download-btn { padding: 10px 20px; font-size: 1rem; color: #fff; background-color: #28a745; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; } .download-btn:hover { background-color: #218838; } let opmlData = null; function handleFile() { const fileInput = document.getElementById('opml-file'); const file = fileInput.files[0]; if (!file) { alert('Please select an OPML file.'); return; } const reader = new FileReader(); reader.onload = function(event) { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(event.target.result, "application/xml"); const opml = xmlDoc.getElementsByTagName('opml')[0]; if (!opml) { alert('Invalid OPML file.'); return; } opmlData = parseOpmlToJson(opml); alert('OPML file loaded successfully!'); }; reader.onerror = function() { alert('Error reading file!'); }; reader.readAsText(file); } function parseOpmlToJson(opml) { const json = []; const outlines = opml.getElementsByTagName('body')[0].getElementsByTagName('outline'); function parseOutline(outline) { const outlineJson = { text: outline.getAttribute('text'), type: outline.getAttribute('type') || 'url', xmlUrl: outline.getAttribute('xmlUrl') || '', htmlUrl: outline.getAttribute('htmlUrl') || '', children: [] }; const subOutlines = outline.getElementsByTagName('outline'); for (let subOutline of subOutlines) { outlineJson.children.push(parseOutline(subOutline)); } return outlineJson; } for (let outline of outlines) { json.push(parseOutline(outline)); } return json; } function convertToJson() { if (!opmlData) { alert('Please load an OPML file first!'); return; } const jsonOutput = document.getElementById('json-output'); jsonOutput.value = JSON.stringify(opmlData, null, 2); document.getElementById('download-btn').style.display = 'inline-block'; } function downloadJson() { const json = JSON.stringify(opmlData, null, 2); const blob = new Blob([json], { type: 'application/json' }); saveAs(blob, 'opml_to_json.json'); } <

} } Responsive Text Editor Responsive Text Editor B ...