Buckets:
| <html lang="ar" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Pro Semantic SEO Tool | Client-Side Edition</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"> | |
| <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;900&display=swap" rel="stylesheet"> | |
| <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> | |
| <script src="https://cdn.sheetjs.com/xlsx-0.20.0/package/dist/xlsx.full.min.js"></script> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| fontFamily: { janna: ['Janna LT', 'Cairo', 'sans-serif'] }, | |
| colors: { | |
| main: '#0000FF', darkBlue: '#0101B1', | |
| lightBlue: '#D5E4FF', lightestBlue: '#DBEAFE', dark: '#0F172A' | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| body { font-family: 'Janna LT', 'Cairo', sans-serif; background-color: #D5E4FF; } | |
| .custom-scrollbar::-webkit-scrollbar { height: 6px; width: 6px; } | |
| .custom-scrollbar::-webkit-scrollbar-thumb { background-color: #0000FF; border-radius: 10px; } | |
| .markdown-content h2 { font-size: 1.5rem; font-weight: bold; color: #0101B1; margin-top: 1.5rem; margin-bottom: 0.5rem; } | |
| .markdown-content h3 { font-size: 1.25rem; font-weight: bold; color: #0000FF; margin-top: 1rem; margin-bottom: 0.5rem; } | |
| .markdown-content ul { list-style-type: disc; margin-right: 1.5rem; margin-bottom: 1rem; } | |
| .markdown-content li { margin-bottom: 0.25rem; } | |
| .progress-bar-fill { transition: width 0.6s ease; } | |
| </style> | |
| </head> | |
| <body class="min-h-screen text-dark font-janna"> | |
| <section class="bg-gradient-to-b from-[#0101B1] to-[#0000FF] text-white p-10 md:p-16 rounded-b-[40px] md:rounded-b-[100px] shadow-2xl relative overflow-hidden"> | |
| <div class="relative z-10 max-w-6xl mx-auto flex flex-col items-center text-center gap-4"> | |
| <h1 class="text-4xl md:text-5xl font-bold leading-tight">Semantic SEO Tool ⚡</h1> | |
| <p class="text-lg text-blue-100 max-w-3xl">نسخة المتصفح السريعة (بدون خوادم) - استخراج الكيانات وتوليد خطط المحتوى مباشرة.</p> | |
| <div class="mt-6 w-full max-w-md bg-white/10 p-4 rounded-2xl backdrop-blur-md border border-white/20"> | |
| <label class="block text-sm font-bold mb-2 text-right">مفتاح Gemini API الخاص بك:</label> | |
| <div class="flex gap-2"> | |
| <input type="password" id="apiKey" placeholder="AIzaSy..." class="w-full px-4 py-2 rounded-lg text-dark focus:outline-none" /> | |
| <button onclick="saveApiKey()" class="bg-emerald-500 hover:bg-emerald-600 px-4 py-2 rounded-lg font-bold transition-colors">حفظ</button> | |
| </div> | |
| <p class="text-xs text-blue-200 mt-2 text-right"><i class="fa-solid fa-lock text-emerald-300"></i> يتم حفظ المفتاح في متصفحك فقط للحماية.</p> | |
| </div> | |
| </div> | |
| </section> | |
| <div class="max-w-7xl mx-auto -mt-6 relative z-20 px-4 pb-24"> | |
| <div class="bg-white rounded-[40px] shadow-xl border border-gray-100 overflow-hidden p-6 md:p-10"> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-10"> | |
| <div class="border-2 border-dashed border-main rounded-[30px] p-6 bg-lightestBlue text-center group cursor-pointer relative transition-all hover:bg-lightBlue"> | |
| <input type="file" id="myArticle" accept=".txt,.csv,.xlsx,.xls" class="absolute inset-0 w-full h-full opacity-0 cursor-pointer z-10"/> | |
| <div id="myArticleIcon" class="w-14 h-14 bg-white text-main rounded-full flex items-center justify-center mx-auto mb-3 shadow-md"> | |
| <i class="fa-solid fa-file-alt text-2xl"></i> | |
| </div> | |
| <label class="block text-lg font-bold text-dark mb-1">مقالك / زحف موقعي</label> | |
| <p id="myArticleLabel" class="text-xs text-main font-bold bg-white/50 py-1 px-3 rounded-full inline-block">اختر ملف .txt أو .csv أو .xlsx</p> | |
| </div> | |
| <div class="border-2 border-dashed border-rose-300 rounded-[30px] p-6 bg-rose-50 text-center group cursor-pointer relative transition-all hover:bg-rose-100"> | |
| <input type="file" id="competitors" accept=".txt,.csv,.xlsx,.xls" multiple class="absolute inset-0 w-full h-full opacity-0 cursor-pointer z-10"/> | |
| <div id="compIcon" class="w-14 h-14 bg-white text-rose-500 rounded-full flex items-center justify-center mx-auto mb-3 shadow-md"> | |
| <i class="fa-solid fa-users text-2xl"></i> | |
| </div> | |
| <label class="block text-lg font-bold text-dark mb-1">المنافسين</label> | |
| <p id="compLabel" class="text-xs text-rose-600 font-bold bg-white/50 py-1 px-3 rounded-full inline-block">يمكنك تحديد أكثر من ملف</p> | |
| </div> | |
| </div> | |
| <div class="flex justify-center"> | |
| <button onclick="analyzeSEO()" id="analyzeBtn" class="group transition-all flex items-center justify-center gap-3 px-10 py-4 rounded-full bg-main shadow-lg text-white font-bold border-2 border-main hover:bg-darkBlue w-full md:w-auto text-xl"> | |
| <span>بدء التحليل واستخراج الكيانات</span> | |
| <i class="fa-solid fa-bolt text-yellow-300"></i> | |
| </button> | |
| </div> | |
| <div id="loading" class="hidden py-10 text-center"> | |
| <i class="fa-solid fa-circle-notch fa-spin text-5xl text-main mb-4"></i> | |
| <h3 id="progressTitle" class="text-2xl font-bold text-dark mb-2">جاري المعالجة...</h3> | |
| <div class="max-w-2xl mx-auto mt-4"> | |
| <div class="w-full bg-gray-200 rounded-full h-4 overflow-hidden shadow-inner"> | |
| <div id="progressBar" class="progress-bar-fill bg-gradient-to-r from-main to-darkBlue h-4 rounded-full flex items-center justify-center text-white text-xs font-bold" style="width: 0%">0%</div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="resultsArea" class="hidden mt-12 pt-10 border-t border-gray-100"> | |
| <div class="flex justify-between items-center mb-8"> | |
| <h2 class="text-2xl font-bold text-dark"><i class="fa-solid fa-chart-pie text-main"></i> لوحة بيانات السيو الدلالي</h2> | |
| <button onclick="downloadExcel()" class="bg-emerald-500 hover:bg-emerald-600 text-white font-bold py-2 px-6 rounded-full shadow-md flex items-center gap-2"> | |
| <span>تصدير Excel</span> <i class="fa-solid fa-file-excel"></i> | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8"> | |
| <div id="gapsSection" class="bg-white rounded-2xl shadow-sm border border-rose-200 overflow-hidden hidden"> | |
| <div class="bg-rose-50 px-4 py-3 border-b border-rose-100"> | |
| <h3 class="font-bold text-rose-700"><i class="fa-solid fa-triangle-exclamation"></i> الفجوات الدلالية</h3> | |
| </div> | |
| <div class="overflow-y-auto custom-scrollbar h-[350px] p-2"> | |
| <table class="min-w-full text-right text-sm"> | |
| <thead class="bg-white sticky top-0 shadow-sm border-b"> | |
| <tr><th class="px-3 py-2 text-slate-700 w-2/5">الكيان</th><th class="px-2 py-2 text-slate-700">النوع</th><th class="px-3 py-2 text-slate-700 text-center">تكرار المنافسين</th></tr> | |
| </thead> | |
| <tbody id="gapsTable" class="divide-y divide-gray-100"></tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <div id="masterSection" class="bg-white rounded-2xl shadow-sm border border-blue-200 overflow-hidden lg:col-span-2"> | |
| <div class="bg-lightestBlue px-4 py-3 border-b border-blue-100"> | |
| <h3 class="font-bold text-main"><i class="fa-solid fa-scale-balanced"></i> الكيانات المستخرجة الشاملة</h3> | |
| </div> | |
| <div class="overflow-y-auto custom-scrollbar h-[350px] p-2"> | |
| <table class="min-w-full text-right text-sm"> | |
| <thead class="bg-white sticky top-0 shadow-sm border-b"> | |
| <tr> | |
| <th class="px-3 py-2 text-slate-700 w-2/5">الكيان</th><th class="px-2 py-2 text-slate-700">النوع</th> | |
| <th id="thMySite" class="px-3 py-2 text-slate-700 text-center">موقعي</th><th id="thCompetitors" class="px-3 py-2 text-slate-700 text-center">المنافسين</th> | |
| </tr> | |
| </thead> | |
| <tbody id="masterTable" class="divide-y divide-gray-100"></tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="briefSection" class="hidden bg-white rounded-2xl shadow-sm border border-emerald-200 overflow-hidden"> | |
| <div class="bg-emerald-50 px-4 py-3 border-b border-emerald-100 flex justify-between items-center"> | |
| <h3 class="font-bold text-emerald-800"><i class="fa-solid fa-pen-to-square"></i> خطة المحتوى (Content Brief)</h3> | |
| <button onclick="copyBrief()" class="text-sm bg-white text-emerald-700 px-3 py-1 rounded-full shadow-sm hover:bg-emerald-100"><i class="fa-regular fa-copy"></i> نسخ</button> | |
| </div> | |
| <div class="p-6 markdown-content text-gray-800" id="briefContent"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| let excelWorkbook = null; | |
| let rawBriefText = ""; | |
| window.onload = () => { | |
| const savedKey = localStorage.getItem('gemini_api_key'); | |
| if(savedKey) document.getElementById('apiKey').value = savedKey; | |
| }; | |
| function saveApiKey() { | |
| const key = document.getElementById('apiKey').value.trim(); | |
| if(key) { | |
| localStorage.setItem('gemini_api_key', key); | |
| alert('تم حفظ المفتاح بنجاح!'); | |
| } | |
| } | |
| document.getElementById('myArticle').addEventListener('change', function(e) { | |
| if (e.target.files.length > 0) { | |
| document.getElementById('myArticleLabel').textContent = "✅ " + e.target.files[0].name; | |
| document.getElementById('myArticleIcon').classList.replace('text-main', 'text-green-500'); | |
| } | |
| }); | |
| document.getElementById('competitors').addEventListener('change', function(e) { | |
| if (e.target.files.length > 0) { | |
| document.getElementById('compLabel').textContent = "✅ تم تحديد " + e.target.files.length + " ملفات"; | |
| document.getElementById('compIcon').classList.replace('text-rose-500', 'text-green-500'); | |
| } | |
| }); | |
| function updateProgress(percent, text) { | |
| const bar = document.getElementById('progressBar'); | |
| bar.style.width = percent + '%'; | |
| bar.textContent = percent + '%'; | |
| if(text) document.getElementById('progressTitle').textContent = text; | |
| } | |
| async function extractTextFromFile(file) { | |
| return new Promise((resolve, reject) => { | |
| const reader = new FileReader(); | |
| reader.onload = (e) => { | |
| const data = e.target.result; | |
| if (file.name.endsWith('.xlsx') || file.name.endsWith('.xls') || file.name.endsWith('.csv')) { | |
| const wb = XLSX.read(data, {type: 'binary'}); | |
| let text = ""; | |
| wb.SheetNames.forEach(sheetName => { text += XLSX.utils.sheet_to_txt(wb.Sheets[sheetName]) + " "; }); | |
| resolve(text); | |
| } else { resolve(data); } | |
| }; | |
| if (file.name.endsWith('.xlsx') || file.name.endsWith('.xls') || file.name.endsWith('.csv')) { | |
| reader.readAsBinaryString(file); | |
| } else { reader.readAsText(file); } | |
| }); | |
| } | |
| async function fetchGemini(prompt, model, apiKey, jsonMode = false) { | |
| const url = `https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent?key=${apiKey}`; | |
| const payload = { | |
| contents: [{ parts: [{ text: prompt }] }], | |
| generationConfig: { temperature: 0.1 } | |
| }; | |
| if(jsonMode) { | |
| payload.generationConfig.responseMimeType = "application/json"; | |
| payload.generationConfig.responseSchema = { | |
| type: "OBJECT", | |
| properties: { | |
| clusters: { | |
| type: "ARRAY", | |
| items: { | |
| type: "OBJECT", | |
| properties: { | |
| cluster_name: { type: "STRING" }, | |
| entities: { type: "ARRAY", items: { type: "OBJECT", properties: { name: { type: "STRING" }, type: { type: "STRING" } } } } | |
| } | |
| } | |
| } | |
| } | |
| }; | |
| } | |
| const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); | |
| if (response.status === 429) throw new Error("يرجى التأكد من تفعيل الدفع بنجاح في Google AI Studio."); | |
| if (!response.ok) throw new Error(`خطأ من الخادم (${response.status}): تأكد من صحة المفتاح.`); | |
| const data = await response.json(); | |
| return data.candidates[0].content.parts[0].text; | |
| } | |
| async function analyzeSEO() { | |
| const apiKey = document.getElementById('apiKey').value.trim(); | |
| if(!apiKey) return alert("يرجى إدخال مفتاح Gemini API أولاً وحفظه."); | |
| const myFile = document.getElementById('myArticle').files[0]; | |
| const compFiles = Array.from(document.getElementById('competitors').files).slice(0, 5); | |
| if (!myFile && compFiles.length === 0) return alert("يرجى رفع ملفات للتحليل."); | |
| document.getElementById('analyzeBtn').classList.add('hidden'); | |
| document.getElementById('resultsArea').classList.add('hidden'); | |
| document.getElementById('loading').classList.remove('hidden'); | |
| let allData = {}; | |
| let masterEntities = new Set(); | |
| let excelData = {}; | |
| try { | |
| if (myFile) { | |
| updateProgress(15, `جاري استخراج بيانات موقعك...`); | |
| const text = await extractTextFromFile(myFile); | |
| const prompt = "أنت خبير SEO. استخرج الكيانات الهامة من النص. \nالنص: " + text.substring(0, 10000); | |
| const jsonStr = await fetchGemini(prompt, "gemini-2.5-flash", apiKey, true); | |
| const result = JSON.parse(jsonStr); | |
| let myCounts = {}; | |
| let mySheetRows = [["العنقود", "الكيان", "النوع"]]; | |
| (result.clusters || []).forEach(c => { | |
| (c.entities || []).forEach(e => { | |
| if(e.name.length > 2) { | |
| const key = e.name + "|||" + e.type; | |
| myCounts[key] = (myCounts[key] || 0) + 1; | |
| masterEntities.add(key); | |
| mySheetRows.push([c.cluster_name, e.name, e.type]); | |
| } | |
| }); | |
| }); | |
| allData["موقعي"] = myCounts; | |
| excelData["كيانات موقعي"] = mySheetRows; | |
| } | |
| for (let i = 0; i < compFiles.length; i++) { | |
| updateProgress(30 + (i * 10), `جاري استخراج بيانات المنافس ${i+1}...`); | |
| const text = await extractTextFromFile(compFiles[i]); | |
| const prompt = "أنت خبير SEO. استخرج الكيانات الهامة من النص. \nالنص: " + text.substring(0, 10000); | |
| const jsonStr = await fetchGemini(prompt, "gemini-2.5-flash", apiKey, true); | |
| const result = JSON.parse(jsonStr); | |
| let compCounts = {}; | |
| let compSheetRows = [["العنقود", "الكيان", "النوع"]]; | |
| (result.clusters || []).forEach(c => { | |
| (c.entities || []).forEach(e => { | |
| if(e.name.length > 2) { | |
| const key = e.name + "|||" + e.type; | |
| compCounts[key] = (compCounts[key] || 0) + 1; | |
| masterEntities.add(key); | |
| compSheetRows.push([c.cluster_name, e.name, e.type]); | |
| } | |
| }); | |
| }); | |
| allData[`المنافس ${i+1}`] = compCounts; | |
| excelData[`المنافس ${i+1}`] = compSheetRows; | |
| } | |
| updateProgress(80, "جاري مقارنة البيانات واستخراج الفجوات..."); | |
| let comparisonRows = []; | |
| masterEntities.forEach(key => { | |
| const [name, type] = key.split("|||"); | |
| let myCount = (allData["موقعي"] || {})[key] || 0; | |
| let compCount = 0; | |
| compFiles.forEach((_, i) => { compCount += (allData[`المنافس ${i+1}`] || {})[key] || 0; }); | |
| comparisonRows.push({ name, type, myCount, compCount }); | |
| }); | |
| comparisonRows.sort((a, b) => b.compCount - a.compCount || b.myCount - a.myCount); | |
| let gaps = comparisonRows.filter(r => r.myCount === 0 && r.compCount > 0); | |
| let brief = ""; | |
| if (myFile && compFiles.length > 0 && gaps.length > 0) { | |
| updateProgress(90, "جاري صياغة خطة المحتوى (Gemini Pro)..."); | |
| const topGaps = gaps.slice(0, 15).map(g => g.name).join(", "); | |
| const briefPrompt = `أنت خبير Technical SEO. قم بإنشاء هيكل مقال SEO متوافق مع نية البحث لسد هذه الفجوات: ${topGaps}. استخدم وسوم Markdown.`; | |
| brief = await fetchGemini(briefPrompt, "gemini-2.5-pro", apiKey, false); | |
| rawBriefText = brief; | |
| } | |
| excelWorkbook = XLSX.utils.book_new(); | |
| if(brief) XLSX.utils.book_append_sheet(excelWorkbook, XLSX.utils.aoa_to_sheet([["Content Brief"], [brief]]), "خطة المحتوى"); | |
| if(gaps.length > 0) { | |
| let gapsSheet = [["الكيان", "النوع", "تكرار المنافسين"]]; | |
| gaps.forEach(g => gapsSheet.push([g.name, g.type, g.compCount])); | |
| XLSX.utils.book_append_sheet(excelWorkbook, XLSX.utils.aoa_to_sheet(gapsSheet), "الفجوات"); | |
| } | |
| let masterSheet = [["الكيان", "النوع", "تكرار موقعي", "إجمالي المنافسين"]]; | |
| comparisonRows.forEach(r => masterSheet.push([r.name, r.type, r.myCount, r.compCount])); | |
| XLSX.utils.book_append_sheet(excelWorkbook, XLSX.utils.aoa_to_sheet(masterSheet), "الكيانات الشاملة"); | |
| for (const [sheetName, rows] of Object.entries(excelData)) { | |
| XLSX.utils.book_append_sheet(excelWorkbook, XLSX.utils.aoa_to_sheet(rows), sheetName); | |
| } | |
| renderTables(gaps, comparisonRows, !!myFile, compFiles.length > 0); | |
| if(brief) { | |
| document.getElementById('briefContent').innerHTML = marked.parse(brief); | |
| document.getElementById('briefSection').classList.remove('hidden'); | |
| } else { | |
| document.getElementById('briefSection').classList.add('hidden'); | |
| } | |
| updateProgress(100, "اكتمل التحليل بنجاح!"); | |
| } catch (err) { | |
| alert(err.message); | |
| console.error(err); | |
| } finally { | |
| setTimeout(() => { | |
| document.getElementById('loading').classList.add('hidden'); | |
| document.getElementById('analyzeBtn').classList.remove('hidden'); | |
| }, 1000); | |
| } | |
| } | |
| function renderTables(gaps, master, hasMy, hasComp) { | |
| const gapsSection = document.getElementById('gapsSection'); | |
| const masterSection = document.getElementById('masterSection'); | |
| if (hasMy && hasComp && gaps.length > 0) { | |
| gapsSection.classList.remove('hidden'); | |
| masterSection.classList.remove('lg:col-span-2'); | |
| document.getElementById('gapsTable').innerHTML = gaps.map(g => ` | |
| <tr class="hover:bg-rose-50"><td class="px-3 py-2 font-bold">${g.name}</td><td class="px-2 py-2 text-xs text-gray-500">${g.type}</td><td class="px-3 py-2 text-center text-rose-600 font-bold">${g.compCount}</td></tr> | |
| `).join(''); | |
| } else { | |
| gapsSection.classList.add('hidden'); | |
| masterSection.classList.add('lg:col-span-2'); | |
| } | |
| document.getElementById('thMySite').style.display = hasMy ? 'table-cell' : 'none'; | |
| document.getElementById('thCompetitors').style.display = hasComp ? 'table-cell' : 'none'; | |
| document.getElementById('masterTable').innerHTML = master.slice(0, 100).map(r => ` | |
| <tr class="hover:bg-blue-50"> | |
| <td class="px-3 py-2 font-bold text-dark">${r.name}</td> | |
| <td class="px-2 py-2 text-xs text-gray-500">${r.type}</td> | |
| ${hasMy ? `<td class="px-3 py-2 text-center font-bold ${r.myCount>0?'text-emerald-600':'text-gray-300'}">${r.myCount}</td>` : ''} | |
| ${hasComp ? `<td class="px-3 py-2 text-center font-bold text-main">${r.compCount}</td>` : ''} | |
| </tr> | |
| `).join(''); | |
| document.getElementById('resultsArea').classList.remove('hidden'); | |
| } | |
| function copyBrief() { navigator.clipboard.writeText(rawBriefText).then(() => alert("تم النسخ!")); } | |
| function downloadExcel() { if (excelWorkbook) XLSX.writeFile(excelWorkbook, "Almaster_SEO_Report.xlsx"); } | |
| </script> | |
| </body> | |
| </html> |
Xet Storage Details
- Size:
- 24.4 kB
- Xet hash:
- d9aca4235d2733f21fcf32817a87ea52955fa644a609580a8fa9a2d70230411f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.