بواسطة morbah |
بريد مؤقت بلوجر
لم يتم إنشاء بريد بعد
الرسائل الواردة:
<!-- ابدأ أداة البريد المؤقت -->
<div id="tempMailApp">
<style>
#tempMailApp {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 0 auto;
padding: 20px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
border-radius: 8px;
background: #fff;
}
.mail-box {
border: 1px solid #ddd;
padding: 15px;
margin-bottom: 15px;
border-radius: 5px;
background: #f9f9f9;
}
.mail-header {
font-weight: bold;
margin-bottom: 10px;
color: #333;
}
.mail-body {
color: #555;
white-space: pre-line;
}
button {
background: #4285f4;
color: white;
border: none;
padding: 8px 15px;
border-radius: 4px;
cursor: pointer;
margin: 5px 0;
}
button:hover {
background: #3367d6;
}
.refresh-btn {
background: #34a853;
}
.copy-btn {
background: #fbbc05;
}
#emailDisplay {
font-weight: bold;
word-break: break-all;
margin: 15px 0;
padding: 10px;
background: #f0f7ff;
border-radius: 4px;
border: 1px dashed #4285f4;
}
.no-mails {
color: #777;
font-style: italic;
text-align: center;
padding: 20px;
}
.loading {
color: #777;
text-align: center;
padding: 20px;
}
</style>
<h2 style="color: #4285f4; text-align: center;">بريد مؤقت بلوجر</h2>
<div style="text-align: center; margin-bottom: 20px;">
<button id="generateEmail">إنشاء بريد جديد</button>
<button id="refreshMails" class="refresh-btn">تحديث الرسائل</button>
<button id="copyEmail" class="copy-btn">نسخ البريد</button>
</div>
<div id="emailDisplay" style="text-align: center;">لم يتم إنشاء بريد بعد</div>
<h3 style="border-bottom: 1px solid #eee; padding-bottom: 10px;">الرسائل الواردة:</h3>
<div id="mailList">
<p class="no-mails">لا توجد رسائل</p>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const generateEmailBtn = document.getElementById('generateEmail');
const refreshMailsBtn = document.getElementById('refreshMails');
const copyEmailBtn = document.getElementById('copyEmail');
const emailDisplay = document.getElementById('emailDisplay');
const mailList = document.getElementById('mailList');
let currentEmail = localStorage.getItem('tempMailCurrentEmail') || '';
function generateTempEmail() {
const randomString = Math.random().toString(36).substring(2, 8);
const domain = window.location.hostname;
const email = `temp-${randomString}@${domain}`;
localStorage.setItem('tempMailCurrentEmail', email);
return email;
}
generateEmailBtn.addEventListener('click', function() {
currentEmail = generateTempEmail();
emailDisplay.textContent = currentEmail;
alert('تم إنشاء البريد: ' + currentEmail);
checkMails();
});
copyEmailBtn.addEventListener('click', function() {
navigator.clipboard.writeText(currentEmail);
alert('تم النسخ: ' + currentEmail);
});
async function checkMails() {
mailList.innerHTML = '<p class="loading">جاري التحقق من الرسائل...</p>';
try {
const response = await fetch(`/feeds/posts/default?alt=json&q=${encodeURIComponent(currentEmail)}`);
const data = await response.json();
if (data.feed.entry) {
mailList.innerHTML = '';
data.feed.entry.forEach(post => {
const mailContent = post.content.$t;
const mailElement = document.createElement('div');
mailElement.className = 'mail-box';
mailElement.innerHTML = `
<div class="mail-header">
${post.title.$t}
</div>
<div class="mail-body">${mailContent}</div>
`;
mailList.appendChild(mailElement);
});
} else {
mailList.innerHTML = '<p class="no-mails">لا توجد رسائل جديدة</p>';
}
} catch (error) {
mailList.innerHTML = '<p class="no-mails">خطأ في تحميل الرسائل</p>';
}
}
refreshMailsBtn.addEventListener('click', checkMails);
if (currentEmail) {
emailDisplay.textContent = currentEmail;
checkMails();
}
});
</script>
<!-- نهاية أداة البريد المؤقت -->
انا مهتم بمجال التقنية والربح من الانترنت واتطلع لنشر المزيد من المقالات التي تفيدكم
تعليقات
إرسال تعليق