<?xml version="1.0" encoding="UTF-8" ?>
<b:skin><![CDATA[/* CSS هنا */]]></b:skin>
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>نظام تبادل الزيارات</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #f4f4f4;
}
.container {
width: 60%;
margin: 20px auto;
padding: 20px;
background: white;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
iframe {
width: 100%;
height: 400px;
border: 1px solid #ccc;
margin-top: 10px;
}
.controls {
margin-top: 15px;
}
button {
background: #007BFF;
color: white;
border: none;
padding: 10px;
cursor: pointer;
border-radius: 5px;
}
button:hover {
background: #0056b3;
}
input {
padding: 8px;
width: 50px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<h1>نظام تبادل الزيارات</h1>
<p>سيتم التبديل بين المواقع تلقائيًا بعد <span id="timer">5</span> ثوانٍ.</p>
<iframe id="siteFrame" src="" frameborder="0"></iframe>
<div class="controls">
<label for="interval">مدة التنقل (بالثواني):</label>
<input type="number" id="interval" value="5">
<button onclick="startRotation()">ابدأ التصفح</button>
</div>
</div>
<script>
// استدعاء الروابط من أداة التخطيط في بلوجر
function getLinks() {
let links = [];
let widgets = document.querySelectorAll(".traffic-links a");
widgets.forEach(link => {
links.push(link.href);
});
return links;
}
let currentIndex = 0;
let intervalTime = 5000;
let interval;
function startRotation() {
let links = getLinks();
if (links.length === 0) {
alert("لم يتم العثور على روابط!");
return;
}
intervalTime = document.getElementById("interval").value * 1000;
if (interval) clearInterval(interval);
updateSite(links);
interval = setInterval(() => updateSite(links), intervalTime);
}
function updateSite(links) {
if (links.length === 0) return;
document.getElementById("siteFrame").src = links[currentIndex];
document.getElementById("timer").innerText = intervalTime / 1000;
currentIndex = (currentIndex + 1) % links.length;
let countdown = intervalTime / 1000;
let countdownInterval = setInterval(() => {
countdown--;
document.getElementById("timer").innerText = countdown;
if (countdown <= 0) clearInterval(countdownInterval);
}, 1000);
}
</script>
<div class="traffic-links" style="display: none;">
<a href="https://example.com">موقع 1</a>
<a href="https://example2.com">موقع 2</a>
<a href="https://example3.com">موقع 3</a>
</div>
</body>
</html>