<style>
body {font-family: Arial, Helvetica, sans-serif;}
/* Tombol buka modal */
#openModalBtn {
padding: 10px 20px;
background-color: #2196F3;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
font-weight: bold;
}
#openModalBtn:hover {
background-color: #0b7dda;
}
/* Modal Background */
.modal {
display: none; /* disembunyikan default */
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
/* Modal Box */
.modal-content {
background-color: #000;
margin: 100px auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-height: 80%;
overflow:auto;
border-radius: 10px;
}
/* Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
/* Script Text */
pre {
white-space: pre-wrap;
word-break: break-word;
cursor: text;
}
</style>
<!-- Tombol buka modal -->
<button id="openModalBtn">Open Safelink Modal</button>
<!-- Modal -->
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<pre id="scriptContent"></pre>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const modal = document.getElementById("myModal");
const btn = document.getElementById("openModalBtn");
const span = document.getElementsByClassName("close")[0];
// Script asli dimasukkan ke modal
const code = `<script>
document.addEventListener("DOMContentLoaded", function () {
const FEED = "https://safelink-aza.blogspot.com/feeds/posts/default?alt=json-in-script";
const HOST = "https://safelink-aza.blogspot.com/";
const PARAM = "to";
const EXCEPT = ["blogger.com","facebook.com","instagram.com","google.com","twitter.com","mailto:","javascript:"];
function u2b(s){ try{ return btoa(unescape(encodeURIComponent(s))); }catch(e){ return btoa(s); } }
function randomFromFeed(data){
try{
const entries = data.feed.entry || [];
if(!entries.length) return "";
const pick = entries[Math.floor(Math.random()*entries.length)];
const linkObj = pick.link.find(l=>l.rel==="alternate");
return linkObj ? linkObj.href : "";
}catch(e){ return ""; }
}
function replaceLinks(randomPost){
document.querySelectorAll("a[href^='http']").forEach(a=>{
const href = a.href;
if(EXCEPT.some(ex=>href.includes(ex))) return;
if(randomPost==="") return;
const enc = u2b(href);
const url = HOST + randomPost.replace(HOST,"") + "?" + PARAM + "=" + encodeURIComponent(enc);
a.href = url;
a.target="_blank";
a.rel="noopener noreferrer";
});
}
const cbName = "__asl_cb_"+Math.random().toString(36).slice(2);
window[cbName] = function(data){
replaceLinks(randomFromFeed(data));
delete window[cbName];
};
const s = document.createElement("script");
s.src = FEED + "&callback=" + cbName;
document.head.appendChild(s);
});
<\/script>`;
const pre = document.getElementById("scriptContent");
pre.textContent = code;
// Tombol buka modal
btn.onclick = function() { modal.style.display = "block"; }
// Tombol tutup modal
span.onclick = function() { modal.style.display = "none"; }
// Klik di luar modal juga menutup
window.onclick = function(event) {
if (event.target == modal) { modal.style.display = "none"; }
}
});
</script>
https://safelink-aza.blogspot.com/

No comments:
Post a Comment