Line 252: |
Line 252: |
| if ($tables.length == 0) return; | | if ($tables.length == 0) return; |
| | | |
− | $tables.each(function() { | + | $tables.each(function(n) { |
| if ($(this).hasClass('header-fixed-done')) return; | | if ($(this).hasClass('header-fixed-done')) return; |
| if ($(this).hasClass('mw-collapsed')) { | | if ($(this).hasClass('mw-collapsed')) { |
| + | console.debug('header-fixed: collapsed: ' + n) |
| $(this).find('.mw-collapsible-text').click(function() { | | $(this).find('.mw-collapsible-text').click(function() { |
− | setTimeout(function() { initializeStickyHeader(); }, 500); | + | console.debug('header-fixed: click: ' + n) |
| + | setTimeout(function() { initializeStickyHeader(); }, 1000); |
| }) | | }) |
| return; | | return; |
Line 303: |
Line 305: |
| */ | | */ |
| $(this).addClass('header-fixed-done'); | | $(this).addClass('header-fixed-done'); |
| + | console.debug('header-fixed: fixed: ' + n) |
| }); | | }); |
| } | | } |
Line 329: |
Line 332: |
| } | | } |
| */ | | */ |
− | initializeStickyHeader(); | + | setTimeout(function() { initializeStickyHeader(); }, 1000); |
| //}) | | //}) |
| + | |
| + | // Basic video support using <img> and <video> elements |
| + | |
| + | $('.video').each(function () { |
| + | var src = $(this).data('src') || ''; |
| + | var parts = src.split('.'); |
| + | var ext = parts[parts.length - 1] || ''; |
| + | if (ext === 'webp') { |
| + | var a = $('<a>').addClass('image').attr('href', '/File:' + src); |
| + | var img = $('<img>'); |
| + | for (var attr in $(this).data()) { |
| + | img.attr(attr, (attr === 'src' ? 'https://en.kancollewiki.net/Special:Filepath/' : '') + $(this).data(attr)); |
| + | } |
| + | a.append(img); |
| + | $(this).append(a); |
| + | } else { |
| + | var video = $('<video>').attr('controls', ''); |
| + | var source = $('<source>').attr('type', 'video/' + ext); |
| + | for (var attr in $(this).data()) { |
| + | var el = attr === 'src' || attr === 'type' ? source : video; |
| + | el.attr(attr, (attr === 'src' ? 'https://en.kancollewiki.net/Special:Filepath/' : '') + $(this).data(attr)); |
| + | } |
| + | video.append(source); |
| + | $(this).append(video); |
| + | } |
| + | }); |
| + | |
| }); | | }); |