MediaWiki:Gadget-idle-util.js
From Idle Clans wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/** * Create a checkbox widget with an optional label and selected * state. * * @param {boolean} [selected] * Optionally, whether the checkbox is selected. * @param {string} [label] * Optionally, the label for the checkbox. * * @returns {OO.ui.CheckboxInputWidget|OO.ui.FieldLayout} * The checkbox widget, or a field layout with the checkbox * and the label. */ checkbox: function(selected, label) { var checkbox = new OO.ui.CheckboxInputWidget({ selected: selected }); if (label !== undefined && typeof label === 'string') { return new OO.ui.FieldLayout(checkbox, { label: label, align: 'inline' }); } return checkbox; }, /** * Create a toggle switch widget with an optional initial state. * * @param {boolean} [switched] * Optionally, whether the switch is on. * * @returns {OO.ui.ToggleSwitchWidget} * The toggle switch widget. */ switch: function(switched) { switched = switched || false; return new OO.ui.ToggleSwitchWidget({ value: switched }); } } } })(window.jQuery, window.mw, window.idleClans = window.idleClans || {});