MediaWiki:Gadget-StickyTableHeaders.js - Vikipedi
İçeriğe atla
Ana menü
Gezinti
  • Anasayfa
  • Hakkımızda
  • İçindekiler
  • Rastgele madde
  • Seçkin içerik
  • Yakınımdakiler
Katılım
  • Deneme tahtası
  • Köy çeşmesi
  • Son değişiklikler
  • Dosya yükle
  • Topluluk portalı
  • Wikimedia dükkânı
  • Yardım
  • Özel sayfalar
Vikipedi Özgür Ansiklopedi
Ara
  • Bağış yapın
  • Hesap oluştur
  • Oturum aç
  • Bağış yapın
  • Hesap oluştur
  • Oturum aç

MediaWiki:Gadget-StickyTableHeaders.js

  • Arayüz metni
  • Tartışma
  • Oku
  • Kaynağı gör
  • Geçmişi gör
Araçlar
Eylemler
  • Oku
  • Kaynağı gör
  • Geçmişi gör
Genel
  • Sayfaya bağlantılar
  • İlgili değişiklikler
  • Kalıcı bağlantı
  • Sayfa bilgisi
  • Kısaltılmış URL'yi al
  • Karekodu indir
Yazdır/dışa aktar
  • Bir kitap oluştur
  • PDF olarak indir
  • Basılmaya uygun görünüm
Diğer projelerde
Görünüm
Vikipedi, özgür ansiklopedi

Not: Sayfayı kaydettikten sonra değişiklikleri görebilmek için tarayıcınızın önbelleğinizi temizlemeniz gerekir. Google Chrome, Firefox, Microsoft Edge ve Safari: ⇧ Shift tuşuna basılı tutun ve Yeniden Yükle araç çubuğu düğmesine tıklayın. Ayrıntılar ve diğer tarayıcılara yönelik yönergeler için Vikipedi:Önbelleğinizi atlayın sayfasını inceleyin.

/**
 * Find all header rows in a thead-less table and put them in a <thead> tag.
 * This only treats a row as a header row if it contains only <th>s (no <td>s)
 * and if it is preceded entirely by header rows. The algorithm stops when
 * it encounters the first non-header row.
 *
 * After this, it will look at all rows at the bottom for footer rows
 * And place these in a tfoot using similar rules.
 * 
 * This function was copied from MediaWiki's jquery.tablesorter module
 * @param {jQuery} $table object for a <table>
 */
function emulateTHeadAndFoot( $table ) {
	var $thead, $tfoot, i, len,
		$rows = $table.find( '> tbody > tr' );
	if ( !$table.get( 0 ).tHead ) {
		$thead = $( '<thead>' );
		$rows.each( function () {
			if ( $( this ).children( 'td' ).length ) {
				// This row contains a <td>, so it's not a header row
				// Stop here
				return false;
			}
			$thead.append( this );
		} );
		$table.find( ' > tbody:first' ).before( $thead );
	}
	if ( !$table.get( 0 ).tFoot ) {
		$tfoot = $( '<tfoot>' );
		len = $rows.length;
		for ( i = len - 1; i >= 0; i-- ) {
			if ( $( $rows[ i ] ).children( 'td' ).length ) {
				break;
			}
			$tfoot.prepend( $( $rows[ i ] ) );
		}
		$table.append( $tfoot );
	}
}

mw.hook('wikipage.content').add( function( $content ) {
	// Do this for wikitable, but sortable does it on it's own already
	$content.find('.wikitable:not(.sortable) ').each( function ( i, table ) {
		if ( table.tBodies && !table.tHead ) {
			// No thead found. Look for rows with <th>s and
			// move them into a <thead> tag or a <tfoot> tag
			emulateTHeadAndFoot( $(table).addClass('mw-sticky-header') );
		}
	} );
} );
"https://tr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-StickyTableHeaders.js&oldid=26320557" sayfasından alınmıştır
  • Sayfa en son 16.23, 12 Ekim 2021 tarihinde değiştirildi.
  • Metin Creative Commons Atıf-AynıLisanslaPaylaş Lisansı altındadır ve ek koşullar uygulanabilir. Bu siteyi kullanarak Kullanım Şartlarını ve Gizlilik Politikasını kabul etmiş olursunuz.
    Vikipedi® (ve Wikipedia®) kâr amacı gütmeyen kuruluş olan Wikimedia Foundation, Inc. tescilli markasıdır.
  • Gizlilik politikası
  • Vikipedi hakkında
  • Sorumluluk reddi
  • Davranış Kuralları
  • Geliştiriciler
  • İstatistikler
  • Çerez politikası
  • Mobil görünüm
  • Wikimedia Foundation
  • Powered by MediaWiki
MediaWiki:Gadget-StickyTableHeaders.js
Konu ekle