Sha256: 2d072b768b7f70e799dcede132bf5d7d670279228f5b47b462477455cc17e655

Contents?: true

Size: 1.93 KB

Versions: 19

Compression:

Stored size: 1.93 KB

Contents

tinymce.PluginManager.add("autosave",function(e){function t(e,t){var n={s:1e3,m:6e4};return e=/^(\d+)([ms]?)$/.exec(""+(e||t)),(e[2]?n[e[2]]:1)*parseInt(e,10)}function n(){var e=parseInt(f.getItem(h+"autosave.time"),10)||0;return(new Date).getTime()-e>d.autosave_retention?(i(!1),!1):!0}function i(t){f.removeItem(h+"autosave.draft"),f.removeItem(h+"autosave.time"),t!==!1&&e.fire("RemoveDraft")}function a(){c()||(f.setItem(h+"autosave.draft",e.getContent({format:"raw",no_events:!0})),f.setItem(h+"autosave.time",(new Date).getTime()),e.fire("StoreDraft"))}function r(){n()&&(e.setContent(f.getItem(h+"autosave.draft"),{format:"raw"}),e.fire("RestoreDraft"))}function o(){m||(setInterval(function(){e.removed||a()},d.autosave_interval),m=!0)}function s(){var t=this;t.disabled(!n()),e.on("StoreDraft RestoreDraft RemoveDraft",function(){t.disabled(!n())}),o()}function l(){e.undoManager.beforeChange(),r(),i(),e.undoManager.add()}function u(){var e;return tinymce.each(tinymce.editors,function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&t.getParam("autosave_ask_before_unload",!0)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e}function c(t){var n=e.settings.forced_root_block;return t=tinymce.trim("undefined"==typeof t?e.getBody().innerHTML:t),""===t||new RegExp("^<"+n+">(( |&nbsp;|[ 	]|<br[^>]*>)+?|)</"+n+">|<br>$","i").test(t)}var m,d=e.settings,f=tinymce.util.LocalStorage,h=e.id;d.autosave_interval=t(d.autosave_interval,"30s"),d.autosave_retention=t(d.autosave_retention,"20m"),e.addButton("restoredraft",{title:"Restore last draft",onclick:l,onPostRender:s}),e.addMenuItem("restoredraft",{text:"Restore last draft",onclick:l,onPostRender:s,context:"file"}),e.settings.autosave_restore_when_empty!==!1&&(e.on("init",function(){n()&&c()&&r()}),e.on("saveContent",function(){i()})),window.onbeforeunload=u,this.hasDraft=n,this.storeDraft=a,this.restoreDraft=r,this.removeDraft=i,this.isEmpty=c});

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
it-logica-application-backbone-1.5.3 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.5.2 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.5.1 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.5.0 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.12 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.11 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.10 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.9 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.8 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.7 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.6 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.5 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
tinymce-rails-4.0.8 vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js
tinymce-rails-4.0.7 vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js
tinymce-rails4-4.0.6 app/assets/javascripts/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.4 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
it-logica-application-backbone-1.4.3 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js
tinymce-rails-4.0.6 vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js
it-logica-application-backbone-1.4.2 app/assets/javascripts/backbone_js/tinymce/jscripts/tiny_mce/plugins/autosave/plugin.min.js