User:Prezintenden/monobook.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
<nowiki>/*DIFF*/
window.WikEdDiffInit = function() {
if (typeof(wikEdDiffScriptSrc) == 'undefined') { window.wikEdDiffScriptSrc = 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js&action=raw&ctype=text/javascript'; }
if (typeof(wikEdAllowLocalAjax) == 'undefined') { window.wikEdAllowLocalAjax = false; }
if (typeof(wikEdDiffCSS) == 'undefined') { window.wikEdDiffCSS = []; }
WikEdDiffInitObject(wikEdDiffCSS, {
'.wikEdDiffWrapper': 'margin: 0 0 1em 0;',
'.wikEdDiffButtonWrapper': 'text-align: center;',
'.wikEdDiffButton': 'padding: 0; margin: 0.2em 0 0.33em 0;',
'.wikEdDiffDiv': 'background: #faf8f6; padding: 0.5em; border: 1px solid; border-color: #808080;'
});
if (typeof(wikEdUseLocalImages) == 'undefined') { window.wikEdUseLocalImages = false; }
if (typeof(wikEdImagePathLocal) == 'undefined') { window.wikEdImagePathLocal = 'file:///D:/wikEd/images/'; }
if (typeof(wikEdImagePath) == 'undefined') { window.wikEdImagePath = 'http://upload.wikimedia.org/wikipedia/commons/'; }
if (typeof(wikEdImage) == 'undefined') { window.wikEdImage = []; }
WikEdDiffInitImage(wikEdImage, {
'wikEdDiff': 'c/c6/WikEdDiff.png'
});
if (typeof(wikEdText) == 'undefined') { window.wikEdText = []; }
WikEdDiffInitObject(wikEdText, {
'wikEdDiffButtonImg alt': 'wikEdDiff',
'wikEdDiffButton title': 'Show improved diff view',
'wikEdDiffLoading': '...'
});
if (typeof(wikEdFullDiff) == 'undefined') { window.wikEdFullDiff = false; }
window.wikEdDiffDiv = null;
window.wikEdDiffWrapper = null;
window.wikEdDiffButtonWrapper = null;
window.wikEdDiffButton = null;
window.wikEdDiffGetGlobalNode = null;
if (typeof(wikEdExternalScripts) == 'undefined') { window.wikEdExternalScripts = null; }
if (typeof(wikEdDiffPreset) == 'undefined') { window.wikEdDiffPreset = false; }
window.wikEdDiffWikiGlobals = [];
window.wikEdDiffTable = null;
}
if (typeof(wikEdDiffStartup) == 'undefined') { window.wikEdDiffStartup = false; }
window.WikEdDiffStartup = function() {
if (window.wikEdDiffStartup == true) {
return;
}
window.wikEdDiffStartup = true;
if (window.wikEdPageLoaded == true) {
WikEdDiffSetup();
}
else {
if (window.attachEvent != null) {
window.attachEvent('onload', WikEdDiffSetup);
}
else {
window.addEventListener('load', WikEdDiffSetup, false);
}
return;
}
}
window.WikEdDiffSetup = function() {
if (document.getElementById('wikEdDiffSetupFlag') != null) {
return;
}
var flag = document.createElement('span');
flag.id = 'wikEdDiffSetupFlag';
flag.style.display = 'none';
flag.style.visibility = 'hidden';
document.body.appendChild(flag);
WikEdDiffInit();
var table = document.getElementsByTagName('table');
for (var i = 0; i < table.length; i ++) {
if (table[i].className == 'diff') {
wikEdDiffTable = table[i];
}
}
if (wikEdDiffTable == null) {
return;
}
window.wikEdDiffGreasemonkey = false;
if (typeof(GM_getValue) == 'function' ) {
wikEdDiffGreasemonkey = true;
}
var variable = ['wgServer', 'wgArticlePath', 'wgScriptPath', 'wgCurRevisionId'];
for (var i = 0; i < variable.length; i ++) {
wikEdDiffWikiGlobals[ variable[i] ] = WikEdDiffGetGlobal(variable[i]);
}
if (wikEdExternalScripts == null) {
wikEdExternalScripts = [];
var pageScripts = document.getElementsByTagName('script');
for (var i = 0; i < pageScripts.length; i ++) {
var scriptSrc = pageScripts[i].src;
var nameMatch = scriptSrc.match(/\/([^\/]*?)($|\?)/);
if (nameMatch != null) {
var scriptName = nameMatch[1];
if (scriptName != '') {
if ( (scriptName == 'diff.js') && (scriptSrc != wikEdDiffScriptSrc) ) {
continue;
}
wikEdExternalScripts[scriptName] = true;
}
}
}
}
var head = document.getElementsByTagName('head')[0];
if (wikEdExternalScripts['diff.js'] == null) {
if (typeof(WDiffString) == 'undefined') {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = wikEdDiffScriptSrc;
head.appendChild(script);
}
wikEdExternalScripts['diff.js'] = true;
}
var diffStyle = new WikEdDiffStyleSheet();
var rules = '';
for (var ruleName in wikEdDiffCSS) {
var ruleStyle = wikEdDiffCSS[ruleName];
diffStyle.addRule(ruleName, ruleStyle);
}
wikEdDiffWrapper = document.createElement('div');
wikEdDiffWrapper.id = 'wikEdDiffWrapper';
wikEdDiffWrapper.className = 'wikEdDiffWrapper';
wikEdDiffButtonWrapper = document.createElement('div');
wikEdDiffButtonWrapper.id = 'wikEdDiffButtonWrapper';
wikEdDiffButtonWrapper.className = 'wikEdDiffButtonWrapper';
wikEdDiffWrapper.appendChild(wikEdDiffButtonWrapper);
wikEdDiffButton = document.createElement('button');
wikEdDiffButton.id = 'wikEdDiffButton';
wikEdDiffButton.title = wikEdText['wikEdDiffButton title'];
wikEdDiffButton.className = 'wikEdDiffButton';
wikEdDiffButtonWrapper.appendChild(wikEdDiffButton);
var diffImg = document.createElement('img');
diffImg.id = 'wikEdDiffButtonImg';
diffImg.src = wikEdImage['wikEdDiff'];
diffImg.title = wikEdText['wikEdDiffButton title'];
diffImg.alt = wikEdText['wikEdDiffButtonImg alt'];
wikEdDiffButton.appendChild(diffImg);
wikEdDiffDiv = document.createElement('div');
wikEdDiffDiv.id = 'wikEdDiffDiv';
wikEdDiffDiv.className = 'wikEdDiffDiv';
wikEdDiffDiv.style.display = 'none';
wikEdDiffWrapper.appendChild(wikEdDiffDiv);
if (wikEdDiffTable.nextSibling != null) {
wikEdDiffTable.parentNode.insertBefore(wikEdDiffWrapper, wikEdDiffTable.nextSibling);
}
else {
wikEdDiffTable.parentNode.appendChild(wikEdDiffWrapper);
}
if (window.attachEvent != null) {
wikEdDiffButton.attachEvent('onclick', WikEdDiff);
}
else {
wikEdDiffButton.addEventListener('click', WikEdDiff, true);
}
var cells = wikEdDiffTable.getElementsByTagName('td');
for (var i = 0; i < cells.length; i ++) {
if (cells[i].className.indexOf('title') < 0) {
cells[i].innerHTML = WikEdDiffLinkify(cells[i].innerHTML);
}
}
var setting = WikEdDiffGetPersistent('wikEdDiff');
if ( (setting == '') && (typeof(wikEdDiffPreset) == 'boolean') ) {
setting = wikEdDiffPreset;
}
else if (setting == '1') {
setting = true;
}
if (setting == true) {
WikEdDiff();
}
if (typeof(setupTooltips) == 'function') {
setupTooltips(wikEdDiffTable);
}
return;
}
window.WikEdDiff = function() {
if (wikEdDiffDiv == null) {
return;
}
if (typeof(WDiffString) == 'undefined') {
return;
}
wikEdDiffDiv.style.display = 'block';
if (wikEdDiffDiv.innerHTML.length > 0) {
return;
}
if (wikEdDiffTable == null) {
return;
}
wikEdDiffDiv.innerHTML = wikEdText['wikEdDiffLoading'];
var url;
var server = WikEdDiffGetGlobal('wgServer');
var scriptPath = WikEdDiffGetGlobal('wgScriptPath');
scriptPath = scriptPath.replace(server, '');
if ( (server != '') && (scriptPath != '') ) {
url = server + scriptPath.replace(/\$1/, '') + '/index.php';
}
else {
url = window.location.protocol + '//' + window.location.hostname + '/' + window.location.pathname;
}
var article;
var pageName = WikEdDiffGetGlobal('wgPageName');
if (pageName != '') {
article = pageName;
}
else {
var articleMatch = window.location.search.match(/(\?|&)title=([^&#]+)/);
if(articleMatch != null) {
article = articleMatch[2];
}
}
url += '?title=' + encodeURIComponent(article) + '&action=raw&maxage=0';
var tdArray = document.getElementsByTagName('TD');
var tdOld;
var tdNew;
for (var i = 0; i < tdArray.length; i ++) {
if (tdArray[i].className == 'diff-otitle') {
tdOld = tdArray[i];
}
else if (tdArray[i].className == 'diff-ntitle') {
tdNew = tdArray[i];
break;
}
}
if ( (tdOld == null) || (tdNew == null) ) {
return;
}
var oldVersion = null;
var newVersion = null;
var oldUrl;
var newUrl;
if (
(/(\?|&)action=submit\b/.test(window.location.search) == true) ||
(/(\?|&)undoafter=/.test(window.location.search) == true)
) {
var textarea = document.getElementsByName('wpTextbox1');
if (textarea.length == 0) {
return;
}
newVersion = textarea[0].value;
newVersion = newVersion.replace(/\s+$/g, '');
var curRevisionId = WikEdDiffGetGlobal('wgCurRevisionId');
if (curRevisionId != '') {
oldUrl = url + '&oldid=' + curRevisionId;
}
else {
oldUrl = url;
}
var section = document.getElementsByName('wpSection');
if (section != null) {
if (section.length > 0) {
if (section[0].value != '') {
oldUrl += '§ion=' + section[0].value;
}
}
}
}
else {
var versionMatchOld = tdOld.innerHTML.match(/(\?|&)oldid=(\d+)/);
var versionMatchNew = tdNew.innerHTML.match(/(\?|&)oldid=(\d+)/);
if (versionMatchOld == null) {
return;
}
oldUrl = url + '&oldid=' + versionMatchOld[2];
if (versionMatchNew != null) {
newUrl = url + '&oldid=' + versionMatchNew[2];
}
else {
newUrl = url;
}
}
WikEdDiffAjaxRequest('GET', oldUrl, null, null, null, null, function(ajax) {
oldVersion = ajax.responseText;
if (newVersion != null) {
WikEdDiffResponse(oldVersion, newVersion);
}
return;
});
if (newUrl != null) {
WikEdDiffAjaxRequest('GET', newUrl, null, null, null, null, function(ajax) {
newVersion = ajax.responseText;
if (oldVersion != null) {
WikEdDiffResponse(oldVersion, newVersion);
}
return;
});
}
return;
}
window.WikEdDiffResponse = function(oldVersion, newVersion) {
var diffText = WDiffString(oldVersion, newVersion);
if (wikEdFullDiff != true) {
diffText = WDiffShortenOutput(diffText);
}
wikEdDiffDiv.innerHTML = diffText;
wikEdDiffDiv.style.display = 'block';
return;
}
window.WikEdDiffLinkify = function(html) {
html = html.replace(/((https?|ftp):(\/\/[^\[\]\{\}\(\)<>\s&=\?#%]+|<[^>]*>)+)/g, function (p, p1) {
p1 = p1.replace(/<[^>]*>/g, '');
var url = encodeURI(p1);
url = url.replace(/\"/g, '%22');
url = url.replace(/\'/g, '%27');
url = url.replace(/#/g, '%23');
var ti = p1.replace(/\"/g, '"');
return('<a href = "' + url + '" style = "text-decoration:none;color:inherit;color:expression(parentElement.currentStyle.color);" title = "' + ti + '">' + p + '</a>');
});
if ((wikEdDiffWikiGlobals['wgServer'] != null) && (wikEdDiffWikiGlobals['wgArticlePath'] != null)) {
html = html.replace(/((\[\[)([^\|\[\]\{\}\n]*)([^\]\n&=\?#%]*)(]\]))/g, function (p, p1, p2, p3) {
p3 = p3.replace(/<[^>]*>/g, '');
var url = encodeURI(p3);
url = url.replace(/\"/g, '%22');
url = url.replace(/\'/g, '%27');
url = url.replace(/#/g, '%23');
url = wikEdDiffWikiGlobals['wgServer'] + wikEdDiffWikiGlobals['wgArticlePath'].replace(/\$1/, '') + url;
var ti = p3.replace(/\"/g, '"');
return('<a href = "' + url + '" style = "text-decoration:none;color:inherit;color:expression(parentElement.currentStyle.color)" title = "' + ti+'">' + p + '</a>');
});
}
return(html);
}
window.WikEdDiffInitObject = function(array, preset) {
for (var key in preset) {
if (array[key] == null) {
array[key] = preset[key];
}
}
return;
}
window.WikEdDiffInitImage = function(array, preset) {
for (var key in preset) {
if (array[key] == null) {
if (wikEdUseLocalImages == true) {
array[key] = wikEdImagePathLocal + preset[key].replace(/^[0-9a-f]+\/[0-9a-f]+\/()/, '');
}
else {
array[key] = wikEdImagePath + preset[key];
}
}
}
return;
}
window.WikEdDiffStyleSheet = function(documentObject) {
this.styleElement = null;
if (documentObject == null) {
documentObject = document;
}
if (documentObject.createStyleSheet) {
this.styleElement = documentObject.createStyleSheet();
}
else {
this.styleElement = documentObject.createElement('style');
this.styleElement.from = 'text/css';
var insert = documentObject.getElementsByTagName('head')[0];
if (insert != null) {
this.styleElement.appendChild(document.createTextNode('')); // Safari 3 fix
insert.appendChild(this.styleElement);
}
}
this.addRule = function(selector, declaration) {
if (this.styleElement.addRule) {
this.styleElement.addRule(selector, declaration);
}
else {
if (this.styleElement.sheet != null) {
if (this.styleElement.sheet.insertRule != null) {
this.styleElement.sheet.insertRule(selector + ' { ' + declaration + ' } ', 0);
}
}
}
};
this.addRules = function(rules) {
this.styleElement.innerHTML = rules;
return;
}
}
window.WikEdDiffGetPersistent = function(name) {
var getStr = '';
if (wikEdDiffGreasemonkey == true) {
getStr = GM_getValue(name, '');
}
else {
getStr = WikEdDiffGetCookie(name);
}
return(getStr);
}
window.WikEdDiffGetCookie = function(cookieName) {
var cookie = ' ' + document.cookie;
var search = ' ' + cookieName + '=';
var cookieValue = '';
var offset = 0;
var end = 0;
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(';', offset)
if (end == -1) {
end = cookie.length;
}
cookieValue = cookie.substring(offset, end);
cookieValue = cookieValue.replace(/\\+/g, ' ');
cookieValue = decodeURIComponent(cookieValue);
}
return(cookieValue);
}
window.WikEdDiffAjaxRequest = function(requestMethod, requestUrl, headerName, headerValue, bodyData, overrideMimeType, responseHandler) {
var request;
if (wikEdDiffGreasemonkey == true) {
var headerArray = { 'User-Agent': navigator.userAgent }
if (headerName != null) {
headerArray[headerName] = headerValue;
}
request = new GM_xmlhttpRequest({
'method': requestMethod,
'url': requestUrl,
'headers': headerArray,
'data': bodyData,
'onreadystatechange':
function(ajax) {
if (ajax.readyState != 4) {
return;
}
responseHandler(ajax);
return;
}
});
}
else {
if (wikEdAllowLocalAjax == true) {
if (typeof(netscape) == 'object') {
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
}
}
try {
request = new XMLHttpRequest();
}
catch(err) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP');
}
catch(err) {
try {
request = new ActiveXObject('Msxml2.XMLHTTP');
}
catch(err) {
return;
}
}
}
request.open(requestMethod, requestUrl, true);
if (headerName != null) {
request.setRequestHeader(headerName, headerValue);
}
if ( (request.overrideMimeType != null) && (overrideMimeType != null) ) {
request.overrideMimeType(overrideMimeType);
}
request.send(bodyData);
request.onreadystatechange = function() {
if (request.readyState != 4) {
return;
}
responseHandler(request);
return;
}
}
return;
}
window.WikEdDiffGetOffsetTop = function(element) {
var offset = 0;
do {
offset += element.offsetTop;
} while ( (element = element.offsetParent) != null );
return(offset);
}
window.WikEdDiffGetGlobal = function(globalName) {
var globalValue;
if (wikEdDiffGreasemonkey == true) {
if (wikEdDiffGetGlobalNode == null) {
wikEdDiffGetGlobalNode = document.getElementById('wikEdDiffGetGlobalNode');
}
if (wikEdDiffGetGlobalNode == null) {
wikEdDiffGetGlobalNode = document.createElement('textarea');
wikEdDiffGetGlobalNode.id = 'wikEdDiffGetGlobalNode';
wikEdDiffGetGlobalNode.style.display = 'none';
wikEdDiffGetGlobalNode.style.visibility = 'hidden';
document.body.appendChild(wikEdDiffGetGlobalNode);
}
location.href = 'javascript:void(typeof(' + globalName + ')!=\'undefined\'?(' + globalName + '!=null?(document.getElementById(\'wikEdDiffGetGlobalNode\').value=' + globalName + '.toString()):null):null)';
globalValue = wikEdDiffGetGlobalNode.value;
}
else {
try {
globalValue = eval(globalName + '.toString();');
}
catch(err) { }
}
return(globalValue);
}
WikEdDiffStartup();
/*LIVE PREVIEW*/
function LivePreviewInstall()
{
copywarn = document.getElementById('editpage-copywarn');
if (copywarn != null) {
LivePreviewHTML = '<input type="button" value="Live Preview" onclick="document.getElementById(\'PreviewBox\').innerHTML = wiki2html(editform.wpTextbox1.value);" />';
LivePreviewHTML += '<div style="margin-top:5px;padding:5px;border:2px inset #0b0;-moz-border-radius-topleft:40px;-moz-border-radius-bottomright:40px;" id="PreviewBox"></div>';
copywarn.innerHTML = LivePreviewHTML + copywarn.innerHTML;
}
}
var wpUserName=wpUserName||'Pikipedia user';
var wpUserSignature=wpUserSignature||wpUserName;
var wpShowImages=wpShowImages||true;
var wpLanguageCode='en';
var wpInterwikiCodes='none';
var wpBaseArticlePath='/wiki/';
var wpImageBasePath='http://pikmin.wikia.com/images/';
var wpImageFailbackPath='';
var wpDefaultThumbWidth=180;
var wpSkinMagnifyClip='/skins/common/images/magnify-clip.png';
var wpUserNamespace='User';
var wpImageNamespace='Image';
var wpCategoryNamespace='Category';
function wiki2html(str)
{str=strip_cr(str);var w=new WikiCode();w.lines=str.split(/\n/);w.parse();return w.html;};var wpSignature='[['+wpUserNamespace+':'+wpUserName+'|'+wpUserSignature+']]';var wpInvisibleNamespaces=new RegExp('\\[\\[(?:'+wpCategoryNamespace+'|'+wpInterwikiCodes+'):.*?\\]\\]','gi')
var wpBlockImage=new RegExp('^\\[\\['+wpImageNamespace+':.*?\\|.*?(?:frame|thumbnail|thumb|none|right|left|center)','i');function WikiCode()
{this.lines=new Array;this.html=new String;this._endline=function(str)
{this.html+=str;this.lines.shift();};this.parse=function()
{var p=false;do{if((h_match=this.lines[0].match(/^(={1,6})(.*)\1(.*)$/))!=null){p=false;this._endline('<h'+h_match[1].length+'>'+_parse_inline_wiki(h_match[2])+'</h'+h_match[1].length+'>'+h_match[3]);}else if(this.lines[0].match(/^[*#:;]/)!=null){p=false;this._parse_list();}else if(this.lines[0].charAt(0)==' '){p=false;this._parse_pre();}else if(this.lines[0].substr(0,2)=='{|'){p=false;this._parse_table();}else if(this.lines[0].match(/^----+$/)!=null){p=false;this._endline('<hr/>');}else if(this.lines[0].match(wpBlockImage)!=null){p=false;this._parse_block_image();}else{if(this.lines[0]==''){if(p=(this.lines.length>1&&this.lines[1]=='')){this._endline('<p><br />');}}else{if(!p){this.html+='<p>';p=true;}
this.html+=_parse_inline_wiki(this.lines[0])+' ';}
this.lines.shift();}}while(this.lines.length);};this._parse_list=function(){var prev=new String;var l_match,imatch;while(this.lines.length&&(l_match=this.lines[0].match(/^([*#:;]+)(.*)$/))!=null){this.lines.shift();imatch=str_imatch(prev,l_match[1]);for(var i=prev.length-1;i>=imatch;i--){if(prev.charAt(i)=='*'){this.html+='</ul>';}else if(prev.charAt(i)=='#'){this.html+='</ol>'}else{this.html+='</d'+((prev.charAt(i)==';')?'t':'d')+'>';switch(l_match[1].charAt(i)){case'':case'*':case'#':this.html+='</dl>';}}}
for(var i=imatch;i<l_match[1].length;i++){if(l_match[1].charAt(i)=='*'){this.html+='<ul>';}else if(l_match[1].charAt(i)=='#'){this.html+='<ol>';}else{switch(prev.charAt(i)){case'':case'*':case'#':this.html+='<dl>';}
this.html+='<d'+((l_match[1].charAt(i)==';')?'t':'d')+'>';}}
if(l_match[1].charAt(l_match[1].length-1)=='*'||l_match[1].charAt(l_match[1].length-1)=='#'){this.html+='<li>'+_parse_inline_wiki(l_match[2])+'</li>';}else{if((dt_match=l_match[2].match(/(.*?) (:.*?)$/))!=null){this.html+=_parse_inline_wiki(dt_match[1]);this.lines.unshift(dt_match[2]);}else{this.html+=_parse_inline_wiki(l_match[2]);}}
prev=l_match[1];}
for(i=prev.length-1;i>=0;i--){if(prev.charAt(i)=='*'){this.html+='</ul>';}else if(prev.charAt(i)=='#'){this.html+='</ol>';}else{this.html+='</d'+((prev.charAt(i)==';')?'t':'d')+'></dl>';}}};this._parse_table=function()
{var table_match;if((table_match=this.lines[0].match(/^\{\|( .*)$/))!=null){this._endline('<table'+table_match[1]+'>');}else this._endline('<table>');do{if(this.lines[0].charAt(0)=='|'){switch(this.lines[0].charAt(1)){case'}':this._endline('</table>');return;case'-':this._endline('<tr '+this.lines[0].match(/\|-*(.*)/)[1]+'>');break;default:this._parse_table_data();}}else if(this.lines[0].charAt(0)=='!'){this._parse_table_data();}else{this.lines.shift();}}while(this.lines.length)};this._parse_table_data=function()
{var td_match,td_line;td_match=this.lines.shift().match(/^(\|\+|\||!)((?:([^[|]*?)\|(?!\|))?(.*))$/);if(td_match[1]=='|+'){this.html+='<caption';}else{this.html+='<t'+((td_match[1]=='|')?'d':'h');}
if(typeof td_match[3]!='undefined'){this.html+=' '+td_match[3];td_line=td_match[4].split('||');}else{td_line=td_match[2].split('||');}
this.html+='>';while(td_line.length>1){this.lines.unshift(td_match[1]+td_line.pop());}
this.html+=_parse_inline_wiki(td_line[0]);var td=new WikiCode;var table_count=0;while(this.lines.length){if(this.lines[0].charAt(0)=='|'){if(table_count==0)break;else if(this.lines[0].charAt(1)=='}')table_count--;}else if(this.lines[0].charAt(0)=='!'&&table_count==0){break;}else if(this.lines[0].substr(0,2)=='{|')table_count++;td.lines.push(this.lines.shift());}
if(td.lines.length){td.parse();}
this.html+=td.html;};this._parse_pre=function()
{this.html+='<pre>';do{this._endline(_parse_inline_wiki(this.lines[0].substring(1,this.lines[0].length))+"\n");}while(this.lines.length&&this.lines[0].charAt(0)==' ');this.html+='</pre>';};this._parse_block_image=function()
{this.html+=_parse_image(this.lines.shift());};};function _parse_image(str)
{var attr=str.substring(wpImageNamespace.length+3,str.length-2).split(/\s*\|\s*/);var filename=attr[0];var caption=attr[attr.length-1];var width,w_match;var thumb=false;var frame=false;var center=false;var align='';var html='';do{if((w_match=attr[0].match(/^(\d*)px$/))!=null){width=w_match[1];}else switch(attr[0]){case'thumb':case'thumbnail':thumb=true;case'frame':frame=true;break;case'none':case'right':case'left':center=false;align=attr[0];break;case'center':center=true;align='none';}
attr.shift();}while(attr.length);if(frame){if(align=='')align='right';html+="<div class='thumb t"+align+"'>";if(thumb){if(width=='')width=wpDefaultThumbWidth;html+="<div style='width:"+(2+parseInt(width))+"px;'>";html+=_make_image(filename,caption,width);html+="<div class='thumbcaption'><div class='magnify' style='float:right'><a href='"+wpBaseArticlePath+wpImageNamespace+':'+filename+"' class='internal' title='Enlarge'><img src='"+wpSkinMagnifyClip+"' /></a></div>"+_parse_inline_wiki(caption)+"</div>";}else{html+='<div>';html+=_make_image(filename,caption);html+="<div class='thumbcaption'>"+_parse_inline_wiki(caption)+"</div>";}
html+='</div></div>';}else if(align!=''){html+="<div class='float"+align+"'><span>"+_make_image(filename,caption,width)+"</span></div>";}else{return _make_image(filename,caption,width);}
if(center){return"<div class='center'>"+html+'</div>';}else{return html;}};function _make_image(filename,caption,width)
{filename=filename.charAt(0).toUpperCase()+filename.substr(1);filename=filename.replace(/ /g,'_');var md5=hex_md5(filename);var source=md5.charAt(0)+'/'+md5.substr(0,2)+'/'+filename;var img;if(wpShowImages){if(width){width="width='"+width+"px'";}
img="<img onerror='this.onerror=null;this.src=\""+wpImageFailbackPath+source+"\";' src='"+wpImageBasePath+source+"' alt='"+caption+"' "+width+"/>";}else{img=wpImageNamespace+':'+filename+" <em style='color:red;'>(images disabled)</em>";}
caption=_strip_inline_wiki(caption);return"<a class='image' title='"+caption+"' href='"+wpBaseArticlePath+wpImageNamespace+':'+filename+"'>"+img+"</a>";};function _parse_inline_images(str)
{var start,substart=0,nestlev=0;var loop,close,open,wiki,html;while(-1!=(start=str.indexOf('[[',substart))){if(str.substr(start+2).match(RegExp('^'+wpImageNamespace+':','i'))!=null){loop=true;substart=start;do{substart+=2;close=str.indexOf(']]',substart);open=str.indexOf('[[',substart);if(close<=open||open==-1){if(close==-1)return str;substart=close;if(nestlev){nestlev--;}else{wiki=str.substring(start,close+2);html=_parse_image(wiki);str=str.replace(wiki,html);substart=start+html.length;loop=false;}}else{substart=open;nestlev++;}}while(loop);}else{break;}}
return str;};function _parse_inline_wiki(str)
{str=str.replace(/'''''(.*?)''(.*?)'''/g,'<strong><em>$1</em>$2</strong>');str=str.replace(/'''''(.*?)'''(.*?)''/g,'<em><strong>$1</strong>$2</em>');str=str.replace(/'''(.*?)''(.*?)'''''/g,'<strong>$1<em>$2</em></strong>');str=str.replace(/'''(.*?)'''/g,'<strong>$1</strong>');str=str.replace(/''(.*?)''/g,'<em>$1</em>');str=str.replace(/~{4,5}(?!~)/g,wpSignature+' '+Date());str=str.replace(/~{3}(?!~)/g,wpSignature);str=_parse_inline_images(str);str=str.replace(wpInvisibleNamespaces,'');str=str.replace(/\[\[([^|]*?)\]\](\w*)/g,"<a href='"+wpBaseArticlePath+"$1'>$1$2</a>");str=str.replace(/\[\[(.*?)\|([^\]]+?)\]\](\w*)/g,"<a href='"+wpBaseArticlePath+"$1'>$2$3</a>");str=str.replace(/\[\[([^\]]*:)?(.*?)( *\(.*?\))?\|\]\]/g,"<a href='"+wpBaseArticlePath+"$1$2$3'>$2</a>");str=str.replace(/\[(http|news|ftp|mailto|gopher|irc):(\/*)([^\]]*?) (.*?)\]/g,"<a href='$1:$2$3'>$4</a>");str=str.replace(/\[http:\/\/(.*?)\]/g,"<a href='http://$1'>[#]</a>");str=str.replace(/\[(news|ftp|mailto|gopher|irc):(\/*)(.*?)\]/g,"<a href='$1:$2$3'>$1:$2$3</a>");return str.replace(/(^| )(http|news|ftp|mailto|gopher|irc):(\/*)([^ $]*)/g,"$1<a href='$2:$3$4'>$2:$3$4</a>");};function _strip_inline_wiki(str)
{str=str.replace(/\[\[[^\]]*\|(.*?)\]\]/g,'$1');str=str.replace(/\[\[(.*?)\]\]/g,'$1');str=str.replace(/''(.*?)''/g,'$1');return str;};function max(a,b)
{if(a>b)return a;else return b;};function min(a,b)
{if(a<b)return a;else return b;};function str_imatch(str_a,str_b)
{var lim=min(str_a.length,str_b.length);for(var i=0;i<lim;i++){if(str_a.charAt(i)!=str_b.charAt(i))return i;}
return i;};function strip_cr(str)
{str=str.replace(/\n\r/g,"\n");str=str.replace(/\r/g,'');return str;};var chrsz=8;var hex_tab="0123456789abcdef";function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));};function core_md5(x,len)
{x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16)
{var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}
return Array(a,b,c,d);};function md5_cmn(q,a,b,x,s,t)
{return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);};function md5_ff(a,b,c,d,x,s,t)
{return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);};function md5_gg(a,b,c,d,x,s,t)
{return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);};function md5_hh(a,b,c,d,x,s,t)
{return md5_cmn(b^c^d,a,b,x,s,t);};function md5_ii(a,b,c,d,x,s,t)
{return md5_cmn(c^(b|(~d)),a,b,x,s,t);};function safe_add(x,y)
{var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);};function bit_rol(num,cnt)
{return(num<<cnt)|(num>>>(32-cnt));};function str2binl(str)
{var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)
bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;};function binl2hex(binarray)
{var str='';for(var i=0;i<binarray.length*4;i++)
{str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
return str;};
window.onload = Main;
function Main()
{
LivePreviewInstall();
}
</nowiki>