user305883
user305883

Reputation: 1741

How to restyle Json from wikipedia api in mobile app?

I'd like to restyle part of wikipedia articles and embed these parts into mobile app.

I tried to use http://en.wikipedia.org/w/api.php?action=parse&format=json&page=New_York but text in json files contains formatting for mediawiki.

How to maintain links to other pages without a mediawiki platform, so that they are displayed within the mobile (or web) app? e.g.

e.g.

<a href="/wiki/Wikipedia:IPA_for _English # Key" title="Wikipedia:IPA \
for English">

Upvotes: 0

Views: 462

Answers (1)

user305883
user305883

Reputation: 1741

hehe, yes, this was one of my first questions when I did not know about programming with javascript. It is funny how questions are posed when beginner :) Here and then I will go back to old questions of mine and answer them if something useful to share.

To answer my own question: it is possible to hijack a link.

using jquery here for simplicity, it is possible to select <a> tags that have a pattern and then bind a function to them.

Example:

$("a[href*='/wiki/']").click(function(e){
  // capture the link 
var link  = this.href;
// do something else..
}

Upvotes: 0

Related Questions