MediaWiki:Common.js: Porovnání verzí

Z TEST Wiki
Ofara (diskuse | příspěvky)
Bez shrnutí editace
Ofara (diskuse | příspěvky)
Bez shrnutí editace
Řádek 14: Řádek 14:
});
});


mw.loader.using(['jquery'], function () {
$(function () {
   $(function () {
   mw.loader.using('ext.articleFeedbackv5').then(function () {
    function forceEnableAFTv5Buttons() {
    setTimeout(function () {
      $('.articleFeedbackv5-button-placeholder.ui-button').each(function () {
      $('.articleFeedbackv5-submit').css({
        const $btn = $(this);
        'background-color': 'red',
        $btn.removeClass('ui-state-disabled');
         'color': 'white'
        $btn.attr('aria-disabled', 'false');
        $btn.removeAttr('aria-disabled');
        $btn.css({
          'opacity': '1',
          'pointer-events': 'auto',
          'background-color': '#0052cc',
          'color': '#ffffff',
          'border': 'none',
          'box-shadow': '0 2px 4px rgba(0,0,0,0.1)',
          'font-weight': 'bold',
          'border-radius': '4px',
          'padding': '8px 16px',
          'cursor': 'pointer'
        });
 
         $btn.find('.ui-button-text').css({
          'opacity': '1',
          'color': '#ffffff'
        });
       });
       });
     }
     }, 1000); // můžeš upravit čas dle potřeby
 
    // Pro jistotu zkus opakovaně (AFTv5 se spouští pozdě)
    let tries = 0;
    const interval = setInterval(function () {
      if ($('.articleFeedbackv5-button-placeholder.ui-button').length > 0) {
        forceEnableAFTv5Buttons();
        clearInterval(interval);
      }
      if (++tries > 10) {
        clearInterval(interval); // po 10 pokusech (cca 3s) končíme
      }
    }, 300);
   });
   });
});
});

Verze z 9. 6. 2025, 11:21

/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky */
$(document).ready(function() {
    var searchForm = $("#searchform");
    if (searchForm.length > 0) {
        var searchInput = searchForm.find("input[name='search']");
        if (searchInput.length > 0) {
            var currentAction = searchForm.attr("action");

            // Přepíšeme `profile=default` na `profile=all`
            var newAction = currentAction.replace("profile=default", "profile=all");
            searchForm.attr("action", newAction);
        }
    }
});

$(function () {
  mw.loader.using('ext.articleFeedbackv5').then(function () {
    setTimeout(function () {
      $('.articleFeedbackv5-submit').css({
        'background-color': 'red',
        'color': 'white'
      });
    }, 1000); // můžeš upravit čas dle potřeby
  });
});