Last active
August 29, 2015 14:14
-
-
Save jdlrobson/eca5ef61261ffd39cf9f to your computer and use it in GitHub Desktop.
Populate a list of categories on MobileFrontend - run this in your console
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
function makeStockContent( titles, content ) { | |
var M = mw.mobileFrontend; | |
mw.loader.using( 'mobile.editor.api').done( function() { | |
var EditorApi = M.require( 'modules/editor/EditorApi' ); | |
titles.forEach( function( title ) { | |
var api = new EditorApi( { | |
title: title, | |
isNewPage: true | |
} ); | |
api.setContent( content ); | |
api.save(); | |
} ); | |
} ); | |
} | |
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
var titles = []; | |
for(var i=0; i < possible.length; i++ ) { | |
titles.push(possible[i] + ' category test' ); | |
} | |
makeStockContent( titles, '[[Category:Test]]' ); | |
makeStockContent( [ 'Category:Test' ], 'Testing.' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment