furatto 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +102 -17
  3. data/furatto.gemspec +1 -0
  4. data/lib/furatto/version.rb +1 -1
  5. data/vendor/assets/javascripts/furatto.js +5978 -15
  6. data/vendor/assets/javascripts/furatto.min.js +3 -0
  7. data/vendor/assets/stylesheets/font-awesome.scss +2495 -0
  8. data/vendor/assets/stylesheets/furatto.scss +15 -30
  9. data/vendor/assets/stylesheets/furatto/_alerts.scss +5 -6
  10. data/vendor/assets/stylesheets/furatto/_base.scss +33 -121
  11. data/vendor/assets/stylesheets/furatto/_buttons.scss +36 -11
  12. data/vendor/assets/stylesheets/furatto/_code.scss +7 -6
  13. data/vendor/assets/stylesheets/furatto/_dashboard.scss +36 -0
  14. data/vendor/assets/stylesheets/furatto/_dropdown.scss +29 -31
  15. data/vendor/assets/stylesheets/furatto/_fonts.scss +0 -588
  16. data/vendor/assets/stylesheets/furatto/_footer.scss +8 -25
  17. data/vendor/assets/stylesheets/furatto/_forms.scss +80 -63
  18. data/vendor/assets/stylesheets/furatto/_grid.scss +34 -30
  19. data/vendor/assets/stylesheets/furatto/_images.scss +28 -8
  20. data/vendor/assets/stylesheets/furatto/_labels.scss +3 -2
  21. data/vendor/assets/stylesheets/furatto/_mixins.scss +81 -164
  22. data/vendor/assets/stylesheets/furatto/_modal.scss +339 -77
  23. data/vendor/assets/stylesheets/furatto/_nav.scss +43 -45
  24. data/vendor/assets/stylesheets/furatto/_navbar.scss +60 -31
  25. data/vendor/assets/stylesheets/furatto/_panel.scss +277 -0
  26. data/vendor/assets/stylesheets/furatto/_responsive_navbar.scss +37 -26
  27. data/vendor/assets/stylesheets/furatto/_responsive_tables.scss +1 -1
  28. data/vendor/assets/stylesheets/furatto/_responsive_utilities.scss +182 -0
  29. data/vendor/assets/stylesheets/furatto/_responsiveslides.scss +157 -174
  30. data/vendor/assets/stylesheets/furatto/_tooltips.scss +2 -14
  31. data/vendor/assets/stylesheets/furatto/_typography.scss +41 -83
  32. data/vendor/assets/stylesheets/furatto/_variables.scss +241 -244
  33. metadata +14 -81
  34. data/vendor/assets/images/icheck/aero.png +0 -0
  35. data/vendor/assets/images/icheck/aero@2x.png +0 -0
  36. data/vendor/assets/images/icheck/blue.png +0 -0
  37. data/vendor/assets/images/icheck/blue@2x.png +0 -0
  38. data/vendor/assets/images/icheck/flat.png +0 -0
  39. data/vendor/assets/images/icheck/flat@2x.png +0 -0
  40. data/vendor/assets/images/icheck/green.png +0 -0
  41. data/vendor/assets/images/icheck/green@2x.png +0 -0
  42. data/vendor/assets/images/icheck/grey.png +0 -0
  43. data/vendor/assets/images/icheck/grey@2x.png +0 -0
  44. data/vendor/assets/images/icheck/orange.png +0 -0
  45. data/vendor/assets/images/icheck/orange@2x.png +0 -0
  46. data/vendor/assets/images/icheck/pink.png +0 -0
  47. data/vendor/assets/images/icheck/pink@2x.png +0 -0
  48. data/vendor/assets/images/icheck/purple.png +0 -0
  49. data/vendor/assets/images/icheck/purple@2x.png +0 -0
  50. data/vendor/assets/images/icheck/red.png +0 -0
  51. data/vendor/assets/images/icheck/red@2x.png +0 -0
  52. data/vendor/assets/images/icheck/yellow.png +0 -0
  53. data/vendor/assets/images/icheck/yellow@2x.png +0 -0
  54. data/vendor/assets/images/icons/customize-icon150.png +0 -0
  55. data/vendor/assets/images/icons/flexible-icon.png +0 -0
  56. data/vendor/assets/images/icons/github-128-black.png +0 -0
  57. data/vendor/assets/images/icons/iphone-icon150.png +0 -0
  58. data/vendor/assets/images/icons/lock-icon128.png +0 -0
  59. data/vendor/assets/images/icons/rocket-icon128.png +0 -0
  60. data/vendor/assets/images/icons/rocket-icon150.png +0 -0
  61. data/vendor/assets/images/icons/screen-icon.png +0 -0
  62. data/vendor/assets/images/icons/screens-icon.png +0 -0
  63. data/vendor/assets/images/icons/screens2-icon.png +0 -0
  64. data/vendor/assets/images/next.png +0 -0
  65. data/vendor/assets/images/previous.png +0 -0
  66. data/vendor/assets/images/themes.gif +0 -0
  67. data/vendor/assets/images/toggle.png +0 -0
  68. data/vendor/assets/javascripts/dropdown.js +0 -169
  69. data/vendor/assets/javascripts/jpanel.js +0 -547
  70. data/vendor/assets/javascripts/jquery.avgrund.js +0 -127
  71. data/vendor/assets/javascripts/jquery.dropkick-1.0.0.js +0 -400
  72. data/vendor/assets/javascripts/jquery.icheck.js +0 -462
  73. data/vendor/assets/javascripts/jquery.tagsinput.js +0 -354
  74. data/vendor/assets/javascripts/jquery.toolbar.js +0 -242
  75. data/vendor/assets/javascripts/legacy.js +0 -140
  76. data/vendor/assets/javascripts/picker.date.js +0 -957
  77. data/vendor/assets/javascripts/picker.js +0 -785
  78. data/vendor/assets/javascripts/picker.time.js +0 -651
  79. data/vendor/assets/javascripts/rainbow-custom.min.js +0 -13
  80. data/vendor/assets/javascripts/responsive-tables.js +0 -67
  81. data/vendor/assets/javascripts/responsiveslides.js +0 -391
  82. data/vendor/assets/javascripts/tooltip.js +0 -353
  83. data/vendor/assets/stylesheets/furatto/_date_picker.time.scss +0 -122
  84. data/vendor/assets/stylesheets/furatto/_font-awesome-ie7.scss +0 -1953
  85. data/vendor/assets/stylesheets/furatto/_layout.scss +0 -0
  86. data/vendor/assets/stylesheets/furatto/_left_navbar.scss +0 -100
  87. data/vendor/assets/stylesheets/furatto/_pagination.scss +0 -158
  88. data/vendor/assets/stylesheets/furatto/_responsive-1200px-min.scss +0 -21
  89. data/vendor/assets/stylesheets/furatto/_responsive-767px-max.scss +0 -82
  90. data/vendor/assets/stylesheets/furatto/_responsive-768px-979px.scss +0 -23
  91. data/vendor/assets/stylesheets/furatto/_select.scss +0 -191
  92. data/vendor/assets/stylesheets/furatto/_tags.scss +0 -107
  93. data/vendor/assets/stylesheets/furatto/_vrt_navbar.scss +0 -61
  94. data/vendor/assets/stylesheets/furatto/icheck/_aero.scss +0 -64
  95. data/vendor/assets/stylesheets/furatto/icheck/_all.scss +0 -20
  96. data/vendor/assets/stylesheets/furatto/icheck/_blue.scss +0 -64
  97. data/vendor/assets/stylesheets/furatto/icheck/_flat.scss +0 -64
  98. data/vendor/assets/stylesheets/furatto/icheck/_green.scss +0 -64
  99. data/vendor/assets/stylesheets/furatto/icheck/_grey.scss +0 -64
  100. data/vendor/assets/stylesheets/furatto/icheck/_orange.scss +0 -64
  101. data/vendor/assets/stylesheets/furatto/icheck/_pink.scss +0 -64
  102. data/vendor/assets/stylesheets/furatto/icheck/_purple.scss +0 -64
  103. data/vendor/assets/stylesheets/furatto/icheck/_red.scss +0 -64
  104. data/vendor/assets/stylesheets/furatto/icheck/_yellow.scss +0 -64
