Bureaucrats, editor, Interface administrators, Administrators (Semantic MediaWiki), Curators (Semantic MediaWiki), Editors (Semantic MediaWiki), Administrators
47,327
edits
(Created page with "/** * Infobox quantity script * Adds a number input box next to specific numbers in tables * Primary use case: the price in Infobox Item * * TODO: add infobox monster support (for what?) * * USAGE: * <td><span class="infobox-quantity" data-val-each="100" data-value="1"><span class="infobox-quantity-replace">100</span> coins</span></td> * Everything inside the td should be wrapped in the outer span, which has class=infobox-quantity and attr data-val-each=(value...") |
No edit summary |
||
Line 1:
"use strict";
/**
* Infobox quantity script
Line 20 ⟶ 22:
*
* originally based on [[User:Joeytje50/monstercalc.js]]
*/
$(function () {
}
}
▲ $rep.html(warn + rswiki.addCommas(each * val) + warn2);
▲ });
▲ /**
▲ * generic one-value calc
▲ * compatible with most (switch) infoboxes made with [[Module:Infobox]]
*/
▲ * Takes an argument `el` which must be a selector for the parent element, or the element itself.
▲ rswiki.initQtyBox = function(el) {
var $self = $(e);
▲ $(el).find('td > span.infobox-quantity').not(':has(input)').each(function(i,e){
▲ id: 'QtyCalc'+i,
▲ class: 'QtyCalc',
▲ type: 'number',
▲ value: $self.data('value') || '1',
▲ maxlength: '10',
}).css({
▲ min: '0',
▲ max: '9999999999',
});
▲ width: '65px',
};
▲ 'margin-right': '0.25em',
▲ .trigger('change');
▲ // init boxes in on the whole page
▲ rswiki.initQtyBox( $content );
|