Spaces:
Paused
Paused
Commit ·
c7a137e
1
Parent(s): 2a4771c
Update static/index.html
Browse files- static/index.html +42 -2
static/index.html
CHANGED
|
@@ -168,6 +168,7 @@ textarea.code{direction:ltr;font-family:monospace;font-size:.72rem;height:120px;
|
|
| 168 |
<option value="gallery">🖼️ معرض/دليل</option>
|
| 169 |
<option value="dashboard">📊 لوحة تحكم</option>
|
| 170 |
<option value="landing">🎯 صفحة هبوط</option>
|
|
|
|
| 171 |
</select>
|
| 172 |
</div>
|
| 173 |
<div class="field"><label>رقم الإصدار</label>
|
|
@@ -175,6 +176,11 @@ textarea.code{direction:ltr;font-family:monospace;font-size:.72rem;height:120px;
|
|
| 175 |
<div class="hint">صيغة SemVer مثل 1.0.0</div>
|
| 176 |
</div>
|
| 177 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
<div class="field"><label>شعار التطبيق</label>
|
| 179 |
<input type="file" id="f_logo" accept="image/*" class="hiddenfile">
|
| 180 |
<div style="display:flex;gap:10px;align-items:center">
|
|
@@ -556,7 +562,12 @@ function restoreForm(){
|
|
| 556 |
return true;
|
| 557 |
}
|
| 558 |
document.addEventListener('input', e=>{ if(e.target.id) saveForm(); });
|
| 559 |
-
document.addEventListener('change', e=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
|
| 561 |
/* ---------- 2) التحقق اللحظي ---------- */
|
| 562 |
const VALIDATORS = {
|
|
@@ -827,6 +838,15 @@ function appBody(){
|
|
| 827 |
<div class="wrap"><h2>📊 ${name}</h2>
|
| 828 |
<div class="cards"><div class="kpi">الزيارات<b id="k1">0</b></div><div class="kpi">المستخدمون<b id="k2">0</b></div><div class="kpi">الطلبات<b id="k3">0</b></div></div>
|
| 829 |
<canvas id="ch" height="180"></canvas></div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 830 |
return `
|
| 831 |
<div class="wrap center"><img class="hero" id="heroLogo" alt="logo">
|
| 832 |
<h1>${name}</h1><p id="tagline"></p>
|
|
@@ -946,6 +966,18 @@ const ctx=document.getElementById('ch');if(window.Chart&&ctx)new Chart(ctx,{type
|
|
| 946 |
}
|
| 947 |
if(t==='landing'){ s += `
|
| 948 |
document.getElementById('tagline').textContent='مدعوم بـ SkyApp Builder';track('landing_view');`; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 949 |
|
| 950 |
/* Backup/Restore */
|
| 951 |
if(useBackup){
|
|
@@ -1007,7 +1039,14 @@ body{font-family:'${$('f_font').value}',sans-serif;background:var(--bg);color:va
|
|
| 1007 |
.splash{position:fixed;inset:0;background:var(--c);display:flex;align-items:center;justify-content:center;color:#fff;font-size:1.4rem;font-weight:700;z-index:300;transition:opacity .4s}
|
| 1008 |
.lockscr{position:fixed;inset:0;background:var(--bg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;z-index:400}
|
| 1009 |
.lockscr input{background:var(--pan);border:1px solid var(--bd);color:var(--tx);padding:12px;border-radius:10px;text-align:center;font-size:1rem}
|
| 1010 |
-
.lockscr button{background:var(--c);color:#fff;border:none;padding:11px 28px;border-radius:10px;cursor:pointer}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1011 |
}
|
| 1012 |
|
| 1013 |
/* ---------- شاشات القفل ---------- */
|
|
@@ -1235,6 +1274,7 @@ $('btnGenLogo').onclick = async ()=>{
|
|
| 1235 |
const restored = restoreForm();
|
| 1236 |
saveForm();
|
| 1237 |
if(restored) toast('♻️ تم استرجاع جلستك السابقة');
|
|
|
|
| 1238 |
$('f_app_id').value = $('f_app_id').value && FORM.f_app_id ? FORM.f_app_id : $('f_app_id').value;
|
| 1239 |
})();
|
| 1240 |
</script>
|
|
|
|
| 168 |
<option value="gallery">🖼️ معرض/دليل</option>
|
| 169 |
<option value="dashboard">📊 لوحة تحكم</option>
|
| 170 |
<option value="landing">🎯 صفحة هبوط</option>
|
| 171 |
+
<option value="webview">🌐 موقعي داخل التطبيق (WebView)</option>
|
| 172 |
</select>
|
| 173 |
</div>
|
| 174 |
<div class="field"><label>رقم الإصدار</label>
|
|
|
|
| 176 |
<div class="hint">صيغة SemVer مثل 1.0.0</div>
|
| 177 |
</div>
|
| 178 |
</div>
|
| 179 |
+
<div class="field" id="wrap_site_url" style="display:none"><label>🔗 رابط موقعك (يُعرض داخل التطبيق بملء الشاشة)</label>
|
| 180 |
+
<input type="url" id="f_site_url" placeholder="https://mysite.com">
|
| 181 |
+
<div class="hint">⚠️ يجب أن يسمح موقعك بالتضمين: أزل X-Frame-Options أو اجعله يسمح بالنطاقات</div>
|
| 182 |
+
<div class="err">أدخل URL صحيح يبدأ بـ http(s)://</div>
|
| 183 |
+
</div>
|
| 184 |
<div class="field"><label>شعار التطبيق</label>
|
| 185 |
<input type="file" id="f_logo" accept="image/*" class="hiddenfile">
|
| 186 |
<div style="display:flex;gap:10px;align-items:center">
|
|
|
|
| 562 |
return true;
|
| 563 |
}
|
| 564 |
document.addEventListener('input', e=>{ if(e.target.id) saveForm(); });
|
| 565 |
+
document.addEventListener('change', e=>{
|
| 566 |
+
if(e.target.id === 'f_app_type'){
|
| 567 |
+
$('wrap_site_url').style.display = e.target.value === 'webview' ? 'block' : 'none';
|
| 568 |
+
}
|
| 569 |
+
if(e.target.id) saveForm();
|
| 570 |
+
});
|
| 571 |
|
| 572 |
/* ---------- 2) التحقق اللحظي ---------- */
|
| 573 |
const VALIDATORS = {
|
|
|
|
| 838 |
<div class="wrap"><h2>📊 ${name}</h2>
|
| 839 |
<div class="cards"><div class="kpi">الزيارات<b id="k1">0</b></div><div class="kpi">المستخدمون<b id="k2">0</b></div><div class="kpi">الطلبات<b id="k3">0</b></div></div>
|
| 840 |
<canvas id="ch" height="180"></canvas></div>`;
|
| 841 |
+
if(t==='webview') return `
|
| 842 |
+
<div class="wvbar" id="wvbar"><span id="wvtitle">${name}</span><button onclick="wvReload()">🔄</button><button onclick="wvExternal()">↗️</button></div>
|
| 843 |
+
<div class="wvload" id="wvload"><div class="spinner"></div><div>جارٍ تحميل الموقع...</div></div>
|
| 844 |
+
<iframe id="wv" class="wvframe" src="${esc($('f_site_url').value||'about:blank')}" allow="camera;microphone;geolocation;payment" sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals"></iframe>
|
| 845 |
+
<div class="wvblock" id="wvblock" style="display:none">
|
| 846 |
+
<div style="font-size:3rem">🚧</div><h3>الموقع منع التضمين</h3>
|
| 847 |
+
<p style="opacity:.7;font-size:.85rem">موقعك يرسل X-Frame-Options. اسمح بالتضمين من إعدادات خادمك أو افتح الموقع خارجيًا:</p>
|
| 848 |
+
<button class="cta" onclick="wvExternal()">↗️ فتح الموقع في المتصفح</button>
|
| 849 |
+
</div>`;
|
| 850 |
return `
|
| 851 |
<div class="wrap center"><img class="hero" id="heroLogo" alt="logo">
|
| 852 |
<h1>${name}</h1><p id="tagline"></p>
|
|
|
|
| 966 |
}
|
| 967 |
if(t==='landing'){ s += `
|
| 968 |
document.getElementById('tagline').textContent='مدعوم بـ SkyApp Builder';track('landing_view');`; }
|
| 969 |
+
if(t==='webview'){ s += `
|
| 970 |
+
const SITE="${($('f_site_url').value||'').replace(/"/g,'')}";
|
| 971 |
+
const wv=document.getElementById('wv');
|
| 972 |
+
let loadTimer=setTimeout(wvBlocked,12000); // إن لم يحمّل خلال 12 ثانية افترض الحجب
|
| 973 |
+
wv.addEventListener('load',()=>{clearTimeout(loadTimer);document.getElementById('wvload').style.display='none';track('wv_loaded');});
|
| 974 |
+
function wvReload(){const b=document.getElementById('wvblock');b.style.display='none';document.getElementById('wvload').style.display='flex';wv.src=SITE+'?t='+Date.now();loadTimer=setTimeout(wvBlocked,12000);}
|
| 975 |
+
function wvExternal(){window.open(SITE,'_blank');}
|
| 976 |
+
function wvBlocked(){if(document.getElementById('wvload').style.display!=='none'){document.getElementById('wvload').style.display='none';document.getElementById('wvblock').style.display='flex';track('wv_blocked');}}
|
| 977 |
+
// حقن Offline: عند فقدان النت أوقف المحاولة واعرض صفحتنا المخصصة
|
| 978 |
+
window.addEventListener('offline',()=>{clearTimeout(loadTimer);});
|
| 979 |
+
// حقن رسالة من الموقع المضمّن (لو استخدم postMessage)
|
| 980 |
+
window.addEventListener('message',e=>{if(e.origin!==new URL(SITE).origin)return;try{const m=JSON.parse(e.data);if(m&&m.title)document.getElementById('wvtitle').textContent=m.title;}catch(x){}});`; }
|
| 981 |
|
| 982 |
/* Backup/Restore */
|
| 983 |
if(useBackup){
|
|
|
|
| 1039 |
.splash{position:fixed;inset:0;background:var(--c);display:flex;align-items:center;justify-content:center;color:#fff;font-size:1.4rem;font-weight:700;z-index:300;transition:opacity .4s}
|
| 1040 |
.lockscr{position:fixed;inset:0;background:var(--bg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;z-index:400}
|
| 1041 |
.lockscr input{background:var(--pan);border:1px solid var(--bd);color:var(--tx);padding:12px;border-radius:10px;text-align:center;font-size:1rem}
|
| 1042 |
+
.lockscr button{background:var(--c);color:#fff;border:none;padding:11px 28px;border-radius:10px;cursor:pointer}
|
| 1043 |
+
.wvframe{position:fixed;inset:0;width:100%;height:100%;border:none;background:#fff}
|
| 1044 |
+
.wvbar{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;background:var(--c);color:#fff;padding:8px 14px;z-index:20;font-weight:700;font-size:.85rem}
|
| 1045 |
+
.wvbar button{background:rgba(255,255,255,.2);border:none;color:#fff;border-radius:8px;padding:4px 12px;cursor:pointer;margin-right:6px}
|
| 1046 |
+
.wvload{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;background:var(--bg);z-index:15}
|
| 1047 |
+
.spinner{width:44px;height:44px;border:4px solid var(--bd);border-top-color:var(--c);border-radius:50%;animation:sp 1s linear infinite}
|
| 1048 |
+
@keyframes sp{to{transform:rotate(360deg)}}
|
| 1049 |
+
.wvblock{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:var(--bg);z-index:18;text-align:center;padding:24px}`;
|
| 1050 |
}
|
| 1051 |
|
| 1052 |
/* ---------- شاشات القفل ---------- */
|
|
|
|
| 1274 |
const restored = restoreForm();
|
| 1275 |
saveForm();
|
| 1276 |
if(restored) toast('♻️ تم استرجاع جلستك السابقة');
|
| 1277 |
+
$('wrap_site_url').style.display = $('f_app_type').value === 'webview' ? 'block' : 'none';
|
| 1278 |
$('f_app_id').value = $('f_app_id').value && FORM.f_app_id ? FORM.f_app_id : $('f_app_id').value;
|
| 1279 |
})();
|
| 1280 |
</script>
|