tjadmin 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tjadmin/version.rb +1 -1
  3. data/vendor/assets/font/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff +0 -0
  4. data/vendor/assets/font/FontAwesome.otf +0 -0
  5. data/vendor/assets/font/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff +0 -0
  6. data/vendor/assets/font/fontawesome-webfont.eot +0 -0
  7. data/vendor/assets/font/fontawesome-webfont.svg +399 -0
  8. data/vendor/assets/font/fontawesome-webfont.ttf +0 -0
  9. data/vendor/assets/font/fontawesome-webfont.woff +0 -0
  10. data/vendor/assets/javascripts/tjadmin/ace-elements.js +866 -0
  11. data/vendor/assets/javascripts/tjadmin/ace-extra.js +374 -0
  12. data/vendor/assets/javascripts/tjadmin/ace.js +310 -0
  13. data/vendor/assets/javascripts/tjadmin/additional-methods.js +617 -0
  14. data/vendor/assets/javascripts/tjadmin/bootbox.js +660 -0
  15. data/vendor/assets/javascripts/tjadmin/bootstrap-colorpicker.js +540 -0
  16. data/vendor/assets/javascripts/tjadmin/bootstrap-tag.js +206 -0
  17. data/vendor/assets/javascripts/tjadmin/bootstrap-wysiwyg.js +206 -0
  18. data/vendor/assets/javascripts/tjadmin/bootstrap.js +2280 -0
  19. data/vendor/assets/javascripts/tjadmin/chosen.jquery.js +1166 -0
  20. data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-datepicker.js +1016 -0
  21. data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-timepicker.js +888 -0
  22. data/vendor/assets/javascripts/tjadmin/date-time/daterangepicker.js +854 -0
  23. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.bg.js +14 -0
  24. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ca.js +14 -0
  25. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.cs.js +15 -0
  26. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.da.js +14 -0
  27. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.de.js +16 -0
  28. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.el.js +13 -0
  29. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.es.js +14 -0
  30. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fi.js +14 -0
  31. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fr.js +16 -0
  32. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.he.js +15 -0
  33. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hr.js +13 -0
  34. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hu.js +16 -0
  35. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.id.js +13 -0
  36. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.is.js +14 -0
  37. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.it.js +16 -0
  38. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ja.js +15 -0
  39. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.kr.js +13 -0
  40. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lt.js +16 -0
  41. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lv.js +16 -0
  42. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ms.js +14 -0
  43. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nb.js +14 -0
  44. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nl.js +14 -0
  45. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pl.js +15 -0
  46. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt-BR.js +14 -0
  47. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt.js +14 -0
  48. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ro.js +15 -0
  49. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs-latin.js +14 -0
  50. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs.js +14 -0
  51. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ru.js +14 -0
  52. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sk.js +15 -0
  53. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sl.js +14 -0
  54. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sv.js +14 -0
  55. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sw.js +15 -0
  56. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.th.js +14 -0
  57. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.tr.js +15 -0
  58. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.uk.js +14 -0
  59. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-CN.js +14 -0
  60. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-TW.js +13 -0
  61. data/vendor/assets/javascripts/tjadmin/date-time/moment.js +1400 -0
  62. data/vendor/assets/javascripts/tjadmin/excanvas.js +1428 -0
  63. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.js +3061 -0
  64. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.pie.js +817 -0
  65. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.resize.js +60 -0
  66. data/vendor/assets/javascripts/tjadmin/fuelux/data/fuelux.tree-sampledata.js +174 -0
  67. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.spinner.js +201 -0
  68. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.tree.js +173 -0
  69. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.wizard.js +172 -0
  70. data/vendor/assets/javascripts/tjadmin/fullcalendar.js +5973 -0
  71. data/vendor/assets/javascripts/tjadmin/jquery-1.10.2.js +9789 -0
  72. data/vendor/assets/javascripts/tjadmin/jquery-2.0.3.js +8829 -0
  73. data/vendor/assets/javascripts/tjadmin/jquery-ui-1.10.3.custom.js +5423 -0
  74. data/vendor/assets/javascripts/tjadmin/jquery.autosize.js +242 -0
  75. data/vendor/assets/javascripts/tjadmin/jquery.colorbox.js +1063 -0
  76. data/vendor/assets/javascripts/tjadmin/jquery.dataTables.js +12099 -0
  77. data/vendor/assets/javascripts/tjadmin/jquery.easy-pie-chart.js +200 -0
  78. data/vendor/assets/javascripts/tjadmin/jquery.gritter.js +418 -0
  79. data/vendor/assets/javascripts/tjadmin/jquery.hotkeys.js +113 -0
  80. data/vendor/assets/javascripts/tjadmin/jquery.inputlimiter.1.3.1.js +172 -0
  81. data/vendor/assets/javascripts/tjadmin/jquery.knob.js +656 -0
  82. data/vendor/assets/javascripts/tjadmin/jquery.maskedinput.js +338 -0
  83. data/vendor/assets/javascripts/tjadmin/jquery.mobile.custom.js +1081 -0
  84. data/vendor/assets/javascripts/tjadmin/jquery.slimscroll.js +448 -0
  85. data/vendor/assets/javascripts/tjadmin/jquery.sparkline.js +3054 -0
  86. data/vendor/assets/javascripts/tjadmin/jquery.ui.touch-punch.js +160 -0
  87. data/vendor/assets/javascripts/tjadmin/jquery.validate.js +1231 -0
  88. data/vendor/assets/javascripts/tjadmin/markdown/bootstrap-markdown.js +993 -0
  89. data/vendor/assets/javascripts/tjadmin/markdown/markdown.js +1616 -0
  90. data/vendor/assets/javascripts/tjadmin/markdown/to-markdown.js +184 -0
  91. data/vendor/assets/javascripts/tjadmin/select2.js +3168 -0
  92. data/vendor/assets/javascripts/tjadmin/spin.js +349 -0
  93. data/vendor/assets/javascripts/tjadmin/x-editable/ace-editable.js +368 -0
  94. data/vendor/assets/javascripts/tjadmin/x-editable/bootstrap-editable.js +6827 -0
  95. data/vendor/assets/javascripts/tjadmin.js +5 -0
  96. data/vendor/assets/stylesheets/tjadmin/ace-fonts.css.scss +13 -0
  97. data/vendor/assets/stylesheets/tjadmin/ace-ie.css +293 -0
  98. data/vendor/assets/stylesheets/tjadmin/ace-responsive.css +1113 -0
  99. data/vendor/assets/stylesheets/tjadmin/ace-skins.css +1301 -0
  100. data/vendor/assets/stylesheets/tjadmin/ace.css +14701 -0
  101. data/vendor/assets/stylesheets/tjadmin/bootstrap-responsive.css +1109 -0
  102. data/vendor/assets/stylesheets/tjadmin/bootstrap.css +6167 -0
  103. data/vendor/assets/stylesheets/tjadmin/chosen.css +430 -0
  104. data/vendor/assets/stylesheets/tjadmin/font-awesome-ie7.css +1203 -0
  105. data/vendor/assets/stylesheets/tjadmin/font-awesome.css +1479 -0
  106. data/vendor/assets/stylesheets/tjadmin/jquery-ui-1.10.3.custom.css +223 -0
  107. data/vendor/assets/stylesheets/tjadmin.css +9 -0
  108. metadata +106 -1
