-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwikipedia.php
More file actions
38 lines (30 loc) · 1.01 KB
/
wikipedia.php
File metadata and controls
38 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
include("header.php");
$source = $_REQUEST["source"];
?>
<script>
$(window).click(handleClick);
function handleClick(e) {
var target = $(e.target).closest('a');
if( target ) {
e.preventDefault();
window.location = target.attr('href');
}
}
$.getJSON("http://en.wikipedia.org/w/api.php?action=parse&format=json&callback=?",
{
page:"<?php echo $source; ?>", prop:"text"
}, function(data) {
var content = data.parse.text['*'];
content = content.replace(/href=\"\/wiki\//g, "href=\"wikipedia.php?source=");
$("#wikiPage").html(content);
});
</script>
<div id="wikiPage">
</div>
<div data-role="footer" data-position="fixed" style="padding:3px;">
<a href="index.php" data-role="button" data-rel="back" data-ajax="false" data-icon="arrow-l">Back</a>
<a href="index.php" data-role="button" data-icon="home">Home</a>
<a href="add.php?source=<?php echo $source; ?>" data-role="button" data-icon="plus" style="float:right;" data-transition="pop">Add Fact</a>
</div>
<?php include('footer.php'); ?>