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
40. satır: 40. satır:
     });
     });


    // 3. MEDIAVIEWER AYARLARI (GÜNCELLENMİŞ)
      $(document).on('click', 'a.image', function(e) {
    function handleImageClick(e) {
         e.preventDefault();
         e.preventDefault();
         var $link = $(this);
         e.stopPropagation(); // Çift tetiklemeyi engelle
        var imageUrl = $link.attr('href');
          
          
         // Eğer URL dosya sayfasına işaret ediyorsa, direkt resim URL'sini al
         var imgUrl = $(this).attr('href');
        if (imageUrl.includes('/Dosya:')) {
            imageUrl = imageUrl.replace('/index.php/Dosya:', '/images/').replace('/Dosya:', '/');
        }
          
          
         // MediaViewer'ı dene
        // URL düzenleme (Dosya: → File:)
         mw.loader.using('mmv').then(function() {
        imgUrl = imgUrl.replace('/Dosya:', '/File:');
       
         // MediaViewer kontrolü
         mw.loader.using(['mmv'], function() {
             if (mw.mmv && mw.mmv.lightboxbox) {
             if (mw.mmv && mw.mmv.lightboxbox) {
                 mw.mmv.lightboxbox.open(imageUrl);
                 mw.mmv.lightboxbox.open(imgUrl);
             } else {
             } else {
                 // Fallback: Resmi yeni sekmede
                 // Fallback: Resmi doğrudan
                 window.open(imageUrl, '_blank');
                 window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
             }
             }
         }).catch(function() {
         }, function() {
             // Fallback 2: Orjinal linke git
             // Eğer MediaViewer yüklenemezse
             window.location.href = $link.attr('href');
             window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
         });
         });
    }
    // 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);
     });
     });
});
});

21.43, 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)
        );
    });

       $(document).on('click', 'a.image', function(e) {
        e.preventDefault();
        e.stopPropagation(); // Çift tetiklemeyi engelle
        
        var imgUrl = $(this).attr('href');
        
        // URL düzenleme (Dosya: → File:)
        imgUrl = imgUrl.replace('/Dosya:', '/File:');
        
        // MediaViewer kontrolü
        mw.loader.using(['mmv'], function() {
            if (mw.mmv && mw.mmv.lightboxbox) {
                mw.mmv.lightboxbox.open(imgUrl);
            } else {
                // Fallback: Resmi doğrudan aç
                window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
            }
        }, function() {
            // Eğer MediaViewer yüklenemezse
            window.open(imgUrl.replace('/index.php/File:', '/images/'), '_self');
        });
    });
});