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

Z TEST Wiki
Ofara (diskuse | příspěvky)
Bez shrnutí editace
značka: revertováno
Ofara (diskuse | příspěvky)
Bez shrnutí editace
značka: revertováno
Řádek 39: Řádek 39:
   });
   });
});
});
alert('Common.js funguje!');

Verze z 9. 6. 2025, 09:46

/* 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', 'mediawiki.util'], function () {
  $(function () {
    // Funkce, která přepíše stylování tlačítek
    function styleAFTButtons() {
      $('.articleFeedbackv5 .articleFeedbackv5-button-placeholder.ui-button').each(function () {
        $(this).css({
          'background-color': '#0052cc',
          'color': '#ffffff',
          'font-weight': 'bold',
          'border': 'none',
          'border-radius': '4px',
          'padding': '8px 16px',
          'box-shadow': '0 2px 4px rgba(0, 0, 0, 0.1)',
          'text-decoration': 'none'
        });
      });
    }

    // Spuštění po načtení obsahu stránky
    mw.hook('wikipage.content').add(function () {
      // Počkej až se načte i ArticleFeedbackV5 widget
      setTimeout(styleAFTButtons, 500); // lze zvýšit na 1000ms pokud potřeba
    });
  });
});

alert('Common.js funguje!');