How could I migrate HTML5 local storage into mediaWiki
I have explored the web but could not find how the data in the local storage of HTML5 be shown as a content in my Wiki? My aim is that if I have to put any data in the local storage of my HTML5 code, it should be shown to my Wiki page. How could I relate these two (HTML5/JS and MediaWiki)? My HTML 5 code is given as
<!DOCTYPE HTML>
<html>
<head>
<title> HTML5 localStorage (name/value item pairs) demo </title>
<style>
td, th {
font-family: monospace;
padding: 4px;
background-color: #ccc;
}
#hoge {
border: 1px dotted blue;
padding: 6px;
background-color: #ccc;
margin-right: 50%;
}
#items_table {
border: 1px dotted blue;
padding: 6px;
margin-top: 12px;
margin-right: 50%;
}
#items_table h2 {
font-size: 18px;
margin-top: 0px;
font-family: sans-serif;
}
label {
vertical-align: top;
}
</style>
</head>
<body onload="doShowAll()" >
<h1> HTML5 localStorage (name/value item pairs) demo</h1>
<form name=editor>
<div id="hoge">
<p>
<label> Value: <textarea name=data cols=41 rows=10></textarea></label>
</p>
<p>
&开发者_JAVA百科lt;label>Name: <input name=name></label>
<input type=button value="getItem()" onclick="doGetItem()">
<input type=button value="setItem()" onclick="doSetItem()">
<input type=button value="removeItem()" onclick="doRemoveItem()">
</p>
</div>
<div id="items_table">
<h2>Items</h2>
<table id=pairs></table>
<p>
<label><input type=button value="clear()" onclick="doClear()"> <i>* clear() removes all items</i></label>
</p>
</div>
<script>
function doSetItem() {
var name = document.forms.editor.name.value;
var data = document.forms.editor.data.value;
localStorage.setItem(name, data);
doShowAll();
}
function doGetItem() {
var name = document.forms.editor.name.value;
document.forms.editor.data.value = localStorage.getItem(name);
doShowAll();
}
function doRemoveItem() {
var name = document.forms.editor.name.value;
document.forms.editor.data.value = localStorage.removeItem(name);
doShowAll();
}
function doClear() {
localStorage.clear();
doShowAll();
}
function doShowAll() {
var key = "";
var pairs = "<tr><th>Name</th><th>Value</th></tr>\n";
var i=0;
for (i=0; i<=localStorage.length-1; i++) {
key = localStorage.key(i);
pairs += "<tr><td>"+key+"</td>\n<td>"+localStorage.getItem(key)+"</td></tr>\n";
}
if (pairs == "<tr><th>Name</th><th>Value</th></tr>\n") {
pairs += "<tr><td><i>empty</i></td>\n<td><i>empty</i></td></tr>\n";
}
document.getElementById('pairs').innerHTML = pairs;
}
</script>
</form>
</body>
</html>
My Wiki URL is: http://localhost:8888/mediawiki/index.php/Main_Page
My question is how the data input into the text area of the HTML5 code could be shown into my Wiki page? Where and how should I relate this wiki URL with the HTML5/JS script for local storage?
You're going to need a fair amount of programming skills to go about this in the correct manner. No one here is going to program it for you. Here is the best resource there is available.
http://diveintohtml5.ep.io/storage.html
The fact that you put a localhost url in your post obviously shows that you have quite a bit to learn about web development in general. I wish you luck.
Not entirely sure if this is what you're asking... but here goes nothing...
Step 1) Read the data from your local storage (use Caimen's link for help).
Step 2) Use JavaScript to group it into JSON, XML, comma delimited string, etc...
Step 3) POST to the server (AJAX or old fashioned POST)
Step 4) Use a server-side language (assuming PHP) to parse the POST and insert it into the mediaWiki DB
I have a feeling that https://www.odesk.com/ might be more suitable for this request than StackOverflow. It sounds like you're asking for someone to get quite involved in your task and guide you through the process.
This kind of personal attention generally isn't free, and it is unlikely someone will want to devote a decent amount of time towards it. However if you pay someone, on say oDesk, you're likely to get a working solution for your specific problem.
However if you can funnel your question down to a key point, we may be able to help with that...
精彩评论