summaryrefslogtreecommitdiff
path: root/public/javascripts/tiny_mce/plugins/insertdatetime
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/insertdatetime')
-rw-r--r--public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js1
-rw-r--r--public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js80
2 files changed, 0 insertions, 81 deletions
diff --git a/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js b/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js
deleted file mode 100644
index 938ce6b..0000000
--- a/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js
+++ /dev/null
@@ -1 +0,0 @@
1(function(){tinymce.create("tinymce.plugins.InsertDateTime",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceInsertDate",function(){var d=c._getDateTime(new Date(),a.getParam("plugin_insertdate_dateFormat",a.getLang("insertdatetime.date_fmt")));a.execCommand("mceInsertContent",false,d)});a.addCommand("mceInsertTime",function(){var d=c._getDateTime(new Date(),a.getParam("plugin_insertdate_timeFormat",a.getLang("insertdatetime.time_fmt")));a.execCommand("mceInsertContent",false,d)});a.addButton("insertdate",{title:"insertdatetime.insertdate_desc",cmd:"mceInsertDate"});a.addButton("inserttime",{title:"insertdatetime.inserttime_desc",cmd:"mceInsertTime"})},getInfo:function(){return{longname:"Insert date/time",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getDateTime:function(e,a){var c=this.editor;function b(g,d){g=""+g;if(g.length<d){for(var f=0;f<(d-g.length);f++){g="0"+g}}return g}a=a.replace("%D","%m/%d/%y");a=a.replace("%r","%I:%M:%S %p");a=a.replace("%Y",""+e.getFullYear());a=a.replace("%y",""+e.getYear());a=a.replace("%m",b(e.getMonth()+1,2));a=a.replace("%d",b(e.getDate(),2));a=a.replace("%H",""+b(e.getHours(),2));a=a.replace("%M",""+b(e.getMinutes(),2));a=a.replace("%S",""+b(e.getSeconds(),2));a=a.replace("%I",""+((e.getHours()+11)%12+1));a=a.replace("%p",""+(e.getHours()<12?"AM":"PM"));a=a.replace("%B",""+c.getLang("insertdatetime.months_long").split(",")[e.getMonth()]);a=a.replace("%b",""+c.getLang("insertdatetime.months_short").split(",")[e.getMonth()]);a=a.replace("%A",""+c.getLang("insertdatetime.day_long").split(",")[e.getDay()]);a=a.replace("%a",""+c.getLang("insertdatetime.day_short").split(",")[e.getDay()]);a=a.replace("%%","%");return a}});tinymce.PluginManager.add("insertdatetime",tinymce.plugins.InsertDateTime)})(); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js
deleted file mode 100644
index 9ab3135..0000000
--- a/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js
+++ /dev/null
@@ -1,80 +0,0 @@
1/**
2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
3 *
4 * @author Moxiecode
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
6 */
7
8(function() {
9 tinymce.create('tinymce.plugins.InsertDateTime', {
10 init : function(ed, url) {
11 var t = this;
12
13 t.editor = ed;
14
15 ed.addCommand('mceInsertDate', function() {
16 var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_dateFormat", ed.getLang('insertdatetime.date_fmt')));
17
18 ed.execCommand('mceInsertContent', false, str);
19 });
20
21 ed.addCommand('mceInsertTime', function() {
22 var str = t._getDateTime(new Date(), ed.getParam("plugin_insertdate_timeFormat", ed.getLang('insertdatetime.time_fmt')));
23
24 ed.execCommand('mceInsertContent', false, str);
25 });
26
27 ed.addButton('insertdate', {title : 'insertdatetime.insertdate_desc', cmd : 'mceInsertDate'});
28 ed.addButton('inserttime', {title : 'insertdatetime.inserttime_desc', cmd : 'mceInsertTime'});
29 },
30
31 getInfo : function() {
32 return {
33 longname : 'Insert date/time',
34 author : 'Moxiecode Systems AB',
35 authorurl : 'http://tinymce.moxiecode.com',
36 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime',
37 version : tinymce.majorVersion + "." + tinymce.minorVersion
38 };
39 },
40
41 // Private methods
42
43 _getDateTime : function(d, fmt) {
44 var ed = this.editor;
45
46 function addZeros(value, len) {
47 value = "" + value;
48
49 if (value.length < len) {
50 for (var i=0; i<(len-value.length); i++)
51 value = "0" + value;
52 }
53
54 return value;
55 };
56
57 fmt = fmt.replace("%D", "%m/%d/%y");
58 fmt = fmt.replace("%r", "%I:%M:%S %p");
59 fmt = fmt.replace("%Y", "" + d.getFullYear());
60 fmt = fmt.replace("%y", "" + d.getYear());
61 fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));
62 fmt = fmt.replace("%d", addZeros(d.getDate(), 2));
63 fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));
64 fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));
65 fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));
66 fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));
67 fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));
68 fmt = fmt.replace("%B", "" + ed.getLang("insertdatetime.months_long").split(',')[d.getMonth()]);
69 fmt = fmt.replace("%b", "" + ed.getLang("insertdatetime.months_short").split(',')[d.getMonth()]);
70 fmt = fmt.replace("%A", "" + ed.getLang("insertdatetime.day_long").split(',')[d.getDay()]);
71 fmt = fmt.replace("%a", "" + ed.getLang("insertdatetime.day_short").split(',')[d.getDay()]);
72 fmt = fmt.replace("%%", "%");
73
74 return fmt;
75 }
76 });
77
78 // Register plugin
79 tinymce.PluginManager.add('insertdatetime', tinymce.plugins.InsertDateTime);
80})(); \ No newline at end of file