spree_backend 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/admin/address_states.js +19 -15
- data/app/assets/javascripts/admin/admin.js.erb +1 -5
- data/app/assets/javascripts/admin/nested-attribute.js +15 -11
- data/app/assets/javascripts/admin/option_type_autocomplete.js.erb +20 -16
- data/app/assets/javascripts/admin/orders/edit.js +17 -12
- data/app/assets/javascripts/admin/orders/edit_form.js +16 -12
- data/app/assets/javascripts/admin/product_picker.js +22 -16
- data/app/assets/javascripts/admin/promotions.js +34 -35
- data/app/assets/javascripts/admin/shipments.js.erb +35 -27
- data/app/assets/javascripts/admin/spree-select2.js.erb +2 -1
- data/app/assets/javascripts/admin/spree_backend.js +0 -1
- data/app/assets/javascripts/admin/states.js +10 -8
- data/app/assets/javascripts/admin/stock_management.js.coffee +2 -2
- data/app/assets/javascripts/admin/taxon_autocomplete.js.erb +32 -19
- data/app/assets/javascripts/admin/user_picker.js +21 -13
- data/app/assets/javascripts/admin/variant_autocomplete.js.erb +16 -4
- data/app/assets/stylesheets/admin/plugins/_select2.scss +5 -3
- data/app/assets/stylesheets/admin/sections/_alerts.scss +27 -0
- data/app/assets/stylesheets/admin/spree_admin.scss +1 -0
- data/app/controllers/spree/admin/base_controller.rb +11 -13
- data/app/controllers/spree/admin/images_controller.rb +4 -5
- data/app/controllers/spree/admin/mail_methods_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +3 -7
- data/app/controllers/spree/admin/payments_controller.rb +1 -1
- data/app/controllers/spree/admin/resource_controller.rb +6 -2
- data/app/helpers/spree/admin/navigation_helper.rb +4 -2
- data/app/helpers/spree/admin/stock_locations_helper.rb +15 -0
- data/app/views/spree/admin/countries/index.html.erb +2 -2
- data/app/views/spree/admin/general_settings/edit.html.erb +3 -3
- data/app/views/spree/admin/option_types/index.html.erb +15 -5
- data/app/views/spree/admin/orders/_shipment.html.erb +2 -2
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +8 -8
- data/app/views/spree/admin/orders/index.html.erb +4 -3
- data/app/views/spree/admin/payment_methods/index.html.erb +7 -4
- data/app/views/spree/admin/payments/_form.html.erb +1 -1
- data/app/views/spree/admin/payments/show.html.erb +2 -2
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +1 -1
- data/app/views/spree/admin/product_properties/index.html.erb +9 -13
- data/app/views/spree/admin/products/index.html.erb +3 -3
- data/app/views/spree/admin/products/stock.html.erb +10 -8
- data/app/views/spree/admin/promotions/index.html.erb +6 -6
- data/app/views/spree/admin/properties/index.html.erb +12 -5
- data/app/views/spree/admin/prototypes/_form.html.erb +1 -1
- data/app/views/spree/admin/prototypes/index.html.erb +9 -2
- data/app/views/spree/admin/reports/index.html.erb +2 -3
- data/app/views/spree/admin/shared/_address_form.html.erb +11 -11
- data/app/views/spree/admin/shared/_alert.html.erb +3 -3
- data/app/views/spree/admin/shared/_routes.html.erb +1 -0
- data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/_translations.html.erb +3 -0
- data/app/views/spree/admin/shipping_categories/index.html.erb +9 -2
- data/app/views/spree/admin/shipping_methods/_form.html.erb +10 -0
- data/app/views/spree/admin/shipping_methods/index.html.erb +9 -5
- data/app/views/spree/admin/stock_locations/_form.html.erb +15 -11
- data/app/views/spree/admin/stock_locations/index.html.erb +9 -6
- data/app/views/spree/admin/stock_movements/index.html.erb +7 -0
- data/app/views/spree/admin/stock_transfers/index.html.erb +19 -18
- data/app/views/spree/admin/stock_transfers/new.html.erb +24 -21
- data/app/views/spree/admin/stock_transfers/show.html.erb +13 -9
- data/app/views/spree/admin/tax_categories/index.html.erb +12 -8
- data/app/views/spree/admin/tax_rates/_form.html.erb +8 -8
- data/app/views/spree/admin/tax_rates/index.html.erb +12 -11
- data/app/views/spree/admin/taxonomies/_list.html.erb +5 -5
- data/app/views/spree/admin/taxonomies/index.html.erb +11 -4
- data/app/views/spree/admin/taxons/_form.html.erb +6 -5
- data/app/views/spree/admin/taxons/edit.html.erb +17 -2
- data/app/views/spree/admin/trackers/index.html.erb +10 -10
- data/app/views/spree/admin/variants/_autocomplete.js.erb +3 -3
- data/app/views/spree/admin/variants/index.html.erb +9 -7
- data/app/views/spree/admin/zones/_country_members.html.erb +10 -0
- data/app/views/spree/admin/zones/_form.html.erb +4 -1
- data/app/views/spree/admin/zones/_state_members.html.erb +10 -0
- data/app/views/spree/admin/zones/edit.html.erb +3 -7
- data/app/views/spree/admin/zones/index.html.erb +11 -10
- data/vendor/assets/javascripts/trunk8.js +362 -226
- metadata +11 -11
- data/app/views/spree/admin/zones/_country_member.html.erb +0 -5
- data/app/views/spree/admin/zones/_member_type.html.erb +0 -19
- data/app/views/spree/admin/zones/_state_member.html.erb +0 -5
- data/vendor/assets/javascripts/jquery.horizontalNav.js +0 -141
@@ -1,233 +1,369 @@
|
|
1
1
|
/**!
|
2
|
-
* trunk8 v1.
|
2
|
+
* trunk8 v1.3.1
|
3
3
|
* https://github.com/rviscomi/trunk8
|
4
|
-
*
|
4
|
+
*
|
5
5
|
* Copyright 2012 Rick Viscomi
|
6
6
|
* Released under the MIT License.
|
7
|
-
*
|
8
|
-
* Date: September
|
7
|
+
*
|
8
|
+
* Date: September 26, 2012
|
9
9
|
*/
|
10
|
-
|
11
10
|
(function ($) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
11
|
+
var methods,
|
12
|
+
utils,
|
13
|
+
SIDES = {
|
14
|
+
/* cen...ter */
|
15
|
+
center: 'center',
|
16
|
+
/* ...left */
|
17
|
+
left: 'left',
|
18
|
+
/* right... */
|
19
|
+
right: 'right'
|
20
|
+
},
|
21
|
+
WIDTH = {
|
22
|
+
auto: 'auto'
|
23
|
+
};
|
24
|
+
|
25
|
+
function trunk8(element) {
|
26
|
+
this.$element = $(element);
|
27
|
+
this.original_text = this.$element.html();
|
28
|
+
this.settings = $.extend({}, $.fn.trunk8.defaults);
|
29
|
+
}
|
30
|
+
|
31
|
+
trunk8.prototype.updateSettings = function (options) {
|
32
|
+
this.settings = $.extend(this.settings, options);
|
33
|
+
};
|
34
|
+
|
35
|
+
function stripHTML(html) {
|
36
|
+
var tmp = document.createElement("DIV");
|
37
|
+
tmp.innerHTML = html;
|
38
|
+
return tmp.textContent || tmp.innerText;
|
39
|
+
}
|
40
|
+
|
41
|
+
function getHtmlArr(str) {
|
42
|
+
/* Builds an array of strings and designated */
|
43
|
+
/* HTML tags around them. */
|
44
|
+
if (stripHTML(str) === str) {
|
45
|
+
return str.split(/\s/g);
|
46
|
+
}
|
47
|
+
var allResults = [],
|
48
|
+
reg = /<([a-z]+)([^<]*)(?:>(.*?(?!<\1>)*)<\/\1>|\s+\/>)(['.?!,]*)|((?:[^<>\s])+['.?!,]*\w?|<br\s?\/?>)/ig,
|
49
|
+
outArr = reg.exec(str),
|
50
|
+
lastI,
|
51
|
+
ind;
|
52
|
+
while (outArr && lastI !== reg.lastIndex) {
|
53
|
+
lastI = reg.lastIndex;
|
54
|
+
if (outArr[5]) {
|
55
|
+
allResults.push(outArr[5]);
|
56
|
+
} else if (outArr[1]) {
|
57
|
+
allResults.push({
|
58
|
+
tag: outArr[1],
|
59
|
+
attribs: outArr[2],
|
60
|
+
content: outArr[3],
|
61
|
+
after: outArr[4]
|
62
|
+
});
|
63
|
+
}
|
64
|
+
outArr = reg.exec(str);
|
65
|
+
}
|
66
|
+
for (ind = 0; ind < allResults.length; ind++) {
|
67
|
+
if (typeof allResults[ind] !== 'string' && allResults[ind].content) {
|
68
|
+
allResults[ind].content = getHtmlArr(allResults[ind].content);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
return allResults;
|
72
|
+
}
|
73
|
+
|
74
|
+
function rebuildHtmlFromBite(bite, htmlObject, fill) {
|
75
|
+
// Take the processed bite after binary-search
|
76
|
+
// truncated and re-build the original HTML
|
77
|
+
// tags around the processed string.
|
78
|
+
bite = bite.replace(fill, '');
|
79
|
+
|
80
|
+
var biteHelper = function (contentArr, tagInfo) {
|
81
|
+
var retStr = '',
|
82
|
+
content,
|
83
|
+
biteContent,
|
84
|
+
biteLength,
|
85
|
+
i;
|
86
|
+
for (i = 0; i < contentArr.length; i++) {
|
87
|
+
content = contentArr[i];
|
88
|
+
biteLength = $.trim(bite).split(' ').length;
|
89
|
+
if ($.trim(bite).length) {
|
90
|
+
if (typeof content === 'string') {
|
91
|
+
if (!/<br\s*\/?>/.test(content)) {
|
92
|
+
if (biteLength === 1 && $.trim(bite).length <= content.length) {
|
93
|
+
content = bite;
|
94
|
+
// We want the fill to go inside of the last HTML
|
95
|
+
// element if the element is a container.
|
96
|
+
if (tagInfo === 'p' || tagInfo === 'div') {
|
97
|
+
content += fill;
|
98
|
+
}
|
99
|
+
bite = '';
|
100
|
+
} else {
|
101
|
+
bite = bite.replace(content, '');
|
102
|
+
}
|
103
|
+
}
|
104
|
+
retStr += $.trim(content) + ((i === contentArr.length - 1 || biteLength <= 1) ? '' : ' ');
|
105
|
+
} else {
|
106
|
+
biteContent = biteHelper(content.content, content.tag);
|
107
|
+
if (content.after) {
|
108
|
+
bite = bite.replace(content.after, '');
|
109
|
+
}
|
110
|
+
if (biteContent) {
|
111
|
+
if (!content.after) {
|
112
|
+
content.after = ' ';
|
113
|
+
}
|
114
|
+
retStr += '<' + content.tag + content.attribs + '>' + biteContent + '</' + content.tag + '>' + content.after;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
return retStr;
|
120
|
+
},
|
121
|
+
htmlResults = biteHelper(htmlObject);
|
122
|
+
|
123
|
+
// Add fill if doesn't exist. This will place it outside the HTML elements.
|
124
|
+
if (htmlResults.slice(htmlResults.length - fill.length) === fill) {
|
125
|
+
htmlResults += fill;
|
126
|
+
}
|
127
|
+
|
128
|
+
return htmlResults;
|
129
|
+
}
|
130
|
+
|
131
|
+
function truncate() {
|
132
|
+
var data = this.data('trunk8'),
|
133
|
+
settings = data.settings,
|
134
|
+
width = settings.width,
|
135
|
+
side = settings.side,
|
136
|
+
fill = settings.fill,
|
137
|
+
parseHTML = settings.parseHTML,
|
138
|
+
line_height = utils.getLineHeight(this) * settings.lines,
|
139
|
+
str = data.original_text,
|
140
|
+
length = str.length,
|
141
|
+
max_bite = '',
|
142
|
+
lower, upper,
|
143
|
+
bite_size,
|
144
|
+
bite,
|
145
|
+
text,
|
146
|
+
htmlObject;
|
147
|
+
|
148
|
+
/* Reset the field to the original string. */
|
149
|
+
this.html(str);
|
150
|
+
text = this.text();
|
151
|
+
|
152
|
+
/* If string has HTML and parse HTML is set, build */
|
153
|
+
/* the data struct to house the tags */
|
154
|
+
if (parseHTML && stripHTML(str) !== str) {
|
155
|
+
htmlObject = getHtmlArr(str);
|
156
|
+
str = stripHTML(str);
|
157
|
+
length = str.length;
|
158
|
+
}
|
159
|
+
|
160
|
+
if (width === WIDTH.auto) {
|
161
|
+
/* Assuming there is no "overflow: hidden". */
|
162
|
+
if (this.height() <= line_height) {
|
163
|
+
/* Text is already at the optimal trunkage. */
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
|
167
|
+
/* Binary search technique for finding the optimal trunkage. */
|
168
|
+
/* Find the maximum bite without overflowing. */
|
169
|
+
lower = 0;
|
170
|
+
upper = length - 1;
|
171
|
+
|
172
|
+
while (lower <= upper) {
|
173
|
+
bite_size = lower + ((upper - lower) >> 1);
|
174
|
+
|
175
|
+
bite = utils.eatStr(str, side, length - bite_size, fill);
|
176
|
+
|
177
|
+
if (parseHTML && htmlObject) {
|
178
|
+
bite = rebuildHtmlFromBite(bite, htmlObject, fill);
|
179
|
+
}
|
180
|
+
|
181
|
+
this.html(bite);
|
182
|
+
|
183
|
+
/* Check for overflow. */
|
184
|
+
if (this.height() > line_height) {
|
185
|
+
upper = bite_size - 1;
|
186
|
+
} else {
|
187
|
+
lower = bite_size + 1;
|
188
|
+
|
189
|
+
/* Save the bigger bite. */
|
190
|
+
max_bite = (max_bite.length > bite.length) ? max_bite : bite;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
/* Reset the content to eliminate possible existing scroll bars. */
|
195
|
+
this.html('');
|
196
|
+
|
197
|
+
/* Display the biggest bite. */
|
198
|
+
this.html(max_bite);
|
199
|
+
|
200
|
+
if (settings.tooltip) {
|
201
|
+
this.attr('title', text);
|
202
|
+
}
|
203
|
+
} else if (!isNaN(width)) {
|
204
|
+
bite_size = length - width;
|
205
|
+
|
206
|
+
bite = utils.eatStr(str, side, bite_size, fill);
|
207
|
+
|
208
|
+
this.html(bite);
|
209
|
+
|
210
|
+
if (settings.tooltip) {
|
211
|
+
this.attr('title', str);
|
212
|
+
}
|
213
|
+
} else {
|
214
|
+
$.error('Invalid width "' + width + '".');
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
methods = {
|
219
|
+
init: function (options) {
|
220
|
+
return this.each(function () {
|
221
|
+
var $this = $(this),
|
222
|
+
data = $this.data('trunk8');
|
223
|
+
|
224
|
+
if (!data) {
|
225
|
+
$this.data('trunk8', (data = new trunk8(this)));
|
226
|
+
}
|
227
|
+
|
228
|
+
data.updateSettings(options);
|
229
|
+
|
230
|
+
truncate.call($this);
|
231
|
+
});
|
232
|
+
},
|
233
|
+
|
234
|
+
/** Updates the text value of the elements while maintaining truncation. */
|
235
|
+
update: function (new_string) {
|
236
|
+
return this.each(function () {
|
237
|
+
var $this = $(this);
|
238
|
+
|
239
|
+
/* Update text. */
|
240
|
+
if (new_string) {
|
241
|
+
$this.data('trunk8').original_text = new_string;
|
242
|
+
}
|
243
|
+
|
244
|
+
/* Truncate accordingly. */
|
245
|
+
truncate.call($this);
|
246
|
+
});
|
247
|
+
},
|
248
|
+
|
249
|
+
revert: function () {
|
250
|
+
return this.each(function () {
|
251
|
+
/* Get original text. */
|
252
|
+
var text = $(this).data('trunk8').original_text;
|
253
|
+
|
254
|
+
/* Revert element to original text. */
|
255
|
+
$(this).html(text);
|
256
|
+
});
|
257
|
+
},
|
258
|
+
|
259
|
+
/** Returns this instance's settings object. NOT CHAINABLE. */
|
260
|
+
getSettings: function () {
|
261
|
+
return $(this.get(0)).data('trunk8').settings;
|
262
|
+
}
|
263
|
+
};
|
264
|
+
|
265
|
+
utils = {
|
266
|
+
/** Replaces [bite_size] [side]-most chars in [str] with [fill]. */
|
267
|
+
eatStr: function (str, side, bite_size, fill) {
|
268
|
+
var length = str.length,
|
269
|
+
key = utils.eatStr.generateKey.apply(null, arguments),
|
270
|
+
half_length,
|
271
|
+
half_bite_size;
|
272
|
+
|
273
|
+
/* If the result is already in the cache, return it. */
|
274
|
+
if (utils.eatStr.cache[key]) {
|
275
|
+
return utils.eatStr.cache[key];
|
276
|
+
}
|
277
|
+
|
278
|
+
/* Common error handling. */
|
279
|
+
if ((typeof str !== 'string') || (length === 0)) {
|
280
|
+
$.error('Invalid source string "' + str + '".');
|
281
|
+
}
|
282
|
+
if ((bite_size < 0) || (bite_size > length)) {
|
283
|
+
$.error('Invalid bite size "' + bite_size + '".');
|
284
|
+
} else if (bite_size === 0) {
|
285
|
+
/* No bite should show no truncation. */
|
286
|
+
return str;
|
287
|
+
}
|
288
|
+
if (typeof (fill + '') !== 'string') {
|
289
|
+
$.error('Fill unable to be converted to a string.');
|
290
|
+
}
|
291
|
+
|
292
|
+
/* Compute the result, store it in the cache, and return it. */
|
293
|
+
switch (side) {
|
294
|
+
case SIDES.right:
|
295
|
+
/* str... */
|
296
|
+
return utils.eatStr.cache[key] = $.trim(str.substr(0, length - bite_size)) + fill;
|
297
|
+
|
298
|
+
case SIDES.left:
|
299
|
+
/* ...str */
|
300
|
+
return utils.eatStr.cache[key] = fill + $.trim(str.substr(bite_size));
|
301
|
+
|
302
|
+
case SIDES.center:
|
303
|
+
/* Bit-shift to the right by one === Math.floor(x / 2) */
|
304
|
+
half_length = length >> 1; // halve the length
|
305
|
+
half_bite_size = bite_size >> 1; // halve the bite_size
|
306
|
+
|
307
|
+
/* st...r */
|
308
|
+
return utils.eatStr.cache[key] = $.trim(utils.eatStr(str.substr(0, length - half_length), SIDES.right, bite_size - half_bite_size, '')) + fill + $.trim(utils.eatStr(str.substr(length - half_length), SIDES.left, half_bite_size, ''));
|
309
|
+
|
310
|
+
default:
|
311
|
+
$.error('Invalid side "' + side + '".');
|
312
|
+
}
|
313
|
+
},
|
314
|
+
|
315
|
+
getLineHeight: function (elem) {
|
316
|
+
var floats = $(elem).css('float');
|
317
|
+
if (floats !== 'none') {
|
318
|
+
$(elem).css('float', 'none');
|
319
|
+
}
|
320
|
+
var pos = $(elem).css('position');
|
321
|
+
if (pos === 'absolute') {
|
322
|
+
$(elem).css('position', 'static');
|
323
|
+
}
|
324
|
+
|
325
|
+
var html = $(elem).html(),
|
326
|
+
wrapper_id = 'line-height-test',
|
327
|
+
line_height;
|
328
|
+
|
329
|
+
/* Set the content to a small single character and wrap. */
|
330
|
+
$(elem).html('i').wrap('<div id="' + wrapper_id + '" />');
|
331
|
+
|
332
|
+
/* Calculate the line height by measuring the wrapper.*/
|
333
|
+
line_height = $('#' + wrapper_id).innerHeight();
|
334
|
+
|
335
|
+
/* Remove the wrapper and reset the content. */
|
336
|
+
$(elem).html(html).css({
|
337
|
+
'float': floats,
|
338
|
+
'position': pos
|
339
|
+
}).unwrap();
|
340
|
+
|
341
|
+
return line_height;
|
342
|
+
}
|
343
|
+
};
|
344
|
+
|
345
|
+
utils.eatStr.cache = {};
|
346
|
+
utils.eatStr.generateKey = function () {
|
347
|
+
return Array.prototype.join.call(arguments, '');
|
348
|
+
};
|
349
|
+
|
350
|
+
$.fn.trunk8 = function (method) {
|
351
|
+
if (methods[method]) {
|
352
|
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
353
|
+
} else if (typeof method === 'object' || !method) {
|
354
|
+
return methods.init.apply(this, arguments);
|
355
|
+
} else {
|
356
|
+
$.error('Method ' + method + ' does not exist on jQuery.trunk8');
|
357
|
+
}
|
358
|
+
};
|
359
|
+
|
360
|
+
/* Default trunk8 settings. */
|
361
|
+
$.fn.trunk8.defaults = {
|
362
|
+
fill: '…',
|
363
|
+
lines: 1,
|
364
|
+
side: SIDES.right,
|
365
|
+
tooltip: true,
|
366
|
+
width: WIDTH.auto,
|
367
|
+
parseHTML: false
|
368
|
+
};
|
233
369
|
})(jQuery);
|