Blame view

js/_tiny_mce/plugins/autosave/editor_plugin_src.js 1.09 KB
42868d70   andryeyev   Создал GIT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  /**
   * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
   *
   * @author Moxiecode
   * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
   */
  
  /* Import plugin specific language pack */
  tinyMCE.importPluginLanguagePack('autosave');
  
  var TinyMCE_AutoSavePlugin = {
  	getInfo : function() {
  		return {
  			longname : 'Auto save',
  			author : 'Moxiecode Systems AB',
  			authorurl : 'http://tinymce.moxiecode.com',
  			infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
  			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
  		};
  	},
  
  	// Private plugin internal methods
  
  	_beforeUnloadHandler : function() {
  		var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
  
  		if (tinyMCE.getParam("fullscreen_is_enabled"))
  			return;
  
  		for (n in tinyMCE.instances) {
  			inst = tinyMCE.instances[n];
  
  			if (!tinyMCE.isInstance(inst))
  				continue;
  
  			if (inst.isDirty())
  				return msg;
  		}
  
  		return;
  	}
  };
  
  window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
  
  tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);