jail 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,163 @@
1
+ /**
2
+ * @name jQuery Stick 'em
3
+ * @author Trevor Davis
4
+ * @version 1.1
5
+ *
6
+ * $('.container').stickem({
7
+ * item: '.stickem',
8
+ * container: '.stickem-container',
9
+ * stickClass: 'stickit',
10
+ * endStickClass: 'stickit-end',
11
+ * offset: 0
12
+ * });
13
+ */
14
+
15
+ ;(function($, window, document, undefined) {
16
+
17
+ var Stickem = function(elem, options) {
18
+ this.elem = elem;
19
+ this.$elem = $(elem);
20
+ this.options = options;
21
+ this.metadata = this.$elem.data("stickem-options");
22
+ this.$win = $(window);
23
+ };
24
+
25
+ Stickem.prototype = {
26
+ defaults: {
27
+ item: '.stickem',
28
+ container: '.stickem-container',
29
+ stickClass: 'stickit',
30
+ endStickClass: 'stickit-end',
31
+ offset: 0,
32
+ start: 0
33
+ },
34
+
35
+ init: function() {
36
+ var _self = this;
37
+
38
+ //Merge options
39
+ _self.config = $.extend({}, _self.defaults, _self.options, _self.metadata);
40
+
41
+ _self.setWindowHeight();
42
+ _self.getItems();
43
+ _self.bindEvents();
44
+
45
+ return _self;
46
+ },
47
+
48
+ bindEvents: function() {
49
+ var _self = this;
50
+
51
+ if(_self.items.length > 0) {
52
+ _self.$win.on('scroll.stickem', $.proxy(_self.handleScroll, _self));
53
+
54
+ _self.$win.on('resize.stickem', $.proxy(_self.handleResize, _self));
55
+ }
56
+ },
57
+
58
+ destroy: function() {
59
+ var _self = this;
60
+
61
+ _self.$win.off('scroll.stickem');
62
+ _self.$win.off('resize.stickem');
63
+ },
64
+
65
+ getItem: function(index, element) {
66
+ var _self = this;
67
+ var $this = $(element);
68
+ var item = {
69
+ $elem: $this,
70
+ elemHeight: $this.height(),
71
+ $container: $this.parents(_self.config.container),
72
+ isStuck: false
73
+ };
74
+
75
+ //If the element is smaller than the window
76
+ if(_self.windowHeight > item.elemHeight) {
77
+ item.containerHeight = item.$container.outerHeight();
78
+ item.containerInner = {
79
+ border: {
80
+ bottom: parseInt(item.$container.css('border-bottom'), 10) || 0,
81
+ top: parseInt(item.$container.css('border-top'), 10) || 0
82
+ },
83
+ padding: {
84
+ bottom: parseInt(item.$container.css('padding-bottom'), 10) || 0,
85
+ top: parseInt(item.$container.css('padding-top'), 10) || 0
86
+ }
87
+ };
88
+
89
+ item.containerInnerHeight = item.$container.height();
90
+ item.containerStart = item.$container.offset().top - _self.config.offset + _self.config.start + item.containerInner.padding.top + item.containerInner.border.top;
91
+ item.scrollFinish = item.containerStart - _self.config.start + (item.containerInnerHeight - item.elemHeight);
92
+
93
+ //If the element is smaller than the container
94
+ if(item.containerInnerHeight > item.elemHeight) {
95
+ _self.items.push(item);
96
+ }
97
+ }
98
+ },
99
+
100
+ getItems: function() {
101
+ var _self = this;
102
+
103
+ _self.items = [];
104
+
105
+ _self.$elem.find(_self.config.item).each($.proxy(_self.getItem, _self));
106
+ },
107
+
108
+ handleResize: function() {
109
+ var _self = this;
110
+
111
+ _self.getItems();
112
+ _self.setWindowHeight();
113
+ },
114
+
115
+ handleScroll: function() {
116
+ var _self = this;
117
+ var pos = _self.$win.scrollTop();
118
+
119
+ for(var i = 0, len = _self.items.length; i < len; i++) {
120
+ var item = _self.items[i];
121
+
122
+ //If it's stuck, and we need to unstick it
123
+ if(item.isStuck && (pos < item.containerStart || pos > item.scrollFinish)) {
124
+ item.$elem.removeClass(_self.config.stickClass);
125
+
126
+ //only at the bottom
127
+ if(pos > item.scrollFinish) {
128
+ item.$elem.addClass(_self.config.endStickClass);
129
+ }
130
+
131
+ item.isStuck = false;
132
+
133
+ //If we need to stick it
134
+ } else if(item.isStuck === false && pos > item.containerStart && pos < item.scrollFinish) {
135
+ item.$elem.removeClass(_self.config.endStickClass).addClass(_self.config.stickClass);
136
+ item.isStuck = true;
137
+ }
138
+ }
139
+ },
140
+
141
+ setWindowHeight: function() {
142
+ var _self = this;
143
+
144
+ _self.windowHeight = _self.$win.height() - _self.config.offset;
145
+ }
146
+ };
147
+
148
+ Stickem.defaults = Stickem.prototype.defaults;
149
+
150
+ $.fn.stickem = function(options) {
151
+ //Create a destroy method so that you can kill it and call it again.
152
+ this.destroy = function() {
153
+ this.each(function() {
154
+ new Stickem(this, options).destroy();
155
+ });
156
+ };
157
+
158
+ return this.each(function() {
159
+ new Stickem(this, options).init();
160
+ });
161
+ };
162
+
163
+ })(jQuery, window , document);
@@ -0,0 +1,226 @@
1
+ /* tooltipsy by Brian Cray
2
+ * Lincensed under GPL2 - http://www.gnu.org/licenses/gpl-2.0.html
3
+ * Option quick reference:
4
+ * - alignTo: "element" or "cursor" (Defaults to "element")
5
+ * - offset: Tooltipsy distance from element or mouse cursor, dependent on alignTo setting. Set as array [x, y] (Defaults to [0, -1])
6
+ * - content: HTML or text content of tooltip. Defaults to "" (empty string), which pulls content from target element's title attribute
7
+ * - show: function(event, tooltip) to show the tooltip. Defaults to a show(100) effect
8
+ * - hide: function(event, tooltip) to hide the tooltip. Defaults to a fadeOut(100) effect
9
+ * - delay: A delay in milliseconds before showing a tooltip. Set to 0 for no delay. Defaults to 200
10
+ * - css: object containing CSS properties and values. Defaults to {} to use stylesheet for styles
11
+ * - className: DOM class for styling tooltips with CSS. Defaults to "tooltipsy"
12
+ * - showEvent: Set a custom event to bind the show function. Defaults to mouseenter
13
+ * - hideEvent: Set a custom event to bind the show function. Defaults to mouseleave
14
+ * Method quick reference:
15
+ * - $('element').data('tooltipsy').show(): Force the tooltip to show
16
+ * - $('element').data('tooltipsy').hide(): Force the tooltip to hide
17
+ * - $('element').data('tooltipsy').destroy(): Remove tooltip from DOM
18
+ * More information visit http://tooltipsy.com/
19
+ */
20
+
21
+ (function($){
22
+ $.tooltipsy = function (el, options) {
23
+ this.options = options;
24
+ this.$el = $(el);
25
+ this.title = this.$el.attr('title') || '';
26
+ this.$el.attr('title', '');
27
+ this.random = parseInt(Math.random()*10000);
28
+ this.ready = false;
29
+ this.shown = false;
30
+ this.width = 0;
31
+ this.height = 0;
32
+ this.delaytimer = null;
33
+
34
+ this.$el.data("tooltipsy", this);
35
+ this.init();
36
+ };
37
+
38
+ $.tooltipsy.prototype.init = function () {
39
+ var base = this;
40
+
41
+ base.settings = $.extend({}, base.defaults, base.options);
42
+ base.settings.delay = parseInt(base.settings.delay);
43
+
44
+ if (typeof base.settings.content === 'function') {
45
+ base.readify();
46
+ }
47
+
48
+ if (base.settings.showEvent === base.settings.hideEvent && base.settings.showEvent === 'click') {
49
+ base.$el.toggle(function (e) {
50
+ if (base.settings.showEvent === 'click' && base.$el[0].tagName == 'A') {
51
+ e.preventDefault();
52
+ }
53
+ if (base.settings.delay > 0) {
54
+ base.delaytimer = window.setTimeout(function () {
55
+ base.show(e);
56
+ }, base.settings.delay);
57
+ }
58
+ else {
59
+ base.show(e);
60
+ }
61
+ }, function (e) {
62
+ if (base.settings.showEvent === 'click' && base.$el[0].tagName == 'A') {
63
+ e.preventDefault();
64
+ }
65
+ window.clearTimeout(base.delaytimer);
66
+ base.delaytimer = null;
67
+ base.hide(e);
68
+ });
69
+ }
70
+ else {
71
+ base.$el.bind(base.settings.showEvent, function (e) {
72
+ if (base.settings.showEvent === 'click' && base.$el[0].tagName == 'A') {
73
+ e.preventDefault();
74
+ }
75
+ if (base.settings.delay > 0) {
76
+ base.delaytimer = window.setTimeout(function () {
77
+ base.show(e);
78
+ }, base.settings.delay);
79
+ }
80
+ else {
81
+ base.show(e);
82
+ }
83
+ }).bind(base.settings.hideEvent, function (e) {
84
+ if (base.settings.showEvent === 'click' && base.$el[0].tagName == 'A') {
85
+ e.preventDefault();
86
+ }
87
+ window.clearTimeout(base.delaytimer);
88
+ base.delaytimer = null;
89
+ base.hide(e);
90
+ });
91
+ }
92
+ };
93
+
94
+ $.tooltipsy.prototype.show = function (e) {
95
+ var base = this;
96
+
97
+ if (base.ready === false) {
98
+ base.readify();
99
+ }
100
+
101
+ if (base.shown === false) {
102
+ if ((function (o) {
103
+ var s = 0, k;
104
+ for (k in o) {
105
+ if (o.hasOwnProperty(k)) {
106
+ s++;
107
+ }
108
+ }
109
+ return s;
110
+ })(base.settings.css) > 0) {
111
+ base.$tip.css(base.settings.css);
112
+ }
113
+ base.width = base.$tipsy.outerWidth();
114
+ base.height = base.$tipsy.outerHeight();
115
+ }
116
+
117
+ if (base.settings.alignTo === 'cursor' && e) {
118
+ var tip_position = [e.pageX + base.settings.offset[0], e.pageY + base.settings.offset[1]];
119
+ if(tip_position[0] + base.width > $(window).width()) {
120
+ var tip_css = {top: tip_position[1] + 'px', right: tip_position[0] + 'px', left: 'auto'};
121
+ }
122
+ else {
123
+ var tip_css = {top: tip_position[1] + 'px', left: tip_position[0] + 'px', right: 'auto'};
124
+ }
125
+ }
126
+ else {
127
+ var tip_position = [
128
+ (function (pos) {
129
+ if (base.settings.offset[0] < 0) {
130
+ return pos.left - Math.abs(base.settings.offset[0]) - base.width;
131
+ }
132
+ else if (base.settings.offset[0] === 0) {
133
+ return pos.left - ((base.width - base.$el.outerWidth()) / 2);
134
+ }
135
+ else {
136
+ return pos.left + base.$el.outerWidth() + base.settings.offset[0];
137
+ }
138
+ })(base.offset(base.$el[0])),
139
+ (function (pos) {
140
+ if (base.settings.offset[1] < 0) {
141
+ return pos.top - Math.abs(base.settings.offset[1]) - base.height;
142
+ }
143
+ else if (base.settings.offset[1] === 0) {
144
+ return pos.top - ((base.height - base.$el.outerHeight()) / 2);
145
+ }
146
+ else {
147
+ return pos.top + base.$el.outerHeight() + base.settings.offset[1];
148
+ }
149
+ })(base.offset(base.$el[0]))
150
+ ];
151
+ }
152
+ base.$tipsy.css({top: tip_position[1] + 'px', left: tip_position[0] + 'px'});
153
+ base.settings.show(e, base.$tipsy.stop(true, true));
154
+ };
155
+
156
+ $.tooltipsy.prototype.hide = function (e) {
157
+ var base = this;
158
+
159
+ if (base.ready === false) {
160
+ return;
161
+ }
162
+
163
+ if (e && e.relatedTarget === base.$tip[0]) {
164
+ base.$tip.bind('mouseleave', function (e) {
165
+ if (e.relatedTarget === base.$el[0]) {
166
+ return;
167
+ }
168
+ base.settings.hide(e, base.$tipsy.stop(true, true));
169
+ });
170
+ return;
171
+ }
172
+ base.settings.hide(e, base.$tipsy.stop(true, true));
173
+ };
174
+
175
+ $.tooltipsy.prototype.readify = function () {
176
+ this.ready = true;
177
+ this.$tipsy = $('<div id="tooltipsy' + this.random + '" style="position:absolute;z-index:2147483647;display:none">').appendTo('body');
178
+ this.$tip = $('<div class="' + this.settings.className + '">').appendTo(this.$tipsy);
179
+ this.$tip.data('rootel', this.$el);
180
+ var e = this.$el;
181
+ var t = this.$tip;
182
+ this.$tip.html(this.settings.content != '' ? (typeof this.settings.content == 'string' ? this.settings.content : this.settings.content(e, t)) : this.title);
183
+ };
184
+
185
+ $.tooltipsy.prototype.offset = function (el) {
186
+ var ol = ot = 0;
187
+ if (el.offsetParent) {
188
+ do {
189
+ if (el.tagName != 'BODY') {
190
+ ol += el.offsetLeft - el.scrollLeft;
191
+ ot += el.offsetTop - el.scrollTop;
192
+ }
193
+ } while (el = el.offsetParent);
194
+ }
195
+ return {left : ol, top : ot};
196
+ };
197
+
198
+ $.tooltipsy.prototype.destroy = function () {
199
+ this.$tipsy.remove();
200
+ $.removeData(this.$el, 'tooltipsy');
201
+ };
202
+
203
+ $.tooltipsy.prototype.defaults = {
204
+ alignTo: 'element',
205
+ offset: [0, -1],
206
+ content: '',
207
+ show: function (e, $el) {
208
+ $el.fadeIn(100);
209
+ },
210
+ hide: function (e, $el) {
211
+ $el.fadeOut(100);
212
+ },
213
+ css: {},
214
+ className: 'tooltipsy',
215
+ delay: 200,
216
+ showEvent: 'mouseenter',
217
+ hideEvent: 'mouseleave'
218
+ };
219
+
220
+ $.fn.tooltipsy = function(options) {
221
+ return this.each(function() {
222
+ new $.tooltipsy(this, options);
223
+ });
224
+ };
225
+
226
+ })(jQuery);
@@ -0,0 +1,93 @@
1
+ /*
2
+ Skin Name: Nivo Slider Default Theme
3
+ Skin URI: http://nivo.dev7studios.com
4
+ Description: The default skin for the Nivo Slider.
5
+ Version: 1.3
6
+ Author: Gilbert Pellegrom
7
+ Author URI: http://dev7studios.com
8
+ Supports Thumbs: true
9
+ */
10
+
11
+ .theme-default .nivoSlider {
12
+ position:relative;
13
+ background:#fff url(loading.gif) no-repeat 50% 50%;
14
+ margin-bottom:10px;
15
+ -webkit-box-shadow: 0px 1px 5px 0px #4a4a4a;
16
+ -moz-box-shadow: 0px 1px 5px 0px #4a4a4a;
17
+ box-shadow: 0px 1px 5px 0px #4a4a4a;
18
+ }
19
+ .theme-default .nivoSlider img {
20
+ position:absolute;
21
+ top:0px;
22
+ left:0px;
23
+ display:none;
24
+ }
25
+ .theme-default .nivoSlider a {
26
+ border:0;
27
+ display:block;
28
+ }
29
+
30
+ .theme-default .nivo-controlNav {
31
+ text-align: center;
32
+ padding: 20px 0;
33
+ }
34
+ .theme-default .nivo-controlNav a {
35
+ display:inline-block;
36
+ width:22px;
37
+ height:22px;
38
+ background:url(bullets.png) no-repeat;
39
+ text-indent:-9999px;
40
+ border:0;
41
+ margin: 0 2px;
42
+ }
43
+ .theme-default .nivo-controlNav a.active {
44
+ background-position:0 -22px;
45
+ }
46
+
47
+ .theme-default .nivo-directionNav a {
48
+ display:block;
49
+ width:30px;
50
+ height:30px;
51
+ background:url(arrows.png) no-repeat;
52
+ text-indent:-9999px;
53
+ border:0;
54
+ opacity: 0;
55
+ -webkit-transition: all 200ms ease-in-out;
56
+ -moz-transition: all 200ms ease-in-out;
57
+ -o-transition: all 200ms ease-in-out;
58
+ transition: all 200ms ease-in-out;
59
+ }
60
+ .theme-default:hover .nivo-directionNav a { opacity: 1; }
61
+ .theme-default a.nivo-nextNav {
62
+ background-position:-30px 0;
63
+ right:15px;
64
+ }
65
+ .theme-default a.nivo-prevNav {
66
+ left:15px;
67
+ }
68
+
69
+ .theme-default .nivo-caption {
70
+ font-family: Helvetica, Arial, sans-serif;
71
+ }
72
+ .theme-default .nivo-caption a {
73
+ color:#fff;
74
+ border-bottom:1px dotted #fff;
75
+ }
76
+ .theme-default .nivo-caption a:hover {
77
+ color:#fff;
78
+ }
79
+
80
+ .theme-default .nivo-controlNav.nivo-thumbs-enabled {
81
+ width: 100%;
82
+ }
83
+ .theme-default .nivo-controlNav.nivo-thumbs-enabled a {
84
+ width: auto;
85
+ height: auto;
86
+ background: none;
87
+ margin-bottom: 5px;
88
+ }
89
+ .theme-default .nivo-controlNav.nivo-thumbs-enabled img {
90
+ display: block;
91
+ width: 120px;
92
+ height: auto;
93
+ }