MediaWiki:Common.js: Revizyonlar arasındaki fark
korna ansiklopedisi sitesinden
Gezinti kısmına atlaArama kısmına atla
Değişiklik özeti yok |
Değişiklik özeti yok |
||
1. satır: | 1. satır: | ||
$(function() { | $(function() { | ||
// 1. SOSYAL MEDYA LİNKLERİ | // 1. SOSYAL MEDYA LİNKLERİ | ||
var links = [ | var links = [ | ||
{ | { | ||
33. satır: | 33. satır: | ||
href: link.url, | href: link.url, | ||
title: link.text, | title: link.text, | ||
target: '_blank | target: '_blank' | ||
}) | }) | ||
.append($('<img>', { | .append($('<img>', { src: link.icon, alt: link.text })) | ||
.append(link.text) | .append(link.text) | ||
); | ); | ||
}); | }); | ||
// 3. MEDIAVIEWER | // 3. MEDIAVIEWER AYARLARI (GÜNCELLENMİŞ) | ||
function | function handleImageClick(e) { | ||
e.preventDefault(); | |||
var $link = $(this); | |||
var imageUrl = $link.attr('href'); | |||
// Eğer URL dosya sayfasına işaret ediyorsa, direkt resim URL'sini al | |||
if (imageUrl.includes('/Dosya:')) { | |||
imageUrl = imageUrl.replace('/index.php/Dosya:', '/images/').replace('/Dosya:', '/'); | |||
} | |||
// MediaViewer'ı dene | |||
mw.loader.using('mmv').then(function() { | |||
if (mw.mmv && mw.mmv.lightboxbox) { | |||
mw.mmv.lightboxbox.open(imageUrl); | |||
} else { | |||
// Fallback: Resmi yeni sekmede aç | |||
window.open(imageUrl, '_blank'); | |||
} | |||
}).catch(function() { | |||
// Fallback 2: Orjinal linke git | |||
window.location.href = $link.attr('href'); | |||
}); | }); | ||
} | } | ||
71. satır: | 69. satır: | ||
$('#firstHeading').before($socialBar); | $('#firstHeading').before($socialBar); | ||
// | // Resim linklerini dinle | ||
$(document).on('click', 'a.image', handleImageClick); | |||
// MediaViewer yüklendikten sonra tekrar init et | |||
mw.loader.using('mmv').then(function() { | mw.loader.using('mmv').then(function() { | ||
$('a.image').off('click').on('click', handleImageClick); | |||
}); | }); | ||
}); | }); |
21.40, 3 Nisan 2025 tarihindeki hâli
$(function() { // 1. SOSYAL MEDYA LİNKLERİ var links = [ { icon: '//videoliq.com.tr/images/d/dd/Discord.png?20250402213537', text: 'Discord', url: 'https://discord.gg/a4jGxPkHTc' }, { icon: '//upload.wikimedia.org/wikipedia/commons/8/82/Telegram_logo.svg', text: 'Telegram', url: 'https://videoliq.com.tr/acmadik.php' }, { icon: '//videoliq.com.tr/images/7/76/Sitwatch.png?20250402214911', text: 'SitWatch', url: 'https://sitwatch.net/profile/EncyclopediaKorna' }, { icon: '//upload.wikimedia.org/wikipedia/commons/8/83/Steam_icon_logo.svg', text: 'Steam', url: 'https://videoliq.com.tr/acmadik.php' } ]; // 2. SOSYAL MEDYA BARINI OLUŞTUR var $socialBar = $('<div id="korna-social-header"></div>'); var $linksContainer = $('<div id="korna-social-links"></div>'); links.forEach(function(link) { $linksContainer.append( $('<a>', { href: link.url, title: link.text, target: '_blank' }) .append($('<img>', { src: link.icon, alt: link.text })) .append(link.text) ); }); // 3. MEDIAVIEWER AYARLARI (GÜNCELLENMİŞ) function handleImageClick(e) { e.preventDefault(); var $link = $(this); var imageUrl = $link.attr('href'); // Eğer URL dosya sayfasına işaret ediyorsa, direkt resim URL'sini al if (imageUrl.includes('/Dosya:')) { imageUrl = imageUrl.replace('/index.php/Dosya:', '/images/').replace('/Dosya:', '/'); } // MediaViewer'ı dene mw.loader.using('mmv').then(function() { if (mw.mmv && mw.mmv.lightboxbox) { mw.mmv.lightboxbox.open(imageUrl); } else { // Fallback: Resmi yeni sekmede aç window.open(imageUrl, '_blank'); } }).catch(function() { // Fallback 2: Orjinal linke git window.location.href = $link.attr('href'); }); } // 4. SAYFA YÜKLENDİĞİNDE ÇALIŞTIR $socialBar.append($linksContainer); $('#firstHeading').before($socialBar); // Resim linklerini dinle $(document).on('click', 'a.image', handleImageClick); // MediaViewer yüklendikten sonra tekrar init et mw.loader.using('mmv').then(function() { $('a.image').off('click').on('click', handleImageClick); }); });