@@ -0,0 +1,206 @@
1
+ /* ==========================================================
2
+ * bootstrap-tag.js v2.2.5
3
+ * https://github.com/fdeschenes/bootstrap-tag
4
+ * ==========================================================
5
+ * Copyright 2012 Francois Deschenes.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================== */
19
+
20
+ !function ( $ ) {
21
+
22
+ 'use strict' // jshint ;_;
23
+
24
+ var Tag = function ( element, options ) {
25
+ this.element = $(element)
26
+ this.options = $.extend(true, {}, $.fn.tag.defaults, options)
27
+ this.values = $.grep($.map(this.element.val().split(','), $.trim), function ( value ) { return value.length > 0 })
28
+ this.show()
29
+ }
30
+
31
+ Tag.prototype = {
32
+ constructor: Tag
33
+
34
+ , show: function () {
35
+ var that = this
36
+
37
+ that.element.parent().prepend(that.element.detach().hide())
38
+ that.element
39
+ .wrap($('<div class="tags">'))
40
+ .parent()
41
+ .on('click', function () {
42
+ that.input.focus()
43
+ })
44
+
45
+ if (that.values.length) {
46
+ $.each(that.values, function () {
47
+ that.createBadge(this)
48
+ })
49
+ }
50
+
51
+ that.input = $('<input type="text">')
52
+ .attr('placeholder', that.options.placeholder)
53
+ .insertAfter(that.element)
54
+ .on('focus', function () {
55
+ that.element.parent().addClass('tags-hover')
56
+ })
57
+ .on('blur', function () {
58
+ if (!that.skip) {
59
+ that.process()
60
+ that.element.parent().removeClass('tags-hover')
61
+ that.element.siblings('.tag').removeClass('tag-important')
62
+ }
63
+ that.skip = false
64
+ })
65
+ .on('keydown', function ( event ) {
66
+ if ( event.keyCode == 188 || event.keyCode == 13 || event.keyCode == 9 ) {
67
+ if ( $.trim($(this).val()) && ( !that.element.siblings('.typeahead').length || that.element.siblings('.typeahead').is(':hidden') ) ) {
68
+ if ( event.keyCode != 9 ) event.preventDefault()
69
+ that.process()
70
+ } else if ( event.keyCode == 188 ) {
71
+ if ( !that.element.siblings('.typeahead').length || that.element.siblings('.typeahead').is(':hidden') ) {
72
+ event.preventDefault()
73
+ } else {
74
+ that.input.data('typeahead').select()
75
+ event.stopPropagation()
76
+ event.preventDefault()
77
+ }
78
+ }
79
+ } else if ( !$.trim($(this).val()) && event.keyCode == 8 ) {
80
+ var count = that.element.siblings('.tag').length
81
+ if (count) {
82
+ var tag = that.element.siblings('.tag:eq(' + (count - 1) + ')')
83
+ if (tag.hasClass('tag-important')) that.remove(count - 1)
84
+ else tag.addClass('tag-important')
85
+ }
86
+ } else {
87
+ that.element.siblings('.tag').removeClass('tag-important')
88
+ }
89
+ })
90
+ .typeahead({
91
+ source: that.options.source
92
+ , matcher: function ( value ) {
93
+ return ~value.toLowerCase().indexOf(this.query.toLowerCase()) && (that.inValues(value) == -1 || that.options.allowDuplicates)
94
+ }
95
+ , updater: $.proxy(that.add, that)
96
+ })
97
+
98
+ $(that.input.data('typeahead').$menu).on('mousedown', function() {
99
+ that.skip = true
100
+ })
101
+
102
+ this.element.trigger('shown')
103
+ }
104
+ , inValues: function ( value ) {
105
+ if (this.options.caseInsensitive) {
106
+ var index = -1
107
+ $.each(this.values, function (indexInArray, valueOfElement) {
108
+ if ( valueOfElement.toLowerCase() == value.toLowerCase() ) {
109
+ index = indexInArray
110
+ return false
111
+ }
112
+ })
113
+ return index
114
+ } else {
115
+ return $.inArray(value, this.values)
116
+ }
117
+ }
118
+ , createBadge: function ( value ) {
119
+ var that = this
120
+
121
+ $('<span/>', {
122
+ 'class' : "tag"
123
+ })
124
+ .text(value)
125
+ .append($('<button type="button" class="close">&times;</button>')
126
+ .on('click', function () {
127
+ that.remove(that.element.siblings('.tag').index($(this).closest('.tag')))
128
+ })
129
+ )
130
+ .insertBefore(that.element)
131
+ }
132
+ , add: function ( value ) {
133
+ var that = this
134
+
135
+ if ( !that.options.allowDuplicates ) {
136
+ var index = that.inValues(value)
137
+ if ( index != -1 ) {
138
+ var badge = that.element.siblings('.tag:eq(' + index + ')')
139
+ badge.addClass('tag-warning')
140
+ setTimeout(function () {
141
+ $(badge).removeClass('tag-warning')
142
+ }, 500)
143
+ return
144
+ }
145
+ }
146
+
147
+ this.values.push(value)
148
+ this.createBadge(value)
149
+
150
+ this.element.val(this.values.join(', '))
151
+ this.element.trigger('added', [value])
152
+ }
153
+ , remove: function ( index ) {
154
+ if ( index >= 0 ) {
155
+ var value = this.values.splice(index, 1)
156
+ this.element.siblings('.tag:eq(' + index + ')').remove()
157
+ this.element.val(this.values.join(', '))
158
+
159
+ this.element.trigger('removed', [value])
160
+ }
161
+ }
162
+ , process: function () {
163
+ var values = $.grep($.map(this.input.val().split(','), $.trim), function ( value ) { return value.length > 0 }),
164
+ that = this
165
+ $.each(values, function() {
166
+ that.add(this)
167
+ })
168
+ this.input.val('')
169
+ }
170
+ , skip: false
171
+ }
172
+
173
+ var old = $.fn.tag
174
+
175
+ $.fn.tag = function ( option ) {
176
+ return this.each(function () {
177
+ var that = $(this)
178
+ , data = that.data('tag')
179
+ , options = typeof option == 'object' && option
180
+ if (!data) that.data('tag', (data = new Tag(this, options)))
181
+ if (typeof option == 'string') data[option]()
182
+ })
183
+ }
184
+
185
+ $.fn.tag.defaults = {
186
+ allowDuplicates: false
187
+ , caseInsensitive: true
188
+ , placeholder: ''
189
+ , source: []
190
+ }
191
+
192
+ $.fn.tag.Constructor = Tag
193
+
194
+ $.fn.tag.noConflict = function () {
195
+ $.fn.tag = old
196
+ return this
197
+ }
198
+
199
+ $(window).on('load', function () {
200
+ $('[data-provide="tag"]').each(function () {
201
+ var that = $(this)
202
+ if (that.data('tag')) return
203
+ that.tag(that.data())
204
+ })
205
+ })
206
+ }(window.jQuery)
@@ -0,0 +1,206 @@
1
+ /* http://github.com/mindmup/bootstrap-wysiwyg */
2
+ /*global jQuery, $, FileReader*/
3
+ /*jslint browser:true*/
4
+ (function ($) {
5
+ 'use strict';
6
+ var readFileIntoDataUrl = function (fileInfo) {
7
+ var loader = $.Deferred(),
8
+ fReader = new FileReader();
9
+ fReader.onload = function (e) {
10
+ loader.resolve(e.target.result);
11
+ };
12
+ fReader.onerror = loader.reject;
13
+ fReader.onprogress = loader.notify;
14
+ fReader.readAsDataURL(fileInfo);
15
+ return loader.promise();
16
+ };
17
+ $.fn.cleanHtml = function () {
18
+ var html = $(this).html();
19
+ return html && html.replace(/(<br>|\s|<div><br><\/div>|&nbsp;)*$/, '');
20
+ };
21
+ $.fn.wysiwyg = function (userOptions) {
22
+ var editor = this,
23
+ selectedRange,
24
+ options,
25
+ toolbarBtnSelector,
26
+ updateToolbar = function () {
27
+ if (options.activeToolbarClass) {
28
+ $(options.toolbarSelector).find(toolbarBtnSelector).each(function () {
29
+ try {
30
+ var command = $(this).data(options.commandRole);
31
+ if (document.queryCommandState(command)) {
32
+ $(this).addClass(options.activeToolbarClass);
33
+ } else {
34
+ $(this).removeClass(options.activeToolbarClass);
35
+ }
36
+ } catch(e){}
37
+ });
38
+ }
39
+ },
40
+ execCommand = function (commandWithArgs, valueArg) {
41
+ var commandArr = commandWithArgs.split(' '),
42
+ command = commandArr.shift(),
43
+ args = commandArr.join(' ') + (valueArg || '');
44
+ document.execCommand(command, 0, args);
45
+ updateToolbar();
46
+ },
47
+ bindHotkeys = function (hotKeys) {
48
+ $.each(hotKeys, function (hotkey, command) {
49
+ editor.keydown(hotkey, function (e) {
50
+ if (editor.attr('contenteditable') && editor.is(':visible')) {
51
+ e.preventDefault();
52
+ e.stopPropagation();
53
+ execCommand(command);
54
+ }
55
+ }).keyup(hotkey, function (e) {
56
+ if (editor.attr('contenteditable') && editor.is(':visible')) {
57
+ e.preventDefault();
58
+ e.stopPropagation();
59
+ }
60
+ });
61
+ });
62
+ },
63
+ getCurrentRange = function () {
64
+ try {
65
+ var sel = window.getSelection();
66
+ if (sel.getRangeAt && sel.rangeCount) {
67
+ return sel.getRangeAt(0);
68
+ }
69
+ } catch(e){}
70
+ },
71
+ saveSelection = function () {
72
+ selectedRange = getCurrentRange();
73
+ },
74
+ restoreSelection = function () {
75
+ try {
76
+ var selection = window.getSelection();
77
+ if (selectedRange) {
78
+ try {
79
+ selection.removeAllRanges();
80
+ } catch (ex) {
81
+ document.body.createTextRange().select();
82
+ document.selection.empty();
83
+ }
84
+
85
+ selection.addRange(selectedRange);
86
+ }
87
+ } catch(e){}
88
+ },
89
+ insertFiles = function (files) {
90
+ editor.focus();
91
+ $.each(files, function (idx, fileInfo) {
92
+ if (/^image\//.test(fileInfo.type)) {
93
+ $.when(readFileIntoDataUrl(fileInfo)).done(function (dataUrl) {
94
+ execCommand('insertimage', dataUrl);
95
+ }).fail(function (e) {
96
+ options.fileUploadError("file-reader", e);
97
+ });
98
+ } else {
99
+ options.fileUploadError("unsupported-file-type", fileInfo.type);
100
+ }
101
+ });
102
+ },
103
+ markSelection = function (input, color) {
104
+ restoreSelection();
105
+ if (document.queryCommandSupported('hiliteColor')) {
106
+ document.execCommand('hiliteColor', 0, color || 'transparent');
107
+ }
108
+ saveSelection();
109
+ input.data(options.selectionMarker, color);
110
+ },
111
+ bindToolbar = function (toolbar, options) {
112
+ toolbar.find(toolbarBtnSelector).click(function () {
113
+ restoreSelection();
114
+ editor.focus();
115
+ execCommand($(this).data(options.commandRole));
116
+ saveSelection();
117
+ });
118
+ toolbar.find('[data-toggle=dropdown]').click(restoreSelection);
119
+
120
+ toolbar.find('input[type=text][data-' + options.commandRole + ']').on('webkitspeechchange change', function () {
121
+ var newValue = this.value; /* ugly but prevents fake double-calls due to selection restoration */
122
+ this.value = '';
123
+ restoreSelection();
124
+ if (newValue) {
125
+ editor.focus();
126
+ execCommand($(this).data(options.commandRole), newValue);
127
+ }
128
+ saveSelection();
129
+ }).on('focus', function () {
130
+ var input = $(this);
131
+ if (!input.data(options.selectionMarker)) {
132
+ markSelection(input, options.selectionColor);
133
+ input.focus();
134
+ }
135
+ }).on('blur', function () {
136
+ var input = $(this);
137
+ if (input.data(options.selectionMarker)) {
138
+ markSelection(input, false);
139
+ }
140
+ });
141
+ toolbar.find('input[type=file][data-' + options.commandRole + ']').change(function () {
142
+ restoreSelection();
143
+ if (this.type === 'file' && this.files && this.files.length > 0) {
144
+ insertFiles(this.files);
145
+ }
146
+ saveSelection();
147
+ this.value = '';
148
+ });
149
+ },
150
+ initFileDrops = function () {
151
+ editor.on('dragenter dragover', false)
152
+ .on('drop', function (e) {
153
+ var dataTransfer = e.originalEvent.dataTransfer;
154
+ e.stopPropagation();
155
+ e.preventDefault();
156
+ if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
157
+ insertFiles(dataTransfer.files);
158
+ }
159
+ });
160
+ };
161
+ options = $.extend({}, $.fn.wysiwyg.defaults, userOptions);
162
+ toolbarBtnSelector = 'a[data-' + options.commandRole + '],button[data-' + options.commandRole + '],input[type=button][data-' + options.commandRole + ']';
163
+ bindHotkeys(options.hotKeys);
164
+ if (options.dragAndDropImages) {
165
+ initFileDrops();
166
+ }
167
+ bindToolbar($(options.toolbarSelector), options);
168
+ editor.attr('contenteditable', true)
169
+ .on('mouseup keyup mouseout', function () {
170
+ saveSelection();
171
+ updateToolbar();
172
+ });
173
+ $(window).bind('touchend', function (e) {
174
+ var isInside = (editor.is(e.target) || editor.has(e.target).length > 0),
175
+ currentRange = getCurrentRange(),
176
+ clear = currentRange && (currentRange.startContainer === currentRange.endContainer && currentRange.startOffset === currentRange.endOffset);
177
+ if (!clear || isInside) {
178
+ saveSelection();
179
+ updateToolbar();
180
+ }
181
+ });
182
+ return this;
183
+ };
184
+ $.fn.wysiwyg.defaults = {
185
+ hotKeys: {
186
+ 'ctrl+b meta+b': 'bold',
187
+ 'ctrl+i meta+i': 'italic',
188
+ 'ctrl+u meta+u': 'underline',
189
+ 'ctrl+z meta+z': 'undo',
190
+ 'ctrl+y meta+y meta+shift+z': 'redo',
191
+ 'ctrl+l meta+l': 'justifyleft',
192
+ 'ctrl+r meta+r': 'justifyright',
193
+ 'ctrl+e meta+e': 'justifycenter',
194
+ 'ctrl+j meta+j': 'justifyfull',
195
+ 'shift+tab': 'outdent',
196
+ 'tab': 'indent'
197
+ },
198
+ toolbarSelector: '[data-role=editor-toolbar]',
199
+ commandRole: 'edit',
200
+ activeToolbarClass: 'btn-info',
201
+ selectionMarker: 'edit-focus-marker',
202
+ selectionColor: 'darkgrey',
203
+ dragAndDropImages: true,
204
+ fileUploadError: function (reason, detail) { console.log("File upload error", reason, detail); }
205
+ };
206
+ }(window.jQuery));