Last modified: 2013-03-14 13:28:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37084, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35084 - Add helper function to get the current wikicode of a page
Add helper function to get the current wikicode of a page
Status: NEW
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.19
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-09 15:32 UTC by Helder
Modified: 2013-03-14 13:28 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Helder 2012-03-09 15:32:15 UTC
Something like
https://en.wikipedia.org/w/index.php?title=Wikipedia:WikiProject_User_scripts/Guide/Ajax&oldid=480523778#Get_the_wikicode_of_a_page
could be made available on some of the mediawiki.api*** modules.
Comment 1 Krinkle 2012-03-10 14:05:10 UTC
I've added an alternative (shorter) method:

function ok (wikitext) { /* .. */ console.log(wikitext); }
function err () { /* .. */ console.log('err', arguments); }

$.getJSON(mw.util.wikiScript('api'), 'format=json&action=query&prop=revisions&rvprop=content&rvlimit=1&titles=User:Krinkle', function (data) {
  try { for ( var page in data.query.pages ) {
    var wikitext = data.query.pages[page].revisions[0]['*'];
    ok(wikitext);
  } } catch (e) {
    err(e);
  }
}).fail(err);

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links