User:Cacycle/wikEd dev.js: Difference between revisions

Content deleted Content added
0.9.12rc
No edit summary
Line 252:
 
// frame body
'body.wikedFrameBody': 'background: #FFFFFF; margin: 0px; padding: 0.2em; overflow: -moz-scrollbars-vertical; overflow-x: auto; font-family: monospace;',
 
// syntax highlighting
Line 525:
var wikEdFindAheadSelected = wikEdFindAheadSelected || true;
 
// highlight syntax preset (set to false by single-session cookie wikEdSyntaxOff)
var wikEdHighlightSyntax = wikEdHighlightSyntax || true;
 
// enable wikEd preset (set to false by single-session cookie wikEdUseClassic)
var wikEdUseWikEd = wikEdUseWikEd || true;
 
// add '...using wikEd' to summary preset (set to true by single-session cookie wikEdSummaryUsing)
var wikEdUsing = wikEdUsing || false;
 
// fullscreen mode preset (set to true by single-session cookie wikEdFullscreen)
var wikEdFullScreenMode = wikEdFullScreenMode || false;
 
// initial text zoom for edit window (percentage)
Line 622 ⟶ 628:
 
// various
var wikEdFullScreenMode = false;
var wikEdTextareaHeight;
var wikEdLastPosObj = null;
var wikEdUsing;
 
// counters
Line 693 ⟶ 697:
 
// exclude ending space char, if any
if (myText.charAt(myText.length - 1) == ' ') {
subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + ' ';
}
Line 825 ⟶ 829:
}
 
// get button cookie settings from cookies
var cookie = WikEdGetCookie('wikEdSummaryUsing');
if (cookie != '') {
wikEdUsing = true;
}
else {
wikEdUsing = false;
}
 
Line 842 ⟶ 843:
if (cookie != '') {
wikEdHighlightSyntax = false;
}
 
