%PDF- %PDF-
| Direktori : /home2/rezakur1/devita.rezakurnia.com/X9KQ7MW2RT8PY4ND6LV3JH5CG8BF2ZM7QW4/scene22/ |
| Current File : /home2/rezakur1/devita.rezakurnia.com/X9KQ7MW2RT8PY4ND6LV3JH5CG8BF2ZM7QW4/scene22/scene22.js |
/* ===========================================================
SCENE 22
Penutup & Daftar Pustaka
Part 1
=========================================================== */
fetch('../components/header.html')
.then(response => response.text())
.then(data => {
document.getElementById(
'header-container'
).innerHTML = data;
});
document.addEventListener("DOMContentLoaded", () => {
initializeLoading();
initializeReferences();
initializeSearch();
initializeFilter();
initializeReveal();
initializeToast();
initializeModalActions();
});
/* ===========================================================
LOADING SCREEN
=========================================================== */
function initializeLoading() {
const loading = document.getElementById("loadingScreen");
if (!loading) return;
window.addEventListener("load", () => {
setTimeout(() => {
loading.style.opacity = "0";
loading.style.pointerEvents = "none";
setTimeout(() => {
loading.remove();
}, 600);
}, 1200);
});
}
/* ===========================================================
SEARCH REFERENCE
=========================================================== */
function initializeSearch() {
const input = document.getElementById("searchInput");
if (!input) return;
input.addEventListener("keyup", function () {
const keyword = this.value.toLowerCase();
const cards = document.querySelectorAll(".reference-card,.video-card");
cards.forEach(card => {
const text = card.innerText.toLowerCase();
if (text.includes(keyword)) {
card.style.display = "block";
} else {
card.style.display = "none";
}
});
});
}
/* ===========================================================
FILTER
=========================================================== */
function initializeFilter() {
const buttons = document.querySelectorAll(".filter-btn");
const getCards = () => document.querySelectorAll(".reference-card,.video-card");
buttons.forEach(button => {
button.addEventListener("click", () => {
buttons.forEach(btn => {
btn.classList.remove("active");
});
button.classList.add("active");
const filter = button.dataset.filter;
getCards().forEach(card => {
const type = card.dataset.type;
if (filter === "all") {
card.style.display = "block";
return;
}
if (type === filter) {
card.style.display = "block";
} else {
card.style.display = "none";
}
});
showToast("Filter : " + button.innerText);
});
});
}
/* ===========================================================
GENERATED REFERENCES
=========================================================== */
const journalReferences = [
["Armand, M., Endres, F., MacFarlane, D. R., Ohno, H., & Scrosati, B. (2009). Ionic-liquid materials for the electrochemical challenges of the future. Nature Materials.", "https://doi.org/10.1038/nmat2448"],
["Wasserscheid, P., & Keim, W. (2000). Ionic liquids: New solutions for transition metal catalysis. Angewandte Chemie International Edition.", "https://doi.org/10.1002/1521-3773(20001201)39:21%3C3772::AID-ANIE3772%3E3.0.CO;2-5"],
["Huddleston, J. G., Visser, A. E., Reichert, W. M., Willauer, H. D., Broker, G. A., & Rogers, R. D. (2001). Characterization and comparison of hydrophilic and hydrophobic room temperature ionic liquids. Green Chemistry.", "https://doi.org/10.1039/b103275p"],
["Hallett, J. P., & Welton, T. (2011). Room-temperature ionic liquids: Solvents for synthesis and catalysis. Chemical Reviews.", "https://doi.org/10.1021/cr1003248"],
["Tokuda, H., Hayamizu, K., Ishii, K., Susan, M. A. B. H., & Watanabe, M. (2004). Physicochemical properties and structures of room temperature ionic liquids. Journal of Physical Chemistry B.", "https://doi.org/10.1021/jp047480r"],
["MacFarlane, D. R., Pringle, J. M., Johansson, K. M., Forsyth, S. A., & Forsyth, M. (2007). Lewis base ionic liquids. Faraday Discussions.", "https://doi.org/10.1039/b617225k"],
["Swatloski, R. P., Spear, S. K., Holbrey, J. D., & Rogers, R. D. (2002). Dissolution of cellulose with ionic liquids. Journal of the American Chemical Society.", "https://doi.org/10.1021/ja025790m"],
["Garcia, M. T., Gathergood, N., & Scammells, P. J. (2004). Biodegradable ionic liquids. Green Chemistry.", "https://doi.org/10.1039/b411922c"],
["Olivier-Bourbigou, H., Magna, L., & Morvan, D. (2010). Ionic liquids and catalysis: Recent progress. Applied Catalysis A.", "https://doi.org/10.1016/j.apcata.2010.01.016"],
["Walden, P. (1914). Molecular weights and electrical conductivity of several fused salts. Bulletin de l'Académie Impériale des Sciences de St.-Pétersbourg.", ""]
];
const generalReferences = [
["Saputra (2018). Kajian cairan ionik dan aplikasinya. Tesis ITB.", "journal"],
["Prasetyaningrum et al. (2016). Pengembangan material berbasis cairan ionik. Jurnal Kimia Indonesia.", "journal"],
["Grätzel, M. (2003). Dye-sensitized solar cells. Journal of Photochemistry and Photobiology C.", "journal"],
["Kalyanasundaram, K. (2010). Dye-sensitized solar cells. EPFL Press.", "book"],
["Zhang & Shreeve (2014). Energetic ionic liquids. Chemical Reviews.", "journal"],
["Zhao (2006). Innovative applications of ionic liquids as green engineering liquids. Chemical Engineering Communications.", "journal"],
["Zhu et al. (2006). Dissolution of cellulose with ionic liquids and regeneration. Green Chemistry.", "journal"]
];
function initializeReferences() {
const journalContainer = document.getElementById("journalContainer");
const generalContainer = document.getElementById("generalContainer");
if (journalContainer) {
journalContainer.innerHTML = journalReferences.map(([text, url]) => `
<div class="reference-card" data-type="journal">
<h3>${text.split(".")[0]}</h3>
<p>${text}</p>
${url ? `<div class="reference-action"><a href="${url}" target="_blank" rel="noopener">DOI / URL</a></div>` : ""}
</div>
<br>
`).join("");
}
if (generalContainer) {
generalContainer.innerHTML = generalReferences.map(([text, type]) => `
<div class="reference-card" data-type="${type}">
<h3>${text.split(".")[0]}</h3>
<p>${text}</p>
</div>
<br>
`).join("");
}
}
/* ===========================================================
SCROLL REVEAL
=========================================================== */
function initializeReveal() {
const items = document.querySelectorAll(
".takeaway-card,.reference-card,.video-card,.achievement-card,.teacher-card,.nav-button,.closing-message"
);
const observer = new IntersectionObserver(
(entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = "1";
entry.target.style.transform =
"translateY(0px)";
}
});
},
{
threshold: .15
}
);
items.forEach(item => {
item.style.opacity = "0";
item.style.transform = "translateY(50px)";
item.style.transition = ".8s ease";
observer.observe(item);
});
}
/* ===========================================================
TOAST
=========================================================== */
function initializeToast() {
window.showToast = function (message) {
const toast = document.getElementById("toast");
if (!toast) return;
toast.innerHTML = message;
toast.classList.add("show");
clearTimeout(toast.timer);
toast.timer = setTimeout(() => {
toast.classList.remove("show");
}, 2500);
}
}
/* ===========================================================
SMOOTH SCROLL BUTTON
=========================================================== */
document.querySelectorAll("a[href^='#']").forEach(anchor => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
const target = document.querySelector(
this.getAttribute("href")
);
if (target) {
target.scrollIntoView({
behavior: "smooth"
});
}
});
});
/* ===========================================================
HOVER EFFECT
=========================================================== */
document.querySelectorAll(".reference-card").forEach(card => {
card.addEventListener("mouseenter", () => {
card.style.transform =
"translateY(-8px) scale(1.01)";
});
card.addEventListener("mouseleave", () => {
card.style.transform =
"translateY(0px)";
});
});
/* ===========================================================
ACHIEVEMENT ANIMATION
=========================================================== */
document.querySelectorAll(".achievement-card").forEach(card => {
card.addEventListener("mouseenter", () => {
card.animate([
{
transform: "translateY(0)"
},
{
transform: "translateY(-8px)"
},
{
transform: "translateY(0)"
}
], {
duration: 500
});
});
});
/* ===========================================================
HEADER EFFECT
=========================================================== */
window.addEventListener("scroll", () => {
const hero = document.querySelector(".hero-content");
if (!hero) return;
const offset = window.scrollY * .25;
hero.style.transform =
`translateY(${offset}px)`;
});
/* ===========================================================
PDF GENERATOR
=========================================================== */
function initializePDF() {
const btn = document.getElementById("btnDownload");
if (!btn) return;
btn.addEventListener("click", () => {
const modal = document.getElementById("pdfModal");
if (modal) {
openModal(modal);
return;
}
generatePortfolioPDF();
});
}
function openModal(modal) {
modal.classList.add("show");
document.body.style.overflow = "hidden";
}
function closeModal(modal) {
modal.classList.remove("show");
document.body.style.overflow = "";
}
function initializeModalActions() {
document.querySelectorAll(".close-modal").forEach(button => {
button.addEventListener("click", () => {
closeModal(button.closest(".modal"));
});
});
document.querySelectorAll(".modal").forEach(modal => {
modal.addEventListener("click", event => {
if (event.target === modal) {
closeModal(modal);
}
});
});
const generateBtn = document.getElementById("generatePdf");
if (generateBtn) {
generateBtn.addEventListener("click", () => {
closeModal(document.getElementById("pdfModal"));
generatePortfolioPDF();
});
}
const shareLink = document.getElementById("shareLink");
if (shareLink) {
shareLink.value = window.location.href;
}
const copyLink = document.getElementById("copyLink");
if (copyLink) {
copyLink.addEventListener("click", async () => {
await navigator.clipboard.writeText(window.location.href);
showToast("Link berhasil disalin.");
});
}
document.addEventListener("keydown", event => {
if (event.key !== "Escape") return;
document.querySelectorAll(".modal.show").forEach(closeModal);
});
}
async function generatePortfolioPDF() {
if (!window.jspdf) {
showToast("jsPDF belum dimuat.");
return;
}
const { jsPDF } = window.jspdf;
const pdf = new jsPDF({
orientation: "portrait",
unit: "mm",
format: "a4"
});
let y = 20;
pdf.setFont("helvetica", "bold");
pdf.setFontSize(22);
pdf.text("PORTOFOLIO PEMBELAJARAN", 20, y);
y += 15;
pdf.setFontSize(14);
pdf.setFont("helvetica", "normal");
pdf.text(
"Multimedia Interaktif Visualisasi Molekuler 3D",
20,
y
);
y += 15;
pdf.setFont("helvetica", "bold");
pdf.text("KEY TAKEAWAYS", 20, y);
y += 10;
pdf.setFont("helvetica", "normal");
const list = [
"1. Ionic Liquid merupakan garam organik cair.",
"2. Coulomb menjelaskan hubungan ukuran ion dan titik leleh.",
"3. Panjang rantai alkil mempengaruhi viskositas.",
"4. Anion menentukan hidrofobisitas.",
"5. Aplikasi pada DSSC, nanoselulosa, katalis, dll."
];
list.forEach(item => {
pdf.text(item, 25, y);
y += 8;
});
y += 8;
pdf.setFont("helvetica", "bold");
pdf.text("HASIL BELAJAR",20,y);
y += 10;
pdf.setFont("helvetica","normal");
pdf.text("Nilai Kuis : ____________",20,y);
y += 8;
pdf.text("Refleksi VNOST : ____________",20,y);
y += 8;
pdf.text("Tanggal Cetak : " + new Date().toLocaleString(),20,y);
pdf.save("Portfolio_Belajar_Cairan_Ionik.pdf");
showToast("PDF berhasil diunduh.");
}
/* ===========================================================
SHARE
=========================================================== */
function initializeShare(){
const btn=document.getElementById("btnShare");
if(!btn) return;
btn.addEventListener("click", () => {
const modal = document.getElementById("shareModal");
if (modal) {
openModal(modal);
return;
}
shareApplication();
});
}
async function shareApplication(){
const data={
title:"Multimedia Interaktif Cairan Ionik",
text:"Saya telah menyelesaikan pembelajaran Visualisasi Molekuler 3D.",
url:window.location.href
};
try{
if(navigator.share){
await navigator.share(data);
showToast("Berhasil dibagikan.");
}else{
await navigator.clipboard.writeText(window.location.href);
showToast("Link berhasil disalin.");
}
}catch(e){
console.log(e);
}
}
/* ===========================================================
HOME BUTTON
=========================================================== */
function initializeHome(){
const btn=document.getElementById("btnHome");
if(!btn) return;
btn.addEventListener("click",()=>{
if(confirm("Kembali ke Dashboard Utama?")){
window.location.href="../scene4/index.html";
}
});
}
/* ===========================================================
QUIZ BUTTON
=========================================================== */
function initializeQuiz(){
const btn=document.getElementById("btnQuiz");
if(!btn) return;
btn.addEventListener("click",()=>{
if(confirm("Kembali ke evaluasi materi?")){
window.location.href="../scene23/index.html";
}
});
}
/* ===========================================================
SHORTCUT
=========================================================== */
document.addEventListener("keydown",(e)=>{
if(e.ctrlKey && e.key==="p"){
e.preventDefault();
generatePortfolioPDF();
}
if(e.ctrlKey && e.key==="h"){
e.preventDefault();
window.location.href="../scene4/index.html";
}
if(e.ctrlKey && e.key==="e"){
e.preventDefault();
window.location.href="../scene23/index.html";
}
});
/* ===========================================================
INITIALIZE
=========================================================== */
document.addEventListener("DOMContentLoaded",()=>{
initializePDF();
initializeShare();
initializeHome();
initializeQuiz();
});
/* ===========================================================
SCENE 22
PART 3
Premium Animation & Utility
=========================================================== */
/* ===========================================================
PARTICLE BACKGROUND
=========================================================== */
function initializeParticles() {
const container = document.querySelector(".particle-container");
if (!container) return;
setInterval(() => {
const particle = document.createElement("span");
particle.className = "dynamic-particle";
particle.style.left = Math.random() * 100 + "%";
particle.style.width = 4 + Math.random() * 8 + "px";
particle.style.height = particle.style.width;
particle.style.animationDuration =
8 + Math.random() * 12 + "s";
container.appendChild(particle);
setTimeout(() => {
particle.remove();
}, 20000);
}, 500);
}
/* ===========================================================
FLOATING MOLECULE
=========================================================== */
function initializeFloatingMolecule() {
const molecules = document.querySelectorAll(".molecule");
molecules.forEach((molecule, index) => {
let direction = 1;
setInterval(() => {
direction *= -1;
molecule.animate([
{
transform:
"translateX(-50%) translateY(0px)"
},
{
transform:
`translateX(-50%) translateY(${direction * 8}px)`
},
{
transform:
"translateX(-50%) translateY(0px)"
}
], {
duration: 2500 + index * 300,
easing: "ease-in-out"
});
}, 2600 + index * 250);
});
}
/* ===========================================================
ACHIEVEMENT COUNTER
=========================================================== */
function initializeAchievementCounter() {
const cards =
document.querySelectorAll(".achievement-card");
cards.forEach((card, index) => {
card.style.animationDelay =
`${index * .15}s`;
});
}
/* ===========================================================
BUTTON RIPPLE
=========================================================== */
function initializeRipple() {
const buttons =
document.querySelectorAll("button");
buttons.forEach(button => {
button.addEventListener("click", e => {
const ripple =
document.createElement("span");
ripple.className = "ripple";
ripple.style.left =
e.offsetX + "px";
ripple.style.top =
e.offsetY + "px";
button.appendChild(ripple);
setTimeout(() => {
ripple.remove();
}, 600);
});
});
}
/* ===========================================================
SCROLL PROGRESS
=========================================================== */
function initializeScrollProgress() {
const progress =
document.createElement("div");
progress.id = "scrollProgress";
document.body.appendChild(progress);
window.addEventListener("scroll", () => {
const total =
document.documentElement.scrollHeight -
window.innerHeight;
const value =
(window.scrollY / total) * 100;
progress.style.width =
value + "%";
});
}
/* ===========================================================
ACTIVE FILTER HIGHLIGHT
=========================================================== */
function initializeFilterHover() {
const buttons =
document.querySelectorAll(".filter-btn");
buttons.forEach(button => {
button.addEventListener("mouseenter", () => {
button.style.transform =
"translateY(-4px)";
});
button.addEventListener("mouseleave", () => {
button.style.transform =
"translateY(0px)";
});
});
}
/* ===========================================================
HERO TITLE TYPE EFFECT
=========================================================== */
function initializeTyping() {
const title =
document.querySelector(".hero-content h1");
if (!title) return;
const text = title.innerText;
title.innerHTML = "";
let index = 0;
const timer = setInterval(() => {
title.innerHTML += text[index];
index++;
if (index >= text.length) {
clearInterval(timer);
}
}, 45);
}
/* ===========================================================
KEY TAKEAWAY HOVER
=========================================================== */
document.querySelectorAll(".takeaway-card")
.forEach(card => {
card.addEventListener("mousemove", e => {
const rect =
card.getBoundingClientRect();
const x =
e.clientX - rect.left;
const y =
e.clientY - rect.top;
card.style.background =
`radial-gradient(circle at ${x}px ${y}px,
rgba(255,255,255,.18),
rgba(255,255,255,.08))`;
});
card.addEventListener("mouseleave", () => {
card.style.background =
"rgba(255,255,255,.08)";
});
});
/* ===========================================================
SHORTCUT HELP
=========================================================== */
document.addEventListener("keydown", e => {
if (e.key === "?") {
alert(
`Shortcut
CTRL + P = Download PDF
CTRL + H = Dashboard
CTRL + E = Evaluasi
`
);
}
});
/* ===========================================================
PERFORMANCE
=========================================================== */
window.addEventListener("blur", () => {
document.body.classList.add("paused");
});
window.addEventListener("focus", () => {
document.body.classList.remove("paused");
});
/* ===========================================================
INIT
=========================================================== */
document.addEventListener("DOMContentLoaded", () => {
initializeParticles();
initializeFloatingMolecule();
initializeAchievementCounter();
initializeRipple();
initializeScrollProgress();
initializeFilterHover();
initializeTyping();
});
/* ===========================================================
END
=========================================================== */