holder_rails 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/holder_rails/version.rb +1 -1
- data/vendor/assets/javascripts/holder.js +227 -82
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3da663fd410589a49f7a76619dce16e13366e2a8
|
4
|
+
data.tar.gz: b40a90454d388b61a624dc0c879d093f48d2e5a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 054eaf54f3e1eff00e96f9dd4452c41f36cb80d83b557c7f494d52702f8dd0533b9ff4d1ab2951955974959f0c90a799f514fa9012ef753ae3826b25810d3975
|
7
|
+
data.tar.gz: bcc3c6d368097eceda372161e27e2f574d1b640d57964fc803f7a7feff2b18f04519815250cd8208556382a4398aeabeeba9bbfb2ec9ff0c0e84fb1f87383c2c
|
data/LICENSE.txt
CHANGED
data/lib/holder_rails/version.rb
CHANGED
@@ -1,35 +1,44 @@
|
|
1
1
|
/*
|
2
2
|
|
3
|
-
Holder - 2.
|
4
|
-
(c) 2012-
|
3
|
+
Holder - 2.3 - client side image placeholders
|
4
|
+
(c) 2012-2014 Ivan Malopinsky / http://imsky.co
|
5
5
|
|
6
6
|
Provided under the MIT License.
|
7
7
|
Commercial use requires attribution.
|
8
8
|
|
9
9
|
*/
|
10
|
-
|
11
10
|
var Holder = Holder || {};
|
12
11
|
(function (app, win) {
|
13
12
|
|
14
|
-
var
|
15
|
-
|
13
|
+
var system_config = {
|
14
|
+
use_svg: false,
|
15
|
+
use_canvas: false,
|
16
|
+
use_fallback: false
|
17
|
+
};
|
18
|
+
var instance_config = {};
|
19
|
+
var preempted = false;
|
16
20
|
canvas = document.createElement('canvas');
|
17
21
|
var dpr = 1, bsr = 1;
|
18
22
|
var resizable_images = [];
|
19
23
|
|
20
24
|
if (!canvas.getContext) {
|
21
|
-
|
25
|
+
system_config.use_fallback = true;
|
22
26
|
} else {
|
23
27
|
if (canvas.toDataURL("image/png")
|
24
28
|
.indexOf("data:image/png") < 0) {
|
25
29
|
//Android doesn't support data URI
|
26
|
-
|
30
|
+
system_config.use_fallback = true;
|
27
31
|
} else {
|
28
32
|
var ctx = canvas.getContext("2d");
|
29
33
|
}
|
30
34
|
}
|
31
35
|
|
32
|
-
if(
|
36
|
+
if(!!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect){
|
37
|
+
system_config.use_svg = true;
|
38
|
+
system_config.use_canvas = false;
|
39
|
+
}
|
40
|
+
|
41
|
+
if(!system_config.use_fallback){
|
33
42
|
dpr = window.devicePixelRatio || 1,
|
34
43
|
bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
|
35
44
|
}
|
@@ -129,46 +138,6 @@ app.flags = {
|
|
129
138
|
}
|
130
139
|
}
|
131
140
|
|
132
|
-
//getElementsByClassName polyfill
|
133
|
-
document.getElementsByClassName||(document.getElementsByClassName=function(e){var t=document,n,r,i,s=[];if(t.querySelectorAll)return t.querySelectorAll("."+e);if(t.evaluate){r=".//*[contains(concat(' ', @class, ' '), ' "+e+" ')]",n=t.evaluate(r,t,null,0,null);while(i=n.iterateNext())s.push(i)}else{n=t.getElementsByTagName("*"),r=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0;i<n.length;i++)r.test(n[i].className)&&s.push(n[i])}return s})
|
134
|
-
|
135
|
-
//getComputedStyle polyfill
|
136
|
-
window.getComputedStyle||(window.getComputedStyle=function(e){return this.el=e,this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;return t=="float"&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle[t]?e.currentStyle[t]:null},this})
|
137
|
-
|
138
|
-
//http://javascript.nwbox.com/ContentLoaded by Diego Perini with modifications
|
139
|
-
function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}}
|
140
|
-
|
141
|
-
//https://gist.github.com/991057 by Jed Schmidt with modifications
|
142
|
-
function selector(a){
|
143
|
-
a=a.match(/^(\W)?(.*)/);var b=document["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2]);
|
144
|
-
var ret=[]; b!==null&&(b.length?ret=b:b.length===0?ret=b:ret=[b]); return ret;
|
145
|
-
}
|
146
|
-
|
147
|
-
//shallow object property extend
|
148
|
-
function extend(a,b){
|
149
|
-
var c={};
|
150
|
-
for(var i in a){
|
151
|
-
if(a.hasOwnProperty(i)){
|
152
|
-
c[i]=a[i];
|
153
|
-
}
|
154
|
-
}
|
155
|
-
for(var i in b){
|
156
|
-
if(b.hasOwnProperty(i)){
|
157
|
-
c[i]=b[i];
|
158
|
-
}
|
159
|
-
}
|
160
|
-
return c
|
161
|
-
}
|
162
|
-
|
163
|
-
//hasOwnProperty polyfill
|
164
|
-
if (!Object.prototype.hasOwnProperty)
|
165
|
-
/*jshint -W001, -W103 */
|
166
|
-
Object.prototype.hasOwnProperty = function(prop) {
|
167
|
-
var proto = this.__proto__ || this.constructor.prototype;
|
168
|
-
return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
|
169
|
-
}
|
170
|
-
/*jshint +W001, +W103 */
|
171
|
-
|
172
141
|
function text_size(width, height, template) {
|
173
142
|
height = parseInt(height, 10);
|
174
143
|
width = parseInt(width, 10);
|
@@ -181,20 +150,64 @@ function text_size(width, height, template) {
|
|
181
150
|
}
|
182
151
|
}
|
183
152
|
|
184
|
-
|
185
|
-
var
|
186
|
-
var
|
187
|
-
var
|
188
|
-
|
189
|
-
|
190
|
-
var
|
191
|
-
var
|
153
|
+
var svg_el = (function(){
|
154
|
+
var serializer = new XMLSerializer();
|
155
|
+
var svg_ns = "http://www.w3.org/2000/svg"
|
156
|
+
var svg = document.createElementNS(svg_ns, "svg");
|
157
|
+
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg")
|
158
|
+
svg.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
|
159
|
+
var bg_el = document.createElementNS(svg_ns, "rect")
|
160
|
+
var text_el = document.createElementNS(svg_ns, "text")
|
161
|
+
var textnode_el = document.createTextNode(null)
|
162
|
+
text_el.setAttribute("text-anchor", "middle")
|
163
|
+
text_el.appendChild(textnode_el)
|
164
|
+
svg.appendChild(bg_el)
|
165
|
+
svg.appendChild(text_el)
|
166
|
+
|
167
|
+
return function(props){
|
168
|
+
svg.setAttribute("width",props.width);
|
169
|
+
svg.setAttribute("height", props.height);
|
170
|
+
bg_el.setAttribute("width", props.width);
|
171
|
+
bg_el.setAttribute("height", props.height);
|
172
|
+
bg_el.setAttribute("fill", props.template.background);
|
173
|
+
text_el.setAttribute("x", props.width/2)
|
174
|
+
text_el.setAttribute("y", props.height/2)
|
175
|
+
textnode_el.nodeValue=props.text
|
176
|
+
text_el.setAttribute("style", css_properties({
|
177
|
+
"fill": props.template.foreground,
|
178
|
+
"font-weight": "bold",
|
179
|
+
"font-size": props.text_height+"px",
|
180
|
+
"font-family":props.font,
|
181
|
+
"dominant-baseline":"central"
|
182
|
+
}))
|
183
|
+
return serializer.serializeToString(svg)
|
184
|
+
}
|
185
|
+
})()
|
186
|
+
|
187
|
+
function css_properties(props){
|
188
|
+
var ret = [];
|
189
|
+
for(p in props){
|
190
|
+
if(props.hasOwnProperty(p)){
|
191
|
+
ret.push(p+":"+props[p])
|
192
|
+
}
|
193
|
+
}
|
194
|
+
return ret.join(";")
|
195
|
+
}
|
196
|
+
|
197
|
+
function draw_canvas(args) {
|
198
|
+
var ctx = args.ctx,
|
199
|
+
dimensions = args.dimensions,
|
200
|
+
template = args.template,
|
201
|
+
ratio = args.ratio,
|
202
|
+
holder = args.holder,
|
203
|
+
literal = holder.textmode == "literal",
|
204
|
+
exact = holder.textmode == "exact";
|
192
205
|
|
193
206
|
var ts = text_size(dimensions.width, dimensions.height, template);
|
194
207
|
var text_height = ts.height;
|
195
208
|
var width = dimensions.width * ratio,
|
196
209
|
height = dimensions.height * ratio;
|
197
|
-
var font = template.font ? template.font : "sans-serif";
|
210
|
+
var font = template.font ? template.font : "Arial,Helvetica,sans-serif";
|
198
211
|
canvas.width = width;
|
199
212
|
canvas.height = height;
|
200
213
|
ctx.textAlign = "center";
|
@@ -222,8 +235,50 @@ function draw(args) {
|
|
222
235
|
return canvas.toDataURL("image/png");
|
223
236
|
}
|
224
237
|
|
225
|
-
function
|
238
|
+
function draw_svg(args){
|
239
|
+
var dimensions = args.dimensions,
|
240
|
+
template = args.template,
|
241
|
+
holder = args.holder,
|
242
|
+
literal = holder.textmode == "literal",
|
243
|
+
exact = holder.textmode == "exact";
|
244
|
+
|
245
|
+
var ts = text_size(dimensions.width, dimensions.height, template);
|
246
|
+
var text_height = ts.height;
|
247
|
+
var width = dimensions.width,
|
248
|
+
height = dimensions.height;
|
249
|
+
|
250
|
+
var font = template.font ? template.font : "Arial,Helvetica,sans-serif";
|
251
|
+
var text = template.text ? template.text : (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
|
226
252
|
|
253
|
+
if (literal) {
|
254
|
+
var dimensions = holder.dimensions;
|
255
|
+
text = dimensions.width + "x" + dimensions.height;
|
256
|
+
}
|
257
|
+
else if(exact && holder.exact_dimensions){
|
258
|
+
var dimensions = holder.exact_dimensions;
|
259
|
+
text = (Math.floor(dimensions.width) + "x" + Math.floor(dimensions.height));
|
260
|
+
}
|
261
|
+
var string = svg_el({
|
262
|
+
text: text,
|
263
|
+
width:width,
|
264
|
+
height:height,
|
265
|
+
text_height:text_height,
|
266
|
+
font:font,
|
267
|
+
template:template
|
268
|
+
})
|
269
|
+
return "data:image/svg+xml;base64,"+btoa(string);
|
270
|
+
}
|
271
|
+
|
272
|
+
function draw(args) {
|
273
|
+
if(instance_config.use_canvas && !instance_config.use_svg){
|
274
|
+
return draw_canvas(args);
|
275
|
+
}
|
276
|
+
else{
|
277
|
+
return draw_svg(args);
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
function render(mode, el, holder, src) {
|
227
282
|
var dimensions = holder.dimensions,
|
228
283
|
theme = holder.theme,
|
229
284
|
text = holder.text ? decodeURIComponent(holder.text) : holder.text;
|
@@ -240,11 +295,11 @@ function render(mode, el, holder, src) {
|
|
240
295
|
|
241
296
|
if (mode == "image") {
|
242
297
|
el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
|
243
|
-
if (
|
298
|
+
if (instance_config.use_fallback || !holder.auto) {
|
244
299
|
el.style.width = dimensions.width + "px";
|
245
300
|
el.style.height = dimensions.height + "px";
|
246
301
|
}
|
247
|
-
if (
|
302
|
+
if (instance_config.use_fallback) {
|
248
303
|
el.style.backgroundColor = theme.background;
|
249
304
|
} else {
|
250
305
|
el.setAttribute("src", draw({ctx: ctx, dimensions: dimensions, template: theme, ratio:ratio, holder: holder}));
|
@@ -256,7 +311,7 @@ function render(mode, el, holder, src) {
|
|
256
311
|
|
257
312
|
}
|
258
313
|
} else if (mode == "background") {
|
259
|
-
if (!
|
314
|
+
if (!instance_config.use_fallback) {
|
260
315
|
el.style.backgroundImage = "url(" + draw({ctx:ctx, dimensions: dimensions, template: theme, ratio: ratio, holder: holder}) + ")";
|
261
316
|
el.style.backgroundSize = dimensions.width + "px " + dimensions.height + "px";
|
262
317
|
}
|
@@ -264,18 +319,21 @@ function render(mode, el, holder, src) {
|
|
264
319
|
el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
|
265
320
|
if (dimensions.height.slice(-1) == "%") {
|
266
321
|
el.style.height = dimensions.height
|
267
|
-
} else {
|
322
|
+
} else if(holder.auto == null || !holder.auto){
|
268
323
|
el.style.height = dimensions.height + "px"
|
269
324
|
}
|
270
325
|
if (dimensions.width.slice(-1) == "%") {
|
271
326
|
el.style.width = dimensions.width
|
272
|
-
} else {
|
327
|
+
} else if(holder.auto == null || !holder.auto){
|
273
328
|
el.style.width = dimensions.width + "px"
|
274
329
|
}
|
275
330
|
if (el.style.display == "inline" || el.style.display === "" || el.style.display == "none") {
|
276
331
|
el.style.display = "block";
|
277
332
|
}
|
278
|
-
|
333
|
+
|
334
|
+
set_initial_dimensions(el)
|
335
|
+
|
336
|
+
if (instance_config.use_fallback) {
|
279
337
|
el.style.backgroundColor = theme.background;
|
280
338
|
} else {
|
281
339
|
resizable_images.push(el);
|
@@ -290,19 +348,36 @@ function dimension_check(el, callback) {
|
|
290
348
|
width: el.clientWidth
|
291
349
|
};
|
292
350
|
if (!dimensions.height && !dimensions.width) {
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
setTimeout(function () {
|
298
|
-
callback.call(this, el)
|
299
|
-
}, 1)
|
300
|
-
return null;
|
301
|
-
}
|
302
|
-
} else {
|
351
|
+
el.setAttribute("data-holder-invisible", true)
|
352
|
+
callback.call(this, el)
|
353
|
+
}
|
354
|
+
else{
|
303
355
|
el.removeAttribute("data-holder-invisible")
|
356
|
+
return dimensions;
|
357
|
+
}
|
358
|
+
}
|
359
|
+
|
360
|
+
function set_initial_dimensions(el){
|
361
|
+
if(el.holder_data){
|
362
|
+
var dimensions = dimension_check(el, app.invisible_error_fn( set_initial_dimensions))
|
363
|
+
if(dimensions){
|
364
|
+
var holder = el.holder_data;
|
365
|
+
holder.initial_dimensions = dimensions;
|
366
|
+
holder.fluid_data = {
|
367
|
+
fluid_height: holder.dimensions.height.slice(-1) == "%",
|
368
|
+
fluid_width: holder.dimensions.width.slice(-1) == "%",
|
369
|
+
mode: null
|
370
|
+
}
|
371
|
+
if(holder.fluid_data.fluid_width && !holder.fluid_data.fluid_height){
|
372
|
+
holder.fluid_data.mode = "width"
|
373
|
+
holder.fluid_data.ratio = holder.initial_dimensions.width / parseFloat(holder.dimensions.height)
|
374
|
+
}
|
375
|
+
else if(!holder.fluid_data.fluid_width && holder.fluid_data.fluid_height){
|
376
|
+
holder.fluid_data.mode = "height";
|
377
|
+
holder.fluid_data.ratio = parseFloat(holder.dimensions.width) / holder.initial_dimensions.height
|
378
|
+
}
|
379
|
+
}
|
304
380
|
}
|
305
|
-
return dimensions;
|
306
381
|
}
|
307
382
|
|
308
383
|
function resizable_update(element) {
|
@@ -319,9 +394,19 @@ function resizable_update(element) {
|
|
319
394
|
var el = images[i]
|
320
395
|
if (el.holder_data) {
|
321
396
|
var holder = el.holder_data;
|
322
|
-
var dimensions = dimension_check(el, resizable_update)
|
397
|
+
var dimensions = dimension_check(el, app.invisible_error_fn( resizable_update))
|
323
398
|
if(dimensions){
|
324
399
|
if(holder.fluid){
|
400
|
+
if(holder.auto){
|
401
|
+
switch(holder.fluid_data.mode){
|
402
|
+
case "width":
|
403
|
+
dimensions.height = dimensions.width / holder.fluid_data.ratio;
|
404
|
+
break;
|
405
|
+
case "height":
|
406
|
+
dimensions.width = dimensions.height * holder.fluid_data.ratio;
|
407
|
+
break;
|
408
|
+
}
|
409
|
+
}
|
325
410
|
el.setAttribute("src", draw({
|
326
411
|
ctx: ctx,
|
327
412
|
dimensions: dimensions,
|
@@ -350,7 +435,7 @@ function parse_flags(flags, options) {
|
|
350
435
|
theme: extend(settings.themes.gray, {})
|
351
436
|
};
|
352
437
|
var render = false;
|
353
|
-
for (
|
438
|
+
for (var fl = flags.length, j = 0; j < fl; j++) {
|
354
439
|
var flag = flags[j];
|
355
440
|
if (app.flags.dimensions.match(flag)) {
|
356
441
|
render = true;
|
@@ -385,10 +470,20 @@ for (var flag in app.flags) {
|
|
385
470
|
return val.match(this.regex)
|
386
471
|
}
|
387
472
|
}
|
473
|
+
|
474
|
+
app.invisible_error_fn = function(fn){
|
475
|
+
return function(el){
|
476
|
+
if(el.hasAttribute("data-holder-invisible")){
|
477
|
+
throw new Error("Holder: invisible placeholder")
|
478
|
+
}
|
479
|
+
}
|
480
|
+
}
|
481
|
+
|
388
482
|
app.add_theme = function (name, theme) {
|
389
483
|
name != null && theme != null && (settings.themes[name] = theme);
|
390
484
|
return app;
|
391
485
|
};
|
486
|
+
|
392
487
|
app.add_image = function (src, el) {
|
393
488
|
var node = selector(el);
|
394
489
|
if (node.length) {
|
@@ -400,21 +495,31 @@ app.add_image = function (src, el) {
|
|
400
495
|
}
|
401
496
|
return app;
|
402
497
|
};
|
498
|
+
|
403
499
|
app.run = function (o) {
|
500
|
+
instance_config = extend({}, system_config)
|
404
501
|
preempted = true;
|
405
|
-
|
502
|
+
|
406
503
|
var options = extend(settings, o),
|
407
504
|
images = [],
|
408
505
|
imageNodes = [],
|
409
506
|
bgnodes = [];
|
507
|
+
|
508
|
+
if(options.use_canvas != null && options.use_canvas){
|
509
|
+
instance_config.use_canvas = true;
|
510
|
+
instance_config.use_svg = false;
|
511
|
+
}
|
512
|
+
|
410
513
|
if (typeof (options.images) == "string") {
|
411
514
|
imageNodes = selector(options.images);
|
412
515
|
} else if (window.NodeList && options.images instanceof window.NodeList) {
|
413
516
|
imageNodes = options.images;
|
414
517
|
} else if (window.Node && options.images instanceof window.Node) {
|
415
518
|
imageNodes = [options.images];
|
519
|
+
} else if(window.HTMLCollection && options.images instanceof window.HTMLCollection){
|
520
|
+
imageNodes = options.images
|
416
521
|
}
|
417
|
-
|
522
|
+
|
418
523
|
if (typeof (options.bgnodes) == "string") {
|
419
524
|
bgnodes = selector(options.bgnodes);
|
420
525
|
} else if (window.NodeList && options.elements instanceof window.NodeList) {
|
@@ -469,8 +574,7 @@ app.run = function (o) {
|
|
469
574
|
src = attr_datasrc;
|
470
575
|
}
|
471
576
|
if (src) {
|
472
|
-
var holder = parse_flags(src.substr(src.lastIndexOf(options.domain) + options.domain.length + 1)
|
473
|
-
.split("/"), options);
|
577
|
+
var holder = parse_flags(src.substr(src.lastIndexOf(options.domain) + options.domain.length + 1).split("/"), options);
|
474
578
|
if (holder) {
|
475
579
|
if (holder.fluid) {
|
476
580
|
render("fluid", images[i], holder, src)
|
@@ -482,6 +586,7 @@ app.run = function (o) {
|
|
482
586
|
}
|
483
587
|
return app;
|
484
588
|
};
|
589
|
+
|
485
590
|
contentLoaded(win, function () {
|
486
591
|
if (window.addEventListener) {
|
487
592
|
window.addEventListener("resize", resizable_update, false);
|
@@ -489,7 +594,7 @@ contentLoaded(win, function () {
|
|
489
594
|
} else {
|
490
595
|
window.attachEvent("onresize", resizable_update)
|
491
596
|
}
|
492
|
-
preempted || app.run();
|
597
|
+
preempted || app.run({});
|
493
598
|
});
|
494
599
|
if (typeof define === "function" && define.amd) {
|
495
600
|
define([], function () {
|
@@ -497,4 +602,44 @@ if (typeof define === "function" && define.amd) {
|
|
497
602
|
});
|
498
603
|
}
|
499
604
|
|
605
|
+
//github.com/davidchambers/Base64.js
|
606
|
+
(function(){function t(t){this.message=t}var e="undefined"!=typeof exports?exports:this,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=Error(),t.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(var o,n,a=0,i=r,c="";e.charAt(0|a)||(i="=",a%1);c+=i.charAt(63&o>>8-8*(a%1))){if(n=e.charCodeAt(a+=.75),n>255)throw new t("'btoa' failed");o=o<<8|n}return c}),e.atob||(e.atob=function(e){if(e=e.replace(/=+$/,""),1==e.length%4)throw new t("'atob' failed");for(var o,n,a=0,i=0,c="";n=e.charAt(i++);~n&&(o=a%4?64*o+n:n,a++%4)?c+=String.fromCharCode(255&o>>(6&-2*a)):0)n=r.indexOf(n);return c})})();
|
607
|
+
|
608
|
+
//getElementsByClassName polyfill
|
609
|
+
document.getElementsByClassName||(document.getElementsByClassName=function(e){var t=document,n,r,i,s=[];if(t.querySelectorAll)return t.querySelectorAll("."+e);if(t.evaluate){r=".//*[contains(concat(' ', @class, ' '), ' "+e+" ')]",n=t.evaluate(r,t,null,0,null);while(i=n.iterateNext())s.push(i)}else{n=t.getElementsByTagName("*"),r=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0;i<n.length;i++)r.test(n[i].className)&&s.push(n[i])}return s})
|
610
|
+
|
611
|
+
//getComputedStyle polyfill
|
612
|
+
window.getComputedStyle||(window.getComputedStyle=function(e){return this.el=e,this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;return t=="float"&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle[t]?e.currentStyle[t]:null},this})
|
613
|
+
|
614
|
+
//http://javascript.nwbox.com/ContentLoaded by Diego Perini with modifications
|
615
|
+
function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}}
|
616
|
+
|
617
|
+
//https://gist.github.com/991057 by Jed Schmidt with modifications
|
618
|
+
function selector(a,b){var a=a.match(/^(\W)?(.*)/),b=b||document,c=b["getElement"+(a[1]?"#"==a[1]?"ById":"sByClassName":"sByTagName")],d=c.call(b,a[2]),e=[];return null!==d&&(e=d.length||0===d.length?d:[d]),e}
|
619
|
+
|
620
|
+
//shallow object property extend
|
621
|
+
function extend(a,b){
|
622
|
+
var c={};
|
623
|
+
for(var i in a){
|
624
|
+
if(a.hasOwnProperty(i)){
|
625
|
+
c[i]=a[i];
|
626
|
+
}
|
627
|
+
}
|
628
|
+
for(var i in b){
|
629
|
+
if(b.hasOwnProperty(i)){
|
630
|
+
c[i]=b[i];
|
631
|
+
}
|
632
|
+
}
|
633
|
+
return c
|
634
|
+
}
|
635
|
+
|
636
|
+
//hasOwnProperty polyfill
|
637
|
+
if (!Object.prototype.hasOwnProperty)
|
638
|
+
/*jshint -W001, -W103 */
|
639
|
+
Object.prototype.hasOwnProperty = function(prop) {
|
640
|
+
var proto = this.__proto__ || this.constructor.prototype;
|
641
|
+
return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
|
642
|
+
}
|
643
|
+
/*jshint +W001, +W103 */
|
644
|
+
|
500
645
|
})(Holder, window);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holder_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nihad Abbasov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.0.0
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Holder.js for Rails 3.1 asset pipeline
|