Content deleted Content added
0.9.91i (July 21, 2010) |
0.9.91m (August 21, 2010) Midori test alert |
||
Line 2:
// version info
window.wikEdProgramVersion = window.wikEdProgramVersion || '0.9.
window.wikEdProgramDate = window.wikEdProgramDate || '
/*
Line 500:
// reselection / scroll to selection
'.wikEdScrollLineHeight': 'position: absolute;',
Line 1,464 ⟶ 1,462:
// parser variables {{variable}}
window.wikEdParserVariables = 'CURRENTYEAR|CURRENTMONTH|CURRENTMONTHNAME|CURRENTMONTHNAMEGEN|CURRENTMONTHABBREV|CURRENTDAY|CURRENTDAY2|CURRENTDOW|CURRENTDAYNAME|CURRENTTIME|CURRENTHOUR|CURRENTWEEK|CURRENTTIMESTAMP|LOCALYEAR|LOCALMONTH|LOCALMONTHNAME|LOCALMONTHNAMEGEN|LOCALMONTHABBREV|LOCALDAY|LOCALDAY2|LOCALDOW|LOCALDAYNAME|LOCALTIME|LOCALHOUR|LOCALWEEK|LOCALTIMESTAMP|SITENAME|CURRENTVERSION|CONTENTLANGUAGE|REVISIONID|REVISIONDAY|REVISIONDAY2|REVISIONMONTH|REVISIONYEAR|REVISIONTIMESTAMP|SERVER|SERVERNAME|SCRIPTPATH|FULLPAGENAME|PAGENAME|BASEPAGENAME|SUBPAGENAME|SUBJECTPAGENAME|TALKPAGENAME|FULLPAGENAMEE|PAGENAMEE|BASEPAGENAMEE|SUBPAGENAMEE|SUBJECTPAGENAMEE|TALKPAGENAMEE|NAMESPACE|SUBJECTSPACE|ARTICLESPACE|TALKSPACE|NAMESPACEE|SUBJECTSPACEE|TALKSPACEE|DIRMARK|DIRECTIONMARK|PAGENAME|PAGENAMEE|ARTICLEPATH';
// parser variables {{variable:R}}
Line 1,728 ⟶ 1,726:
// check for other WebKit
else {
agentMatch = navigator.userAgent.match(/(WebKit)(GTK\+)?\W+(\d+\.\d+)/i);
if (agentMatch != null) {
wikEdBrowserName = 'WebKit';
wikEdBrowserVersion = parseFloat(agentMatch[
wikEdWebKit = true;
}
Line 2,067 ⟶ 2,065:
wikEdBrowserNotSupported = true;
}
alert('userAgent: ' + navigator.userAgent + '\nappName: ' + navigator.appName + '\nappVersion: ' + navigator.appVersion);//////
// check browser versions
Line 3,198:
}
insertTags = window.WikEdInsertTags;
}
else {
window.insertTags = window.WikEdInsertTags;
}
Line 3,558 ⟶ 3,561:
wikEdTextareaUpdated = true;
}
return;
};
Line 3,861 ⟶ 3,863:
if (wikEdUseWikEd == true) {
switch (event.type) {
// keydown event
Line 3,900 ⟶ 3,890:
break;
// after cursor movements set cursor position into closest highest text node so that highlighting does not bleed out
case 'keyup':
if (event.charCode == 0) {
switch (event.keyCode) {
case 17: // ctrl-v
case 37: // left
case 38: // up
case 39: // right
case 40: // down
case 33: // page up
case 34: // page down
case 46: // del
case 8: // backspace
WikEdAntiHighlightBleeding(new Object());
}
}
break;
// grey out inactive buttons
case 'mouseup':
WikEdAntiHighlightBleeding(new Object());
case 'keypress':
WikEdInactiveButtons();
}
Line 3,918 ⟶ 3,924:
//
window.WikEdAntiHighlightBleeding = function(obj, editButtonInsert) {
// check if disabled
Line 3,942 ⟶ 3,948:
return;
}
// set focus into deepest node
if (focusNode.childNodes != null) {
if ( (focusNode.childNodes.length > 0) && (focusOffset < focusNode.childNodes.length) ) {
focusNode = focusNode.childNodes.item(focusOffset);
focusOffset = 0;
if (focusNode.tagName != 'BR') {
range.setStart(focusNode, focusOffset);
range.setEnd(focusNode, focusOffset);
}
}
}
// do not further correct if focus is linebreak if key but not if edit button
if ( (focusNode.tagName == 'BR') && (editButtonInsert != true) ) {
return;
}
Line 3,982 ⟶ 3,994:
}
// check if we need to correct the focus node to higher level text-like node
var correctTo = '';
if (leftNode != rightNode) {
if ( (
correctTo = 'left';
}
else if ( (leftLevel > rightLevel) && (leftNode != focusNode) ) {
correctTo = 'left';
}
Line 3,992 ⟶ 4,007:
}
// same level, set focus outside tag markups (class names contains 'Tag'): [ [[ | || <
else if (leftLevel == rightLevel) {
Line 4,012 ⟶ 4,027:
}
if ( (/wikEd.*?Tag/.test(leftClass) != true) && (/wikEd.*?Tag/.test(rightClass) == true) && (leftNode != focusNode) ) {
correctTo = 'left';
}
else if ( (/wikEd.*?Tag/.test(leftClass) == true) && (/wikEd.*?Tag/.test(rightClass) != true) && (rightNode != focusNode) ) {
correctTo = 'right';
}
Line 4,023 ⟶ 4,038:
// set focus to the next left node
if (correctTo == 'left') {
var node
// insert new text node after linebreak and focus
if (leftNode.tagName == 'BR') {
node = wikEdFrameDocument.createTextNode('');
leftNode.parentNode.insertBefore(node, leftNode.nextSibling);
range.setStart(node, 0);
range.setEnd(node, 0);
}
else {
if (node.nodeName == '#text') {
range.setStart(node, node.textContent.length);
range.setEnd(node, node.textContent.length);
}
else {
range.setStartAfter(node);
range.setEndAfter(node);
}
}
}
Line 4,036 ⟶ 4,062:
// set focus to the next right node
else if (correctTo == 'right') {
var node
// insert new text node before linebreak
if (rightNode.tagName == 'BR') {
var node = wikEdFrameDocument.createTextNode('');
rightNode.parentNode.insertBefore(node, rightNode);
range.setStart(node, 0);
range.setEnd(node, 0);
}
else {
node = rightNode;
if (node.nodeName == '#text') {
range.setStart(node, 0);
range.setEnd(node, 0);
}
else {
range.setStartBefore(node);
range.setEndBefore(node);
}
}
}
return;
}
Line 4,801 ⟶ 4,839:
// postfix (User_talk) or prefix (Discussion_Utilisateur), test for xxx_ vs. _xxx (all ASCII non-letters as separator)
// Firefox 3.6.7 + Greasemonkey 0.8.20100408.06: invalid range with \{-‰ and \x8f-™
if (/[ -\/\:-\@\[-\`\{-\x88‰‹\x8d\x8f-\x98™›\x9d\xa0-»¿×÷]/.test(wikEdText['talk namespace suffix']) == true) {
talk = article.replace(/([^:]*)/, wikEdText['talk namespace suffix'] + '$1');
}
Line 5,123 ⟶ 5,162:
// set cursor position into closest highest text node so that highlighting does not bleed out
WikEdAntiHighlightBleeding(obj, true);
// switch the button
Line 5,424 ⟶ 5,463:
}
else {
obj.changed = obj.
}
}
Line 6,543 ⟶ 6,582:
var startNodeReselect = wikEdFrameDocument.getElementById('wikEdScrollBefore' + wikEdInsertCounter);
var endNodeReselect = wikEdFrameDocument.getElementById('wikEdScrollAfter' + wikEdInsertCounter);
range.
// should be range.setEndAfter, but that causes caret at start of next line due to https://bugzilla.mozilla.org/show_bug.cgi?id=587461
range.setEndBefore(endNodeReselect);
obj.sel.addRange(range);
WikEdScrollToNodes(startNodeReselect, endNodeReselect);
Line 7,213 ⟶ 7,253:
// set whole range
obj.whole.range = wikEdFrameDocument.createRange();
// get whole plain text
Line 7,699 ⟶ 7,737:
// scroll to node coordinates
scrollStartNode.style.verticalAlign = 'top';
scrollEndNode.style.verticalAlign = 'top';
var startOffsetLeft = WikEdGetOffsetLeft(scrollStartNode);
var startOffsetTop = WikEdGetOffsetTop(scrollStartNode);
var endOffsetRight = WikEdGetOffsetLeft(scrollEndNode);
var endOffsetBottom = WikEdGetOffsetTop(scrollEndNode);
scrollStartNode.style.verticalAlign = 'baseline';
scrollEndNode.style.verticalAlign = 'baseline';
var frameScrollTop = wikEdFrameBody.scrollTop;
var frameScrollLeft = wikEdFrameBody.scrollLeft;
Line 7,769 ⟶ 7,811:
// newlines
obj.plain = obj.plain.replace(/[\n ]*<br\b[^>]*>[\n ]*()/g, '\n');
// <div>...</div> to <br> for Safari, Chrome, WebKit
if ( (wikEdSafari == true) || (wikEdChrome == true) || (wikEdWebKit == true) ) {
var isRemove = [];
obj.plain = obj.plain.replace(/(<(\/?)div\b([^>]*)>)/g,
function (p, p1, p2, p3) {
if (p2 == '') {
if (p3 == '') {
isRemove.push(true);
return('\x00');
}
isRemove.push(false);
return(p1);
}
if (isRemove.pop() == true) {
return('\x01');
}
return(p1);
}
);
obj.plain = obj.plain.replace(/\x00\n\x01/g, '\x01');
obj.plain = obj.plain.replace(/\x01\n/g, '\x01');
obj.plain = obj.plain.replace(/\n\x00/g, '\x00');
obj.plain = obj.plain.replace(/\x01\x00/g, '\x01');
obj.plain = obj.plain.replace(/^\x00|\x01$/g, '');
obj.plain = obj.plain.replace(/[\x00\x01]/g, '\n');
}
// remove empty lines from block tags
Line 8,961 ⟶ 9,030:
if ( (obj.html != '') || (wikify == true) ) {
// <div>...</div> to <br> for
if ( (wikEdSafari == true) || (wikEdChrome == true) || (wikEdWebKit == true) ) {
var isRemove = [];
Line 8,980 ⟶ 9,049:
}
);
obj.html = obj.html.replace(/
obj.html = obj.html.replace(/\x01\s*<br>/g, '\x01');
obj.html = obj.html.replace(/<br>\s*\x00/g, '\x00');
obj.html = obj.html.replace(/\x01\s*\x00/g, '\x01');
obj.html = obj.html.replace(/^\x00|\x01$/g, '');
obj.html = obj.html.replace(/[\x00\x01]/g, '<br>');
}
Line 11,452 ⟶ 11,525:
// detect interlink and namespace
// 12 inter:2 1 34 : 4 5 namespace 53 6template 6 7 89param 87
var regExpLink = /^\s*(([\w\- ]+)\:\s*)?((\:\s*)?([^\:\|\[\]\{\}\n\t]*\s*\:
regExpLink.lastIndex = 0;
var regExpMatch;
Line 11,461 ⟶ 11,534:
if (regExpMatch[1] != null) {
inter = regExpMatch[1];
interClean = inter
interClean = interClean.replace(/\s/g, ' ');
interClean = interClean.replace(/ {2,}/g, ' ');
interClean = interClean.replace(/: +:/, '');
interClean = interClean.replace(/^ $/, '');
}
if (regExpMatch[3] != null) {
ns = regExpMatch[3];
nsClean = ns
nsClean = nsClean.replace(/\s
nsClean = nsClean.replace(/
nsClean = nsClean.replace(/: :/, '');
nsClean = nsClean.replace(/^ $/, '');
// change interwiki into more common namespace if ambiguous
if ( (interClean != '') && (nsClean == '') ) {
nsClean = interClean;
ns = inter;
inter = '';
interClean = '';
}
}
Line 11,736 ⟶ 11,815:
}
}
insertLeft = '<span class="wikEdTemplContainer"><button class="' + hideButtonClass + wikEdTemplateArray.length + '" title="' + wikEdText['
wikEdTemplateArray.push( {'text': template, 'added': false} );
}
Line 12,161 ⟶ 12,240:
}
}
insertLeft += '<span class="wikEdRef"><span class="wikEdHtmlTag">';
pushRight = '</span><!--wikEdHtmlTag--></span><!--wikEdRef-->';
break;
case 'references':
Line 12,480 ⟶ 12,559:
// fix strange white spaces, leading colons
linkPrefix = linkPrefix.replace(/\s/g, ' ');
linkPrefix = linkPrefix.replace(/^ +
linkPrefix = linkPrefix.replace(/^:+ *()/, '');
linkPrefix = linkPrefix.replace(/ +/g, '_');
linkTitle = linkTitle.replace(/\s/g, ' ');
linkTitle = linkTitle.replace(/
linkTitle = linkTitle.replace(/^:+ *()/, '');
linkTitle = linkTitle.replace(/ +/g, '_');
Line 13,839 ⟶ 13,918:
// cycle through the child nodes of currentNode
var childNodes = currentNode.childNodes;
var childNode = childNodes.item(i);
Line 13,928 ⟶ 14,007:
var childNodes = currentNode.childNodes;
var childNode = childNodes.item(i);
switch (childNode.nodeType) {
Line 14,020 ⟶ 14,099:
// recurse into child nodes
if ( (currentNode.nodeType == currentNode.ELEMENT_NODE) && (/wikEdScroll(Before|After)/.test(currentNode.className) != true) ) {
WikEdGetNextTextNodeChilds(obj, currentNode, currentLevel - 1);
if (obj.foundNode != null) {
Line 14,055 ⟶ 14,134:
// cycle through child nodes (left or right)
var currentNode = childNodes.item(i);
Line 14,070 ⟶ 14,149:
// recurse into child nodes
if ( (currentNode.nodeType == currentNode.ELEMENT_NODE) && (/wikEdScroll(Before|After)/.test(currentNode.className) != true) ) {
WikEdGetNextTextNodeChilds(obj, currentNode, currentLevel - 1);
if (obj.foundNode != null) {
|