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 117: | Baris 117: | ||
$('.wiki-preview').remove(); | $('.wiki-preview').remove(); | ||
}); | }); | ||
} | |||
}); | |||
/* Smart Search Overlay - Spesialis Mobile */ | |||
$(document).ready(function() { | |||
// Cari tombol search bawaan (ikon kaca pembesar) | |||
var searchBtn = $('#searchIcon, .mw-ui-icon-minerva-search'); | |||
if (searchBtn.length) { | |||
searchBtn.click(function(e) { | |||
// Cegah buka halaman search standar kalau di HP | |||
if ($(window).width() < 768) { | |||
e.preventDefault(); | |||
showSearchOverlay(); | |||
} | |||
}); | |||
} | |||
function showSearchOverlay() { | |||
var overlayHtml = '<div id="custom-search-overlay" style="position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(255,255,255,0.98); z-index:20000; display:flex; flex-direction:column; align-items:center; padding-top:50px; opacity:0; transition:all 0.4s ease;">' + | |||
'<div id="close-search" style="position:absolute; top:20px; right:20px; font-size:30px; cursor:pointer; color:#333;">×</div>' + | |||
'<h2 style="margin-bottom:20px; color:#36c; font-family:sans-serif;">Cari di Mippedia</h2>' + | |||
'<form action="/w/index.php" method="get" style="width:85%;">' + | |||
'<input type="hidden" name="title" value="Istimewa:Pencarian">' + | |||
'<input type="search" name="search" placeholder="Ketik kata kunci..." autofocus style="width:100%; padding:15px; border:2px solid #36c; border-radius:30px; font-size:18px; outline:none; box-shadow:0 4px 10px rgba(54,102,204,0.1);">' + | |||
'<button type="submit" style="margin-top:20px; width:100%; background:#36c; color:#fff; border:none; padding:12px; border-radius:30px; font-weight:bold; font-size:16px;">Cari Sekarang</button>' + | |||
'</form>' + | |||
'</div>'; | |||
if ($('#custom-search-overlay').length === 0) { | |||
$('body').append(overlayHtml); | |||
// Animasi masuk | |||
setTimeout(function() { | |||
$('#custom-search-overlay').css('opacity', '1'); | |||
}, 10); | |||
// Fungsi tutup | |||
$('#close-search, #custom-search-overlay').click(function(e) { | |||
if (e.target !== this && e.target.id !== 'close-search') return; | |||
$('#custom-search-overlay').css('opacity', '0'); | |||
setTimeout(function() { $('#custom-search-overlay').remove(); }, 400); | |||
}); | |||
} | |||
} | } | ||
}); | }); | ||