This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Webpack configuration to transpile banana-i18n to ES5. Run: | |
// $ npm i -D webpack webpack-cli @babel/core @babel/preset-env babel-loader | |
// $ npx webpack | |
// Find output in dist/banana-i18n.js | |
const path = require('path') | |
const TerserPlugin = require('terser-webpack-plugin') | |
module.exports = { | |
mode: 'production', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Webpack configuration to transpile ES module library to MW environment | |
// Run: | |
// $ npm i -D webpack webpack-cli @babel/core @babel/preset-env babel-loader | |
// $ npx webpack | |
// Find output in dist/banana-i18n.js | |
const path = require('path') | |
const TerserPlugin = require('terser-webpack-plugin') | |
module.exports = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env node, es2021 */ | |
/* eslint-disable */ | |
// Serves the script from localhost for development purposes. | |
const http = require('http'); | |
const fs = require('fs/promises'); | |
const argv = require('minimist')(process.argv); | |
async function readFile(path) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mediawiki | |
WORKDIR /var/www | |
RUN rm -rf html | |
WORKDIR /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env es6 */ | |
class ApiManager { | |
constructor(config = {}) { | |
this.userAgent = config.userAgent ?? 'New-Morebits.js'; | |
this.defaultParams = $.extend({ | |
action: 'query', | |
format: 'json', | |
formatversion: '2', | |
assert: 'user', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TwinkleModule { | |
attachMenu() { | |
Twinkle.addPortletLink(this.makeWindow, this.portletName, this.portletId, this.portletTooltip) | |
} | |
} | |
// Init: Twinkle.addInitCallback(function() { new Twinkle(); }, 'Tag'); | |
class Tag extends TwinkleModule { | |
// Override to change modes available, | |
// each mode is a class extending TagMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to run: copy paste to console in a tab with WP open | |
Morebits.taskManager = function () { | |
this.taskDependencyMap = new Map(); | |
this.deferreds = new Map(); | |
this.allDeferreds = []; // Hack: IE doesn't support Map.prototype.values | |
/** | |
* Register a task along with its dependencies (tasks which should have finished | |
* execution before we can begin this one). Each task is a function that must return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************** Morebits.date ********************/ | |
/** | |
* @constructor | |
* Create a date object. MediaWiki timestamp format is also acceptable, | |
* in addition to everything that JS Date() accepts. | |
*/ | |
Morebits.date = function() { | |
var args = Array.prototype.slice.call(arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Declare fallbacks | |
Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; | |
Date.monthNamesAbbrev = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
$.ajax({ | |
url: mw.util.wikiScript('api'), | |
data: $.param({ action: 'query', format: 'json', utf8: 'y', meta: 'allmessages', | |
ammessages: 'january|february|march|april|may|june|july|august|september|october|november|december' + | |
'|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec', | |
amlang: mw.config.get('wgContentLanguage') |