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
 
(Aynı kullanıcının aradaki diğer 3 değişikliği gösterilmiyor)
1. satır: 1. satır:
$(function() {
$(function() {
     // 1. SOSYAL MEDYA LİNKLERİ (ORJİNAL KODUNUZ)
     // 1. SOSYAL MEDYA LİNKLERİ
     var links = [
     var links = [
         {  
         {  
             icon: '//videoliq.com.tr/images/d/dd/Discord.png?20250402213537',
             icon: '//ansiklopedi.videoliq.com.tr/images/d/dd/Discord.png?20250402213537',
             text: 'Discord',  
             text: 'Discord',  
             url: 'https://discord.gg/a4jGxPkHTc'  
             url: 'https://discord.gg/a4jGxPkHTc'  
13. satır: 13. satır:
         },
         },
         {
         {
             icon: '//videoliq.com.tr/images/7/76/Sitwatch.png?20250402214911',
             icon: '//ansiklopedi.videoliq.com.tr/images/7/76/Sitwatch.png?20250402214911',
             text: 'SitWatch',
             text: 'SitWatch',
             url: 'https://sitwatch.net/profile/EncyclopediaKorna'
             url: 'https://sitwatch.net/profile/EncyclopediaKorna'
24. satır: 24. satır:
     ];
     ];


     // 2. SOSYAL MEDYA BARINI OLUŞTUR
     // 2. SOSYAL MEDYA BARINI OLUŞTUR VE EKLE (EKSİK OLAN KISIM)
     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>', {  
             .append($('<img>', { src: link.icon, alt: link.text }))
                src: link.icon,  
                alt: link.text,
                loading: 'lazy'
            }))
             .append(link.text)
             .append(link.text)
         );
         );
     });
     });


     // 3. MEDIAVIEWER DÜZELTMESİ (GÜNCELLENMİŞ)
     $socialBar.append($linksContainer);
     function initMediaViewer() {
     $('#firstHeading').before($socialBar); // BU SATIR EKLENDİ
        $('a.image').off('click').on('click', function(e) {
 
            e.preventDefault();
    // 3. MEDIAVIEWER AYARLARI
            var $this = $(this);
    $(document).on('click', 'a.image', function(e) {
            var imgSrc = $this.find('img').attr('src') || $this.attr('href');
        e.preventDefault();
           
        e.stopPropagation();
            // GÜNCEL MEDIAVIEWER API KULLANIMI
       
            mw.loader.using('mmv').then(function() {
        var imgUrl = $(this).attr('href').replace('/Dosya:', '/File:');
                if (mw.mmv && mw.mmv.lightboxbox) {
       
                    mw.mmv.lightboxbox.open(imgSrc);
        mw.loader.using(['mmv'], function() {
                } else if (mw.mmv && mw.mmv.openImage) {
            if (mw.mmv && mw.mmv.lightboxbox) {
                    mw.mmv.openImage(imgSrc); // Eski sürümler için
                mw.mmv.lightboxbox.open(imgUrl);
                } else {
            } else {
                    window.location.href = $this.attr('href'); // Fallback
                window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
                }
            }
            }).catch(function() {
        }, function() {
                window.location.href = $this.attr('href'); // Fallback
            window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
            });
         });
         });
    }
    // 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);
     });
     });
});
});

18.51, 14 Nisan 2025 itibarı ile sayfanın şu anki hâli

$(function() {
    // 1. SOSYAL MEDYA LİNKLERİ
    var links = [
        { 
            icon: '//ansiklopedi.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: '//ansiklopedi.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 VE EKLE (EKSİK OLAN KISIM)
    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)
        );
    });

    $socialBar.append($linksContainer);
    $('#firstHeading').before($socialBar); // BU SATIR EKLENDİ

    // 3. MEDIAVIEWER AYARLARI
    $(document).on('click', 'a.image', function(e) {
        e.preventDefault();
        e.stopPropagation();
        
        var imgUrl = $(this).attr('href').replace('/Dosya:', '/File:');
        
        mw.loader.using(['mmv'], function() {
            if (mw.mmv && mw.mmv.lightboxbox) {
                mw.mmv.lightboxbox.open(imgUrl);
            } else {
                window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
            }
        }, function() {
            window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
        });
    });
});