MediaWiki:Common.js: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
m test
Tag: Reverted
Undo revision 3327 by 76561198021843184 (talk)
Tag: Undo
Line 22: Line 22:
   );
   );
});
});
/**************************
* Start Sidebar icons    *
**************************/
#p-SFK.mw-portlet .mw-list-item a span:before {
content: '';
display: inline-block;
vertical-align: bottom;
height: 1.3em;
width: 1.3em;
background-size: contain;
background-repeat: no-repeat;
margin: 0 0.3em;
}
.mw-portlet #n-Factions span:before {
background-image: url(/images/mbhh_homm/c/c0/Human_icon.png);
}
.mw-portlet #n-Heroes span:before {
background-image: url(/images/mbhh_sfki/1/13/Frontpage-hero.png);
}
.mw-portlet #n-Characters span:before {
background-image: url(/images/mbhh_sfki/1/15/Frontpage-star.png);
}
.mw-portlet #n-Kingdoms span:before {
background-image: url(/images/mbhh_sfki/8/88/Frontpage-beer.png);
}
.mw-portlet #n-Resources span:before {
background-image: url(/images/mbhh_sfki/3/39/Frontpage-resources.png);
}
/**************************
* End Sidebar icons      *
**************************/

Revision as of 13:15, 29 October 2025

/* Any JavaScript here will be loaded for all users on every page load. */

$(function() {
  var $box = $('#spellboxv-display');
  $('.spell-link').hover(
    function() {
      var spellName = $(this).data('spell');
      var apiUrl = mw.util.wikiScript('api');
      $.post(apiUrl, {
        action: 'parse',
        format: 'json',
        text: '{{#invoke:SpellTableUtil|spellBoxV|name=' + spellName + '}}',
        contentmodel: 'wikitext'
      }, function(data) {
        var html = data.parse.text['*'];
        $box.html(html).show();
      });
    },
    function() {
      $box.hide().empty();
    }
  );
});