MediaWiki:Common.js: Perbedaan antara revisi
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
Tidak ada ringkasan suntingan Tanda: Suntingan perangkat seluler Suntingan peramban seluler |
||
| Baris 1.327: | Baris 1.327: | ||
/* ========================================================== | /* ========================================================== | ||
🧠 MIPPEDIA SMART-SUMMARY | 🧠 MIPPEDIA SMART-SUMMARY V5 - TYPEWRITER EDITION | ||
- Posisi: | - Posisi: Absolute Floating (Aman dari tab menu) | ||
- | - Efek: Typing Animation (Satu per satu kata) | ||
- | - UI: Compact Modal (Scrollable content) | ||
========================================================== */ | ========================================================== */ | ||
(function() { | (function() { | ||
| Baris 1.336: | Baris 1.336: | ||
var paragraphs = $('#mw-content-text p').filter(function() { | var paragraphs = $('#mw-content-text p').filter(function() { | ||
return $(this).text().trim().length > 40; | return $(this).text().trim().length > 40; | ||
}).slice(0, | }).slice(0, 4); // Ambil 4 poin biar gak kepanjangan | ||
var points = []; | var points = []; | ||
paragraphs.each(function() { | paragraphs.each(function() { | ||
var sentence = $(this).text().split('.')[0]; | var sentence = $(this).text().split('.')[0]; | ||
if (sentence.length > 10) points.push(sentence + '.'); | if (sentence.length > 10) points.push('• ' + sentence + '.'); | ||
}); | }); | ||
return points; | return points.join('\n\n'); | ||
} | } | ||
| Baris 1.350: | Baris 1.350: | ||
if (ns !== 0 || mw.config.get('wgAction') !== 'view') return; | if (ns !== 0 || mw.config.get('wgAction') !== 'view') return; | ||
// 1. Tombol Melayang | // 1. Tombol Melayang Presisi | ||
var $btn = $('<div id="mip-summary-btn">✨ Rangkum</div>').css({ | var $btn = $('<div id="mip-summary-btn">✨ Rangkum</div>').css({ | ||
'position': 'absolute', | 'position': 'absolute', 'right': '15px', 'top': '-35px', | ||
'padding': '4px 14px', 'background': '#3498db', 'color': '#fff', | |||
'border-radius': '20px', 'cursor': 'pointer', 'font-size': '11px', | |||
'padding': '4px | 'font-weight': 'bold', 'z-index': '10', 'box-shadow': '0 2px 8px rgba(0,0,0,0.15)' | ||
'border-radius': '20px', | |||
'font-weight': 'bold', | |||
}); | }); | ||
$('.page-actions-menu').css('position', 'relative').prepend($btn); | $('.page-actions-menu').css('position', 'relative').prepend($btn); | ||
// 2. Logic | // 2. Logic Cinematic Typing | ||
$btn.on('click', function() { | $btn.on('click', function() { | ||
var | var fullText = getSummary(); | ||
var $overlay = $('<div id="mip-sum-ov"></div>').css({ | |||
var $overlay = $('<div id="mip- | |||
'position': 'fixed', 'top': 0, 'left': 0, 'width': '100%', 'height': '100%', | 'position': 'fixed', 'top': 0, 'left': 0, 'width': '100%', 'height': '100%', | ||
'background': 'rgba(0,0,0,0. | 'background': 'rgba(0,0,0,0.8)', 'backdrop-filter': 'blur(4px)', | ||
'z-index': '1000000', 'display': 'flex', 'align-items': 'center', 'justify-content': 'center', | 'z-index': '1000000', 'display': 'flex', 'align-items': 'center', 'justify-content': 'center', | ||
'opacity': '0', 'transition': 'opacity 0. | 'opacity': '0', 'transition': 'opacity 0.3s' | ||
}); | }); | ||
var $modal = $('<div id="mip- | var $modal = $('<div id="mip-sum-mod"></div>').css({ | ||
'background': '#fff', 'width': ' | 'background': '#fff', 'width': '88%', 'max-height': '80vh', 'padding': '20px', | ||
'border-radius': ' | 'border-radius': '12px', 'display': 'flex', 'flex-direction': 'column', | ||
'box-shadow': '0 10px 30px rgba(0,0,0,0.5)', 'transform': 'scale(0.9)', 'transition': '0.3s' | |||
}); | }); | ||
$modal.html(` | |||
<div style="font-weight:bold; color:#3498db; border-bottom:1px solid #eee; padding-bottom:10px; margin-bottom:15px; font-size:16px;">📌 Intisari Mippedia</div> | |||
<div id="mip-typing-area" style="color:#333; line-height:1.6; font-size:14px; overflow-y:auto; flex-grow:1; white-space: pre-wrap; font-family: sans-serif;"></div> | |||
<div id="mip-close" style="margin-top:15px; padding-top:10px; border-top:1px solid #eee; text-align:center; color:#e74c3c; font-weight:bold; cursor:pointer; font-size:14px;">Tutup</div> | |||
`); | |||
$overlay.append($modal); | $overlay.append($modal); | ||
$('body').append($overlay); | $('body').append($overlay); | ||
setTimeout(function() { | |||
setTimeout(function() { | $overlay.css('opacity', '1'); | ||
$overlay.css('opacity', '1'); | $modal.css('transform', 'scale(1)'); | ||
$modal.css( | }, 50); | ||
}, | |||
// | // FUNGSI TYPING (Muncul satu per satu huruf) | ||
var i = 0; | var i = 0; | ||
function | var speed = 25; // Makin kecil makin cepet | ||
if (i < | function typeWriter() { | ||
if (i < fullText.length) { | |||
document.getElementById("mip-typing-area").innerHTML += fullText.charAt(i); | |||
i++; | i++; | ||
setTimeout( | // Auto-scroll ke bawah pas ngetik biar gak ilang | ||
var area = document.getElementById("mip-typing-area"); | |||
area.scrollTop = area.scrollHeight; | |||
setTimeout(typeWriter, speed); | |||
} | } | ||
} | } | ||
setTimeout( | setTimeout(typeWriter, 500); | ||
// Close | // Close | ||
$('#mip-close | $('#mip-close, #mip-sum-ov').on('click', function(e) { | ||
if (e.target !== this) return; | if (e.target !== this) return; | ||
$overlay.css('opacity', '0'); | $overlay.css('opacity', '0'); | ||
setTimeout(function() { $overlay.remove(); }, 300); | |||
setTimeout(function() { $overlay.remove(); }, | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||
})(); | })(); | ||