cookie = WikEdGetCookie('wikEdFullscreen');
if (cookie != '') {
if (wikEdFullScreenMode == true) {;
}
 
// preset the frame styles to avoid crashes
var styleFrameWrapperPosition;
var styleFrameWrapperVisibility;
var styleFrameBody;
if (wikEdUseWikEd == true) {
styleFrameWrapperPosition = 'static';
styleFrameWrapperVisibility = 'visible';
styleFrameBody = 'style="display: block;" ';
}
else {
styleFrameWrapperPosition = 'absolute';
styleFrameWrapperVisibility = 'hidden';
styleFrameBody = 'style="display: none;" ';
}
 
Line 867 ⟶ 888:
wikEdFrameWrapper = document.createElement('div');
wikEdFrameWrapper.id = 'wikEdFrameWrapper';
wikEdFrameWrapper.classNamestyle.position = 'wikEdFrameWrapper'styleFrameWrapperPosition;
wikEdFrameWrapper.style.positionvisibility = 'static'styleFrameWrapperVisibility;
wikEdInputWrapper.appendChild(wikEdFrameWrapper);
 
Line 938 ⟶ 960:
 
// call wikibits:mwSetupToolbar() now because it would terminate with an error after setting textarea to display: none
if (wikEdUseWikEdwpToolbar =!= truenull) {
if (wpToolbar.getElementsByTagName('IMG').length !== null0) {
if (wpToolbar.getElementsByTagNametypeof('IMG'mwSetupToolbar).length == 0'function') {
mwSetupToolbar();
if (typeof(mwSetupToolbar) == 'function') {
mwSetupToolbar();
}
window.removeEventListener('load', mwSetupToolbar, false);
}
window.removeEventListener('load', mwSetupToolbar, false);
}
}
Line 990 ⟶ 1,010:
html = '';
html += '<html><head></head>';
html += '<body id="wikEdFrameBody" class="wikedFrameBody"' + styleFrameBody + 'onload="window.document.designMode = \'on\'; window.document.execCommand(\'styleWithCSS\', false, false);">';
html += '</body></html>';
 
Line 1,185 ⟶ 1,205:
 
// wrappers filled
 
// display only the textarea or the iframe
if (wikEdUseWikEd == true) {
WikEdSetEditArea(true);
}
else {
WikEdSetEditArea(false);
}
 
// add local preview button next to submit button
Line 1,229 ⟶ 1,241:
WikEdButton('wikEdHighlightSyntax', null, wikEdHighlightSyntax);
WikEdButton('wikEdUseWikEd', null, wikEdUseWikEd);
WikEdButton('wikEdFullScreen', null, falsewikEdFullScreenMode);
WikEdButton('wikEdUsing', null, wikEdUsing);
WikEdButton('wikEdCaseSensitive', null, false);
Line 1,337 ⟶ 1,349:
WikEdResizeComboInput('replace');
WikEdResizeComboInput('summary');
 
// display only the textarea or the iframe, dont change the frame
if (wikEdFullScreenModewikEdUseWikEd == true) {
WikEdSetEditArea(true, true);
}
else {
WikEdSetEditArea(false, true);
}
 
// add a link to the wikEd help page
Line 1,391 ⟶ 1,411:
// 'Save page' onclick function
saveButton.onclick = function() {
if (wikEdFullScreenMode == true) {
WikEdFullScreen(false);
}
if (wikEdUseWikEd == true) {
WikEdUpdateTextarea();
Line 1,416 ⟶ 1,433:
// 'Show preview' onclick function
previewButton.onclick = function() {
if (wikEdFullScreenMode == true) {
WikEdFullScreen(false);
}
if (wikEdUseWikEd == true) {
WikEdUpdateTextarea();
Line 1,469 ⟶ 1,483:
wikEdTextarea.focus();
}
}
 
// fullscreen mode
if (wikEdFullScreenMode == true) {
WikEdFullScreen(falsewikEdFullScreenMode);
}
 
Line 1,513 ⟶ 1,532:
//
 
function WikEdSetEditArea(useFrame, notFrame) {
 
// turn rich text frame on
Line 1,521 ⟶ 1,540:
wikEdTextarea.style.display = 'none';
 
if (notFrame != true) {
wikEdFrameWrapper.style.position = 'static';
wikEdFrameWrapper.style.visibilityposition = 'visiblestatic';
wikEdFrameBody wikEdFrameWrapper.style.displayvisibility = 'blockvisible';
wikEdFrameBody.style.display = 'block';
}
 
if (document.getElementById('toolbar') != null) {
Line 1,541 ⟶ 1,562:
// turn classic textarea on
else {
if (notFrame != true) {
wikEdFrameWrapper.style.position = 'absolute';
wikEdFrameWrapper.style.visibilityposition = 'hiddenabsolute';
wikEdFrameBody wikEdFrameWrapper.style.displayvisibility = 'nonehidden';
wikEdFrameBody.style.display = 'none';
}
 
wikEdTextareaWrapper.style.position = 'static';
Line 1,634 ⟶ 1,657:
WikEdHighlightSyntax(obj);
obj.html = obj.html.replace(/\n/g, '<br />');
var cookieExpire = new Date();
cookieExpire.setTime(cookieExpire.getTime() - 60 * 60 * 1000);
WikEdSetCookie('wikEdSyntaxOff', '', cookieExpire.toGMTString(), '/');
Line 1,722 ⟶ 1,746:
WikEdSetEditArea(true);
wikEdUseWikEd = true;
var cookieExpire = new Date();
cookieExpire.setTime(cookieExpire.getTime() - 60 * 60 * 1000);
WikEdSetCookie('wikEdUseClassic', '', cookieExpire.toGMTString(), '/');
Line 1,743 ⟶ 1,768:
// add "using wikEd" to summaries
case 'wikEdUsing':
var cookieExpire = new Date();
if (buttonObj.checked == true) {
wikEdUsing = true;
Line 1,750 ⟶ 1,774:
else {
wikEdUsing = false;
var cookieExpire = new Date();
cookieExpire.setTime(cookieExpire.getTime() - 60 * 60 * 1000);
WikEdSetCookie('wikEdSummaryUsing', '', cookieExpire.toGMTString(), '/');
Line 1,771 ⟶ 1,796:
if (buttonObj.checked == true) {
WikEdFullScreen(true);
WikEdSetCookie('wikEdFullscreen', 'true', null, '/');
}
else {
WikEdFullScreen(false);
var cookieExpire = new Date();
cookieExpire.setTime(cookieExpire.getTime() - 60 * 60 * 1000);
WikEdSetCookie('wikEdFullscreen', '', cookieExpire.toGMTString(), '/');
}
break;
Line 1,856 ⟶ 1,885:
 
// set selection range
obj.sel = wikEdFrameWindow.getSelection();
obj.selection.range = obj.sel.getRangeAt(obj.sel.rangeCount - 1);
 
Line 4,903 ⟶ 4,932:
 
// scroll to text input top
if (wikEdFullScreenMode == false) {
var wikEdInputWrapper = document.getElementById('wikEdInputWrapper');
var inputWrapperTop = WikEdGetOffsetTop(wikEdInputWrapper);
Line 4,993 ⟶ 5,022:
 
//
// WikEdFullScreen: change to fullscreen edit area or back to normal view
//
 
function WikEdMainSwitch() {
 
var cookieExpire = new Date();
 
// enable wikEd
Line 5,004 ⟶ 5,032:
wikEdDisabled = false;
WikEdSetLogo();
var cookieExpire = new Date();
cookieExpire.setTime(cookieExpire.getTime() - 60 * 60 * 1000);
WikEdSetCookie('wikEdDisabled', '', cookieExpire.toGMTString(), '/');
Line 5,027 ⟶ 5,056:
wikEdDisabled = true;
WikEdSetLogo();
var cookieExpire = new Date();
cookieExpire.setTime(cookieExpire.getTime() + wikEdCookieExpireSec * 1000);
WikEdSetCookie('wikEdDisabled', 'true', cookieExpire.toGMTString(), '/');
Line 5,243 ⟶ 5,273:
summary += ' ';
}
else if (option.summary.match(/^[\w\(\)\"\'\+\-]/) == null) {
summary += ' ';
}
Line 5,615 ⟶ 5,645:
 
// node references containing text positions
obj.plainPos[childNode] = obj.plainLength;
 
// current text length
obj.plainLength += value.length;
}
}