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

Z TEST Wiki
Ofara (diskuse | příspěvky)
Bez shrnutí editace
značka: ruční vrácení zpět
Ofara (diskuse | příspěvky)
Bez shrnutí editace
Řádek 12: Řádek 12:
         }
         }
     }
     }
});
mw.loader.using(['jquery'], function () {
  $(function () {
    function forceEnableAFTv5Buttons() {
      $('.articleFeedbackv5-button-placeholder.ui-button').each(function () {
        const $btn = $(this);
        $btn.removeClass('ui-state-disabled');
        $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'
        });
      });
    }
    // 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:15

/* 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);
        }
    }
});

mw.loader.using(['jquery'], function () {
  $(function () {
    function forceEnableAFTv5Buttons() {
      $('.articleFeedbackv5-button-placeholder.ui-button').each(function () {
        const $btn = $(this);
        $btn.removeClass('ui-state-disabled');
        $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'
        });
      });
    }

    // 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);
  });
});