tagliatelle

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

thumbnails.js (2434B)


      1 function showTab(tabName) {
      2     // Hide all content
      3     document.getElementById('content-missing').style.display = 'none';
      4     document.getElementById('content-all').style.display = 'none';
      5 
      6     // Remove active styling from all tabs
      7     document.getElementById('tab-missing').style.borderBottomColor = 'transparent';
      8     document.getElementById('tab-missing').style.fontWeight = 'normal';
      9     document.getElementById('tab-all').style.borderBottomColor = 'transparent';
     10     document.getElementById('tab-all').style.fontWeight = 'normal';
     11 
     12     // Show selected content and style tab
     13     document.getElementById('content-' + tabName).style.display = 'block';
     14     document.getElementById('tab-' + tabName).style.borderBottomColor = '#007bff';
     15     document.getElementById('tab-' + tabName).style.fontWeight = 'bold';
     16 }
     17 
     18 autoHideSuccessMessages();
     19 
     20 // Add video preview on hover
     21 document.querySelectorAll('video').forEach(video => {
     22     video.addEventListener('mouseenter', function() {
     23         this.play();
     24     });
     25     video.addEventListener('mouseleave', function() {
     26         this.pause();
     27         this.currentTime = 0;
     28     });
     29 });
     30 
     31 // Add timestamp helper
     32 document.querySelectorAll('input[name="timestamp"]').forEach(input => {
     33     const video = input.closest('div[style*="border"]').querySelector('video');
     34     if (video) {
     35         input.addEventListener('focus', function() {
     36             video.play();
     37         });
     38 
     39         // Click on video to set current time as timestamp
     40         video.addEventListener('click', function(e) {
     41             e.preventDefault();
     42             const currentTime = this.currentTime;
     43             const hours = Math.floor(currentTime / 3600);
     44             const minutes = Math.floor((currentTime % 3600) / 60);
     45             const seconds = Math.floor(currentTime % 60);
     46             const formatted = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
     47             const timestampInput = this.closest('div[style*="border"]').querySelector('input[name="timestamp"]');
     48             if (timestampInput) {
     49                 timestampInput.value = formatted;
     50                 // Flash the input to show it updated
     51                 timestampInput.style.backgroundColor = '#ffffcc';
     52                 setTimeout(() => {
     53                     timestampInput.style.backgroundColor = '';
     54                 }, 500);
     55             }
     56             this.pause();
     57         });
     58     }
     59 });