hashup 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +5 -0
- data/bin/hashup +4 -0
- data/hashup.gemspec +28 -0
- data/lib/hashup.rb +14 -0
- data/lib/hashup/configuration.rb +26 -0
- data/lib/hashup/generator.rb +103 -0
- data/lib/hashup/post.rb +22 -0
- data/lib/hashup/site.rb +74 -0
- data/lib/hashup/templates/config.yml +8 -0
- data/lib/hashup/templates/contents/_pages/about.ma +7 -0
- data/lib/hashup/templates/contents/_posts/markascend.ma +54 -0
- data/lib/hashup/templates/contents/data.yml +9 -0
- data/lib/hashup/templates/themes/_layout/_footer.slim +11 -0
- data/lib/hashup/templates/themes/_layout/_header.slim +12 -0
- data/lib/hashup/templates/themes/_layout/_layout.slim +5 -0
- data/lib/hashup/templates/themes/_layout/_nav.slim +7 -0
- data/lib/hashup/templates/themes/assets/flat-ui/_config.sass +16 -0
- data/lib/hashup/templates/themes/assets/flat-ui/_icon-font-24.sass +91 -0
- data/lib/hashup/templates/themes/assets/flat-ui/_icon-font.sass +91 -0
- data/lib/hashup/templates/themes/assets/flat-ui/_mixins.sass +96 -0
- data/lib/hashup/templates/themes/assets/flat-ui/_spaces.sass +129 -0
- data/lib/hashup/templates/themes/assets/flat-ui/flat-ui.sass +39 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_btn.sass +73 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_checkbox-and-radio.sass +86 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_demo.sass +228 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_footer.sass +57 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_input.sass +66 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_login.sass +95 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_navbar.sass +152 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_pager.sass +56 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_pagination.sass +75 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_palette.sass +88 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_progress.sass +29 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_select.sass +163 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_share.sass +34 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_tagsinput.sass +91 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_tile.sass +42 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_todo.sass +77 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_toggle.sass +85 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_tooltip.sass +45 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_type.sass +43 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_ui-slider.sass +44 -0
- data/lib/hashup/templates/themes/assets/flat-ui/modules/_video.sass +358 -0
- data/lib/hashup/templates/themes/index.slim +9 -0
- data/lib/hashup/templates/themes/post.slim +3 -0
- data/lib/hashup/templates/themes/static/css/bootstrap.css +6039 -0
- data/lib/hashup/templates/themes/static/css/custom.css +11 -0
- data/lib/hashup/templates/themes/static/css/flat-ui.css +2533 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-16.dev.svg +112 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-16.eot +0 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-16.svg +112 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-16.ttf +0 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-16.woff +0 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-24.dev.svg +111 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-24.eot +0 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-24.svg +111 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-24.ttf +0 -0
- data/lib/hashup/templates/themes/static/fonts/Flat-UI-Icons-24.woff +0 -0
- data/lib/hashup/templates/themes/static/images/checkbox-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/checkbox.png +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-author.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-pic-1.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-pic-2.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-pic-3.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-pic-4.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-pic-5.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser-pic-6.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/demo/browser.png +0 -0
- data/lib/hashup/templates/themes/static/images/demo/html-icon.png +0 -0
- data/lib/hashup/templates/themes/static/images/demo/logo-mask-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/demo/logo-mask.png +0 -0
- data/lib/hashup/templates/themes/static/images/demo/video.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/favicon.ico +0 -0
- data/lib/hashup/templates/themes/static/images/footer/logo.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/bag.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/book.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/calendar.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/clipboard.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/colors.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/compass.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/gift.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/infinity.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/mail.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/map.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/paper.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/retina.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/share.png +0 -0
- data/lib/hashup/templates/themes/static/images/illustrations/time.png +0 -0
- data/lib/hashup/templates/themes/static/images/login/icon.png +0 -0
- data/lib/hashup/templates/themes/static/images/login/imac-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/login/imac.png +0 -0
- data/lib/hashup/templates/themes/static/images/pager/next.png +0 -0
- data/lib/hashup/templates/themes/static/images/pager/previous.png +0 -0
- data/lib/hashup/templates/themes/static/images/radio-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/radio.png +0 -0
- data/lib/hashup/templates/themes/static/images/select/toggle.png +0 -0
- data/lib/hashup/templates/themes/static/images/tile/ribbon-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/tile/ribbon.png +0 -0
- data/lib/hashup/templates/themes/static/images/todo/done-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/todo/done.png +0 -0
- data/lib/hashup/templates/themes/static/images/todo/search-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/todo/search.png +0 -0
- data/lib/hashup/templates/themes/static/images/todo/todo-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/todo/todo.png +0 -0
- data/lib/hashup/templates/themes/static/images/toggle/block-off.png +0 -0
- data/lib/hashup/templates/themes/static/images/toggle/block-on.png +0 -0
- data/lib/hashup/templates/themes/static/images/toggle/icon-off-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/toggle/icon-off.png +0 -0
- data/lib/hashup/templates/themes/static/images/toggle/icon-on-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/toggle/icon-on.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/fullscreen-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/fullscreen.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/pause-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/pause.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/play-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/play.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/poster.jpg +0 -0
- data/lib/hashup/templates/themes/static/images/video/volume-full-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/volume-full.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/volume-off-2x.png +0 -0
- data/lib/hashup/templates/themes/static/images/video/volume-off.png +0 -0
- data/lib/hashup/templates/themes/static/js/application.js +51 -0
- data/lib/hashup/templates/themes/static/js/bootstrap-tooltip.js +353 -0
- data/lib/hashup/templates/themes/static/js/custom_checkbox_and_radio.js +53 -0
- data/lib/hashup/templates/themes/static/js/custom_radio.js +28 -0
- data/lib/hashup/templates/themes/static/js/html5shiv.js +8 -0
- data/lib/hashup/templates/themes/static/js/icon-font-ie7.js +44 -0
- data/lib/hashup/templates/themes/static/js/jquery-1.8.2.min.js +2 -0
- data/lib/hashup/templates/themes/static/js/jquery-ui-1.10.0.custom.min.js +6 -0
- data/lib/hashup/templates/themes/static/js/jquery.dropkick-1.0.0.js +400 -0
- data/lib/hashup/templates/themes/static/js/jquery.placeholder.js +157 -0
- data/lib/hashup/templates/themes/static/js/jquery.tagsinput.js +354 -0
- data/lib/hashup/templates/themes/static/js/lte-ie7-24.js +44 -0
- data/lib/hashup/templates/themes/static/pygments-css/README.rst +27 -0
- data/lib/hashup/templates/themes/static/pygments-css/autumn.css +58 -0
- data/lib/hashup/templates/themes/static/pygments-css/borland.css +46 -0
- data/lib/hashup/templates/themes/static/pygments-css/bw.css +34 -0
- data/lib/hashup/templates/themes/static/pygments-css/colorful.css +61 -0
- data/lib/hashup/templates/themes/static/pygments-css/default.css +62 -0
- data/lib/hashup/templates/themes/static/pygments-css/emacs.css +61 -0
- data/lib/hashup/templates/themes/static/pygments-css/friendly.css +61 -0
- data/lib/hashup/templates/themes/static/pygments-css/fruity.css +69 -0
- data/lib/hashup/templates/themes/static/pygments-css/github.css +61 -0
- data/lib/hashup/templates/themes/static/pygments-css/manni.css +61 -0
- data/lib/hashup/templates/themes/static/pygments-css/monokai.css +59 -0
- data/lib/hashup/templates/themes/static/pygments-css/murphy.css +61 -0
- data/lib/hashup/templates/themes/static/pygments-css/native.css +69 -0
- data/lib/hashup/templates/themes/static/pygments-css/pastie.css +60 -0
- data/lib/hashup/templates/themes/static/pygments-css/perldoc.css +58 -0
- data/lib/hashup/templates/themes/static/pygments-css/tango.css +69 -0
- data/lib/hashup/templates/themes/static/pygments-css/trac.css +59 -0
- data/lib/hashup/templates/themes/static/pygments-css/vim.css +69 -0
- data/lib/hashup/templates/themes/static/pygments-css/vs.css +33 -0
- data/lib/hashup/templates/themes/static/pygments-css/zenburn.css +1 -0
- data/lib/hashup/templates/themes/stylesheets/style.css +0 -0
- data/lib/hashup/version.rb +3 -0
- data/spec/generator_spec.rb +11 -0
- data/spec/hashup_spec.rb +12 -0
- data/spec/spec_helper.rb +9 -0
- metadata +310 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Some general UI pack related JS
|
|
2
|
+
|
|
3
|
+
$(function () {
|
|
4
|
+
// Custom selects
|
|
5
|
+
$("select").dropkick();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
$(document).ready(function() {
|
|
9
|
+
// Todo list
|
|
10
|
+
$(".todo li").click(function() {
|
|
11
|
+
$(this).toggleClass("todo-done");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Init tooltips
|
|
15
|
+
$("[data-toggle=tooltip]").tooltip("show");
|
|
16
|
+
|
|
17
|
+
// Init tags input
|
|
18
|
+
$("#tagsinput").tagsInput();
|
|
19
|
+
|
|
20
|
+
// Init jQuery UI slider
|
|
21
|
+
$("#slider").slider({
|
|
22
|
+
min: 1,
|
|
23
|
+
max: 5,
|
|
24
|
+
value: 2,
|
|
25
|
+
orientation: "horizontal",
|
|
26
|
+
range: "min",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// JS input/textarea placeholder
|
|
30
|
+
$("input, textarea").placeholder();
|
|
31
|
+
|
|
32
|
+
// Make pagination demo work
|
|
33
|
+
$(".pagination a").click(function() {
|
|
34
|
+
if (!$(this).parent().hasClass("previous") && !$(this).parent().hasClass("next")) {
|
|
35
|
+
$(this).parent().siblings("li").removeClass("active");
|
|
36
|
+
$(this).parent().addClass("active");
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
$(".btn-group a").click(function() {
|
|
41
|
+
$(this).siblings().removeClass("active");
|
|
42
|
+
$(this).addClass("active");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Disable link click not scroll top
|
|
46
|
+
$("a[href='#']").click(function() {
|
|
47
|
+
return false
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
});
|
|
51
|
+
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/* ===========================================================
|
|
2
|
+
* bootstrap-tooltip.js v2.3.0
|
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#tooltips
|
|
4
|
+
* Inspired by the original jQuery.tipsy by Jason Frame
|
|
5
|
+
* ===========================================================
|
|
6
|
+
* Copyright 2012 Twitter, Inc.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
* ========================================================== */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
!function ($) {
|
|
23
|
+
|
|
24
|
+
"use strict"; // jshint ;_;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/* TOOLTIP PUBLIC CLASS DEFINITION
|
|
28
|
+
* =============================== */
|
|
29
|
+
|
|
30
|
+
var Tooltip = function (element, options) {
|
|
31
|
+
this.init('tooltip', element, options)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Tooltip.prototype = {
|
|
35
|
+
|
|
36
|
+
constructor: Tooltip
|
|
37
|
+
|
|
38
|
+
, init: function (type, element, options) {
|
|
39
|
+
var eventIn
|
|
40
|
+
, eventOut
|
|
41
|
+
, triggers
|
|
42
|
+
, trigger
|
|
43
|
+
, i
|
|
44
|
+
|
|
45
|
+
this.type = type
|
|
46
|
+
this.$element = $(element)
|
|
47
|
+
this.options = this.getOptions(options)
|
|
48
|
+
this.enabled = true
|
|
49
|
+
|
|
50
|
+
triggers = this.options.trigger.split(' ')
|
|
51
|
+
|
|
52
|
+
for (i = triggers.length; i--;) {
|
|
53
|
+
trigger = triggers[i]
|
|
54
|
+
if (trigger == 'click') {
|
|
55
|
+
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
|
56
|
+
} else if (trigger != 'manual') {
|
|
57
|
+
eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
|
|
58
|
+
eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
|
|
59
|
+
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
|
60
|
+
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.options.selector ?
|
|
65
|
+
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
|
66
|
+
this.fixTitle()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
, getOptions: function (options) {
|
|
70
|
+
options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
|
|
71
|
+
|
|
72
|
+
if (options.delay && typeof options.delay == 'number') {
|
|
73
|
+
options.delay = {
|
|
74
|
+
show: options.delay
|
|
75
|
+
, hide: options.delay
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return options
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
, enter: function (e) {
|
|
83
|
+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
|
84
|
+
|
|
85
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
|
86
|
+
|
|
87
|
+
clearTimeout(this.timeout)
|
|
88
|
+
self.hoverState = 'in'
|
|
89
|
+
this.timeout = setTimeout(function() {
|
|
90
|
+
if (self.hoverState == 'in') self.show()
|
|
91
|
+
}, self.options.delay.show)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
, leave: function (e) {
|
|
95
|
+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
|
96
|
+
|
|
97
|
+
if (this.timeout) clearTimeout(this.timeout)
|
|
98
|
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
|
99
|
+
|
|
100
|
+
self.hoverState = 'out'
|
|
101
|
+
this.timeout = setTimeout(function() {
|
|
102
|
+
if (self.hoverState == 'out') self.hide()
|
|
103
|
+
}, self.options.delay.hide)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
, show: function () {
|
|
107
|
+
var $tip
|
|
108
|
+
, pos
|
|
109
|
+
, actualWidth
|
|
110
|
+
, actualHeight
|
|
111
|
+
, placement
|
|
112
|
+
, tp
|
|
113
|
+
, e = $.Event('show')
|
|
114
|
+
|
|
115
|
+
if (this.hasContent() && this.enabled) {
|
|
116
|
+
this.$element.trigger(e)
|
|
117
|
+
if (e.isDefaultPrevented()) return
|
|
118
|
+
$tip = this.tip()
|
|
119
|
+
this.setContent()
|
|
120
|
+
|
|
121
|
+
if (this.options.animation) {
|
|
122
|
+
$tip.addClass('fade')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
placement = typeof this.options.placement == 'function' ?
|
|
126
|
+
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
|
127
|
+
this.options.placement
|
|
128
|
+
|
|
129
|
+
$tip
|
|
130
|
+
.detach()
|
|
131
|
+
.css({ top: 0, left: 0, display: 'block' })
|
|
132
|
+
|
|
133
|
+
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
|
134
|
+
|
|
135
|
+
pos = this.getPosition()
|
|
136
|
+
|
|
137
|
+
actualWidth = $tip[0].offsetWidth
|
|
138
|
+
actualHeight = $tip[0].offsetHeight
|
|
139
|
+
|
|
140
|
+
switch (placement) {
|
|
141
|
+
case 'bottom':
|
|
142
|
+
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
|
143
|
+
break
|
|
144
|
+
case 'top':
|
|
145
|
+
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
|
146
|
+
break
|
|
147
|
+
case 'left':
|
|
148
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
|
149
|
+
break
|
|
150
|
+
case 'right':
|
|
151
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
|
152
|
+
break
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
this.applyPlacement(tp, placement)
|
|
156
|
+
this.$element.trigger('shown')
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
, applyPlacement: function(offset, placement){
|
|
161
|
+
var $tip = this.tip()
|
|
162
|
+
, width = $tip[0].offsetWidth
|
|
163
|
+
, height = $tip[0].offsetHeight
|
|
164
|
+
, actualWidth
|
|
165
|
+
, actualHeight
|
|
166
|
+
, delta
|
|
167
|
+
, replace
|
|
168
|
+
|
|
169
|
+
$tip
|
|
170
|
+
.offset(offset)
|
|
171
|
+
.addClass(placement)
|
|
172
|
+
.addClass('in')
|
|
173
|
+
|
|
174
|
+
actualWidth = $tip[0].offsetWidth
|
|
175
|
+
actualHeight = $tip[0].offsetHeight
|
|
176
|
+
|
|
177
|
+
if (placement == 'top' && actualHeight != height) {
|
|
178
|
+
offset.top = offset.top + height - actualHeight
|
|
179
|
+
replace = true
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (placement == 'bottom' || placement == 'top') {
|
|
183
|
+
delta = 0
|
|
184
|
+
|
|
185
|
+
if (offset.left < 0){
|
|
186
|
+
delta = offset.left * -2
|
|
187
|
+
offset.left = 0
|
|
188
|
+
$tip.offset(offset)
|
|
189
|
+
actualWidth = $tip[0].offsetWidth
|
|
190
|
+
actualHeight = $tip[0].offsetHeight
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
|
|
194
|
+
} else {
|
|
195
|
+
this.replaceArrow(actualHeight - height, actualHeight, 'top')
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (replace) $tip.offset(offset)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
, replaceArrow: function(delta, dimension, position){
|
|
202
|
+
this
|
|
203
|
+
.arrow()
|
|
204
|
+
.css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
, setContent: function () {
|
|
208
|
+
var $tip = this.tip()
|
|
209
|
+
, title = this.getTitle()
|
|
210
|
+
|
|
211
|
+
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
|
212
|
+
$tip.removeClass('fade in top bottom left right')
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
, hide: function () {
|
|
216
|
+
var that = this
|
|
217
|
+
, $tip = this.tip()
|
|
218
|
+
, e = $.Event('hide')
|
|
219
|
+
|
|
220
|
+
this.$element.trigger(e)
|
|
221
|
+
if (e.isDefaultPrevented()) return
|
|
222
|
+
|
|
223
|
+
$tip.removeClass('in')
|
|
224
|
+
|
|
225
|
+
function removeWithAnimation() {
|
|
226
|
+
var timeout = setTimeout(function () {
|
|
227
|
+
$tip.off($.support.transition.end).detach()
|
|
228
|
+
}, 500)
|
|
229
|
+
|
|
230
|
+
$tip.one($.support.transition.end, function () {
|
|
231
|
+
clearTimeout(timeout)
|
|
232
|
+
$tip.detach()
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
|
237
|
+
removeWithAnimation() :
|
|
238
|
+
$tip.detach()
|
|
239
|
+
|
|
240
|
+
this.$element.trigger('hidden')
|
|
241
|
+
|
|
242
|
+
return this
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
, fixTitle: function () {
|
|
246
|
+
var $e = this.$element
|
|
247
|
+
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
|
248
|
+
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
, hasContent: function () {
|
|
253
|
+
return this.getTitle()
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
, getPosition: function () {
|
|
257
|
+
var el = this.$element[0]
|
|
258
|
+
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
|
|
259
|
+
width: el.offsetWidth
|
|
260
|
+
, height: el.offsetHeight
|
|
261
|
+
}, this.$element.offset())
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
, getTitle: function () {
|
|
265
|
+
var title
|
|
266
|
+
, $e = this.$element
|
|
267
|
+
, o = this.options
|
|
268
|
+
|
|
269
|
+
title = $e.attr('data-original-title')
|
|
270
|
+
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
|
271
|
+
|
|
272
|
+
return title
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
, tip: function () {
|
|
276
|
+
return this.$tip = this.$tip || $(this.options.template)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
, arrow: function(){
|
|
280
|
+
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
, validate: function () {
|
|
284
|
+
if (!this.$element[0].parentNode) {
|
|
285
|
+
this.hide()
|
|
286
|
+
this.$element = null
|
|
287
|
+
this.options = null
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
, enable: function () {
|
|
292
|
+
this.enabled = true
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
, disable: function () {
|
|
296
|
+
this.enabled = false
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
, toggleEnabled: function () {
|
|
300
|
+
this.enabled = !this.enabled
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
, toggle: function (e) {
|
|
304
|
+
var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
|
|
305
|
+
self.tip().hasClass('in') ? self.hide() : self.show()
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
, destroy: function () {
|
|
309
|
+
this.hide().$element.off('.' + this.type).removeData(this.type)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
/* TOOLTIP PLUGIN DEFINITION
|
|
316
|
+
* ========================= */
|
|
317
|
+
|
|
318
|
+
var old = $.fn.tooltip
|
|
319
|
+
|
|
320
|
+
$.fn.tooltip = function ( option ) {
|
|
321
|
+
return this.each(function () {
|
|
322
|
+
var $this = $(this)
|
|
323
|
+
, data = $this.data('tooltip')
|
|
324
|
+
, options = typeof option == 'object' && option
|
|
325
|
+
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
|
|
326
|
+
if (typeof option == 'string') data[option]()
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
$.fn.tooltip.Constructor = Tooltip
|
|
331
|
+
|
|
332
|
+
$.fn.tooltip.defaults = {
|
|
333
|
+
animation: true
|
|
334
|
+
, placement: 'top'
|
|
335
|
+
, selector: false
|
|
336
|
+
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
|
337
|
+
, trigger: 'hover focus'
|
|
338
|
+
, title: ''
|
|
339
|
+
, delay: 0
|
|
340
|
+
, html: false
|
|
341
|
+
, container: false
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
/* TOOLTIP NO CONFLICT
|
|
346
|
+
* =================== */
|
|
347
|
+
|
|
348
|
+
$.fn.tooltip.noConflict = function () {
|
|
349
|
+
$.fn.tooltip = old
|
|
350
|
+
return this
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
}(window.jQuery);
|