Download index.html from Examups/Header: direct link, hf CLI and curl.
- Browser
- Download file 116 kB
-
https://huggingface.co/spaces/Examups/Header/resolve/main/index.html
- Command line
-
hf download hf://spaces/Examups/Header/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Examups/Header/resolve/main/index.html
116 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Component Builder (WordPress Safe)</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script>
<style>
:root {
--primary-color: #3b82f6;
--primary-hover-color: #2563eb;
--secondary-color: #10b981;
--secondary-hover-color: #059669;
--text-color: #374151;
--heading-color: #111827;
--font-family: 'Inter', sans-serif;
}
body {
font-family: var(--font-family);
color: var(--text-color);
background-color: var(--background-color);
}
h1, h2, h3, h4, h5, h6 {
color: var(--heading-color);
}
/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
.onley-preview-iframe {
width: 100%;
height: 100%;
border: 0;
transition: all 0.3s ease-in-out;
}
#preview-container.onley-preview-desktop .onley-preview-iframe { width: 100%; }
#preview-container.onley-preview-tablet .onley-preview-iframe { width: 768px; margin: 0 auto; }
#preview-container.onley-preview-mobile .onley-preview-iframe { width: 375px; margin: 0 auto; }
.onley-toast {
visibility: hidden;
min-width: 250px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 8px;
padding: 16px;
position: fixed;
z-index: 100;
left: 50%;
bottom: 30px;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.3s, visibility 0.3s;
}
.onley-toast.onley-show {
visibility: visible;
opacity: 1;
}
/* New Professional Controls UI Styles */
#onley-controls-layout {
display: flex;
height: 100%;
}
#onley-controls-nav {
width: 180px;
flex-shrink: 0;
background-color: #f8fafc;
border-right: 1px solid #e5e7eb;
padding: 0.5rem;
overflow-y: auto;
}
.onley-control-nav-button {
display: flex;
align-items: center;
width: 100%;
padding: 0.75rem;
border-radius: 0.375rem;
font-weight: 500;
color: var(--text-color);
transition: background-color 0.2s, color 0.2s;
text-align: left;
}
.onley-control-nav-button:hover {
background-color: #e5e7eb;
}
.onley-control-nav-button.onley-active {
background-color: var(--primary-color);
color: white;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
.onley-control-nav-button i {
margin-right: 0.75rem;
width: 20px;
text-align: center;
}
#onley-controls-panels {
flex-grow: 1;
padding: 1.5rem;
overflow-y: auto;
}
.onley-control-panel {
display: none;
}
.onley-control-panel.onley-active {
display: block;
}
.onley-control-panel h3 {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1.5rem;
border-bottom: 1px solid #e5e7eb;
padding-bottom: 0.75rem;
}
.onley-nested-builder {
margin-left: 1rem;
padding-left: 1rem;
border-left: 2px solid #e5e7eb;
margin-top: 1rem;
padding-top: 1rem;
}
.onley-item-toolbar {
display: flex;
justify-content: flex-end;
gap: 0.25rem;
margin-bottom: 0.5rem;
}
.onley-layout-item {
cursor: move;
}
.onley-code-modal-pre {
background-color: #2d3748;
color: #e2e8f0;
padding: 1rem;
border-radius: 0.375rem;
max-height: 200px;
overflow-y: auto;
position: relative;
}
/* Feature: Hide/Show Sidebar */
#controls-sidebar {
flex-shrink: 0;
}
#main-container.onley-sidebar-collapsed #controls-sidebar {
width: 0;
padding: 0;
overflow: hidden;
}
#main-container.onley-sidebar-collapsed #preview-main {
width: 100%;
}
input[type="color"] {
-webkit-appearance: none;
border: none;
width: 100%;
height: 32px;
padding: 0;
border-radius: 0.25rem;
cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper {
padding: 0;
}
input[type="color"]::-webkit-color-swatch {
border: 1px solid #ccc;
border-radius: 0.25rem;
}
.onley-sub-items-container {
margin-left: 1rem;
padding-left: 1rem;
border-left: 2px solid #e5e7eb;
}
</style>
</head>
<body class="text-gray-800">
<div id="app" class="flex flex-col h-screen">
<header class="bg-white shadow-md p-4 flex justify-between items-center z-20">
<div class="flex items-center space-x-3">
<h1 class="text-xl font-bold text-gray-700">Component Builder</h1>
<button id="toggle-sidebar-btn" class="p-2 rounded-md hover:bg-gray-200 text-gray-600" title="Hide Controls">
<i class="fas fa-chevron-left"></i>
</button>
</div>
<div class="flex items-center space-x-4">
<button id="import-btn" class="flex items-center space-x-2 bg-blue-600 text-white font-bold py-2 px-4 rounded-md hover:bg-blue-700 transition">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path d="M10 2a1 1 0 00-1 1v5.586l-1.293-1.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 8.586V3a1 1 0 00-1-1z"></path>
<path d="M4 14a1 1 0 011 1v1a1 1 0 001 1h8a1 1 0 001-1v-1a1 1 0 112 0v1a3 3 0 01-3 3H6a3 3 0 01-3-3v-1a1 1 0 011-1z"></path>
</svg>
<span>Import</span>
</button>
<input type="file" id="import-file-input" class="hidden" accept=".html">
<div id="export-menu-container" class="relative">
<button id="export-menu-btn" class="flex items-center space-x-2 bg-green-600 text-white font-bold py-2 px-4 rounded-md hover:bg-green-700 transition">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg>
<span>Export Page</span>
</button>
<div id="export-dropdown" class="hidden absolute right-0 mt-2 w-64 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-30">
<div class="py-1" role="menu" aria-orientation="vertical" aria-labelledby="export-menu-btn">
<a href="#" id="copy-combined-code" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
<span>Copy Combined Code</span>
</a>
<a href="#" id="copy-html" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path d="M5 5a2 2 0 012-2h10a2 2 0 012 2v1h-14V5zM3 8h18v10a2 2 0 01-2 2H5a2 2 0 01-2-2V8z"></path></svg>
<span>Copy Embeddable HTML</span>
</a>
<a href="#" id="copy-css" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"></path></svg>
<span>Copy Page CSS</span>
</a>
<a href="#" id="copy-js" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1h1a1 1 0 010 2h-1v1a1 1 0 01-2 0V6H8a1 1 0 010-2h1V3a1 1 0 011-1zM5 5a3 3 0 013-3h4a3 3 0 013 3v1h-1V5a2 2 0 00-2-2H8a2 2 0 00-2 2v1H5V5zm2 5a1 1 0 011-1h4a1 1 0 110 2H8a1 1 0 01-1-1zm-1 4a1 1 0 100 2h8a1 1 0 100-2H6z" clip-rule="evenodd" /></svg>
<span>Copy Page JS</span>
</a>
<div class="border-t border-gray-100"></div>
<a href="#" id="download-zip-btn" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4 2a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2V4a2 2 0 00-2-2H4zm1 3a1 1 0 000 2h10a1 1 0 100-2H5zM5 13a1 1 0 100 2h10a1 1 0 100-2H5z" clip-rule="evenodd"></path></svg>
<span>Download Page .zip</span>
</a>
</div>
</div>
</div>
<div class="flex items-center space-x-2">
<span class="text-sm font-medium text-gray-500">Preview:</span>
<button id="desktop-btn" class="p-2 rounded-md bg-blue-500 text-white shadow" title="Desktop View">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 2a2 2 0 00-2 2v1H6a2 2 0 00-2 2v7a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2V4a2 2 0 00-2-2zm-1 3V4a1 1 0 112 0v1h-2zM6 7v7h8V7H6z" clip-rule="evenodd"></path></svg>
</button>
<button id="tablet-btn" class="p-2 rounded-md bg-gray-200 text-gray-700" title="Tablet View">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4 2a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2V4a2 2 0 00-2-2H4zm1 2a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1V5a1 1 0 00-1-1H5z" clip-rule="evenodd"></path></svg>
</button>
<button id="mobile-btn" class="p-2 rounded-md bg-gray-200 text-gray-700" title="Mobile View">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path d="M5 2a2 2 0 00-2 2v12a2 2 0 002 2h6a2 2 0 002-2V4a2 2 0 00-2-2H5z"></path></svg>
</button>
</div>
</div>
</header>
<div class="flex flex-1 overflow-hidden" id="main-container">
<aside id="controls-sidebar" class="w-1/3 bg-white shadow-lg overflow-hidden transition-all duration-300 ease-in-out">
<div id="onley-controls-layout">
<nav id="onley-controls-nav" class="space-y-2">
<button class="onley-control-nav-button" data-target="#panel-global-settings"><i class="fas fa-cog"></i>Global</button>
<button class="onley-control-nav-button" data-target="#panel-layout"><i class="fas fa-layer-group"></i>Layout</button>
<button class="onley-control-nav-button" data-target="#panel-topbar"><i class="fas fa-window-minimize fa-rotate-180"></i>Top Bar</button>
<button class="onley-control-nav-button" data-target="#panel-lms-header"><i class="fas fa-graduation-cap"></i>LMS Header</button>
<button class="onley-control-nav-button" data-target="#panel-lms-sidebar"><i class="fas fa-columns"></i>LMS Sidebar</button>
<button class="onley-control-nav-button" data-target="#panel-custom-html"><i class="fas fa-code"></i>Custom HTML</button>
</nav>
<div id="onley-controls-panels">
<div id="panel-global-settings" class="onley-control-panel">
<h3>⚙️ Global Settings</h3>
<div class="space-y-4">
<div class="space-y-2 border-b pb-4">
<label class="font-medium text-sm">Color Palette</label>
<div class="grid grid-cols-2 gap-2 text-xs">
<div>
<label for="global-color-primary">Primary</label>
<input type="color" id="global-color-primary" class="w-full p-0 h-8 border-none rounded-md">
</div>
<div>
<label for="global-color-secondary">Secondary</label>
<input type="color" id="global-color-secondary" class="w-full p-0 h-8 border-none rounded-md">
</div>
<div>
<label for="global-color-text">Text</label>
<input type="color" id="global-color-text" class="w-full p-0 h-8 border-none rounded-md">
</div>
<div>
<label for="global-color-heading">Heading</label>
<input type="color" id="global-color-heading" class="w-full p-0 h-8 border-none rounded-md">
</div>
</div>
</div>
<div class="space-y-2 border-b pb-4">
<label class="font-medium text-sm">Typography</label>
<div>
<label for="global-font-family" class="text-xs">Font Family</label>
<select id="global-font-family" class="w-full p-1 border rounded-md text-sm">
<option value="'Inter', sans-serif">Inter</option>
<option value="'Roboto', sans-serif">Roboto</option>
<option value="'Open Sans', sans-serif">Open Sans</option>
<option value="'Lato', sans-serif">Lato</option>
<option value="'Montserrat', sans-serif">Montserrat</option>
<option value="'Poppins', sans-serif">Poppins</option>
</select>
</div>
</div>
<button id="apply-global-settings" class="w-full bg-blue-600 text-white font-bold py-2 px-4 rounded-md hover:bg-blue-700 transition">Apply Global Styles</button>
</div>
</div>
<div id="panel-layout" class="onley-control-panel">
<h3>↕️ Component Layout</h3>
<p class="text-xs text-gray-500 mb-4">Drag and drop to change the vertical order of the components on your page.</p>
<div id="layout-builder-container" class="space-y-2"></div>
</div>
<div id="panel-topbar" class="onley-control-panel">
<h3>📢 Top Bar Settings</h3>
<div class="space-y-4">
<div class="flex justify-between items-center mb-6">
<h3 class="mb-0 pb-0 border-b-0"></h3>
<button class="get-component-code-btn text-sm bg-indigo-500 text-white py-1 px-3 rounded-md hover:bg-indigo-600" data-component-key="topBar">
<i class="fas fa-code mr-1"></i> Get Code
</button>
</div>
<div class="flex items-center space-x-2 border-b pb-4">
<input type="checkbox" id="topbar-toggle" class="h-4 w-4 rounded">
<label for="topbar-toggle">Enable Top Bar</label>
</div>
<div id="topbar-main-controls" class="space-y-4">
<div>
<label for="topbar-text" class="text-xs">Text (Can include HTML for advanced styling)</label>
<textarea id="topbar-text" rows="4" class="w-full p-1 border rounded-md text-sm"></textarea>
</div>
<div>
<label for="topbar-url" class="text-xs">Fallback Link URL (used if text is not HTML)</label>
<input type="text" id="topbar-url" class="w-full p-1 border rounded-md text-sm" placeholder="#">
</div>
<div id="topbar-style-controls" class="space-y-4 pt-4 border-t">
<div class="grid grid-cols-2 gap-2 text-xs">
<div>
<label for="topbar-bg-color-start">BG Gradient Start</label>
<input type="color" id="topbar-bg-color-start">
</div>
<div>
<label for="topbar-bg-color-end">BG Gradient End</label>
<input type="color" id="topbar-bg-color-end">
</div>
</div>
<div>
<label for="topbar-text-color" class="text-xs">Text Color</label>
<input type="color" id="topbar-text-color">
</div>
<div>
<label for="topbar-font-size" class="text-xs">Font Size (<span id="topbar-font-size-val"></span>px)</label>
<input type="range" id="topbar-font-size" min="10" max="24" class="w-full">
</div>
<div>
<label for="topbar-padding" class="text-xs">Padding (<span id="topbar-padding-val"></span>px)</label>
<input type="range" id="topbar-padding" min="4" max="20" class="w-full">
</div>
</div>
</div>
</div>
</div>
<div id="panel-lms-header" class="onley-control-panel">
<div class="flex justify-between items-center mb-6">
<h3 class="mb-0 pb-0 border-b-0">📚 Learning App Header</h3>
<button class="get-component-code-btn text-sm bg-indigo-500 text-white py-1 px-3 rounded-md hover:bg-indigo-600" data-component-key="lmsHeader">
<i class="fas fa-code mr-1"></i> Get Code
</button>
</div>
<div class="space-y-4">
<div class="space-y-2 border-b pb-4">
<div class="flex items-center space-x-2">
<input type="checkbox" id="lms-header-sticky-toggle" class="h-4 w-4 rounded">
<label for="lms-header-sticky-toggle" class="font-medium text-sm">Enable Sticky Header</label>
</div>
</div>
<div class="space-y-2 border-b pb-4">
<div class="flex items-center space-x-2">
<input type="checkbox" id="lms-primary-bar-toggle" class="h-4 w-4 rounded" checked>
<label for="lms-primary-bar-toggle" class="font-medium text-sm">Enable Top App Bar</label>
</div>
<div class="space-y-2 border-t pt-4 mt-4 pl-4">
<label class="font-medium text-xs">Brand Settings</label>
<div>
<label for="lms-brand-type" class="text-xs">Brand Type</label>
<select id="lms-brand-type" class="w-full p-1 border rounded-md text-sm">
<option value="text">Text</option>
<option value="image">Image Logo</option>
</select>
</div>
<div id="lms-brand-text-control">
<label for="lms-brand-text" class="text-xs">Brand Text</label>
<input type="text" id="lms-brand-text" class="w-full p-1 border rounded-md text-sm">
</div>
<div id="lms-brand-image-controls" class="hidden space-y-2">
<div>
<label for="lms-brand-image-url" class="text-xs">Logo Image URL</label>
<input type="text" id="lms-brand-image-url" class="w-full p-1 border rounded-md text-sm">
</div>
<div>
<label for="lms-brand-image-height" class="text-xs">Logo Height (px)</label>
<input type="range" id="lms-brand-image-height" min="20" max="80" value="30" class="w-full">
</div>
</div>
</div>
<div class="pl-4 space-y-2 pt-4 border-t mt-4">
<label class="font-medium text-xs">Elements</label>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-hamburger" class="h-4 w-4 rounded" checked><label for="lms-el-hamburger" class="text-sm">Hamburger Menu ☰</label></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-search" class="h-4 w-4 rounded" checked><label for="lms-el-search" class="text-sm">Search 🔍</label></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-notifications" class="h-4 w-4 rounded" checked><label for="lms-el-notifications" class="text-sm">Notification Bell 🔔</label></div>
<div class="pl-6"><label for="lms-notification-count" class="text-xs">Badge Count</label><input type="number" id="lms-notification-count" class="w-20 p-1 border rounded-md text-sm" value="2"></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-avatar" class="h-4 w-4 rounded" checked><label for="lms-el-avatar" class="text-sm">User Avatar 👤</label></div>
<div id="lms-avatar-url-control" class="pl-6 space-y-1"><label for="lms-avatar-url" class="text-xs">URL</label><input type="text" id="lms-avatar-url" class="w-full p-1 border rounded-md text-sm" placeholder="#"></div>
<label class="font-medium text-xs pt-2 block">Bonus Icons</label>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-refresh" class="h-4 w-4 rounded"><label for="lms-el-refresh" class="text-sm">Refresh Icon 🔁</label></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-theme" class="h-4 w-4 rounded" checked><label for="lms-el-theme" class="text-sm">Theme Toggle (Header) 🌙</label></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-calendar" class="h-4 w-4 rounded"><label for="lms-el-calendar" class="text-sm">Calendar Icon 📅</label></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-el-share" class="h-4 w-4 rounded"><label for="lms-el-share" class="text-sm">Share Icon 📤</label></div>
</div>
<div id="lms-custom-icons-builder" class="pl-4 space-y-2 pt-4 border-t mt-4">
<label class="font-medium text-xs">Custom Icons</label>
<div id="lms-custom-icons-container" class="space-y-2"></div>
<button id="add-lms-custom-icon-btn" class="text-sm bg-blue-500 text-white py-1 px-3 rounded-md hover:bg-blue-600">+ Add Custom Icon</button>
</div>
</div>
<div class="space-y-2 border-b pb-4">
<div class="flex items-center space-x-2">
<input type="checkbox" id="lms-page-title-toggle" class="h-4 w-4 rounded" checked>
<label for="lms-page-title-toggle" class="font-medium text-sm">Enable Page Title Area</label>
</div>
<div class="pl-4 space-y-2">
<div><label for="lms-page-title-text" class="text-xs">Page Title Text</label><input type="text" id="lms-page-title-text" class="w-full p-1 border rounded-md text-sm" value="Mock Test Series"></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="lms-page-title-back" class="h-4 w-4 rounded" checked><label for="lms-page-title-back" class="text-sm">Show Back Button ←</label></div>
</div>
</div>
<div id="lms-tabs-builder" class="space-y-3">
<div class="flex items-center space-x-2">
<input type="checkbox" id="lms-tabs-toggle" class="h-4 w-4 rounded" checked>
<label for="lms-tabs-toggle" class="font-medium text-sm">Enable Secondary Header Tabs</label>
</div>
<div id="lms-tabs-container" class="space-y-2"></div>
<button id="add-lms-tab-btn" class="text-sm bg-blue-500 text-white py-1 px-3 rounded-md hover:bg-blue-600">+ Add Tab</button>
</div>
</div>
</div>
<div id="panel-lms-sidebar" class="onley-control-panel">
<div class="flex justify-between items-center mb-6">
<h3 class="mb-0 pb-0 border-b-0">📚 Learning App Sidebar</h3>
<button class="get-component-code-btn text-sm bg-indigo-500 text-white py-1 px-3 rounded-md hover:bg-indigo-600" data-component-key="sidebar">
<i class="fas fa-code mr-1"></i> Get Code
</button>
</div>
<div class="space-y-4">
<div class="flex items-center space-x-2 border-b pb-4">
<input type="checkbox" id="sidebar-enable-toggle" class="h-4 w-4 rounded" checked>
<label for="sidebar-enable-toggle" class="font-medium text-sm">Enable Sidebar</label>
</div>
<div id="sidebar-controls-container" class="space-y-4">
<div class="space-y-2 border-b pb-4">
<label class="font-medium text-sm">Branding Area</label>
<div class="flex items-center space-x-2"><input type="checkbox" id="sidebar-brand-logo-toggle" class="h-4 w-4 rounded"><label for="sidebar-brand-logo-toggle" class="text-sm">Show Logo</label></div>
<div class="flex items-center space-x-2"><input type="checkbox" id="sidebar-brand-sitename-toggle" class="h-4 w-4 rounded"><label for="sidebar-brand-sitename-toggle" class="text-sm">Show Sitename/Tagline</label></div>
<div><label class="text-xs">Sitename</label><input type="text" id="sidebar-brand-sitename" class="w-full p-1 border rounded-md text-sm"></div>
<div><label class="text-xs">Tagline</label><input type="text" id="sidebar-brand-tagline" class="w-full p-1 border rounded-md text-sm"></div>
</div>
<div id="sidebar-primary-nav-builder" class="space-y-3 border-b pb-4"></div>
<div id="sidebar-categories-builder" class="space-y-3 border-b pb-4"></div>
<div id="sidebar-user-section-builder" class="space-y-3 border-b pb-4"></div>
<div id="sidebar-shortcuts-builder" class="space-y-3 border-b pb-4"></div>
<div class="space-y-2 border-b pb-4 pl-4">
<label class="font-medium text-sm">Special Toggles</label>
<div class="flex items-center space-x-2">
<input type="checkbox" id="sidebar-theme-toggle-cb" class="h-4 w-4 rounded">
<label for="sidebar-theme-toggle-cb" class="text-sm">Add Dark/Light Mode Toggle</label>
</div>
</div>
<div id="sidebar-footer-builder" class="space-y-3 border-b pb-4"></div>
</div>
</div>
</div>
<div id="panel-custom-html" class="onley-control-panel">
<div class="flex justify-between items-center mb-6">
<h3 class="mb-0 pb-0 border-b-0"> </> Custom HTML</h3>
<button class="get-component-code-btn text-sm bg-indigo-500 text-white py-1 px-3 rounded-md hover:bg-indigo-600" data-component-key="customHtml">
<i class="fas fa-code mr-1"></i> Get Code
</button>
</div>
<div class="space-y-4">
<div class="flex items-center space-x-2 border-b pb-4">
<input type="checkbox" id="custom-html-toggle" class="h-4 w-4 rounded">
<label for="custom-html-toggle" class="font-medium">Enable Custom HTML Section</label>
</div>
<div id="custom-html-builder">
<label for="custom-html-content" class="text-sm font-medium">HTML Content</label>
<p class="text-xs text-gray-500 mb-2">Paste any valid HTML. Be cautious, as invalid code can break the page layout.</p>
<textarea id="custom-html-content" rows="10" class="w-full p-2 border rounded-md font-mono text-sm"></textarea>
</div>
</div>
</div>
</div>
</div>
</aside>
<main id="preview-main" class="w-2/3 bg-gray-200 p-4 flex flex-col items-center justify-center overflow-hidden transition-all duration-300 ease-in-out">
<div id="preview-container" class="bg-white shadow-lg rounded-lg w-full h-full overflow-hidden">
<iframe id="preview-iframe" class="onley-preview-iframe"></iframe>
</div>
</main>
</div>
</div>
<div id="toast-notification" class="onley-toast"></div>
<div id="code-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-75 overflow-y-auto h-full w-full z-50">
<div class="relative top-10 mx-auto p-5 border w-11/12 md:w-2/3 shadow-lg rounded-md bg-white">
<div class="flex justify-between items-center border-b pb-3">
<h3 id="code-modal-title" class="text-lg leading-6 font-medium text-gray-900">Component Code</h3>
<button id="close-code-modal-btn" class="text-gray-400 hover:text-gray-600">×</button>
</div>
<div class="mt-4 space-y-4">
<div>
<label class="font-semibold text-gray-700">HTML</label>
<pre id="code-modal-html" class="onley-code-modal-pre"><code></code></pre>
</div>
<div>
<label class="font-semibold text-gray-700">CSS</label>
<pre id="code-modal-css" class="onley-code-modal-pre"><code></code></pre>
</div>
<div>
<label class="font-semibold text-gray-700">JavaScript</label>
<pre id="code-modal-js" class="onley-code-modal-pre"><code></code></pre>
</div>
</div>
<div class="items-center px-4 py-3 mt-4 text-right bg-gray-50 -mx-5 -mb-5 rounded-b-md">
<button id="download-component-zip-btn" class="px-4 py-2 bg-green-600 text-white text-base font-medium rounded-md shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-300">
Download .zip
</button>
<button id="close-code-modal-btn-2" class="px-4 py-2 bg-gray-200 text-gray-800 text-base font-medium rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-300 ml-2">
Close
</button>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
// State object to hold all configurations
const config = {
globalSettings: {
colors: {
primary: '#3b82f6',
secondary: '#10b981',
text: '#374151',
heading: '#111827',
},
typography: {
fontFamily: "'Inter', sans-serif",
}
},
componentOrder: [
'topBar',
'lmsHeader',
'customHtml',
],
customHtml: {
enabled: false,
content: '<h2>Custom HTML Content</h2><p>This is a placeholder for your own HTML code.</p>'
},
learningAppHeader: {
sticky: false,
primaryBar: {
enabled: true,
brand: {
type: 'image',
text: 'LearnX',
imageUrl: 'https://examups.com/wp-content/uploads/2024/08/examups.com-2.png',
height: 30,
},
elements: {
hamburger: true,
search: true,
notifications: { enabled: true, url: '#' },
avatar: { enabled: true, url: '#' },
refresh: false,
themeToggle: true,
calendar: false,
share: false,
customIcons: [
{ name: 'Cart', icon: 'fas fa-shopping-cart', url: '#', enabled: true },
{ name: 'Dashboard', icon: 'fas fa-th-large', url: '#', enabled: true },
]
},
notificationCount: 2
},
pageTitle: {
enabled: true,
text: 'Mock Test Series',
showBackButton: true,
},
tabs: {
enabled: true,
items: [
{ text: 'All', url: '#', active: true },
{ text: 'Courses', url: '#', active: false },
{ text: 'Mock Tests', url: '#', active: false },
]
}
},
sidebar: {
enabled: true,
branding: {
showLogo: true,
showSitename: true,
sitename: 'ExamUPS',
tagline: 'Your Learning Partner'
},
primaryNav: {
enabled: true,
title: 'Primary Navigation',
links: [
{ icon: 'fas fa-tachometer-alt', text: 'Dashboard', url: '#', enabled: true },
{ icon: 'fas fa-book', text: 'My Courses', url: '#', enabled: true },
{ icon: 'fas fa-file-alt', text: 'Mock Test Series', url: '#', enabled: true },
]
},
categories: {
enabled: true,
title: 'Course & Test Categories',
links: [ { icon: 'fas fa-leaf', text: 'Agriculture', url: '#', enabled: true }, ]
},
userSection: { enabled: true, title: 'User Account', links: [ { icon: 'fas fa-user-circle', text: 'Profile', url: '#', enabled: true }, ] },
shortcuts: { enabled: true, title: 'Shortcuts & CTA', links: [ { icon: 'fas fa-bell', text: 'Notifications', url: '#', badge: '3', enabled: true }, { icon: 'fas fa-moon', text: 'Theme Toggle', url: '#', enabled: true, isThemeToggle: true } ] },
footer: { enabled: true, title: 'Support', links: [ { icon: 'fas fa-headset', text: 'Contact / Support', url: '#', enabled: true }, ] }
},
topBar: {
enabled: true,
text: '<i class="fas fa-gift onley-offer-icon"></i> Special Announcement! Save 25% on all test series! <a href="#" class="onley-cta-button">Claim Offer</a>',
url: '#', // Fallback URL
styles: {
bgColorStart: '#004d40',
bgColorEnd: '#009688',
textColor: '#ffffff',
fontSize: '14',
padding: '10'
}
}
};
const componentNames = {
customHtml: 'Custom HTML',
lmsHeader: 'LMS Header',
sidebar: 'LMS Sidebar',
topBar: 'Top Bar',
};
// UI Element References
const ui = {
previewIframe: document.getElementById('preview-iframe'),
mainContainer: document.getElementById('main-container'),
toggleSidebarBtn: document.getElementById('toggle-sidebar-btn'),
controls: {
nav: document.getElementById('onley-controls-nav'),
panels: document.getElementById('onley-controls-panels'),
},
globalSettings: {
primaryColor: document.getElementById('global-color-primary'),
secondaryColor: document.getElementById('global-color-secondary'),
textColor: document.getElementById('global-color-text'),
headingColor: document.getElementById('global-color-heading'),
fontFamily: document.getElementById('global-font-family'),
applyBtn: document.getElementById('apply-global-settings'),
},
layout: {
container: document.getElementById('layout-builder-container'),
panel: document.getElementById('panel-layout')
},
customHtml: {
toggle: document.getElementById('custom-html-toggle'),
content: document.getElementById('custom-html-content'),
},
learningAppHeader: {
stickyToggle: document.getElementById('lms-header-sticky-toggle'),
primaryBarToggle: document.getElementById('lms-primary-bar-toggle'),
brand: { type: document.getElementById('lms-brand-type'), text: document.getElementById('lms-brand-text'), textControl: document.getElementById('lms-brand-text-control'), imageUrl: document.getElementById('lms-brand-image-url'), imageHeight: document.getElementById('lms-brand-image-height'), imageControls: document.getElementById('lms-brand-image-controls'), },
elHamburger: document.getElementById('lms-el-hamburger'),
elSearch: document.getElementById('lms-el-search'),
elNotifications: document.getElementById('lms-el-notifications'),
notificationCount: document.getElementById('lms-notification-count'),
elAvatar: document.getElementById('lms-el-avatar'),
lmsAvatarUrl: document.getElementById('lms-avatar-url'),
lmsAvatarUrlControl: document.getElementById('lms-avatar-url-control'),
elRefresh: document.getElementById('lms-el-refresh'),
elTheme: document.getElementById('lms-el-theme'),
elCalendar: document.getElementById('lms-el-calendar'),
elShare: document.getElementById('lms-el-share'),
pageTitleToggle: document.getElementById('lms-page-title-toggle'),
pageTitleText: document.getElementById('lms-page-title-text'),
pageTitleBack: document.getElementById('lms-page-title-back'),
tabs: { toggle: document.getElementById('lms-tabs-toggle'), builder: document.getElementById('lms-tabs-builder'), container: document.getElementById('lms-tabs-container'), },
customIcons: { builder: document.getElementById('lms-custom-icons-builder'), container: document.getElementById('lms-custom-icons-container') }
},
sidebar: {
enableToggle: document.getElementById('sidebar-enable-toggle'),
controlsContainer: document.getElementById('sidebar-controls-container'),
brand: { logoToggle: document.getElementById('sidebar-brand-logo-toggle'), sitenameToggle: document.getElementById('sidebar-brand-sitename-toggle'), sitename: document.getElementById('sidebar-brand-sitename'), tagline: document.getElementById('sidebar-brand-tagline'), },
primaryNavBuilder: document.getElementById('sidebar-primary-nav-builder'),
categoriesBuilder: document.getElementById('sidebar-categories-builder'),
userSectionBuilder: document.getElementById('sidebar-user-section-builder'),
shortcutsBuilder: document.getElementById('sidebar-shortcuts-builder'),
themeToggleCheckbox: document.getElementById('sidebar-theme-toggle-cb'),
footerBuilder: document.getElementById('sidebar-footer-builder'),
},
topBar: {
toggle: document.getElementById('topbar-toggle'),
text: document.getElementById('topbar-text'),
url: document.getElementById('topbar-url'),
mainControls: document.getElementById('topbar-main-controls'),
bgColorStart: document.getElementById('topbar-bg-color-start'),
bgColorEnd: document.getElementById('topbar-bg-color-end'),
textColor: document.getElementById('topbar-text-color'),
fontSize: document.getElementById('topbar-font-size'),
padding: document.getElementById('topbar-padding'),
fontSizeVal: document.getElementById('topbar-font-size-val'),
paddingVal: document.getElementById('topbar-padding-val'),
},
buttons: {
desktop: document.getElementById('desktop-btn'),
tablet: document.getElementById('tablet-btn'),
mobile: document.getElementById('mobile-btn'),
import: document.getElementById('import-btn'),
importFile: document.getElementById('import-file-input'),
},
exportMenu: {
container: document.getElementById('export-menu-container'),
button: document.getElementById('export-menu-btn'),
dropdown: document.getElementById('export-dropdown'),
copyCombined: document.getElementById('copy-combined-code'),
copyHtml: document.getElementById('copy-html'),
copyCss: document.getElementById('copy-css'),
copyJs: document.getElementById('copy-js'),
downloadZip: document.getElementById('download-zip-btn'),
},
codeModal: {
modal: document.getElementById('code-modal'),
title: document.getElementById('code-modal-title'),
htmlContainer: document.getElementById('code-modal-html'),
cssContainer: document.getElementById('code-modal-css'),
jsContainer: document.getElementById('code-modal-js'),
htmlCode: document.querySelector('#code-modal-html code'),
cssCode: document.querySelector('#code-modal-css code'),
jsCode: document.querySelector('#code-modal-js code'),
downloadBtn: document.getElementById('download-component-zip-btn'),
closeBtns: [document.getElementById('close-code-modal-btn'), document.getElementById('close-code-modal-btn-2')],
},
previewContainer: document.getElementById('preview-container'),
};
// --- Event Listeners ---
function setupEventListeners() {
ui.controls.nav.addEventListener('click', (e) => {
const button = e.target.closest('.onley-control-nav-button');
if (!button) return;
const targetPanelId = button.dataset.target;
ui.controls.nav.querySelectorAll('.onley-control-nav-button').forEach(btn => btn.classList.remove('onley-active'));
button.classList.add('onley-active');
ui.controls.panels.querySelectorAll('.onley-control-panel').forEach(panel => {
panel.classList.toggle('onley-active', `#${panel.id}` === targetPanelId);
});
});
// Global Settings Listeners
ui.globalSettings.primaryColor.addEventListener('input', e => { config.globalSettings.colors.primary = e.target.value; renderAll(); });
ui.globalSettings.secondaryColor.addEventListener('input', e => { config.globalSettings.colors.secondary = e.target.value; renderAll(); });
ui.globalSettings.textColor.addEventListener('input', e => { config.globalSettings.colors.text = e.target.value; renderAll(); });
ui.globalSettings.headingColor.addEventListener('input', e => { config.globalSettings.colors.heading = e.target.value; renderAll(); });
ui.globalSettings.fontFamily.addEventListener('change', e => { config.globalSettings.typography.fontFamily = e.target.value; renderAll(); });
ui.globalSettings.applyBtn.addEventListener('click', () => {
renderAll();
showToast('Global styles applied!');
});
// Layout Controls
ui.layout.panel.addEventListener('click', handleLayoutControlsClick);
setupDragAndDrop();
// Component Listeners
ui.customHtml.toggle.addEventListener('change', e => { config.customHtml.enabled = e.target.checked; renderAll(); });
ui.customHtml.content.addEventListener('input', e => { config.customHtml.content = e.target.value; renderAll(); });
// LMS Header Listeners
const lmsUI = ui.learningAppHeader;
const lmsConfig = config.learningAppHeader;
lmsUI.stickyToggle.addEventListener('change', e => { lmsConfig.sticky = e.target.checked; renderAll(); });
lmsUI.primaryBarToggle.addEventListener('change', e => { lmsConfig.primaryBar.enabled = e.target.checked; renderAll(); });
lmsUI.brand.type.addEventListener('change', e => { lmsConfig.primaryBar.brand.type = e.target.value; toggleLmsBrandControls(); renderAll(); });
lmsUI.brand.text.addEventListener('input', e => { lmsConfig.primaryBar.brand.text = e.target.value; renderAll(); });
lmsUI.brand.imageUrl.addEventListener('input', e => { lmsConfig.primaryBar.brand.imageUrl = e.target.value; renderAll(); });
lmsUI.brand.imageHeight.addEventListener('input', e => { lmsConfig.primaryBar.brand.height = e.target.value; renderAll(); });
lmsUI.elHamburger.addEventListener('change', e => { lmsConfig.primaryBar.elements.hamburger = e.target.checked; renderAll(); });
lmsUI.elSearch.addEventListener('change', e => { lmsConfig.primaryBar.elements.search = e.target.checked; renderAll(); });
lmsUI.elNotifications.addEventListener('change', e => { lmsConfig.primaryBar.elements.notifications.enabled = e.target.checked; renderAll(); });
lmsUI.notificationCount.addEventListener('input', e => { lmsConfig.primaryBar.notificationCount = e.target.value; renderAll(); });
lmsUI.elAvatar.addEventListener('change', e => { const isChecked = e.target.checked; lmsConfig.primaryBar.elements.avatar.enabled = isChecked; lmsUI.lmsAvatarUrlControl.style.display = isChecked ? 'block' : 'none'; renderAll(); });
lmsUI.lmsAvatarUrl.addEventListener('input', e => { lmsConfig.primaryBar.elements.avatar.url = e.target.value; renderAll(); });
lmsUI.elRefresh.addEventListener('change', e => { lmsConfig.primaryBar.elements.refresh = e.target.checked; renderAll(); });
lmsUI.elTheme.addEventListener('change', e => { lmsConfig.primaryBar.elements.themeToggle = e.target.checked; renderAll(); });
lmsUI.elCalendar.addEventListener('change', e => { lmsConfig.primaryBar.elements.calendar = e.target.checked; renderAll(); });
lmsUI.elShare.addEventListener('change', e => { lmsConfig.primaryBar.elements.share = e.target.checked; renderAll(); });
lmsUI.pageTitleToggle.addEventListener('change', e => { lmsConfig.pageTitle.enabled = e.target.checked; renderAll(); });
lmsUI.pageTitleText.addEventListener('input', e => { lmsConfig.pageTitle.text = e.target.value; renderAll(); });
lmsUI.pageTitleBack.addEventListener('change', e => { lmsConfig.pageTitle.showBackButton = e.target.checked; renderAll(); });
lmsUI.tabs.toggle.addEventListener('change', e => { lmsConfig.tabs.enabled = e.target.checked; renderAll(); });
lmsUI.tabs.builder.addEventListener('click', handleLmsTabsClick);
lmsUI.tabs.builder.addEventListener('input', handleLmsTabsChange);
lmsUI.customIcons.builder.addEventListener('click', handleLmsCustomIconsClick);
lmsUI.customIcons.builder.addEventListener('input', handleLmsCustomIconsChange);
// Sidebar Listeners
const sidebarUI = ui.sidebar;
const sidebarConfig = config.sidebar;
sidebarUI.enableToggle.addEventListener('change', e => { sidebarConfig.enabled = e.target.checked; sidebarUI.controlsContainer.style.display = e.target.checked ? 'block' : 'none'; renderAll(); });
sidebarUI.brand.logoToggle.addEventListener('change', e => { sidebarConfig.branding.showLogo = e.target.checked; renderAll(); });
sidebarUI.brand.sitenameToggle.addEventListener('change', e => { sidebarConfig.branding.showSitename = e.target.checked; renderAll(); });
sidebarUI.brand.sitename.addEventListener('input', e => { sidebarConfig.branding.sitename = e.target.value; renderAll(); });
sidebarUI.brand.tagline.addEventListener('input', e => { sidebarConfig.branding.tagline = e.target.value; renderAll(); });
sidebarUI.themeToggleCheckbox.addEventListener('change', handleThemeToggleCheckboxChange);
// Top Bar Listeners
const topBarUI = ui.topBar;
topBarUI.toggle.addEventListener('change', (e) => {
config.topBar.enabled = e.target.checked;
topBarUI.mainControls.style.display = e.target.checked ? 'block' : 'none';
renderAll();
});
topBarUI.text.addEventListener('input', (e) => { config.topBar.text = e.target.value; renderAll(); });
topBarUI.url.addEventListener('input', (e) => { config.topBar.url = e.target.value; renderAll(); });
topBarUI.bgColorStart.addEventListener('input', (e) => { config.topBar.styles.bgColorStart = e.target.value; renderAll(); });
topBarUI.bgColorEnd.addEventListener('input', (e) => { config.topBar.styles.bgColorEnd = e.target.value; renderAll(); });
topBarUI.textColor.addEventListener('input', (e) => { config.topBar.styles.textColor = e.target.value; renderAll(); });
topBarUI.fontSize.addEventListener('input', (e) => { config.topBar.styles.fontSize = e.target.value; topBarUI.fontSizeVal.textContent = e.target.value; renderAll(); });
topBarUI.padding.addEventListener('input', (e) => { config.topBar.styles.padding = e.target.value; topBarUI.paddingVal.textContent = e.target.value; renderAll(); });
// Preview & Export
ui.buttons.desktop.addEventListener('click', () => setPreviewMode('desktop'));
ui.buttons.tablet.addEventListener('click', () => setPreviewMode('tablet'));
ui.buttons.mobile.addEventListener('click', () => setPreviewMode('mobile'));
ui.exportMenu.button.addEventListener('click', (e) => { e.stopPropagation(); ui.exportMenu.dropdown.classList.toggle('hidden'); });
window.addEventListener('click', (e) => { if (!ui.exportMenu.container.contains(e.target)) { ui.exportMenu.dropdown.classList.add('hidden'); } });
const copyAction = (e, dataGetter, message) => {
e.preventDefault();
navigator.clipboard.writeText(dataGetter()).then(() => showToast(message));
ui.exportMenu.dropdown.classList.add('hidden');
};
ui.exportMenu.copyCombined.addEventListener('click', (e) => copyAction(e, getCombinedCode, 'Combined code copied!'));
ui.exportMenu.copyHtml.addEventListener('click', (e) => copyAction(e, getEmbeddableHtml, 'Embeddable HTML copied!'));
ui.exportMenu.copyCss.addEventListener('click', (e) => copyAction(e, getFullCSS, 'All CSS copied!'));
ui.exportMenu.copyJs.addEventListener('click', (e) => copyAction(e, getFullJS, 'All JS copied!'));
ui.exportMenu.downloadZip.addEventListener('click', (e) => { e.preventDefault(); generatePageZip(); ui.exportMenu.dropdown.classList.add('hidden'); });
// Import
ui.buttons.import.addEventListener('click', () => ui.buttons.importFile.click());
ui.buttons.importFile.addEventListener('change', handleFileImport);
// Code Modal Listeners
ui.controls.panels.addEventListener('click', handleGetCodeClick);
ui.codeModal.closeBtns.forEach(btn => btn.addEventListener('click', () => ui.codeModal.modal.classList.add('hidden')));
ui.codeModal.modal.addEventListener('click', (e) => {
if (e.target.id === 'code-modal-html' || e.target.id === 'code-modal-css' || e.target.id === 'code-modal-js') {
const code = e.target.querySelector('code').innerText;
navigator.clipboard.writeText(code).then(() => showToast('Copied to clipboard!'));
}
});
// Sidebar Toggle Listener
ui.toggleSidebarBtn.addEventListener('click', () => {
ui.mainContainer.classList.toggle('onley-sidebar-collapsed');
const isCollapsed = ui.mainContainer.classList.contains('onley-sidebar-collapsed');
const icon = ui.toggleSidebarBtn.querySelector('i');
icon.classList.toggle('fa-chevron-left', !isCollapsed);
icon.classList.toggle('fa-chevron-right', isCollapsed);
ui.toggleSidebarBtn.title = isCollapsed ? 'Show Controls' : 'Hide Controls';
});
}
// --- LAYOUT CONTROLS ---
function renderLayoutControls() {
const draggableComponents = config.componentOrder.filter(key => key !== 'sidebar' && key !== 'mobileFooter');
ui.layout.container.innerHTML = draggableComponents.map((key, index) => {
const total = draggableComponents.length;
return `
<div class="onley-layout-item p-3 border rounded-md bg-white flex items-center justify-between" draggable="true" data-key="${key}">
<span class="font-medium text-sm"><i class="fas fa-grip-vertical mr-3 text-gray-400"></i> ${componentNames[key]}</span>
<div class="onley-item-toolbar mb-0">
<button class="reorder-layout-up-btn text-xs bg-gray-200 text-gray-700 p-1 rounded-md hover:bg-gray-300" data-index="${index}" ${index === 0 ? 'disabled' : ''}><i class="fas fa-arrow-up fa-fw"></i></button>
<button class="reorder-layout-down-btn text-xs bg-gray-200 text-gray-700 p-1 rounded-md hover:bg-gray-300" data-index="${index}" ${index === total - 1 ? 'disabled' : ''}><i class="fas fa-arrow-down fa-fw"></i></button>
</div>
</div>`;
}).join('');
}
function handleLayoutControlsClick(e) {
const button = e.target.closest('button');
if (!button) return;
let draggableComponents = config.componentOrder.filter(key => key !== 'sidebar' && key !== 'mobileFooter');
const index = parseInt(button.dataset.index, 10);
let changed = false;
if (button.classList.contains('reorder-layout-up-btn') && index > 0) {
[draggableComponents[index], draggableComponents[index - 1]] = [draggableComponents[index - 1], draggableComponents[index]];
changed = true;
} else if (button.classList.contains('reorder-layout-down-btn') && index < draggableComponents.length - 1) {
[draggableComponents[index], draggableComponents[index + 1]] = [draggableComponents[index + 1], draggableComponents[index]];
changed = true;
}
if(changed) {
config.componentOrder = ['sidebar', ...draggableComponents, 'mobileFooter'].filter((v, i, a) => a.indexOf(v) === i);
renderLayoutControls();
renderAll();
}
}
function setupDragAndDrop() {
let draggedItem = null;
ui.layout.container.addEventListener('dragstart', e => {
if (!e.target.classList.contains('onley-layout-item')) return;
draggedItem = e.target;
setTimeout(() => { e.target.style.display = 'none'; }, 0);
});
ui.layout.container.addEventListener('dragend', e => {
if (!draggedItem) return;
setTimeout(() => { draggedItem.style.display = 'flex'; draggedItem = null; }, 0);
});
ui.layout.container.addEventListener('dragover', e => {
e.preventDefault();
const afterElement = getDragAfterElement(ui.layout.container, e.clientY);
if (afterElement == null) {
ui.layout.container.appendChild(draggedItem);
} else {
ui.layout.container.insertBefore(draggedItem, afterElement);
}
});
ui.layout.container.addEventListener('drop', e => {
e.preventDefault();
if (!draggedItem) return;
const newDraggableOrder = [...ui.layout.container.querySelectorAll('.onley-layout-item')].map(item => item.dataset.key);
config.componentOrder = ['sidebar', ...newDraggableOrder, 'mobileFooter'].filter((v, i, a) => a.indexOf(v) === i);
renderLayoutControls();
renderAll();
});
}
function getDragAfterElement(container, y) {
const draggableElements = [...container.querySelectorAll('.onley-layout-item:not(.dragging)')];
return draggableElements.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
if (offset < 0 && offset > closest.offset) {
return { offset: offset, element: child };
} else {
return closest;
}
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
// --- DYNAMIC ITEM BUILDER LOGIC ---
function createSidebarLinkBuilder(sectionKey, sectionTitle, builderUI, configSection) {
function renderControls() {
let linksHtml = configSection.links.map((link, index) => {
const hasBadge = 'badge' in link;
const badgeInput = hasBadge ? `<input type="text" data-prop="badge" value="${link.badge || ''}" placeholder="Badge" class="p-1 border rounded-md text-sm w-16">` : '';
return `<div class="flex items-center gap-1 p-2 border rounded bg-white" data-index="${index}">
<div class="flex-grow grid grid-cols-2 gap-1">
<input type="text" data-prop="icon" value="${link.icon}" placeholder="Icon Class" class="w-full p-1 border rounded-md text-sm">
<input type="text" data-prop="text" value="${link.text}" placeholder="Link Text" class="w-full p-1 border rounded-md text-sm">
<input type="text" data-prop="url" value="${link.url}" placeholder="URL" class="w-full p-1 border rounded-md text-sm col-span-2">
</div>
<div class="flex flex-col items-center gap-1 px-2">
${badgeInput}
<input type="checkbox" data-prop="enabled" class="h-4 w-4 rounded" ${link.enabled ? 'checked' : ''}>
</div>
<button class="remove-link-btn self-start text-xs bg-red-400 text-white py-1 px-2 rounded-md">-</button>
</div>`;
}).join('');
builderUI.innerHTML = `<div class="flex items-center space-x-2">
<input type="checkbox" id="enable-${sectionKey}" class="h-4 w-4 rounded" ${configSection.enabled ? 'checked' : ''}>
<label for="enable-${sectionKey}" class="font-medium text-sm">${sectionTitle}</label>
</div>
<div class="space-y-2 pl-4 links-container">${linksHtml}</div>
<button id="add-${sectionKey}-btn" class="text-sm bg-blue-500 text-white py-1 px-3 rounded-md hover:bg-blue-600 mt-2 ml-4">+ Add Link</button>`;
}
function handleClick(e) {
let changed = false;
if (e.target.id === `add-${sectionKey}-btn`) {
const newLink = { icon: 'fas fa-link', text: 'New Link', url: '#', enabled: true };
if (configSection.links.length > 0 && 'badge' in configSection.links[0]) newLink.badge = '';
configSection.links.push(newLink);
changed = true;
} else if (e.target.classList.contains('remove-link-btn')) {
configSection.links.splice(parseInt(e.target.closest('[data-index]').dataset.index, 10), 1);
changed = true;
}
if (changed) { renderControls(); renderAll(); }
}
function handleChange(e) {
if (e.target.id === `enable-${sectionKey}`) {
configSection.enabled = e.target.checked;
} else {
const index = e.target.closest('[data-index]').dataset.index;
const property = e.target.dataset.prop;
const value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
configSection.links[index][property] = value;
}
renderAll();
}
builderUI.addEventListener('click', handleClick);
builderUI.addEventListener('input', handleChange);
builderUI.addEventListener('change', handleChange);
renderControls();
}
function handleThemeToggleCheckboxChange(e) {
const shortcuts = config.sidebar.shortcuts;
const themeToggleLink = { icon: 'fas fa-moon', text: 'Theme Toggle', url: '#', enabled: true, isThemeToggle: true };
shortcuts.links = shortcuts.links.filter(link => !link.isThemeToggle);
if (e.target.checked) {
shortcuts.links.push(themeToggleLink);
}
createSidebarLinkBuilder('shortcuts', 'Shortcuts & CTA', ui.sidebar.shortcutsBuilder, config.sidebar.shortcuts);
renderAll();
}
function renderLmsTabsControls() {
ui.learningAppHeader.tabs.container.innerHTML = config.learningAppHeader.tabs.items.map((tab, index) => `
<div class="flex items-center gap-1 p-2 border rounded bg-white">
<div class="flex-grow space-y-1">
<input type="text" data-index="${index}" data-prop="text" value="${tab.text}" placeholder="Tab Label" class="w-full p-1 border rounded-md text-sm">
<input type="text" data-index="${index}" data-prop="url" value="${tab.url}" placeholder="URL" class="w-full p-1 border rounded-md text-sm">
</div>
<div class="flex flex-col items-center"><label class="text-xs">Active</label><input type="radio" name="lms-tab-active" data-index="${index}" data-prop="active" class="h-4 w-4" ${tab.active ? 'checked' : ''}></div>
<button class="remove-lms-tab-btn self-start text-xs bg-red-400 text-white py-1 px-2 rounded-md" data-index="${index}">-</button>
</div>`).join('');
}
function handleLmsTabsClick(e) {
let changed = false;
if (e.target.id === 'add-lms-tab-btn') {
config.learningAppHeader.tabs.items.push({ text: 'New Tab', url: '#', active: false }); changed = true;
} else if (e.target.classList.contains('remove-lms-tab-btn')) {
const index = parseInt(e.target.dataset.index, 10);
if (config.learningAppHeader.tabs.items[index].active && config.learningAppHeader.tabs.items.length > 1) config.learningAppHeader.tabs.items[0].active = true;
config.learningAppHeader.tabs.items.splice(index, 1); changed = true;
}
if(changed) { renderLmsTabsControls(); renderAll(); }
}
function handleLmsTabsChange(e) {
const { index, prop } = e.target.dataset;
if (prop === 'active') {
config.learningAppHeader.tabs.items.forEach((tab, i) => tab.active = (i === parseInt(index, 10)));
renderLmsTabsControls();
} else { config.learningAppHeader.tabs.items[index][prop] = e.target.value; }
renderAll();
}
function renderLmsCustomIconsControls() {
ui.learningAppHeader.customIcons.container.innerHTML = config.learningAppHeader.primaryBar.elements.customIcons.map((icon, index) => `
<div class="flex items-center gap-2 p-2 border rounded bg-white">
<div class="flex-grow space-y-1">
<input type="text" data-index="${index}" data-prop="name" value="${icon.name}" placeholder="Icon Name" class="w-full p-1 border rounded-md text-sm">
<div class="grid grid-cols-2 gap-2">
<input type="text" data-index="${index}" data-prop="icon" value="${icon.icon}" placeholder="Font Awesome Class" class="w-full p-1 border rounded-md text-sm">
<input type="text" data-index="${index}" data-prop="url" value="${icon.url}" placeholder="URL" class="w-full p-1 border rounded-md text-sm">
</div>
</div>
<div class="flex flex-col items-center px-2"><label class="text-xs">On</label><input type="checkbox" data-index="${index}" data-prop="enabled" class="h-4 w-4 rounded" ${icon.enabled ? 'checked' : ''}></div>
<button class="remove-lms-custom-icon-btn self-start text-xs bg-red-400 text-white py-1 px-2 rounded-md" data-index="${index}">-</button>
</div>`).join('');
}
function handleLmsCustomIconsClick(e) {
let changed = false;
if (e.target.id === 'add-lms-custom-icon-btn') {
config.learningAppHeader.primaryBar.elements.customIcons.push({ name: 'New Icon', icon: 'fas fa-star', url: '#', enabled: true }); changed = true;
} else if (e.target.classList.contains('remove-lms-custom-icon-btn')) {
config.learningAppHeader.primaryBar.elements.customIcons.splice(parseInt(e.target.dataset.index, 10), 1); changed = true;
}
if (changed) { renderLmsCustomIconsControls(); renderAll(); }
}
function handleLmsCustomIconsChange(e) {
const { index, prop } = e.target.dataset; if (index === undefined || prop === undefined) return;
const value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
config.learningAppHeader.primaryBar.elements.customIcons[index][prop] = value;
renderAll();
}
function toggleLmsBrandControls() {
const isImage = config.learningAppHeader.primaryBar.brand.type === 'image';
ui.learningAppHeader.brand.textControl.classList.toggle('hidden', isImage);
ui.learningAppHeader.brand.imageControls.classList.toggle('hidden', !isImage);
}
// --- HTML Generation Logic ---
const componentGenerators = {
customHtml: () => config.customHtml.enabled ? `<div class="onley-custom-html-section">${config.customHtml.content}</div>` : '',
topBar: () => {
if (!config.topBar.enabled) return '';
const s = config.topBar.styles;
const content = config.topBar.text.includes('<a') ? config.topBar.text : `<a href="${config.topBar.url}">${config.topBar.text}</a>`;
return `<div id="site-topbar" class="onley-site-topbar" style="--bg-start: ${s.bgColorStart}; --bg-end: ${s.bgColorEnd}; --text-color: ${s.textColor}; --font-size: ${s.fontSize}px; --padding: ${s.padding}px;"><div class="onley-container">${content}</div></div>`;
},
lmsHeader: () => {
const c = config.learningAppHeader; if (!c.primaryBar.enabled && !c.pageTitle.enabled && !c.tabs.enabled) return '';
let primaryBar = '';
const { elements, brand, notificationCount } = c.primaryBar;
const searchOverlay = elements.search ? `
<div id="lms-search-overlay" class="onley-lms-search-overlay">
<button id="lms-search-close-btn" class="onley-lms-search-close-btn">×</button>
<div class="onley-lms-search-content">
<h2 class="onley-search-title">What are you looking for?</h2>
<form id="lms-search-form" class="onley-lms-search-form" action="https://examups.com/" method="get" target="_self">
<input type="search" name="s" id="lms-search-input" placeholder="Search..." required>
<button type="submit"><i class="fas fa-search"></i></button>
</form>
<div class="onley-search-suggestions">
<span>Popular:</span>
<a href="https://examups.com/?s=UPSC" target="_self">UPSC</a>
<a href="https://examups.com/?s=BPSC" target="_self">BPSC</a>
<a href="https://examups.com/?s=Test+Series" target="_self">Test Series</a>
</div>
</div>
</div>` : '';
const notificationSidebar = elements.notifications.enabled ? `
<div class="onley-notification-sidebar-overlay"></div>
<aside class="onley-notification-sidebar">
<div class="onley-notification-sidebar-header">
<h3>Notifications</h3>
<button id="close-notification-sidebar-btn">×</button>
</div>
<div class="onley-notification-sidebar-content">
<iframe src="https://examups.com/notification/" title="Notifications"></iframe>
</div>
</aside>
` : '';
if(c.primaryBar.enabled) {
const brandHtml = (brand.type === 'image' && brand.imageUrl) ? `<img src="${brand.imageUrl}" alt="Brand Logo" class="onley-lms-logo" style="height: ${brand.height}px;">` : `<span class="onley-app-name">${brand.text}</span>`;
const badge = (notificationCount > 0) ? `<span class="onley-badge">${notificationCount}</span>` : '';
const customIcons = elements.customIcons.filter(i => i.enabled).map(i => `<a href="${i.url}" class="onley-icon-btn onley-lms-custom-icon" title="${i.name}"><i class="${i.icon}"></i></a>`).join('');
const inlineSearchForm = elements.search ? `
<div class="onley-lms-inline-search">
<form action="https://examups.com/" method="get" target="_self">
<input type="search" name="s" placeholder="Search courses & tests...">
<button type="submit"><i class="fas fa-search"></i></button>
</form>
</div>` : '';
primaryBar = `<div class="onley-lms-primary-bar">
<div class="onley-lms-brand">${elements.hamburger ? '<button class="onley-hamburger-menu" id="lms-sidebar-toggle">☰</button>' : ''}${brandHtml}</div>
${inlineSearchForm}
<div class="onley-lms-icon-group">
${elements.search ? '<button class="onley-icon-btn" id="lms-search-btn"><i class="fas fa-search"></i></button>' : ''}
${elements.notifications.enabled ? `<button id="lms-notification-btn" class="onley-icon-btn onley-notification-bell">${badge}<i class="fas fa-bell"></i></button>` : ''}
${elements.avatar.enabled ? `<a href="${elements.avatar.url}" class="onley-icon-btn onley-user-avatar"><i class="fas fa-user"></i></a>` : ''}
${elements.refresh ? '<button class="onley-icon-btn onley-lms-bonus-icon"><i class="fas fa-sync-alt"></i></button>' : ''}
${elements.themeToggle ? '<button class="onley-icon-btn" id="header-theme-toggle"><i class="fas fa-moon"></i></button>' : ''}
${elements.calendar ? '<button class="onley-icon-btn onley-lms-bonus-icon"><i class="fas fa-calendar-alt"></i></button>' : ''}
${elements.share ? '<button class="onley-icon-btn onley-lms-bonus-icon"><i class="fas fa-share-alt"></i></button>' : ''}
${customIcons}
</div>
</div>`;
}
const title = c.pageTitle.enabled ? `<div class="onley-lms-page-title">${c.pageTitle.showBackButton ? '<button class="onley-back-btn">←</button>' : ''}<h2>${c.pageTitle.text}</h2></div>` : '';
const tabs = c.tabs.enabled ? `<nav class="onley-lms-tabs-nav">${c.tabs.items.map(t => `<a href="${t.url}" class="onley-lms-tab-item ${t.active ? 'onley-active' : ''}">${t.text}</a>`).join('')}</nav>` : '';
return `<header class="onley-learning-app-header-container ${c.sticky ? 'onley-sticky-header' : ''}">${primaryBar}${title}${tabs}${searchOverlay}</header>${notificationSidebar}`;
},
sidebar: () => {
if (!config.sidebar.enabled) return '';
const s = config.sidebar;
const brandHtml = `<div class="onley-lms-sidebar-brand">${s.branding.showLogo ? `<img src="${config.learningAppHeader.primaryBar.brand.imageUrl}" alt="Logo" class="onley-lms-sidebar-logo">` : ''}${s.branding.showSitename ? `<div class="onley-lms-sidebar-sitename"><strong>${s.branding.sitename}</strong><small>${s.branding.tagline}</small></div>` : ''}</div>`;
const createLinkSection = (sec) => {
if (!sec.enabled) return '';
const links = sec.links.filter(l => l.enabled).map(l => {
const badge = l.badge ? `<span class="onley-sidebar-badge">${l.badge}</span>` : '';
const themeToggleId = l.isThemeToggle ? 'id="sidebar-theme-toggle"' : '';
return `<li><a href="${l.url}" ${themeToggleId}><i class="${l.icon}"></i><span>${l.text}</span>${badge}</a></li>`;
}).join('');
return `<nav class="onley-lms-sidebar-nav"><ul>${links}</ul></nav>`;
};
const catSection = () => {
if (!s.categories.enabled) return '';
const links = s.categories.links.filter(l => l.enabled).map(l => `<li><a href="${l.url}"><i class="${l.icon}"></i><span>${l.text}</span></a></li>`).join('');
return `<div class="onley-lms-sidebar-nav-accordion"><button class="onley-accordion-trigger"><div><i class="fas fa-folder"></i><span>${s.categories.title}</span></div><i class="fas fa-chevron-down onley-arrow"></i></button><div class="onley-accordion-panel"><nav class="onley-lms-sidebar-nav"><ul>${links}</ul></nav></div></div>`;
};
return `<div class="onley-lms-sidebar-overlay"></div><aside class="onley-lms-sidebar">${brandHtml}<div class="onley-lms-sidebar-content">${createLinkSection(s.primaryNav)}${catSection()}${createLinkSection(s.userSection)}${createLinkSection(s.shortcuts)}</div><div class="onley-lms-sidebar-footer">${createLinkSection(s.footer)}</div></aside>`;
},
};
function getAllHtml() {
const allComponents = {
sidebar: componentGenerators.sidebar(),
main: ''
};
const mainComponents = config.componentOrder
.filter(key => key !== 'sidebar' && key !== 'mobileFooter')
.map(key => componentGenerators[key] ? componentGenerators[key]() : '')
.filter(Boolean)
.join('\n\n');
allComponents.main = mainComponents;
return allComponents;
}
function getEmbeddableHtml() {
const { sidebar, main } = getAllHtml();
const sidebarHtml = sidebar ? sidebar + '\n' : '';
return `${sidebarHtml}<div class="onley-main-content-pusher">\n${main}\n</div>`;
}
function generateComponentCSS(targetKey = null) {
const { colors, typography } = config.globalSettings;
const css = {};
css.global = `
:root {
--sidebar-width: 260px;
--primary-color: ${colors.primary};
--secondary-color: ${colors.secondary};
--text-color: ${colors.text};
--heading-color: ${colors.heading};
--font-family: ${typography.fontFamily};
}
body { font-family: var(--font-family); color: var(--text-color); margin: 0; background-color: #f0f2f5; transition: background-color 0.3s, color 0.3s; }
h1,h2,h3,h4,h5,h6 { color: var(--heading-color); }
.onley-container { max-width: 1280px; margin: 0 auto; width: 90%; } a { color: var(--primary-color); text-decoration: none; }
.onley-main-content-pusher { transition: margin-left 0.3s ease-in-out; }
@keyframes onley-gift-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes onley-button-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 152, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); } }
/* --- Dark Mode Styles --- */
body.onley-dark-mode { background-color: #1f2937; color: #d1d5db; }
body.onley-dark-mode h1, body.onley-dark-mode h2, body.onley-dark-mode h3, body.onley-dark-mode h4 { color: #f9fafb; }
body.onley-dark-mode .onley-lms-sidebar,
body.onley-dark-mode .onley-learning-app-header-container,
body.onley-dark-mode .onley-lms-page-title,
body.onley-dark-mode .onley-lms-tabs-nav,
body.onley-dark-mode .onley-site-footer { background-color: #111827; border-color: #374151; }
body.onley-dark-mode .onley-lms-sidebar-nav ul li a, body.onley-dark-mode .onley-icon-btn, body.onley-dark-mode .onley-back-btn { color: #f9fafb; }
body.onley-dark-mode .onley-lms-sidebar-nav ul li a:hover, body.onley-dark-mode .onley-icon-btn:hover { background-color: #374151; }
body.onley-dark-mode .onley-site-footer { color: #9ca3af; }
body.onley-dark-mode .onley-footer-widget a { color: #9ca3af; } body.onley-dark-mode .onley-footer-widget a:hover { color: #fff; }
body.onley-dark-mode .onley-widget-title { color: #fff; }
body.onley-dark-mode .onley-lms-inline-search form { background-color: #374151; border-color: #4b5563; }
body.onley-dark-mode .onley-lms-inline-search input { color: #d1d5db; }
`;
if(config.customHtml.enabled) css.customHtml = `.onley-custom-html-section { padding: 2rem 0; }`;
css.topBar = config.topBar.enabled ? `.onley-site-topbar { background: linear-gradient(90deg, var(--bg-start), var(--bg-end)); color: var(--text-color); font-size: var(--font-size); padding: var(--padding) 0; font-weight: 500; } .onley-site-topbar .onley-container { display: flex; align-items: center; justify-content: center; gap: 15px; flex-wrap: wrap; } .onley-site-topbar a { color: inherit; text-decoration: none; } .onley-offer-icon { margin-right: 12px; font-size: 1.2em; animation: onley-gift-bounce 1.5s ease-in-out infinite; } .onley-cta-button { margin-left: 20px; background-color: #ff9800; color: #fff; padding: 0.5em 1.2em; border-radius: 50px; font-weight: 700; animation: onley-button-pulse 2s infinite; } @media (max-width: 768px) { .onley-site-topbar .onley-container { flex-direction: column; gap: 8px; text-align: center; } .onley-cta-button { margin-left: 0; } }` : '';
css.lmsHeader = `
.onley-learning-app-header-container { background-color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.05); z-index: 100; position: relative; transition: background-color 0.3s; }
.onley-learning-app-header-container.onley-sticky-header { position: sticky; top: 0; z-index: 1010; }
.onley-lms-primary-bar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; height: 60px; border-bottom: 1px solid #e5e7eb; }
.onley-lms-brand { display: flex; align-items: center; gap: 1rem; }
.onley-hamburger-menu { background: none; border: none; font-size: 1.5rem; cursor: pointer; display: block; }
.onley-lms-logo { height: 30px; }
.onley-app-name { font-weight: 700; font-size: 1.25rem; }
.onley-lms-icon-group { display: flex; align-items: center; gap: 0.25rem; }
.onley-icon-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: #4b5563; font-size: 1.2rem; cursor: pointer; position: relative; width: 40px; height: 40px; border-radius: 50%; transition: background-color 0.2s, color 0.2s; }
.onley-icon-btn:hover { background-color: #f3f4f6; color: var(--primary-color); }
.onley-notification-bell .onley-badge { position: absolute; top: 5px; right: 5px; background-color: #ef4444; color: #fff; font-size: 0.65rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 500; }
.onley-lms-page-title { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background-color: #fafafa; border-bottom: 1px solid #e5e7eb; transition: background-color 0.3s; }
.onley-back-btn { background: none; border: 1px solid #d1d5db; border-radius: 50%; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.onley-lms-page-title h2 { font-size: 1.125rem; font-weight: 600; margin: 0; }
.onley-lms-tabs-nav { display: flex; overflow-x: auto; padding: 0 1rem; border-bottom: 1px solid #e5e7eb; background: #fff; transition: background-color 0.3s;}
.onley-lms-tab-item { padding: 0.75rem 1rem; font-size: 0.9rem; color: #6b7280; white-space: nowrap; border-bottom: 2px solid transparent; transition: all 0.2s; }
.onley-lms-tab-item.onley-active, .onley-lms-tab-item:hover { color: var(--primary-color); font-weight: 600; border-bottom-color: var(--primary-color); }
.onley-lms-search-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(243, 244, 246, 0.8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out; }
body.onley-search-active .onley-lms-search-overlay { opacity: 1; visibility: visible; }
.onley-lms-search-content { text-align: center; }
.onley-lms-search-close-btn { position: absolute; top: 20px; right: 30px; font-size: 3rem; color: #374151; background: none; border: none; cursor: pointer; }
.onley-search-title { font-size: 2rem; color: #111827; margin-bottom: 1.5rem; font-weight: 600; }
.onley-lms-search-form { display: flex; align-items: center; width: 90%; max-width: 550px; margin: 0 auto; background-color: #ffffff; border-radius: 999px; padding: 0.5rem 0.75rem 0.5rem 1.5rem; box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 5px 10px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05); }
.onley-lms-search-form input { flex-grow: 1; border: none; font-size: 1rem; outline: none; background-color: transparent; color: #333; }
.onley-lms-search-form input::placeholder { color: #9ca3af; }
.onley-lms-search-form button { background-color: transparent; color: #6b7280; border: none; padding: 0.5rem; font-size: 1.2rem; cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; }
.onley-lms-search-form button:hover { background-color: #f3f4f6; }
.onley-search-suggestions { margin-top: 1.5rem; color: #4b5563; }
.onley-search-suggestions span { margin-right: 10px; }
.onley-search-suggestions a { display: inline-block; color: #374151; text-decoration: none; border: 1px solid #d1d5db; padding: 5px 12px; border-radius: 20px; margin: 0 5px; transition: all 0.3s ease; font-size: 0.9rem; }
.onley-search-suggestions a:hover { background-color: #374151; color: #fff; border-color: #374151; }
.onley-lms-inline-search { flex-grow: 1; margin: 0 1rem; max-width: 600px; display: none; }
.onley-lms-inline-search form { display: flex; align-items: center; background-color: #f3f4f6; border-radius: 8px; padding: 0 0.5rem; border: 1px solid #e5e7eb; transition: background-color 0.3s, border-color 0.3s; }
.onley-lms-inline-search input { flex-grow: 1; border: none; outline: none; background-color: transparent; padding: 0.6rem 0.5rem; font-size: 0.9rem; transition: color 0.3s; }
.onley-lms-inline-search button { background: none; border: none; cursor: pointer; color: #6b7280; padding: 0.5rem; }
.onley-notification-sidebar { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 90%; background-color: #fff; z-index: 2010; display: flex; flex-direction: column; box-shadow: -2px 0 8px rgba(0,0,0,0.1); transform: translateX(100%); transition: transform 0.3s ease-in-out; }
body.onley-notification-sidebar-open .onley-notification-sidebar { transform: translateX(0); }
.onley-notification-sidebar-overlay { position: fixed; inset: 0; background-color: rgba(0,0,0,0.4); z-index: 2009; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
body.onley-notification-sidebar-open .onley-notification-sidebar-overlay { opacity: 1; visibility: visible; }
.onley-notification-sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
.onley-notification-sidebar-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
#close-notification-sidebar-btn { background: none; border: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: #6b7280; }
.onley-notification-sidebar-content { flex-grow: 1; overflow-y: auto; }
.onley-notification-sidebar-content iframe { width: 100%; height: 100%; border: none; }
body.onley-dark-mode .onley-notification-sidebar { background-color: #111827; border-left: 1px solid #374151; }
body.onley-dark-mode .onley-notification-sidebar-header { border-bottom-color: #374151; }
body.onley-dark-mode #close-notification-sidebar-btn { color: #d1d5db; }
@media (max-width: 768px) { .onley-lms-bonus-icon, .onley-lms-custom-icon { display: none; } .onley-lms-brand .onley-app-name { display: none; } }
@media (min-width: 769px) { .onley-lms-inline-search { display: block; } #lms-search-btn { display: none; } }
`;
css.sidebar = config.sidebar.enabled ? `
.onley-lms-sidebar {
position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width);
background-color: #fff; z-index: 2000; display: flex; flex-direction: column;
border-right: 1px solid #e5e7eb;
transform: translateX(-100%);
transition: transform 0.3s ease-in-out, background-color 0.3s;
}
body.onley-sidebar-open .onley-lms-sidebar {
transform: translateX(0);
}
.onley-lms-sidebar-overlay {
position: fixed; inset: 0; background-color: rgba(0,0,0,0.5); z-index: 1999;
opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
body.onley-sidebar-open .onley-lms-sidebar-overlay {
opacity: 1; visibility: visible;
}
.onley-lms-sidebar-brand { display: flex; align-items: center; padding: 1rem; height: 60px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
.onley-lms-sidebar-logo { height: 40px; object-fit: contain; }
.onley-lms-sidebar-sitename { margin-left: 0.75rem; line-height: 1.2; } .onley-lms-sidebar-sitename strong { font-weight: 600; } .onley-lms-sidebar-sitename small { font-size: 0.8rem; color: #6b7280; }
.onley-lms-sidebar-content { flex-grow: 1; overflow-y: auto; padding: 0.5rem; }
.onley-lms-sidebar-nav, .onley-lms-sidebar-nav-accordion { border-bottom: 1px solid #e5e7eb; padding: 0.5rem 0; margin-bottom: 0.5rem; }
.onley-lms-sidebar-nav:last-child, .onley-lms-sidebar-nav-accordion:last-child { border: none; }
.onley-lms-sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.onley-lms-sidebar-nav ul li a { display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem; border-radius: 6px; font-weight: 500; color: #374151; overflow: hidden; white-space: nowrap; }
.onley-lms-sidebar-nav ul li a:hover { background-color: #f3f4f6; }
.onley-lms-sidebar-nav ul li a i { width: 20px; text-align: center; color: #9ca3af; flex-shrink: 0; }
.onley-lms-sidebar-nav ul li a span, .onley-accordion-trigger div span { transition: opacity 0.2s; }
.onley-sidebar-badge { margin-left: auto; background-color: var(--primary-color); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; }
.onley-accordion-trigger { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: none; cursor: pointer; padding: 0.65rem; font-weight: 500; color: #374151; }
.onley-accordion-trigger div { display: flex; align-items: center; gap: 0.85rem; overflow: hidden; }
.onley-accordion-trigger i { width: 20px; text-align: center; color: #9ca3af; } .onley-accordion-trigger .onley-arrow { transition: transform 0.3s ease; }
.onley-accordion-trigger.onley-active .onley-arrow { transform: rotate(180deg); }
.onley-accordion-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.onley-accordion-panel .onley-lms-sidebar-nav { border: none; padding: 0; margin: 0; }
.onley-accordion-panel .onley-lms-sidebar-nav ul { padding-left: 1.5rem; }
.onley-lms-sidebar-footer { padding: 0.5rem; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
` : '';
if (targetKey) { return { global: css.global, component: css[targetKey] || '', js: '' }; }
return css;
}
function getFullCSS() {
const cssObject = generateComponentCSS();
return [cssObject.global, cssObject.sidebar, cssObject.topBar, cssObject.lmsHeader, cssObject.customHtml].filter(Boolean).join('\n\n');
}
function generateComponentJavaScript(targetKey = null) {
const js = {};
const fullInteractiveScript = `
const body = document.body;
// Theme Toggling
const toggleTheme = () => {
body.classList.toggle('onley-dark-mode');
const icon = document.querySelector('#sidebar-theme-toggle i') || document.querySelector('#header-theme-toggle i');
if (icon) {
icon.classList.toggle('fa-moon');
icon.classList.toggle('fa-sun');
}
};
document.getElementById('header-theme-toggle')?.addEventListener('click', toggleTheme);
document.getElementById('sidebar-theme-toggle')?.addEventListener('click', (e) => {
e.preventDefault();
toggleTheme();
});
// Sidebar Toggling Logic
const lmsSidebarToggle = document.getElementById('lms-sidebar-toggle');
const lmsSidebarOverlay = document.querySelector('.onley-lms-sidebar-overlay');
if (lmsSidebarToggle && lmsSidebarOverlay) {
const handleSidebarToggle = () => body.classList.toggle('onley-sidebar-open');
const closeSidebar = () => body.classList.remove('onley-sidebar-open');
lmsSidebarToggle.addEventListener('click', handleSidebarToggle);
lmsSidebarOverlay.addEventListener('click', closeSidebar);
}
// Notification Sidebar Logic
const notificationBtn = document.getElementById('lms-notification-btn');
const notificationOverlay = document.querySelector('.onley-notification-sidebar-overlay');
const closeNotificationBtn = document.getElementById('close-notification-sidebar-btn');
if (notificationBtn && notificationOverlay && closeNotificationBtn) {
const openNotificationSidebar = (e) => {
e.preventDefault();
body.classList.add('onley-notification-sidebar-open');
};
const closeNotificationSidebar = () => {
body.classList.remove('onley-notification-sidebar-open');
};
notificationBtn.addEventListener('click', openNotificationSidebar);
closeNotificationBtn.addEventListener('click', closeNotificationSidebar);
notificationOverlay.addEventListener('click', closeNotificationSidebar);
}
// Accordion Logic
document.querySelectorAll('.onley-lms-sidebar-nav-accordion .onley-accordion-trigger').forEach(trigger => {
trigger.addEventListener('click', (e) => {
e.preventDefault();
const panel = trigger.nextElementSibling;
trigger.classList.toggle('onley-active');
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + 'px';
}
});
});
// Search Overlay Logic
const searchBtn = document.getElementById('lms-search-btn');
const searchOverlay = document.getElementById('lms-search-overlay');
const searchCloseBtn = document.getElementById('lms-search-close-btn');
const searchInput = document.getElementById('lms-search-input');
if (searchBtn && searchOverlay && searchCloseBtn) {
const openSearch = (e) => {
e.preventDefault();
body.classList.add('onley-search-active');
setTimeout(() => searchInput.focus(), 50);
};
const closeSearch = () => body.classList.remove('onley-search-active');
searchBtn.addEventListener('click', openSearch);
searchCloseBtn.addEventListener('click', closeSearch);
searchOverlay.addEventListener('click', (e) => {
if (e.target === searchOverlay) closeSearch();
});
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && body.classList.contains('onley-search-active')) {
closeSearch();
}
});
}
`;
// Bundle all interactive JS under one key since they are interdependent.
js.interactive = fullInteractiveScript;
if (targetKey) { return js[targetKey] || ''; }
return js;
}
function getFullJS() {
return generateComponentJavaScript().interactive || '';
}
function getCombinedCode() {
const css = getFullCSS();
let js = getFullJS();
if (js.trim()) js = `document.addEventListener('DOMContentLoaded', () => { \n${js.trim()} \n});`;
const configScript = `<script id="app-config" type="application/json">${JSON.stringify(config, null, 2)}<\/script>`;
const embeddableHtml = getEmbeddableHtml();
return `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Exported Page</title><script src="https://cdn.tailwindcss.com"><\/script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet"><style>${css}</style></head><body class="bg-gray-100">${embeddableHtml}${configScript}${js ? `<script>${js}<\/script>` : ''}</body></html>`;
}
// --- Rendering ---
function renderAll() {
const fullJs = getFullJS();
const embeddableHtml = getEmbeddableHtml();
const previewContent = `<!DOCTYPE html><html><head><title>Preview</title>
<script src="https://cdn.tailwindcss.com"><\/script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>${getFullCSS()}</style></head><body>
${embeddableHtml}
<div style="min-height: 400px; padding: 40px; text-align: center; color: #6b7280; font-family: 'Inter', sans-serif;">Main Content Area</div>
<script> ${fullJs ? `document.addEventListener('DOMContentLoaded', () => { \n${fullJs} \n});` : ''} <\/script></body></html>`;
ui.previewIframe.srcdoc = previewContent;
}
// --- Utility Functions ---
function setPreviewMode(mode) {
ui.previewContainer.classList.remove('bg-white', 'shadow-lg', 'rounded-lg', 'w-full', 'h-full', 'overflow-hidden', 'transition-all', 'duration-300', 'onley-preview-desktop', 'onley-preview-tablet', 'onley-preview-mobile');
ui.previewContainer.className = `bg-white shadow-lg rounded-lg w-full h-full overflow-hidden transition-all duration-300 onley-preview-${mode}`;
['desktop', 'tablet', 'mobile'].forEach(m => {
const btn = ui.buttons[m];
btn.classList.toggle('bg-blue-500', m === mode); btn.classList.toggle('text-white', m === mode);
btn.classList.toggle('bg-gray-200', m !== mode); btn.classList.toggle('text-gray-700', m !== mode);
});
}
function showToast(message) {
const toast = document.getElementById('toast-notification');
toast.textContent = message;
toast.classList.add('onley-show');
setTimeout(() => { toast.classList.remove('onley-show'); }, 3000);
}
function generatePageZip() {
const zip = new JSZip();
const embeddableHtml = getEmbeddableHtml();
const css = getFullCSS();
const js = getFullJS();
const configScript = `<script id="app-config" type="application/json">${JSON.stringify(config, null, 2)}<\/script>`;
const html = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Exported Page</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"><link rel="stylesheet" href="style.css"></head><body>${embeddableHtml}${configScript}<script src="script.js"><\/script></body></html>`;
zip.file("index.html", html);
zip.file("style.css", css);
if (js.trim()) zip.file("script.js", `document.addEventListener('DOMContentLoaded', () => { \n${js} \n});`);
zip.generateAsync({type:"blob"}).then(content => { saveAs(content, "exported-page.zip"); showToast("ZIP file generated!"); });
}
function handleFileImport(event) {
const file = event.target.files[0];
if (!file) {
return;
}
const reader = new FileReader();
reader.onload = function(e) {
const fileContent = e.target.result;
try {
const parser = new DOMParser();
const doc = parser.parseFromString(fileContent, 'text/html');
const configScript = doc.getElementById('app-config');
if (!configScript) {
showToast('Error: No configuration data found in this file.');
return;
}
const importedConfig = JSON.parse(configScript.textContent);
if (!importedConfig || typeof importedConfig !== 'object' || !importedConfig.componentOrder || !importedConfig.globalSettings) {
showToast('Error: Invalid or corrupted configuration file.');
return;
}
Object.keys(config).forEach(key => delete config[key]);
Object.assign(config, importedConfig);
showToast('Configuration imported successfully!');
init();
} catch (error) {
console.error("Import failed:", error);
showToast(`Import failed: ${error.message}`);
} finally {
event.target.value = null;
}
};
reader.readAsText(file);
}
function handleGetCodeClick(e) {
const button = e.target.closest('.get-component-code-btn');
if (!button) return;
const key = button.dataset.componentKey; if (!key) return;
const html = componentGenerators[key] ? componentGenerators[key]() : 'N/A';
const { global, component: css } = generateComponentCSS(key);
const js = getFullJS();
ui.codeModal.title.textContent = `${componentNames[key]} Component Code`;
ui.codeModal.htmlCode.textContent = html;
ui.codeModal.cssCode.textContent = (global + '\n\n' + css).trim();
ui.codeModal.jsCode.textContent = js.trim() ? `document.addEventListener('DOMContentLoaded', () => { \n${js}\n });` : '// No JS for this component';
[ui.codeModal.htmlContainer, ui.codeModal.cssContainer, ui.codeModal.jsContainer].forEach(el => {
const codeContent = el.querySelector('code').textContent;
el.style.display = (codeContent && !codeContent.startsWith('//') && codeContent !== 'N/A') ? 'block' : 'none';
});
ui.codeModal.downloadBtn.onclick = () => generateComponentZip(key);
ui.codeModal.modal.classList.remove('hidden');
}
function generateComponentZip(key) {
const zip = new JSZip();
const { global, component: css } = generateComponentCSS(key);
const js = getFullJS();
const htmlBody = componentGenerators[key] ? componentGenerators[key]() : '';
const html = `<!DOCTYPE html><html><head><title>${componentNames[key]}</title><link rel="stylesheet" href="style.css"></head><body>${htmlBody}${js.trim() ? '<script src="script.js"><\/script>' : ''}</body></html>`;
zip.file("index.html", html);
zip.file("style.css", (global + '\n\n' + css).trim());
if (js.trim()) zip.file("script.js", `document.addEventListener('DOMContentLoaded', () => { \n${js} \n});`);
zip.generateAsync({type:"blob"}).then(content => { saveAs(content, `${key}-component.zip`); showToast("Component ZIP generated!"); });
}
// Initial Load
function init() {
// Init Global Settings
ui.globalSettings.primaryColor.value = config.globalSettings.colors.primary;
ui.globalSettings.secondaryColor.value = config.globalSettings.colors.secondary;
ui.globalSettings.textColor.value = config.globalSettings.colors.text;
ui.globalSettings.headingColor.value = config.globalSettings.colors.heading;
ui.globalSettings.fontFamily.value = config.globalSettings.typography.fontFamily;
ui.customHtml.toggle.checked = config.customHtml.enabled;
ui.customHtml.content.value = config.customHtml.content;
const lmsUI = ui.learningAppHeader; const lmsConfig = config.learningAppHeader;
lmsUI.stickyToggle.checked = lmsConfig.sticky;
lmsUI.primaryBarToggle.checked = lmsConfig.primaryBar.enabled;
lmsUI.brand.type.value = lmsConfig.primaryBar.brand.type;
lmsUI.brand.text.value = lmsConfig.primaryBar.brand.text;
lmsUI.brand.imageUrl.value = lmsConfig.primaryBar.brand.imageUrl;
lmsUI.brand.imageHeight.value = lmsConfig.primaryBar.brand.height;
lmsUI.notificationCount.value = lmsConfig.primaryBar.notificationCount;
lmsUI.pageTitleToggle.checked = lmsConfig.pageTitle.enabled;
lmsUI.pageTitleText.value = lmsConfig.pageTitle.text;
lmsUI.tabs.toggle.checked = lmsConfig.tabs.enabled;
ui.sidebar.enableToggle.checked = config.sidebar.enabled;
ui.sidebar.brand.sitename.value = config.sidebar.branding.sitename;
ui.sidebar.brand.tagline.value = config.sidebar.branding.tagline;
const topBarUI = ui.topBar;
topBarUI.toggle.checked = config.topBar.enabled;
topBarUI.text.value = config.topBar.text;
topBarUI.url.value = config.topBar.url;
topBarUI.bgColorStart.value = config.topBar.styles.bgColorStart;
topBarUI.bgColorEnd.value = config.topBar.styles.bgColorEnd;
topBarUI.textColor.value = config.topBar.styles.textColor;
topBarUI.fontSize.value = config.topBar.styles.fontSize;
topBarUI.padding.value = config.topBar.styles.padding;
topBarUI.fontSizeVal.textContent = config.topBar.styles.fontSize;
topBarUI.paddingVal.textContent = config.topBar.styles.padding;
topBarUI.mainControls.style.display = config.topBar.enabled ? 'block' : 'none';
if (!document.body.classList.contains('initialized')) {
setupEventListeners();
document.body.classList.add('initialized');
}
const hasThemeToggle = config.sidebar.shortcuts.links.some(link => link.isThemeToggle);
ui.sidebar.themeToggleCheckbox.checked = hasThemeToggle;
toggleLmsBrandControls();
createSidebarLinkBuilder('primary-nav', 'Primary Navigation', ui.sidebar.primaryNavBuilder, config.sidebar.primaryNav);
createSidebarLinkBuilder('categories', 'Course Categories', ui.sidebar.categoriesBuilder, config.sidebar.categories);
createSidebarLinkBuilder('user-section', 'User Section', ui.sidebar.userSectionBuilder, config.sidebar.userSection);
createSidebarLinkBuilder('shortcuts', 'Shortcuts & CTA', ui.sidebar.shortcutsBuilder, config.sidebar.shortcuts);
createSidebarLinkBuilder('footer', 'Sidebar Footer', ui.sidebar.footerBuilder, config.sidebar.footer);
renderLmsTabsControls();
renderLmsCustomIconsControls();
renderLayoutControls();
setPreviewMode('desktop');
renderAll();
if(!document.querySelector('.onley-control-nav-button.onley-active')){
ui.controls.nav.querySelector('.onley-control-nav-button').click();
}
}
init();
});
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Component Builder (WordPress Safe)</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script>
<style>
:root {
--primary-color: #3b82f6;
--primary-hover-color: #2563eb;
--secondary-color: #10b981;
--secondary-hover-color: #059669;
--text-color: #374151;
--heading-color: #111827;
--font-family: 'Inter', sans-serif;
}
body {
font-family: var(--font-family);
color: var(--text-color);
background-color: var(--background-color);
}
h1, h2, h3, h4, h5, h6 {
color: var(--heading-color);
}
/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
.onley-preview-iframe {
width: 100%;
height: 100%;
border: 0;
transition: all 0.3s ease-in-out;
}
#preview-container.onley-preview-desktop .onley-preview-iframe { width: 100%; }
#preview-container.onley-preview-tablet .onley-preview-iframe { width: 768px; margin: 0 auto; }
#preview-container.onley-preview-mobile .onley-preview-iframe { width: 375px; margin: 0 auto; }
.onley-toast {
visibility: hidden;
min-width: 250px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 8px;
padding: 16px;
position: fixed;
z-index: 100;
left: 50%;
bottom: 30px;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.3s, visibility 0.3s;
}
.onley-toast.onley-show {
visibility: visible;
opacity: 1;
}
/* New Professional Controls UI Styles */
#onley-controls-layout {
display: flex;
height: 100%;
}
#onley-controls-nav {
width: 180px;
flex-shrink: 0;
background-color: #f8fafc;
border-right: 1px solid #e5e7eb;
padding: 0.5rem;
overflow-y: auto;
}
.onley-control-nav-button {
display: flex;
align-items: center;
width: 100%;
padding: 0.75rem;
border-radius: 0.375rem;
font-weight: 500;
color: var(--text-color);
transition: background-color 0.2s, color 0.2s;
text-align: left;