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İ (ORJİNAL KODUNUZ) | ||
var links = [ | var links = [ | ||
{ | { | ||
24. satır: | 24. satır: | ||
]; | ]; | ||
// | // 2. SOSYAL MEDYA BARINI OLUŞTUR | ||
var $socialBar = $('<div id="korna-social-header"></div>'); | var $socialBar = $('<div id="korna-social-header"></div>'); | ||
var $linksContainer = $('<div id="korna-social-links"></div>'); | var $linksContainer = $('<div id="korna-social-links"></div>'); | ||
33. satır: | 33. satır: | ||
href: link.url, | href: link.url, | ||
title: link.text, | title: link.text, | ||
target: '_blank' | target: '_blank', | ||
rel: 'noopener noreferrer' | |||
}) | }) | ||
.append($('<img>', { src: link.icon, alt: link.text })) | .append($('<img>', { | ||
src: link.icon, | |||
alt: link.text, | |||
loading: 'lazy' | |||
})) | |||
.append(link.text) | .append(link.text) | ||
); | ); | ||
}); | }); | ||
// | // 3. MEDIAVIEWER DÜZELTMESİ (GÜNCELLENMİŞ) | ||
function initMediaViewer() { | function initMediaViewer() { | ||
$('a.image').off('click').on('click', function(e) { | $('a.image').off('click').on('click', function(e) { | ||
47. satır: | 52. satır: | ||
var imgSrc = $this.find('img').attr('src') || $this.attr('href'); | var imgSrc = $this.find('img').attr('src') || $this.attr('href'); | ||
// | // GÜNCEL MEDIAVIEWER API KULLANIMI | ||
if (mw.mmv) { | mw.loader.using('mmv').then(function() { | ||
if (mw.mmv && mw.mmv.lightboxbox) { | |||
mw.mmv.lightboxbox.open(imgSrc); | |||
} else if (mw.mmv && mw.mmv.openImage) { | |||
mw.mmv.openImage(imgSrc); | mw.mmv.openImage(imgSrc); // Eski sürümler için | ||
}).catch(function() { | } else { | ||
window.location.href = $this.attr('href'); // Fallback | |||
} | |||
}).catch(function() { | |||
window.location.href = $this.attr('href'); // Fallback | |||
}); | |||
}); | }); | ||
} | } | ||
// | // 4. SAYFA YÜKLENDİĞİNDE ÇALIŞTIR | ||
$socialBar.append($linksContainer); | $socialBar.append($linksContainer); | ||
$('#firstHeading').before($socialBar); | $('#firstHeading').before($socialBar); | ||
// | // MEDIAVIEWER İNİT (YENİ YÖNTEM) | ||
setTimeout(initMediaViewer, | mw.loader.using('mmv').then(function() { | ||
initMediaViewer(); | |||
}).catch(function() { | |||
console.warn('MediaViewer yüklenemedi, 2. deneme...'); | |||
setTimeout(initMediaViewer, 1000); | |||
}); | |||
}); | }); |
21.38, 3 Nisan 2025 tarihindeki hâli
$(function() { // 1. SOSYAL MEDYA LİNKLERİ (ORJİNAL KODUNUZ) 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', rel: 'noopener noreferrer' }) .append($('<img>', { src: link.icon, alt: link.text, loading: 'lazy' })) .append(link.text) ); }); // 3. MEDIAVIEWER DÜZELTMESİ (GÜNCELLENMİŞ) function initMediaViewer() { $('a.image').off('click').on('click', function(e) { e.preventDefault(); var $this = $(this); var imgSrc = $this.find('img').attr('src') || $this.attr('href'); // GÜNCEL MEDIAVIEWER API KULLANIMI mw.loader.using('mmv').then(function() { if (mw.mmv && mw.mmv.lightboxbox) { mw.mmv.lightboxbox.open(imgSrc); } else if (mw.mmv && mw.mmv.openImage) { mw.mmv.openImage(imgSrc); // Eski sürümler için } else { window.location.href = $this.attr('href'); // Fallback } }).catch(function() { window.location.href = $this.attr('href'); // Fallback }); }); } // 4. SAYFA YÜKLENDİĞİNDE ÇALIŞTIR $socialBar.append($linksContainer); $('#firstHeading').before($socialBar); // MEDIAVIEWER İNİT (YENİ YÖNTEM) mw.loader.using('mmv').then(function() { initMediaViewer(); }).catch(function() { console.warn('MediaViewer yüklenemedi, 2. deneme...'); setTimeout(initMediaViewer, 1000); }); });