flashoff 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +1 -0
- data/app/assets/fonts/gotham/gotham-bold.eot +0 -0
- data/app/assets/fonts/gotham/gotham-bold.svg +2066 -0
- data/app/assets/fonts/gotham/gotham-bold.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-bold.woff +0 -0
- data/app/assets/fonts/gotham/gotham-book.eot +0 -0
- data/app/assets/fonts/gotham/gotham-book.svg +631 -0
- data/app/assets/fonts/gotham/gotham-book.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-book.woff +0 -0
- data/app/assets/fonts/gotham/gotham-light.eot +0 -0
- data/app/assets/fonts/gotham/gotham-light.svg +635 -0
- data/app/assets/fonts/gotham/gotham-light.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-light.woff +0 -0
- data/app/assets/fonts/gotham/gotham-medium.eot +0 -0
- data/app/assets/fonts/gotham/gotham-medium.svg +629 -0
- data/app/assets/fonts/gotham/gotham-medium.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-medium.woff +0 -0
- data/app/assets/fonts/ionicons/ionicons.eot +0 -0
- data/app/assets/fonts/ionicons/ionicons.svg +1390 -0
- data/app/assets/fonts/ionicons/ionicons.ttf +0 -0
- data/app/assets/fonts/ionicons/ionicons.woff +0 -0
- data/flashoff.gemspec +23 -0
- data/lib/flashoff/version.rb +3 -0
- data/lib/flashoff.rb +5 -0
- data/vendor/assets/javascripts/alert.js +78 -0
- data/vendor/assets/javascripts/collapse.js +159 -0
- data/vendor/assets/javascripts/date_picker.js +1385 -0
- data/vendor/assets/javascripts/dropdown.js +134 -0
- data/vendor/assets/javascripts/file_input.js +88 -0
- data/vendor/assets/javascripts/map.js +2036 -0
- data/vendor/assets/javascripts/modal.js +226 -0
- data/vendor/assets/javascripts/popover.js +97 -0
- data/vendor/assets/javascripts/tab.js +115 -0
- data/vendor/assets/javascripts/time_picker.js +878 -0
- data/vendor/assets/javascripts/tooltip.js +365 -0
- data/vendor/assets/javascripts/transition.js +36 -0
- data/vendor/assets/stylesheets/ad.css.scss +72 -0
- data/vendor/assets/stylesheets/alert.css.scss +57 -0
- data/vendor/assets/stylesheets/breadcrumb.css.scss +26 -0
- data/vendor/assets/stylesheets/button.css.scss +183 -0
- data/vendor/assets/stylesheets/code.css.scss +49 -0
- data/vendor/assets/stylesheets/collapse.css.scss +15 -0
- data/vendor/assets/stylesheets/datepicker.css.scss +104 -0
- data/vendor/assets/stylesheets/dropdown.css.scss +84 -0
- data/vendor/assets/stylesheets/footer.css.scss +33 -0
- data/vendor/assets/stylesheets/form.css.scss +213 -0
- data/vendor/assets/stylesheets/grid.css.scss +291 -0
- data/vendor/assets/stylesheets/header.css.scss +134 -0
- data/vendor/assets/stylesheets/icon.css.scss +972 -0
- data/vendor/assets/stylesheets/image.css.scss +39 -0
- data/vendor/assets/stylesheets/label_and_badge.css.scss +53 -0
- data/vendor/assets/stylesheets/link.css.scss +19 -0
- data/vendor/assets/stylesheets/list.css.scss +38 -0
- data/vendor/assets/stylesheets/map.css.scss +13 -0
- data/vendor/assets/stylesheets/modal.css.scss +117 -0
- data/vendor/assets/stylesheets/pagination.css.scss +37 -0
- data/vendor/assets/stylesheets/placeholder.css.scss +11 -0
- data/vendor/assets/stylesheets/popover.css.scss +107 -0
- data/vendor/assets/stylesheets/progress.css.scss +25 -0
- data/vendor/assets/stylesheets/reset.css.scss +57 -0
- data/vendor/assets/stylesheets/tab.css.scss +165 -0
- data/vendor/assets/stylesheets/table.css.scss +70 -0
- data/vendor/assets/stylesheets/timepicker.css.scss +69 -0
- data/vendor/assets/stylesheets/tooltip.css.scss +81 -0
- data/vendor/assets/stylesheets/transition.css.scss +12 -0
- data/vendor/assets/stylesheets/trunk.css.scss +69 -0
- data/vendor/assets/stylesheets/typography.css.scss +147 -0
- metadata +144 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
+function ($) { "use strict";
|
2
|
+
|
3
|
+
// DROPDOWN CLASS DEFINITION
|
4
|
+
// =========================
|
5
|
+
|
6
|
+
var backdrop = '.dropdown-backdrop'
|
7
|
+
var toggle = '[data-toggle=dropdown]'
|
8
|
+
var Dropdown = function (element) {
|
9
|
+
var $el = $(element).on('click.bs.dropdown', this.toggle)
|
10
|
+
}
|
11
|
+
|
12
|
+
Dropdown.prototype.toggle = function (e) {
|
13
|
+
var $this = $(this)
|
14
|
+
|
15
|
+
if ($this.is('.disabled, :disabled')) return
|
16
|
+
|
17
|
+
var $parent = getParent($this)
|
18
|
+
var isActive = $parent.hasClass('open')
|
19
|
+
|
20
|
+
clearMenus()
|
21
|
+
|
22
|
+
if (!isActive) {
|
23
|
+
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
|
24
|
+
// if mobile we use a backdrop because click events don't delegate
|
25
|
+
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
|
26
|
+
}
|
27
|
+
|
28
|
+
$parent.trigger(e = $.Event('show.bs.dropdown'))
|
29
|
+
|
30
|
+
if (e.isDefaultPrevented()) return
|
31
|
+
|
32
|
+
$parent
|
33
|
+
.toggleClass('open')
|
34
|
+
.trigger('shown.bs.dropdown')
|
35
|
+
|
36
|
+
$this.focus()
|
37
|
+
}
|
38
|
+
|
39
|
+
return false
|
40
|
+
}
|
41
|
+
|
42
|
+
Dropdown.prototype.keydown = function (e) {
|
43
|
+
if (!/(38|40|27)/.test(e.keyCode)) return
|
44
|
+
|
45
|
+
var $this = $(this)
|
46
|
+
|
47
|
+
e.preventDefault()
|
48
|
+
e.stopPropagation()
|
49
|
+
|
50
|
+
if ($this.is('.disabled, :disabled')) return
|
51
|
+
|
52
|
+
var $parent = getParent($this)
|
53
|
+
var isActive = $parent.hasClass('open')
|
54
|
+
|
55
|
+
if (!isActive || (isActive && e.keyCode == 27)) {
|
56
|
+
if (e.which == 27) $parent.find(toggle).focus()
|
57
|
+
return $this.click()
|
58
|
+
}
|
59
|
+
|
60
|
+
var $items = $('[role=menu] li:not(.divider):visible a', $parent)
|
61
|
+
|
62
|
+
if (!$items.length) return
|
63
|
+
|
64
|
+
var index = $items.index($items.filter(':focus'))
|
65
|
+
|
66
|
+
if (e.keyCode == 38 && index > 0) index-- // up
|
67
|
+
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
|
68
|
+
if (!~index) index=0
|
69
|
+
|
70
|
+
$items.eq(index).focus()
|
71
|
+
}
|
72
|
+
|
73
|
+
function clearMenus() {
|
74
|
+
$(backdrop).remove()
|
75
|
+
$(toggle).each(function (e) {
|
76
|
+
var $parent = getParent($(this))
|
77
|
+
if (!$parent.hasClass('open')) return
|
78
|
+
$parent.trigger(e = $.Event('hide.bs.dropdown'))
|
79
|
+
if (e.isDefaultPrevented()) return
|
80
|
+
$parent.removeClass('open').trigger('hidden.bs.dropdown')
|
81
|
+
})
|
82
|
+
}
|
83
|
+
|
84
|
+
function getParent($this) {
|
85
|
+
var selector = $this.attr('data-target')
|
86
|
+
|
87
|
+
if (!selector) {
|
88
|
+
selector = $this.attr('href')
|
89
|
+
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
90
|
+
}
|
91
|
+
|
92
|
+
var $parent = selector && $(selector)
|
93
|
+
|
94
|
+
return $parent && $parent.length ? $parent : $this.parent()
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
// DROPDOWN PLUGIN DEFINITION
|
99
|
+
// ==========================
|
100
|
+
|
101
|
+
var old = $.fn.dropdown
|
102
|
+
|
103
|
+
$.fn.dropdown = function (option) {
|
104
|
+
return this.each(function () {
|
105
|
+
var $this = $(this)
|
106
|
+
var data = $this.data('dropdown')
|
107
|
+
|
108
|
+
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
109
|
+
if (typeof option == 'string') data[option].call($this)
|
110
|
+
})
|
111
|
+
}
|
112
|
+
|
113
|
+
$.fn.dropdown.Constructor = Dropdown
|
114
|
+
|
115
|
+
|
116
|
+
// DROPDOWN NO CONFLICT
|
117
|
+
// ====================
|
118
|
+
|
119
|
+
$.fn.dropdown.noConflict = function () {
|
120
|
+
$.fn.dropdown = old
|
121
|
+
return this
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
// APPLY TO STANDARD DROPDOWN ELEMENTS
|
126
|
+
// ===================================
|
127
|
+
|
128
|
+
$(document)
|
129
|
+
.on('click.bs.dropdown.data-api', clearMenus)
|
130
|
+
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
131
|
+
.on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
132
|
+
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
133
|
+
|
134
|
+
}(jQuery);
|
@@ -0,0 +1,88 @@
|
|
1
|
+
$(function() {
|
2
|
+
|
3
|
+
$('input[type=file].btn-file').each(function(i,elem){
|
4
|
+
|
5
|
+
// Maybe some fields don't need to be standardized.
|
6
|
+
if (typeof $(this).attr('data-bfi-disabled') != 'undefined') {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
|
10
|
+
// Set the word to be displayed on the button
|
11
|
+
var buttonWord = 'Browse';
|
12
|
+
|
13
|
+
if (typeof $(this).attr('title') != 'undefined') {
|
14
|
+
buttonWord = $(this).attr('title');
|
15
|
+
}
|
16
|
+
|
17
|
+
// Start by getting the HTML of the input element.
|
18
|
+
// Thanks for the tip http://stackoverflow.com/a/1299069
|
19
|
+
var input = $('<div>').append( $(elem).eq(0).clone() ).html();
|
20
|
+
|
21
|
+
// Now we're going to replace that input field with a Bootstrap button.
|
22
|
+
// The input will actually still be there, it will just be float above and transparent (done with the CSS).
|
23
|
+
$(elem).replaceWith('<a class="file-input-wrapper btn btn-block">'+buttonWord+input+'</a>');
|
24
|
+
})
|
25
|
+
// After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
|
26
|
+
// This is important because the in order to give the illusion that this is a button in FF we actually need to move the button from the file input under the cursor. Ugh.
|
27
|
+
.promise().done( function(){
|
28
|
+
|
29
|
+
// As the cursor moves over our new Bootstrap button we need to adjust the position of the invisible file input Browse button to be under the cursor.
|
30
|
+
// This gives us the pointer cursor that FF denies us
|
31
|
+
$('.file-input-wrapper').mousemove(function(cursor) {
|
32
|
+
|
33
|
+
var input, wrapper,
|
34
|
+
wrapperX, wrapperY,
|
35
|
+
inputWidth, inputHeight,
|
36
|
+
cursorX, cursorY;
|
37
|
+
|
38
|
+
// This wrapper element (the button surround this file input)
|
39
|
+
wrapper = $(this);
|
40
|
+
// The invisible file input element
|
41
|
+
input = wrapper.find("input");
|
42
|
+
// The left-most position of the wrapper
|
43
|
+
wrapperX = wrapper.offset().left;
|
44
|
+
// The top-most position of the wrapper
|
45
|
+
wrapperY = wrapper.offset().top;
|
46
|
+
// The with of the browsers input field
|
47
|
+
inputWidth= input.width();
|
48
|
+
// The height of the browsers input field
|
49
|
+
inputHeight= input.height();
|
50
|
+
//The position of the cursor in the wrapper
|
51
|
+
cursorX = cursor.pageX;
|
52
|
+
cursorY = cursor.pageY;
|
53
|
+
|
54
|
+
//The positions we are to move the invisible file input
|
55
|
+
// The 20 at the end is an arbitrary number of pixels that we can shift the input such that cursor is not pointing at the end of the Browse button but somewhere nearer the middle
|
56
|
+
moveInputX = cursorX - wrapperX - inputWidth + 20;
|
57
|
+
// Slides the invisible input Browse button to be positioned middle under the cursor
|
58
|
+
moveInputY = cursorY- wrapperY - (inputHeight/2);
|
59
|
+
|
60
|
+
// Apply the positioning styles to actually move the invisible file input
|
61
|
+
input.css({
|
62
|
+
left:moveInputX,
|
63
|
+
top:moveInputY
|
64
|
+
});
|
65
|
+
});
|
66
|
+
|
67
|
+
$('.file-input-wrapper input[type=file]').change(function(){
|
68
|
+
|
69
|
+
// Remove any previous file names
|
70
|
+
$(this).parent().next().has('file-input-name').remove();
|
71
|
+
$(this).parent().after('<span class="file-input-name">'+$(this).val()+'</span>');
|
72
|
+
|
73
|
+
});
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
});
|
78
|
+
|
79
|
+
// Add the styles before the first stylesheet
|
80
|
+
// This ensures they can be easily overridden with developer styles
|
81
|
+
var cssHtml = '<style>'+
|
82
|
+
'.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
|
83
|
+
'.file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover { position: absolute; top: 0; left: 0; cursor: pointer; opacity: 0; filter: alpha(opacity=0); z-index: 99; outline: 0; }'+
|
84
|
+
'.file-input-name { margin-left: 8px; }'+
|
85
|
+
'</style>';
|
86
|
+
$('link[rel=stylesheet]').eq(0).before(cssHtml);
|
87
|
+
|
88
|
+
});
|