@@ -1,354 +0,0 @@
1
- /*
2
-
3
- jQuery Tags Input Plugin 1.3.3
4
-
5
- Copyright (c) 2011 XOXCO, Inc
6
-
7
- Documentation for this plugin lives here:
8
- http://xoxco.com/clickable/jquery-tags-input
9
-
10
- Licensed under the MIT license:
11
- http://www.opensource.org/licenses/mit-license.php
12
-
13
- ben@xoxco.com
14
-
15
- */
16
-
17
- (function($) {
18
-
19
- var delimiter = new Array();
20
- var tags_callbacks = new Array();
21
- $.fn.doAutosize = function(o){
22
- var minWidth = $(this).data('minwidth'),
23
- maxWidth = $(this).data('maxwidth'),
24
- val = '',
25
- input = $(this),
26
- testSubject = $('#'+$(this).data('tester_id'));
27
-
28
- if (val === (val = input.val())) {return;}
29
-
30
- // Enter new content into testSubject
31
- var escaped = val.replace(/&/g, '&amp;').replace(/\s/g,' ').replace(/</g, '&lt;').replace(/>/g, '&gt;');
32
- testSubject.html(escaped);
33
- // Calculate new width + whether to change
34
- var testerWidth = testSubject.width(),
35
- newWidth = (testerWidth + o.comfortZone) >= minWidth ? testerWidth + o.comfortZone : minWidth,
36
- currentWidth = input.width(),
37
- isValidWidthChange = (newWidth < currentWidth && newWidth >= minWidth)
38
- || (newWidth > minWidth && newWidth < maxWidth);
39
-
40
- // Animate width
41
- if (isValidWidthChange) {
42
- input.width(newWidth);
43
- }
44
-
45
-
46
- };
47
- $.fn.resetAutosize = function(options){
48
- // alert(JSON.stringify(options));
49
- var minWidth = $(this).data('minwidth') || options.minInputWidth || $(this).width(),
50
- maxWidth = $(this).data('maxwidth') || options.maxInputWidth || ($(this).closest('.tagsinput').width() - options.inputPadding),
51
- val = '',
52
- input = $(this),
53
- testSubject = $('<tester/>').css({
54
- position: 'absolute',
55
- top: -9999,
56
- left: -9999,
57
- width: 'auto',
58
- fontSize: input.css('fontSize'),
59
- fontFamily: input.css('fontFamily'),
60
- fontWeight: input.css('fontWeight'),
61
- letterSpacing: input.css('letterSpacing'),
62
- whiteSpace: 'nowrap'
63
- }),
64
- testerId = $(this).attr('id')+'_autosize_tester';
65
- if(! $('#'+testerId).length > 0){
66
- testSubject.attr('id', testerId);
67
- testSubject.appendTo('body');
68
- }
69
-
70
- input.data('minwidth', minWidth);
71
- input.data('maxwidth', maxWidth);
72
- input.data('tester_id', testerId);
73
- input.css('width', minWidth);
74
- };
75
-
76
- $.fn.addTag = function(value,options) {
77
- options = jQuery.extend({focus:false,callback:true},options);
78
- this.each(function() {
79
- var id = $(this).attr('id');
80
-
81
- var tagslist = $(this).val().split(delimiter[id]);
82
- if (tagslist[0] == '') {
83
- tagslist = new Array();
84
- }
85
-
86
- value = jQuery.trim(value);
87
-
88
- if (options.unique) {
89
- var skipTag = $(this).tagExist(value);
90
- if(skipTag == true) {
91
- //Marks fake input as not_valid to let styling it
92
- $('#'+id+'_tag').addClass('not_valid');
93
- }
94
- } else {
95
- var skipTag = false;
96
- }
97
-
98
- if (value !='' && skipTag != true) {
99
- $('<span>').addClass('tag').append(
100
- $('<span>').text(value).append('&nbsp;&nbsp;'),
101
- $('<a class="tagsinput-remove-link icon-remove">', {
102
- href : '#',
103
- title : 'Remove tag',
104
- text : ''
105
- }).click(function () {
106
- return $('#' + id).removeTag(escape(value));
107
- })
108
- ).insertBefore('#' + id + '_addTag');
109
-
110
- tagslist.push(value);
111
-
112
- $('#'+id+'_tag').val('');
113
- if (options.focus) {
114
- $('#'+id+'_tag').focus();
115
- } else {
116
- $('#'+id+'_tag').blur();
117
- }
118
-
119
- $.fn.tagsInput.updateTagsField(this,tagslist);
120
-
121
- if (options.callback && tags_callbacks[id] && tags_callbacks[id]['onAddTag']) {
122
- var f = tags_callbacks[id]['onAddTag'];
123
- f.call(this, value);
124
- }
125
- if(tags_callbacks[id] && tags_callbacks[id]['onChange'])
126
- {
127
- var i = tagslist.length;
128
- var f = tags_callbacks[id]['onChange'];
129
- f.call(this, $(this), tagslist[i-1]);
130
- }
131
- }
132
-
133
- });
134
-
135
- return false;
136
- };
137
-
138
- $.fn.removeTag = function(value) {
139
- value = unescape(value);
140
- this.each(function() {
141
- var id = $(this).attr('id');
142
-
143
- var old = $(this).val().split(delimiter[id]);
144
-
145
- $('#'+id+'_tagsinput .tag').remove();
146
- str = '';
147
- for (i=0; i< old.length; i++) {
148
- if (old[i]!=value) {
149
- str = str + delimiter[id] +old[i];
150
- }
151
- }
152
-
153
- $.fn.tagsInput.importTags(this,str);
154
-
155
- if (tags_callbacks[id] && tags_callbacks[id]['onRemoveTag']) {
156
- var f = tags_callbacks[id]['onRemoveTag'];
157
- f.call(this, value);
158
- }
159
- });
160
-
161
- return false;
162
- };
163
-
164
- $.fn.tagExist = function(val) {
165
- var id = $(this).attr('id');
166
- var tagslist = $(this).val().split(delimiter[id]);
167
- return (jQuery.inArray(val, tagslist) >= 0); //true when tag exists, false when not
168
- };
169
-
170
- // clear all existing tags and import new ones from a string
171
- $.fn.importTags = function(str) {
172
- id = $(this).attr('id');
173
- $('#'+id+'_tagsinput .tag').remove();
174
- $.fn.tagsInput.importTags(this,str);
175
- }
176
-
177
- $.fn.tagsInput = function(options) {
178
- var settings = jQuery.extend({
179
- interactive:true,
180
- defaultText:'',
181
- minChars:0,
182
- width:'',
183
- height:'',
184
- autocomplete: {selectFirst: false },
185
- 'hide':true,
186
- 'delimiter':',',
187
- 'unique':true,
188
- removeWithBackspace:true,
189
- placeholderColor:'#666666',
190
- autosize: true,
191
- comfortZone: 20,
192
- inputPadding: 6*2
193
- },options);
194
-
195
- this.each(function() {
196
- if (settings.hide) {
197
- $(this).hide();
198
- }
199
- var id = $(this).attr('id');
200
- if (!id || delimiter[$(this).attr('id')]) {
201
- id = $(this).attr('id', 'tags' + new Date().getTime()).attr('id');
202
- }
203
-
204
- var data = jQuery.extend({
205
- pid:id,
206
- real_input: '#'+id,
207
- holder: '#'+id+'_tagsinput',
208
- input_wrapper: '#'+id+'_addTag',
209
- fake_input: '#'+id+'_tag'
210
- },settings);
211
-
212
- delimiter[id] = data.delimiter;
213
-
214
- if (settings.onAddTag || settings.onRemoveTag || settings.onChange) {
215
- tags_callbacks[id] = new Array();
216
- tags_callbacks[id]['onAddTag'] = settings.onAddTag;
217
- tags_callbacks[id]['onRemoveTag'] = settings.onRemoveTag;
218
- tags_callbacks[id]['onChange'] = settings.onChange;
219
- }
220
-
221
- var markup = '<div id="'+id+'_tagsinput" class="tagsinput"><div class="tagsinput-add-container" id="'+id+'_addTag"><div class="tagsinput-add icon-plus"></div>';
222
-
223
- if (settings.interactive) {
224
- markup = markup + '<input id="'+id+'_tag" value="" data-default="'+settings.defaultText+'" />';
225
- }
226
-
227
- markup = markup + '</div></div>';
228
-
229
- $(markup).insertAfter(this);
230
-
231
- $(data.holder).css('width',settings.width);
232
- $(data.holder).css('min-height',settings.height);
233
- $(data.holder).css('height','100%');
234
-
235
- if ($(data.real_input).val()!='') {
236
- $.fn.tagsInput.importTags($(data.real_input),$(data.real_input).val());
237
- }
238
- if (settings.interactive) {
239
- $(data.fake_input).val($(data.fake_input).attr('data-default'));
240
- $(data.fake_input).css('color',settings.placeholderColor);
241
- $(data.fake_input).resetAutosize(settings);
242
-
243
- $(data.holder).bind('click',data,function(event) {
244
- $(event.data.fake_input).focus();
245
- });
246
-
247
- $(data.fake_input).bind('focus',data,function(event) {
248
- if ($(event.data.fake_input).val()==$(event.data.fake_input).attr('data-default')) {
249
- $(event.data.fake_input).val('');
250
- }
251
- $(event.data.fake_input).css('color','#000000');
252
- });
253
-
254
- if (settings.autocomplete_url != undefined) {
255
- autocomplete_options = {source: settings.autocomplete_url};
256
- for (attrname in settings.autocomplete) {
257
- autocomplete_options[attrname] = settings.autocomplete[attrname];
258
- }
259
-
260
- if (jQuery.Autocompleter !== undefined) {
261
- $(data.fake_input).autocomplete(settings.autocomplete_url, settings.autocomplete);
262
- $(data.fake_input).bind('result',data,function(event,data,formatted) {
263
- if (data) {
264
- $('#'+id).addTag(data[0] + "",{focus:true,unique:(settings.unique)});
265
- }
266
- });
267
- } else if (jQuery.ui.autocomplete !== undefined) {
268
- $(data.fake_input).autocomplete(autocomplete_options);
269
- $(data.fake_input).bind('autocompleteselect',data,function(event,ui) {
270
- $(event.data.real_input).addTag(ui.item.value,{focus:true,unique:(settings.unique)});
271
- return false;
272
- });
273
- }
274
-
275
-
276
- } else {
277
- // if a user tabs out of the field, create a new tag
278
- // this is only available if autocomplete is not used.
279
- $(data.fake_input).bind('blur',data,function(event) {
280
- var d = $(this).attr('data-default');
281
- if ($(event.data.fake_input).val()!='' && $(event.data.fake_input).val()!=d) {
282
- if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
283
- $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
284
- } else {
285
- $(event.data.fake_input).val($(event.data.fake_input).attr('data-default'));
286
- $(event.data.fake_input).css('color',settings.placeholderColor);
287
- }
288
- return false;
289
- });
290
-
291
- }
292
- // if user types a comma, create a new tag
293
- $(data.fake_input).bind('keypress',data,function(event) {
294
- if (event.which==event.data.delimiter.charCodeAt(0) || event.which==13 ) {
295
- event.preventDefault();
296
- if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
297
- $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)});
298
- $(event.data.fake_input).resetAutosize(settings);
299
- return false;
300
- } else if (event.data.autosize) {
301
- $(event.data.fake_input).doAutosize(settings);
302
-
303
- }
304
- });
305
- //Delete last tag on backspace
306
- data.removeWithBackspace && $(data.fake_input).bind('keydown', function(event)
307
- {
308
- if(event.keyCode == 8 && $(this).val() == '')
309
- {
310
- event.preventDefault();
311
- var last_tag = $(this).closest('.tagsinput').find('.tag:last').text();
312
- var id = $(this).attr('id').replace(/_tag$/, '');
313
- last_tag = last_tag.replace(/[\s\u00a0]+x$/, '');
314
- $('#' + id).removeTag(escape(last_tag));
315
- $(this).trigger('focus');
316
- }
317
- });
318
- $(data.fake_input).blur();
319
-
320
- //Removes the not_valid class when user changes the value of the fake input
321
- if(data.unique) {
322
- $(data.fake_input).keydown(function(event){
323
- if(event.keyCode == 8 || String.fromCharCode(event.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/)) {
324
- $(this).removeClass('not_valid');
325
- }
326
- });
327
- }
328
- } // if settings.interactive
329
- });
330
-
331
- return this;
332
-
333
- };
334
-
335
- $.fn.tagsInput.updateTagsField = function(obj,tagslist) {
336
- var id = $(obj).attr('id');
337
- $(obj).val(tagslist.join(delimiter[id]));
338
- };
339
-
340
- $.fn.tagsInput.importTags = function(obj,val) {
341
- $(obj).val('');
342
- var id = $(obj).attr('id');
343
- var tags = val.split(delimiter[id]);
344
- for (i=0; i<tags.length; i++) {
345
- $(obj).addTag(tags[i],{focus:false,callback:false});
346
- }
347
- if(tags_callbacks[id] && tags_callbacks[id]['onChange'])
348
- {
349
- var f = tags_callbacks[id]['onChange'];
350
- f.call(obj, obj, tags[i]);
351
- }
352
- };
353
-
354
- })(jQuery);
@@ -1,242 +0,0 @@
1
- /**
2
- * Toolbar.js
3
- *
4
- * @fileoverview jQuery plugin that creates tooltip style toolbars.
5
- * @link http://paulkinzett.github.com/toolbar/
6
- * @author Paul Kinzett (http://kinzett.co.nz/)
7
- * @version 1.0.4
8
- * @requires jQuery 1.7+
9
- *
10
- * @license jQuery Toolbar Plugin v1.0.4
11
- * http://paulkinzett.github.com/toolbar/
12
- * Copyright 2013 Paul Kinzett (http://kinzett.co.nz/)
13
- * Released under the MIT license.
14
- * <https://raw.github.com/paulkinzett/toolbar/master/LICENSE.txt>
15
- */
16
-
17
- if ( typeof Object.create !== 'function' ) {
18
- Object.create = function( obj ) {
19
- function F() {}
20
- F.prototype = obj;
21
- return new F();
22
- };
23
- }
24
-
25
- (function( $, window, document, undefined ) {
26
-
27
- var ToolBar = {
28
- init: function( options, elem ) {
29
- var self = this;
30
- self.elem = elem;
31
- self.$elem = $( elem );
32
- self.options = $.extend( {}, $.fn.toolbar.options, options );
33
- self.toolbar = $('<div class="tool-container gradient" />')
34
- .addClass('tool-'+self.options.position)
35
- .addClass('tool-rounded')
36
- .append('<div class="tool-items" />')
37
- .append('<div class="arrow" />')
38
- .appendTo('body')
39
- .css('opacity', 0)
40
- .hide();
41
- self.toolbar_arrow = self.toolbar.find('.arrow');
42
- self.initializeToolbar();
43
- },
44
-
45
- initializeToolbar: function() {
46
- var self = this;
47
- self.populateContent();
48
- self.setTrigger();
49
- self.toolbarWidth = self.toolbar.width();
50
- },
51
-
52
- setTrigger: function() {
53
- var self = this;
54
-
55
- self.$elem.on('click', function(event) {
56
- event.preventDefault();
57
- if(self.$elem.hasClass('pressed')) {
58
- self.hide();
59
- } else {
60
- self.show();
61
- }
62
- });
63
-
64
- if (self.options.hideOnClick) {
65
- $('html').on("click.toolbar", function ( event ) {
66
- if (event.target != self.elem &&
67
- self.$elem.has(event.target).length === 0 &&
68
- self.toolbar.has(event.target).length === 0 &&
69
- self.toolbar.is(":visible")) {
70
- self.hide();
71
- }
72
- });
73
- }
74
-
75
- $(window).resize(function( event ) {
76
- event.stopPropagation();
77
- if ( self.toolbar.is(":visible") ) {
78
- self.toolbarCss = self.getCoordinates(self.options.position, 20);
79
- self.collisionDetection();
80
- self.toolbar.css( self.toolbarCss );
81
- self.toolbar_arrow.css( self.arrowCss );
82
- }
83
- });
84
- },
85
-
86
- populateContent: function() {
87
- var self = this;
88
- var location = self.toolbar.find('.tool-items');
89
- var content = $(self.options.content).clone( true ).find('a').addClass('tool-item gradient');
90
- location.html(content);
91
- location.find('.tool-item').on('click', function(event) {
92
- event.preventDefault();
93
- self.$elem.trigger('toolbarItemClick', this);
94
- });
95
- },
96
-
97
- calculatePosition: function() {
98
- var self = this;
99
- self.arrowCss = {};
100
- self.toolbarCss = self.getCoordinates(self.options.position, 0);
101
- self.toolbarCss.position = 'absolute';
102
- self.toolbarCss.zIndex = self.options.zIndex;
103
- self.collisionDetection();
104
- self.toolbar.css(self.toolbarCss);
105
- self.toolbar_arrow.css(self.arrowCss);
106
- },
107
-
108
- getCoordinates: function( position, adjustment ) {
109
- var self = this;
110
- self.coordinates = self.$elem.offset();
111
-
112
- if (self.options.adjustment && self.options.adjustment[self.options.position]) {
113
- adjustment = self.options.adjustment[self.options.position];
114
- }
115
-
116
- switch(self.options.position) {
117
- case 'top':
118
- return {
119
- left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
120
- top: self.coordinates.top-self.$elem.height()-adjustment,
121
- right: 'auto'
122
- };
123
- case 'left':
124
- return {
125
- left: self.coordinates.left-(self.toolbar.width()/2)-(self.$elem.width()/2)-adjustment,
126
- top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
127
- right: 'auto'
128
- };
129
- case 'right':
130
- return {
131
- left: self.coordinates.left+(self.toolbar.width()/2)+(self.$elem.width()/3)+adjustment,
132
- top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
133
- right: 'auto'
134
- };
135
- case 'bottom':
136
- return {
137
- left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
138
- top: self.coordinates.top+self.$elem.height()+adjustment,
139
- right: 'auto'
140
- };
141
- }
142
- },
143
-
144
- collisionDetection: function() {
145
- var self = this;
146
- var edgeOffset = 20;
147
- if(self.options.position == 'top' || self.options.position == 'bottom') {
148
- self.arrowCss = {left: '50%', right: '50%'};
149
- if( self.toolbarCss.left < edgeOffset ) {
150
- self.toolbarCss.left = edgeOffset;
151
- self.arrowCss.left = self.$elem.offset().left + self.$elem.width()/2-(edgeOffset);
152
- }
153
- else if(($(window).width() - (self.toolbarCss.left + self.toolbarWidth)) < edgeOffset) {
154
- self.toolbarCss.right = edgeOffset;
155
- self.toolbarCss.left = 'auto';
156
- self.arrowCss.left = 'auto';
157
- self.arrowCss.right = ($(window).width()-self.$elem.offset().left)-(self.$elem.width()/2)-(edgeOffset)-5;
158
- }
159
- }
160
- },
161
-
162
- show: function() {
163
- var self = this;
164
- var animation = {'opacity': 1};
165
-
166
- self.$elem.addClass('pressed');
167
- self.calculatePosition();
168
-
169
- switch(self.options.position) {
170
- case 'top':
171
- animation.top = '-=20';
172
- break;
173
- case 'left':
174
- animation.left = '-=20';
175
- break;
176
- case 'right':
177
- animation.left = '+=20';
178
- break;
179
- case 'bottom':
180
- animation.top = '+=20';
181
- break;
182
- }
183
-
184
- self.toolbar.show().animate(animation, 200 );
185
- self.$elem.trigger('toolbarShown');
186
- },
187
-
188
- hide: function() {
189
- var self = this;
190
- var animation = {'opacity': 0};
191
-
192
- self.$elem.removeClass('pressed');
193
-
194
- switch(self.options.position) {
195
- case 'top':
196
- animation.top = '+=20';
197
- break;
198
- case 'left':
199
- animation.left = '+=20';
200
- break;
201
- case 'right':
202
- animation.left = '-=20';
203
- break;
204
- case 'bottom':
205
- animation.top = '-=20';
206
- break;
207
- }
208
-
209
- self.toolbar.animate(animation, 200, function() {
210
- self.toolbar.hide();
211
- });
212
-
213
- self.$elem.trigger('toolbarHidden');
214
- },
215
-
216
- getToolbarElement: function () {
217
- return this.toolbar.find('.tool-items');
218
- }
219
- };
220
-
221
- $.fn.toolbar = function( options ) {
222
- if ($.isPlainObject( options )) {
223
- return this.each(function() {
224
- var toolbarObj = Object.create( ToolBar );
225
- toolbarObj.init( options, this );
226
- $(this).data('toolbarObj', toolbarObj);
227
- });
228
- } else if ( typeof options === 'string' && options.indexOf('_') !== 0 ) {
229
- var toolbarObj = $(this).data('toolbarObj');
230
- var method = toolbarObj[options];
231
- return method.apply(toolbarObj, $.makeArray(arguments).slice(1));
232
- }
233
- };
234
-
235
- $.fn.toolbar.options = {
236
- content: '#myContent',
237
- position: 'top',
238
- hideOnClick: false,
239
- zIndex: 120
240
- };
241
-
242
- }) ( jQuery, window, document );