wordpress-starter 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -1
- data/README.md +12 -0
- data/lib/wordpress-starter.rb +2 -1
- data/templates/bootstrap/404.php +24 -0
- data/templates/bootstrap/admin/README.txt +25 -0
- data/templates/bootstrap/admin/assets/css/admin-style.css +838 -0
- data/templates/bootstrap/admin/assets/css/colorpicker.css +177 -0
- data/templates/bootstrap/admin/assets/images/1col.png +0 -0
- data/templates/bootstrap/admin/assets/images/2-col-portfolio.png +0 -0
- data/templates/bootstrap/admin/assets/images/2cl.png +0 -0
- data/templates/bootstrap/admin/assets/images/2cr.png +0 -0
- data/templates/bootstrap/admin/assets/images/3-col-portfolio.png +0 -0
- data/templates/bootstrap/admin/assets/images/3cm.png +0 -0
- data/templates/bootstrap/admin/assets/images/3cr.png +0 -0
- data/templates/bootstrap/admin/assets/images/4-col-portfolio.png +0 -0
- data/templates/bootstrap/admin/assets/images/accept.png +0 -0
- data/templates/bootstrap/admin/assets/images/button_check.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/blank.gif +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_background.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hex.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hsb_b.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hsb_h.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hsb_s.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_indic.gif +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_overlay.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_rgb_b.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_rgb_g.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_rgb_r.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_select.gif +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_submit.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/select.png +0 -0
- data/templates/bootstrap/admin/assets/images/dropdown-arrow.png +0 -0
- data/templates/bootstrap/admin/assets/images/favicon.ico +0 -0
- data/templates/bootstrap/admin/assets/images/icon-add.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-backup.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-delete.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-docs.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-edit.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-home.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-info.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-notice.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-paint.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-settings.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-slider.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-warn.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon_option.png +0 -0
- data/templates/bootstrap/admin/assets/images/loading-bottom.gif +0 -0
- data/templates/bootstrap/admin/assets/images/select.png +0 -0
- data/templates/bootstrap/admin/assets/images/sign_warning.png +0 -0
- data/templates/bootstrap/admin/assets/images/stop.png +0 -0
- data/templates/bootstrap/admin/assets/images/toggle_tabs.png +0 -0
- data/templates/bootstrap/admin/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/templates/bootstrap/admin/assets/images/warning.png +0 -0
- data/templates/bootstrap/admin/assets/images/wrench.png +0 -0
- data/templates/bootstrap/admin/assets/images/wrench16.png +0 -0
- data/templates/bootstrap/admin/assets/js/ajaxupload.js +606 -0
- data/templates/bootstrap/admin/assets/js/colorpicker.js +455 -0
- data/templates/bootstrap/admin/assets/js/cookie.js +1 -0
- data/templates/bootstrap/admin/assets/js/jquery.maskedinput-1.2.2.js +252 -0
- data/templates/bootstrap/admin/assets/js/jquery.tipsy.js +241 -0
- data/templates/bootstrap/admin/assets/js/of-medialibrary-uploader.js +168 -0
- data/templates/bootstrap/admin/assets/js/smof.js +623 -0
- data/templates/bootstrap/admin/classes/class.options-machine.php +627 -0
- data/templates/bootstrap/admin/front-end/options.php +77 -0
- data/templates/bootstrap/admin/functions/functions.admin.php +76 -0
- data/templates/bootstrap/admin/functions/functions.interface.php +232 -0
- data/templates/bootstrap/admin/functions/functions.load.php +14 -0
- data/templates/bootstrap/admin/functions/functions.mediauploader.php +194 -0
- data/templates/bootstrap/admin/functions/functions.options.php +508 -0
- data/templates/bootstrap/admin/functions/functions.php +0 -0
- data/templates/bootstrap/admin/index.php +87 -0
- data/templates/bootstrap/admin/layouts/default.css +0 -0
- data/templates/bootstrap/admin/layouts/placebo.css +0 -0
- data/templates/bootstrap/archive.php +57 -0
- data/templates/bootstrap/category.php +40 -0
- data/templates/bootstrap/comments.php +65 -0
- data/templates/bootstrap/content-aside.php +26 -0
- data/templates/bootstrap/content-image.php +29 -0
- data/templates/bootstrap/content-link.php +27 -0
- data/templates/bootstrap/content-none.php +21 -0
- data/templates/bootstrap/content-page.php +24 -0
- data/templates/bootstrap/content-quote.php +26 -0
- data/templates/bootstrap/content-status.php +33 -0
- data/templates/bootstrap/content.php +67 -0
- data/templates/bootstrap/editor-style.scss +72 -0
- data/templates/bootstrap/footer.php +29 -0
- data/templates/bootstrap/functions.php +1528 -0
- data/templates/bootstrap/header.php +74 -0
- data/templates/bootstrap/ie.scss +1 -0
- data/templates/bootstrap/images/bg/bg0.png +0 -0
- data/templates/bootstrap/images/bg/bg1.png +0 -0
- data/templates/bootstrap/images/bg/bg10.png +0 -0
- data/templates/bootstrap/images/bg/bg11.png +0 -0
- data/templates/bootstrap/images/bg/bg2.png +0 -0
- data/templates/bootstrap/images/bg/bg3.png +0 -0
- data/templates/bootstrap/images/bg/bg4.png +0 -0
- data/templates/bootstrap/images/bg/bg5.png +0 -0
- data/templates/bootstrap/images/bg/bg6.jpg +0 -0
- data/templates/bootstrap/images/bg/bg7.jpg +0 -0
- data/templates/bootstrap/images/bg/bg8.png +0 -0
- data/templates/bootstrap/images/bg/bg9.png +0 -0
- data/templates/bootstrap/images/glyphicons-halflings-white.png +0 -0
- data/templates/bootstrap/images/glyphicons-halflings.png +0 -0
- data/templates/bootstrap/index.php +19 -0
- data/templates/bootstrap/javascripts/app.js +6 -0
- data/templates/bootstrap/javascripts/bootstrap.js +2159 -0
- data/templates/bootstrap/javascripts/bootstrap.min.js +6 -0
- data/templates/{project/javascripts/moderninzr.min.js → bootstrap/javascripts/modernizr.min.js} +0 -0
- data/templates/bootstrap/languages/readme.txt +6 -0
- data/templates/bootstrap/license.txt +281 -0
- data/templates/bootstrap/loop.php +30 -0
- data/templates/bootstrap/manifest.rb +156 -0
- data/templates/bootstrap/options.php +42 -0
- data/templates/bootstrap/page.php +29 -0
- data/templates/bootstrap/print.scss +104 -0
- data/templates/bootstrap/readme.txt +6 -0
- data/templates/bootstrap/sass/_app.scss +10 -0
- data/templates/bootstrap/sass/_settings.scss +301 -0
- data/templates/bootstrap/screen.scss +1 -0
- data/templates/bootstrap/screenshot.png +0 -0
- data/templates/bootstrap/search.php +31 -0
- data/templates/bootstrap/searchform.php +31 -0
- data/templates/bootstrap/sidebar.php +15 -0
- data/templates/bootstrap/single.php +31 -0
- data/templates/bootstrap/style.css +18 -0
- data/templates/bootstrap/tag.php +41 -0
- data/templates/foundation/functions.php +8 -9
- data/templates/foundation/sass/_app.scss +2 -0
- data/templates/project/functions.php +1 -1
- data/templates/project/javascripts/app.js +2 -5
- data/templates/project/javascripts/modernizr.min.js +4 -0
- data/templates/project/manifest.rb +1 -1
- metadata +141 -2
@@ -0,0 +1 @@
|
|
1
|
+
jQuery.cookie=function(key,value,options){if(arguments.length>1&&String(value)!=="[object Object]"){options=jQuery.extend({},options);if(value===null||value===undefined){options.expires=-1}if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days)}value=String(value);return(document.cookie=[encodeURIComponent(key),'=',options.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))}options=value||{};var result,decode=options.raw?function(s){return s}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null};
|
@@ -0,0 +1,252 @@
|
|
1
|
+
/// <reference path="../../../lib/jquery-1.2.6.js" />
|
2
|
+
/*
|
3
|
+
Masked Input plugin for jQuery
|
4
|
+
Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
|
5
|
+
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
|
6
|
+
Version: 1.2.2 (03/09/2009 22:39:06)
|
7
|
+
*/
|
8
|
+
(function($) {
|
9
|
+
var pasteEventName = ($.browser.msie ? 'paste' : 'input') + ".mask";
|
10
|
+
var iPhone = (window.orientation != undefined);
|
11
|
+
|
12
|
+
$.mask = {
|
13
|
+
//Predefined character definitions
|
14
|
+
definitions: {
|
15
|
+
'9': "[0-9]",
|
16
|
+
'a': "[A-Za-z]",
|
17
|
+
'*': "[A-Za-z0-9]"
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
$.fn.extend({
|
22
|
+
//Helper Function for Caret positioning
|
23
|
+
caret: function(begin, end) {
|
24
|
+
if (this.length == 0) return;
|
25
|
+
if (typeof begin == 'number') {
|
26
|
+
end = (typeof end == 'number') ? end : begin;
|
27
|
+
return this.each(function() {
|
28
|
+
if (this.setSelectionRange) {
|
29
|
+
this.focus();
|
30
|
+
this.setSelectionRange(begin, end);
|
31
|
+
} else if (this.createTextRange) {
|
32
|
+
var range = this.createTextRange();
|
33
|
+
range.collapse(true);
|
34
|
+
range.moveEnd('character', end);
|
35
|
+
range.moveStart('character', begin);
|
36
|
+
range.select();
|
37
|
+
}
|
38
|
+
});
|
39
|
+
} else {
|
40
|
+
if (this[0].setSelectionRange) {
|
41
|
+
begin = this[0].selectionStart;
|
42
|
+
end = this[0].selectionEnd;
|
43
|
+
} else if (document.selection && document.selection.createRange) {
|
44
|
+
var range = document.selection.createRange();
|
45
|
+
begin = 0 - range.duplicate().moveStart('character', -100000);
|
46
|
+
end = begin + range.text.length;
|
47
|
+
}
|
48
|
+
return { begin: begin, end: end };
|
49
|
+
}
|
50
|
+
},
|
51
|
+
unmask: function() { return this.trigger("unmask"); },
|
52
|
+
mask: function(mask, settings) {
|
53
|
+
if (!mask && this.length > 0) {
|
54
|
+
var input = $(this[0]);
|
55
|
+
var tests = input.data("tests");
|
56
|
+
return $.map(input.data("buffer"), function(c, i) {
|
57
|
+
return tests[i] ? c : null;
|
58
|
+
}).join('');
|
59
|
+
}
|
60
|
+
settings = $.extend({
|
61
|
+
placeholder: "_",
|
62
|
+
completed: null
|
63
|
+
}, settings);
|
64
|
+
|
65
|
+
var defs = $.mask.definitions;
|
66
|
+
var tests = [];
|
67
|
+
var partialPosition = mask.length;
|
68
|
+
var firstNonMaskPos = null;
|
69
|
+
var len = mask.length;
|
70
|
+
|
71
|
+
$.each(mask.split(""), function(i, c) {
|
72
|
+
if (c == '?') {
|
73
|
+
len--;
|
74
|
+
partialPosition = i;
|
75
|
+
} else if (defs[c]) {
|
76
|
+
tests.push(new RegExp(defs[c]));
|
77
|
+
if(firstNonMaskPos==null)
|
78
|
+
firstNonMaskPos = tests.length - 1;
|
79
|
+
} else {
|
80
|
+
tests.push(null);
|
81
|
+
}
|
82
|
+
});
|
83
|
+
|
84
|
+
return this.each(function() {
|
85
|
+
var input = $(this);
|
86
|
+
var buffer = $.map(mask.split(""), function(c, i) { if (c != '?') return defs[c] ? settings.placeholder : c });
|
87
|
+
var ignore = false; //Variable for ignoring control keys
|
88
|
+
var focusText = input.val();
|
89
|
+
|
90
|
+
input.data("buffer", buffer).data("tests", tests);
|
91
|
+
|
92
|
+
function seekNext(pos) {
|
93
|
+
while (++pos <= len && !tests[pos]);
|
94
|
+
return pos;
|
95
|
+
};
|
96
|
+
|
97
|
+
function shiftL(pos) {
|
98
|
+
while (!tests[pos] && --pos >= 0);
|
99
|
+
for (var i = pos; i < len; i++) {
|
100
|
+
if (tests[i]) {
|
101
|
+
buffer[i] = settings.placeholder;
|
102
|
+
var j = seekNext(i);
|
103
|
+
if (j < len && tests[i].test(buffer[j])) {
|
104
|
+
buffer[i] = buffer[j];
|
105
|
+
} else
|
106
|
+
break;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
writeBuffer();
|
110
|
+
input.caret(Math.max(firstNonMaskPos, pos));
|
111
|
+
};
|
112
|
+
|
113
|
+
function shiftR(pos) {
|
114
|
+
for (var i = pos, c = settings.placeholder; i < len; i++) {
|
115
|
+
if (tests[i]) {
|
116
|
+
var j = seekNext(i);
|
117
|
+
var t = buffer[i];
|
118
|
+
buffer[i] = c;
|
119
|
+
if (j < len && tests[j].test(t))
|
120
|
+
c = t;
|
121
|
+
else
|
122
|
+
break;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
};
|
126
|
+
|
127
|
+
function keydownEvent(e) {
|
128
|
+
var pos = $(this).caret();
|
129
|
+
var k = e.keyCode;
|
130
|
+
ignore = (k < 16 || (k > 16 && k < 32) || (k > 32 && k < 41));
|
131
|
+
|
132
|
+
//delete selection before proceeding
|
133
|
+
if ((pos.begin - pos.end) != 0 && (!ignore || k == 8 || k == 46))
|
134
|
+
clearBuffer(pos.begin, pos.end);
|
135
|
+
|
136
|
+
//backspace, delete, and escape get special treatment
|
137
|
+
if (k == 8 || k == 46 || (iPhone && k == 127)) {//backspace/delete
|
138
|
+
shiftL(pos.begin + (k == 46 ? 0 : -1));
|
139
|
+
return false;
|
140
|
+
} else if (k == 27) {//escape
|
141
|
+
input.val(focusText);
|
142
|
+
input.caret(0, checkVal());
|
143
|
+
return false;
|
144
|
+
}
|
145
|
+
};
|
146
|
+
|
147
|
+
function keypressEvent(e) {
|
148
|
+
if (ignore) {
|
149
|
+
ignore = false;
|
150
|
+
//Fixes Mac FF bug on backspace
|
151
|
+
return (e.keyCode == 8) ? false : null;
|
152
|
+
}
|
153
|
+
e = e || window.event;
|
154
|
+
var k = e.charCode || e.keyCode || e.which;
|
155
|
+
var pos = $(this).caret();
|
156
|
+
|
157
|
+
if (e.ctrlKey || e.altKey || e.metaKey) {//Ignore
|
158
|
+
return true;
|
159
|
+
} else if ((k >= 32 && k <= 125) || k > 186) {//typeable characters
|
160
|
+
var p = seekNext(pos.begin - 1);
|
161
|
+
if (p < len) {
|
162
|
+
var c = String.fromCharCode(k);
|
163
|
+
if (tests[p].test(c)) {
|
164
|
+
shiftR(p);
|
165
|
+
buffer[p] = c;
|
166
|
+
writeBuffer();
|
167
|
+
var next = seekNext(p);
|
168
|
+
$(this).caret(next);
|
169
|
+
if (settings.completed && next == len)
|
170
|
+
settings.completed.call(input);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
return false;
|
175
|
+
};
|
176
|
+
|
177
|
+
function clearBuffer(start, end) {
|
178
|
+
for (var i = start; i < end && i < len; i++) {
|
179
|
+
if (tests[i])
|
180
|
+
buffer[i] = settings.placeholder;
|
181
|
+
}
|
182
|
+
};
|
183
|
+
|
184
|
+
function writeBuffer() { return input.val(buffer.join('')).val(); };
|
185
|
+
|
186
|
+
function checkVal(allow) {
|
187
|
+
//try to place characters where they belong
|
188
|
+
var test = input.val();
|
189
|
+
var lastMatch = -1;
|
190
|
+
for (var i = 0, pos = 0; i < len; i++) {
|
191
|
+
if (tests[i]) {
|
192
|
+
buffer[i] = settings.placeholder;
|
193
|
+
while (pos++ < test.length) {
|
194
|
+
var c = test.charAt(pos - 1);
|
195
|
+
if (tests[i].test(c)) {
|
196
|
+
buffer[i] = c;
|
197
|
+
lastMatch = i;
|
198
|
+
break;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
if (pos > test.length)
|
202
|
+
break;
|
203
|
+
} else if (buffer[i] == test[pos] && i!=partialPosition) {
|
204
|
+
pos++;
|
205
|
+
lastMatch = i;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
if (!allow && lastMatch + 1 < partialPosition) {
|
209
|
+
input.val("");
|
210
|
+
clearBuffer(0, len);
|
211
|
+
} else if (allow || lastMatch + 1 >= partialPosition) {
|
212
|
+
writeBuffer();
|
213
|
+
if (!allow) input.val(input.val().substring(0, lastMatch + 1));
|
214
|
+
}
|
215
|
+
return (partialPosition ? i : firstNonMaskPos);
|
216
|
+
};
|
217
|
+
|
218
|
+
if (!input.attr("readonly"))
|
219
|
+
input
|
220
|
+
.one("unmask", function() {
|
221
|
+
input
|
222
|
+
.unbind(".mask")
|
223
|
+
.removeData("buffer")
|
224
|
+
.removeData("tests");
|
225
|
+
})
|
226
|
+
.bind("focus.mask", function() {
|
227
|
+
focusText = input.val();
|
228
|
+
var pos = checkVal();
|
229
|
+
writeBuffer();
|
230
|
+
setTimeout(function() {
|
231
|
+
if (pos == mask.length)
|
232
|
+
input.caret(0, pos);
|
233
|
+
else
|
234
|
+
input.caret(pos);
|
235
|
+
}, 0);
|
236
|
+
})
|
237
|
+
.bind("blur.mask", function() {
|
238
|
+
checkVal();
|
239
|
+
if (input.val() != focusText)
|
240
|
+
input.change();
|
241
|
+
})
|
242
|
+
.bind("keydown.mask", keydownEvent)
|
243
|
+
.bind("keypress.mask", keypressEvent)
|
244
|
+
.bind(pasteEventName, function() {
|
245
|
+
setTimeout(function() { input.caret(checkVal(true)); }, 0);
|
246
|
+
});
|
247
|
+
|
248
|
+
checkVal(); //Perform initial check for existing values
|
249
|
+
});
|
250
|
+
}
|
251
|
+
});
|
252
|
+
})(jQuery);
|
@@ -0,0 +1,241 @@
|
|
1
|
+
// tipsy, facebook style tooltips for jquery
|
2
|
+
// version 1.0.0a
|
3
|
+
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
4
|
+
// released under the MIT license
|
5
|
+
|
6
|
+
(function($) {
|
7
|
+
|
8
|
+
function maybeCall(thing, ctx) {
|
9
|
+
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
|
10
|
+
};
|
11
|
+
|
12
|
+
function Tipsy(element, options) {
|
13
|
+
this.$element = $(element);
|
14
|
+
this.options = options;
|
15
|
+
this.enabled = true;
|
16
|
+
this.fixTitle();
|
17
|
+
};
|
18
|
+
|
19
|
+
Tipsy.prototype = {
|
20
|
+
show: function() {
|
21
|
+
var title = this.getTitle();
|
22
|
+
if (title && this.enabled) {
|
23
|
+
var $tip = this.tip();
|
24
|
+
|
25
|
+
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
26
|
+
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
27
|
+
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
|
28
|
+
|
29
|
+
var pos = $.extend({}, this.$element.offset(), {
|
30
|
+
width: this.$element[0].offsetWidth,
|
31
|
+
height: this.$element[0].offsetHeight
|
32
|
+
});
|
33
|
+
|
34
|
+
var actualWidth = $tip[0].offsetWidth,
|
35
|
+
actualHeight = $tip[0].offsetHeight,
|
36
|
+
gravity = maybeCall(this.options.gravity, this.$element[0]);
|
37
|
+
|
38
|
+
var tp;
|
39
|
+
switch (gravity.charAt(0)) {
|
40
|
+
case 'n':
|
41
|
+
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
42
|
+
break;
|
43
|
+
case 's':
|
44
|
+
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
45
|
+
break;
|
46
|
+
case 'e':
|
47
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
48
|
+
break;
|
49
|
+
case 'w':
|
50
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
51
|
+
break;
|
52
|
+
}
|
53
|
+
|
54
|
+
if (gravity.length == 2) {
|
55
|
+
if (gravity.charAt(1) == 'w') {
|
56
|
+
tp.left = pos.left + pos.width / 2 - 15;
|
57
|
+
} else {
|
58
|
+
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
$tip.css(tp).addClass('tipsy-' + gravity);
|
63
|
+
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
|
64
|
+
if (this.options.className) {
|
65
|
+
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
|
66
|
+
}
|
67
|
+
|
68
|
+
if (this.options.fade) {
|
69
|
+
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
70
|
+
} else {
|
71
|
+
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
72
|
+
}
|
73
|
+
}
|
74
|
+
},
|
75
|
+
|
76
|
+
hide: function() {
|
77
|
+
if (this.options.fade) {
|
78
|
+
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
79
|
+
} else {
|
80
|
+
this.tip().remove();
|
81
|
+
}
|
82
|
+
},
|
83
|
+
|
84
|
+
fixTitle: function() {
|
85
|
+
var $e = this.$element;
|
86
|
+
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
|
87
|
+
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
|
88
|
+
}
|
89
|
+
},
|
90
|
+
|
91
|
+
getTitle: function() {
|
92
|
+
var title, $e = this.$element, o = this.options;
|
93
|
+
this.fixTitle();
|
94
|
+
var title, o = this.options;
|
95
|
+
if (typeof o.title == 'string') {
|
96
|
+
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
|
97
|
+
} else if (typeof o.title == 'function') {
|
98
|
+
title = o.title.call($e[0]);
|
99
|
+
}
|
100
|
+
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
101
|
+
return title || o.fallback;
|
102
|
+
},
|
103
|
+
|
104
|
+
tip: function() {
|
105
|
+
if (!this.$tip) {
|
106
|
+
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
|
107
|
+
}
|
108
|
+
return this.$tip;
|
109
|
+
},
|
110
|
+
|
111
|
+
validate: function() {
|
112
|
+
if (!this.$element[0].parentNode) {
|
113
|
+
this.hide();
|
114
|
+
this.$element = null;
|
115
|
+
this.options = null;
|
116
|
+
}
|
117
|
+
},
|
118
|
+
|
119
|
+
enable: function() { this.enabled = true; },
|
120
|
+
disable: function() { this.enabled = false; },
|
121
|
+
toggleEnabled: function() { this.enabled = !this.enabled; }
|
122
|
+
};
|
123
|
+
|
124
|
+
$.fn.tipsy = function(options) {
|
125
|
+
|
126
|
+
if (options === true) {
|
127
|
+
return this.data('tipsy');
|
128
|
+
} else if (typeof options == 'string') {
|
129
|
+
var tipsy = this.data('tipsy');
|
130
|
+
if (tipsy) tipsy[options]();
|
131
|
+
return this;
|
132
|
+
}
|
133
|
+
|
134
|
+
options = $.extend({}, $.fn.tipsy.defaults, options);
|
135
|
+
|
136
|
+
function get(ele) {
|
137
|
+
var tipsy = $.data(ele, 'tipsy');
|
138
|
+
if (!tipsy) {
|
139
|
+
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
140
|
+
$.data(ele, 'tipsy', tipsy);
|
141
|
+
}
|
142
|
+
return tipsy;
|
143
|
+
}
|
144
|
+
|
145
|
+
function enter() {
|
146
|
+
var tipsy = get(this);
|
147
|
+
tipsy.hoverState = 'in';
|
148
|
+
if (options.delayIn == 0) {
|
149
|
+
tipsy.show();
|
150
|
+
} else {
|
151
|
+
tipsy.fixTitle();
|
152
|
+
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
153
|
+
}
|
154
|
+
};
|
155
|
+
|
156
|
+
function leave() {
|
157
|
+
var tipsy = get(this);
|
158
|
+
tipsy.hoverState = 'out';
|
159
|
+
if (options.delayOut == 0) {
|
160
|
+
tipsy.hide();
|
161
|
+
} else {
|
162
|
+
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
|
163
|
+
}
|
164
|
+
};
|
165
|
+
|
166
|
+
if (!options.live) this.each(function() { get(this); });
|
167
|
+
|
168
|
+
if (options.trigger != 'manual') {
|
169
|
+
var binder = options.live ? 'live' : 'bind',
|
170
|
+
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
|
171
|
+
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
|
172
|
+
this[binder](eventIn, enter)[binder](eventOut, leave);
|
173
|
+
}
|
174
|
+
|
175
|
+
return this;
|
176
|
+
|
177
|
+
};
|
178
|
+
|
179
|
+
$.fn.tipsy.defaults = {
|
180
|
+
className: null,
|
181
|
+
delayIn: 0,
|
182
|
+
delayOut: 0,
|
183
|
+
fade: false,
|
184
|
+
fallback: '',
|
185
|
+
gravity: 'n',
|
186
|
+
html: false,
|
187
|
+
live: false,
|
188
|
+
offset: 0,
|
189
|
+
opacity: 0.8,
|
190
|
+
title: 'title',
|
191
|
+
trigger: 'hover'
|
192
|
+
};
|
193
|
+
|
194
|
+
// Overwrite this method to provide options on a per-element basis.
|
195
|
+
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
196
|
+
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
197
|
+
// (remember - do not modify 'options' in place!)
|
198
|
+
$.fn.tipsy.elementOptions = function(ele, options) {
|
199
|
+
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
200
|
+
};
|
201
|
+
|
202
|
+
$.fn.tipsy.autoNS = function() {
|
203
|
+
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
204
|
+
};
|
205
|
+
|
206
|
+
$.fn.tipsy.autoWE = function() {
|
207
|
+
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
208
|
+
};
|
209
|
+
|
210
|
+
/**
|
211
|
+
* yields a closure of the supplied parameters, producing a function that takes
|
212
|
+
* no arguments and is suitable for use as an autogravity function like so:
|
213
|
+
*
|
214
|
+
* @param margin (int) - distance from the viewable region edge that an
|
215
|
+
* element should be before setting its tooltip's gravity to be away
|
216
|
+
* from that edge.
|
217
|
+
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
|
218
|
+
* if there are no viewable region edges effecting the tooltip's
|
219
|
+
* gravity. It will try to vary from this minimally, for example,
|
220
|
+
* if 'sw' is preferred and an element is near the right viewable
|
221
|
+
* region edge, but not the top edge, it will set the gravity for
|
222
|
+
* that element's tooltip to be 'se', preserving the southern
|
223
|
+
* component.
|
224
|
+
*/
|
225
|
+
$.fn.tipsy.autoBounds = function(margin, prefer) {
|
226
|
+
return function() {
|
227
|
+
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
|
228
|
+
boundTop = $(document).scrollTop() + margin,
|
229
|
+
boundLeft = $(document).scrollLeft() + margin,
|
230
|
+
$this = $(this);
|
231
|
+
|
232
|
+
if ($this.offset().top < boundTop) dir.ns = 'n';
|
233
|
+
if ($this.offset().left < boundLeft) dir.ew = 'w';
|
234
|
+
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
|
235
|
+
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
|
236
|
+
|
237
|
+
return dir.ns + (dir.ew ? dir.ew : '');
|
238
|
+
}
|
239
|
+
};
|
240
|
+
|
241
|
+
})(jQuery);
|