| 62 |
|
|
| 63 |
form.innerHTML = "<p><label>Original text:<br><textarea name=en></textarea></label><br>\ |
form.innerHTML = "<p><label>Original text:<br><textarea name=en></textarea></label><br>\ |
| 64 |
(<label><input name=pattern type=checkbox> Pattern</label><span> <button type=button>Load original text</button></span>)\ |
(<label><input name=pattern type=checkbox> Pattern</label><span> <button type=button>Load original text</button></span>)\ |
| 65 |
<p><label>Translated text:<br><textarea name=ja></textarea></label><p><label>Tags:<br><textarea name=tags></textarea></label><p><button type=submit class=ja-save-button>Save and close</button> <button type=button class=ja-close-button>Close</button> (<output>Text not loaded yet</output>; see also <a href='edit/#license'>license</a>)"; |
<p><label>Translated text:<br><textarea name=ja></textarea></label><p><label>Tags:<br><textarea name=tags></textarea></label><p><button type=button class=ja-save-button>Save and close</button> <button type=button class=ja-close-button>Close</button> (<output>Text not loaded yet</output>; see also <a href='edit/#license'>license</a>)"; |
| 66 |
|
|
| 67 |
form.onchange = function () { |
form.onchange = function () { |
| 68 |
form.jaFormChanged = true; |
form.jaFormChanged = true; |
| 103 |
v += '&pattern=on'; |
v += '&pattern=on'; |
| 104 |
} |
} |
| 105 |
|
|
| 106 |
|
form.getElementsByTagName ('output')[0].firstChild.data |
| 107 |
|
= 'Saving...'; |
| 108 |
|
|
| 109 |
var req = new XMLHttpRequest (); |
var req = new XMLHttpRequest (); |
| 110 |
req.open ('POST', 'edit2/', true); |
req.open ('POST', 'edit2/', true); |
| 111 |
req.onreadystatechange = function () { |
req.onreadystatechange = function () { |
| 114 |
= 'Save: ' + req.status + ' ' + req.statusText; |
= 'Save: ' + req.status + ' ' + req.statusText; |
| 115 |
if (req.status >= 200 && req.status < 400) { |
if (req.status >= 200 && req.status < 400) { |
| 116 |
targetNode.jaForm = null; |
targetNode.jaForm = null; |
| 117 |
form.parentNode.removeChild (form); |
form.style.display = 'none'; |
| 118 |
applyJaUpdates (eval ('(' + req.responseText + ')')); |
setTimeout (function () { |
| 119 |
|
form.parentNode.removeChild (form); |
| 120 |
|
applyJaUpdates (eval ('(' + req.responseText + ')')); |
| 121 |
|
}, 100); |
| 122 |
} |
} |
| 123 |
} |
} |
| 124 |
}; // onreadystatechange |
}; // onreadystatechange |
| 172 |
while (true) { |
while (true) { |
| 173 |
if (!parent.parentNode) break; |
if (!parent.parentNode) break; |
| 174 |
var ln = parent.nodeName.toLowerCase (); |
var ln = parent.nodeName.toLowerCase (); |
| 175 |
if (ln == 'tr' || ln == 'tbody' || ln == 'thead' || ln == 'tfoot' || |
if (ln == 'tr' /*|| ln == 'tbody' || ln == 'thead' || ln == 'tfoot' || |
| 176 |
ln == 'table' || ln == 'pre') { |
ln == 'table'*/ || ln == 'pre') { |
| 177 |
prev = parent; |
prev = parent; |
| 178 |
parent = parent.parentNode; |
parent = parent.parentNode; |
| 179 |
} else { |
} else { |
| 180 |
break; |
break; |
| 181 |
} |
} |
| 182 |
} |
} |
|
|
|
| 183 |
parent.insertBefore (insertedElement, prev.nextSibling); |
parent.insertBefore (insertedElement, prev.nextSibling); |
| 184 |
} // insertInterfaceElement |
} // insertInterfaceElement |
| 185 |
|
|
| 186 |
function applyJaUpdates (updates) { |
function applyJaUpdates (updates) { |
|
document.newEntries =updates; |
|
| 187 |
for (var hash in updates) { |
for (var hash in updates) { |
| 188 |
if (document.jaHashes[hash]) { |
if (document.jaHashes[hash]) { |
| 189 |
for (var i in document.jaHashes[hash]) { |
for (var i in document.jaHashes[hash]) { |
| 199 |
} // applyJaUpdates |
} // applyJaUpdates |
| 200 |
|
|
| 201 |
function applyJaEntry (targetNode, entry) { |
function applyJaEntry (targetNode, entry) { |
| 202 |
if (entry.isPattern) { |
if (entry.isPattern || targetNode.nodeName == 'TR' /* find.cgi */) { |
| 203 |
targetNode.className += ' ja-not-patched'; |
targetNode.className += ' ja-not-patched'; |
| 204 |
} else { |
} else { |
| 205 |
var en; |
var en; |
| 237 |
|
|
| 238 |
function formatJaText (s) { |
function formatJaText (s) { |
| 239 |
return s.replace |
return s.replace |
| 240 |
(/\[\[([A-Z ]+):([^]]+)\]\]/g, |
(/\[\[([A-Z ]+):([^\]]+)\]\]/g, |
| 241 |
function (a, b, c) { |
function (a, b, c) { |
| 242 |
return "<em class=rfc2119 title=\"" + b + "\">" + c + "</em>"; |
return "<em class=rfc2119 title=\"" + b + "\">" + c + "</em>"; |
| 243 |
}); |
}); |
| 244 |
} // formatJaText |
} // formatJaText |
| 245 |
|
|
| 246 |
|
/* |
| 247 |
|
Author: Wakaba <[email protected]>. |
| 248 |
|
License: Copyright 2008 Wakaba. You are granted a license to use, |
| 249 |
|
reproduce and create derivative works of this script. |
| 250 |
|
$Date$ |
| 251 |
|
*/ |