Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../includes/tether-s...
File: tether.js
/*! tether 0.6.5 */
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
(function(root, factory) {
[3] Fix | Delete
if (typeof define === 'function' && define.amd) {
[4] Fix | Delete
define(factory);
[5] Fix | Delete
} else if (typeof exports === 'object') {
[6] Fix | Delete
module.exports = factory(require,exports,module);
[7] Fix | Delete
} else {
[8] Fix | Delete
root.Tether = factory();
[9] Fix | Delete
}
[10] Fix | Delete
}(this, function(require,exports,module) {
[11] Fix | Delete
[12] Fix | Delete
(function() {
[13] Fix | Delete
var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
[14] Fix | Delete
__hasProp = {}.hasOwnProperty,
[15] Fix | Delete
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
[16] Fix | Delete
__slice = [].slice;
[17] Fix | Delete
[18] Fix | Delete
if (this.Tether == null) {
[19] Fix | Delete
this.Tether = {
[20] Fix | Delete
modules: []
[21] Fix | Delete
};
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
getScrollParent = function(el) {
[25] Fix | Delete
var parent, position, scrollParent, style, _ref;
[26] Fix | Delete
position = getComputedStyle(el).position;
[27] Fix | Delete
if (position === 'fixed') {
[28] Fix | Delete
return el;
[29] Fix | Delete
}
[30] Fix | Delete
scrollParent = void 0;
[31] Fix | Delete
parent = el;
[32] Fix | Delete
while (parent = parent.parentNode) {
[33] Fix | Delete
try {
[34] Fix | Delete
style = getComputedStyle(parent);
[35] Fix | Delete
} catch (_error) {}
[36] Fix | Delete
if (style == null) {
[37] Fix | Delete
return parent;
[38] Fix | Delete
}
[39] Fix | Delete
if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
[40] Fix | Delete
if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
[41] Fix | Delete
return parent;
[42] Fix | Delete
}
[43] Fix | Delete
}
[44] Fix | Delete
}
[45] Fix | Delete
return document.body;
[46] Fix | Delete
};
[47] Fix | Delete
[48] Fix | Delete
uniqueId = (function() {
[49] Fix | Delete
var id;
[50] Fix | Delete
id = 0;
[51] Fix | Delete
return function() {
[52] Fix | Delete
return id++;
[53] Fix | Delete
};
[54] Fix | Delete
})();
[55] Fix | Delete
[56] Fix | Delete
zeroPosCache = {};
[57] Fix | Delete
[58] Fix | Delete
getOrigin = function(doc) {
[59] Fix | Delete
var id, k, node, v, _ref;
[60] Fix | Delete
node = doc._tetherZeroElement;
[61] Fix | Delete
if (node == null) {
[62] Fix | Delete
node = doc.createElement('div');
[63] Fix | Delete
node.setAttribute('data-tether-id', uniqueId());
[64] Fix | Delete
extend(node.style, {
[65] Fix | Delete
top: 0,
[66] Fix | Delete
left: 0,
[67] Fix | Delete
position: 'absolute'
[68] Fix | Delete
});
[69] Fix | Delete
doc.body.appendChild(node);
[70] Fix | Delete
doc._tetherZeroElement = node;
[71] Fix | Delete
}
[72] Fix | Delete
id = node.getAttribute('data-tether-id');
[73] Fix | Delete
if (zeroPosCache[id] == null) {
[74] Fix | Delete
zeroPosCache[id] = {};
[75] Fix | Delete
_ref = node.getBoundingClientRect();
[76] Fix | Delete
for (k in _ref) {
[77] Fix | Delete
v = _ref[k];
[78] Fix | Delete
zeroPosCache[id][k] = v;
[79] Fix | Delete
}
[80] Fix | Delete
defer(function() {
[81] Fix | Delete
return zeroPosCache[id] = void 0;
[82] Fix | Delete
});
[83] Fix | Delete
}
[84] Fix | Delete
return zeroPosCache[id];
[85] Fix | Delete
};
[86] Fix | Delete
[87] Fix | Delete
node = null;
[88] Fix | Delete
[89] Fix | Delete
getBounds = function(el) {
[90] Fix | Delete
var box, doc, docEl, k, origin, v, _ref;
[91] Fix | Delete
if (el === document) {
[92] Fix | Delete
doc = document;
[93] Fix | Delete
el = document.documentElement;
[94] Fix | Delete
} else {
[95] Fix | Delete
doc = el.ownerDocument;
[96] Fix | Delete
}
[97] Fix | Delete
docEl = doc.documentElement;
[98] Fix | Delete
box = {};
[99] Fix | Delete
_ref = el.getBoundingClientRect();
[100] Fix | Delete
for (k in _ref) {
[101] Fix | Delete
v = _ref[k];
[102] Fix | Delete
box[k] = v;
[103] Fix | Delete
}
[104] Fix | Delete
origin = getOrigin(doc);
[105] Fix | Delete
box.top -= origin.top;
[106] Fix | Delete
box.left -= origin.left;
[107] Fix | Delete
if (box.width == null) {
[108] Fix | Delete
box.width = document.body.scrollWidth - box.left - box.right;
[109] Fix | Delete
}
[110] Fix | Delete
if (box.height == null) {
[111] Fix | Delete
box.height = document.body.scrollHeight - box.top - box.bottom;
[112] Fix | Delete
}
[113] Fix | Delete
box.top = box.top - docEl.clientTop;
[114] Fix | Delete
box.left = box.left - docEl.clientLeft;
[115] Fix | Delete
box.right = doc.body.clientWidth - box.width - box.left;
[116] Fix | Delete
box.bottom = doc.body.clientHeight - box.height - box.top;
[117] Fix | Delete
return box;
[118] Fix | Delete
};
[119] Fix | Delete
[120] Fix | Delete
getOffsetParent = function(el) {
[121] Fix | Delete
return el.offsetParent || document.documentElement;
[122] Fix | Delete
};
[123] Fix | Delete
[124] Fix | Delete
getScrollBarSize = function() {
[125] Fix | Delete
var inner, outer, width, widthContained, widthScroll;
[126] Fix | Delete
inner = document.createElement('div');
[127] Fix | Delete
inner.style.width = '100%';
[128] Fix | Delete
inner.style.height = '200px';
[129] Fix | Delete
outer = document.createElement('div');
[130] Fix | Delete
extend(outer.style, {
[131] Fix | Delete
position: 'absolute',
[132] Fix | Delete
top: 0,
[133] Fix | Delete
left: 0,
[134] Fix | Delete
pointerEvents: 'none',
[135] Fix | Delete
visibility: 'hidden',
[136] Fix | Delete
width: '200px',
[137] Fix | Delete
height: '150px',
[138] Fix | Delete
overflow: 'hidden'
[139] Fix | Delete
});
[140] Fix | Delete
outer.appendChild(inner);
[141] Fix | Delete
document.body.appendChild(outer);
[142] Fix | Delete
widthContained = inner.offsetWidth;
[143] Fix | Delete
outer.style.overflow = 'scroll';
[144] Fix | Delete
widthScroll = inner.offsetWidth;
[145] Fix | Delete
if (widthContained === widthScroll) {
[146] Fix | Delete
widthScroll = outer.clientWidth;
[147] Fix | Delete
}
[148] Fix | Delete
document.body.removeChild(outer);
[149] Fix | Delete
width = widthContained - widthScroll;
[150] Fix | Delete
return {
[151] Fix | Delete
width: width,
[152] Fix | Delete
height: width
[153] Fix | Delete
};
[154] Fix | Delete
};
[155] Fix | Delete
[156] Fix | Delete
extend = function(out) {
[157] Fix | Delete
var args, key, obj, val, _i, _len, _ref;
[158] Fix | Delete
if (out == null) {
[159] Fix | Delete
out = {};
[160] Fix | Delete
}
[161] Fix | Delete
args = [];
[162] Fix | Delete
Array.prototype.push.apply(args, arguments);
[163] Fix | Delete
_ref = args.slice(1);
[164] Fix | Delete
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
[165] Fix | Delete
obj = _ref[_i];
[166] Fix | Delete
if (obj) {
[167] Fix | Delete
for (key in obj) {
[168] Fix | Delete
if (!__hasProp.call(obj, key)) continue;
[169] Fix | Delete
val = obj[key];
[170] Fix | Delete
out[key] = val;
[171] Fix | Delete
}
[172] Fix | Delete
}
[173] Fix | Delete
}
[174] Fix | Delete
return out;
[175] Fix | Delete
};
[176] Fix | Delete
[177] Fix | Delete
removeClass = function(el, name) {
[178] Fix | Delete
var cls, _i, _len, _ref, _results;
[179] Fix | Delete
if (el.classList != null) {
[180] Fix | Delete
_ref = name.split(' ');
[181] Fix | Delete
_results = [];
[182] Fix | Delete
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
[183] Fix | Delete
cls = _ref[_i];
[184] Fix | Delete
if (cls.trim()) {
[185] Fix | Delete
_results.push(el.classList.remove(cls));
[186] Fix | Delete
}
[187] Fix | Delete
}
[188] Fix | Delete
return _results;
[189] Fix | Delete
} else {
[190] Fix | Delete
return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
[191] Fix | Delete
}
[192] Fix | Delete
};
[193] Fix | Delete
[194] Fix | Delete
addClass = function(el, name) {
[195] Fix | Delete
var cls, _i, _len, _ref, _results;
[196] Fix | Delete
if (el.classList != null) {
[197] Fix | Delete
_ref = name.split(' ');
[198] Fix | Delete
_results = [];
[199] Fix | Delete
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
[200] Fix | Delete
cls = _ref[_i];
[201] Fix | Delete
if (cls.trim()) {
[202] Fix | Delete
_results.push(el.classList.add(cls));
[203] Fix | Delete
}
[204] Fix | Delete
}
[205] Fix | Delete
return _results;
[206] Fix | Delete
} else {
[207] Fix | Delete
removeClass(el, name);
[208] Fix | Delete
return el.className += " " + name;
[209] Fix | Delete
}
[210] Fix | Delete
};
[211] Fix | Delete
[212] Fix | Delete
hasClass = function(el, name) {
[213] Fix | Delete
if (el.classList != null) {
[214] Fix | Delete
return el.classList.contains(name);
[215] Fix | Delete
} else {
[216] Fix | Delete
return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
[217] Fix | Delete
}
[218] Fix | Delete
};
[219] Fix | Delete
[220] Fix | Delete
updateClasses = function(el, add, all) {
[221] Fix | Delete
var cls, _i, _j, _len, _len1, _results;
[222] Fix | Delete
for (_i = 0, _len = all.length; _i < _len; _i++) {
[223] Fix | Delete
cls = all[_i];
[224] Fix | Delete
if (__indexOf.call(add, cls) < 0) {
[225] Fix | Delete
if (hasClass(el, cls)) {
[226] Fix | Delete
removeClass(el, cls);
[227] Fix | Delete
}
[228] Fix | Delete
}
[229] Fix | Delete
}
[230] Fix | Delete
_results = [];
[231] Fix | Delete
for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
[232] Fix | Delete
cls = add[_j];
[233] Fix | Delete
if (!hasClass(el, cls)) {
[234] Fix | Delete
_results.push(addClass(el, cls));
[235] Fix | Delete
} else {
[236] Fix | Delete
_results.push(void 0);
[237] Fix | Delete
}
[238] Fix | Delete
}
[239] Fix | Delete
return _results;
[240] Fix | Delete
};
[241] Fix | Delete
[242] Fix | Delete
deferred = [];
[243] Fix | Delete
[244] Fix | Delete
defer = function(fn) {
[245] Fix | Delete
return deferred.push(fn);
[246] Fix | Delete
};
[247] Fix | Delete
[248] Fix | Delete
flush = function() {
[249] Fix | Delete
var fn, _results;
[250] Fix | Delete
_results = [];
[251] Fix | Delete
while (fn = deferred.pop()) {
[252] Fix | Delete
_results.push(fn());
[253] Fix | Delete
}
[254] Fix | Delete
return _results;
[255] Fix | Delete
};
[256] Fix | Delete
[257] Fix | Delete
Evented = (function() {
[258] Fix | Delete
function Evented() {}
[259] Fix | Delete
[260] Fix | Delete
Evented.prototype.on = function(event, handler, ctx, once) {
[261] Fix | Delete
var _base;
[262] Fix | Delete
if (once == null) {
[263] Fix | Delete
once = false;
[264] Fix | Delete
}
[265] Fix | Delete
if (this.bindings == null) {
[266] Fix | Delete
this.bindings = {};
[267] Fix | Delete
}
[268] Fix | Delete
if ((_base = this.bindings)[event] == null) {
[269] Fix | Delete
_base[event] = [];
[270] Fix | Delete
}
[271] Fix | Delete
return this.bindings[event].push({
[272] Fix | Delete
handler: handler,
[273] Fix | Delete
ctx: ctx,
[274] Fix | Delete
once: once
[275] Fix | Delete
});
[276] Fix | Delete
};
[277] Fix | Delete
[278] Fix | Delete
Evented.prototype.once = function(event, handler, ctx) {
[279] Fix | Delete
return this.on(event, handler, ctx, true);
[280] Fix | Delete
};
[281] Fix | Delete
[282] Fix | Delete
Evented.prototype.off = function(event, handler) {
[283] Fix | Delete
var i, _ref, _results;
[284] Fix | Delete
if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
[285] Fix | Delete
return;
[286] Fix | Delete
}
[287] Fix | Delete
if (handler == null) {
[288] Fix | Delete
return delete this.bindings[event];
[289] Fix | Delete
} else {
[290] Fix | Delete
i = 0;
[291] Fix | Delete
_results = [];
[292] Fix | Delete
while (i < this.bindings[event].length) {
[293] Fix | Delete
if (this.bindings[event][i].handler === handler) {
[294] Fix | Delete
_results.push(this.bindings[event].splice(i, 1));
[295] Fix | Delete
} else {
[296] Fix | Delete
_results.push(i++);
[297] Fix | Delete
}
[298] Fix | Delete
}
[299] Fix | Delete
return _results;
[300] Fix | Delete
}
[301] Fix | Delete
};
[302] Fix | Delete
[303] Fix | Delete
Evented.prototype.trigger = function() {
[304] Fix | Delete
var args, ctx, event, handler, i, once, _ref, _ref1, _results;
[305] Fix | Delete
event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
[306] Fix | Delete
if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
[307] Fix | Delete
i = 0;
[308] Fix | Delete
_results = [];
[309] Fix | Delete
while (i < this.bindings[event].length) {
[310] Fix | Delete
_ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
[311] Fix | Delete
handler.apply(ctx != null ? ctx : this, args);
[312] Fix | Delete
if (once) {
[313] Fix | Delete
_results.push(this.bindings[event].splice(i, 1));
[314] Fix | Delete
} else {
[315] Fix | Delete
_results.push(i++);
[316] Fix | Delete
}
[317] Fix | Delete
}
[318] Fix | Delete
return _results;
[319] Fix | Delete
}
[320] Fix | Delete
};
[321] Fix | Delete
[322] Fix | Delete
return Evented;
[323] Fix | Delete
[324] Fix | Delete
})();
[325] Fix | Delete
[326] Fix | Delete
this.Tether.Utils = {
[327] Fix | Delete
getScrollParent: getScrollParent,
[328] Fix | Delete
getBounds: getBounds,
[329] Fix | Delete
getOffsetParent: getOffsetParent,
[330] Fix | Delete
extend: extend,
[331] Fix | Delete
addClass: addClass,
[332] Fix | Delete
removeClass: removeClass,
[333] Fix | Delete
hasClass: hasClass,
[334] Fix | Delete
updateClasses: updateClasses,
[335] Fix | Delete
defer: defer,
[336] Fix | Delete
flush: flush,
[337] Fix | Delete
uniqueId: uniqueId,
[338] Fix | Delete
Evented: Evented,
[339] Fix | Delete
getScrollBarSize: getScrollBarSize
[340] Fix | Delete
};
[341] Fix | Delete
[342] Fix | Delete
}).call(this);
[343] Fix | Delete
[344] Fix | Delete
(function() {
[345] Fix | Delete
var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
[346] Fix | Delete
__slice = [].slice,
[347] Fix | Delete
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
[348] Fix | Delete
[349] Fix | Delete
if (this.Tether == null) {
[350] Fix | Delete
throw new Error("You must include the utils.js file before tether.js");
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
Tether = this.Tether;
[354] Fix | Delete
[355] Fix | Delete
_ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
[356] Fix | Delete
[357] Fix | Delete
within = function(a, b, diff) {
[358] Fix | Delete
if (diff == null) {
[359] Fix | Delete
diff = 1;
[360] Fix | Delete
}
[361] Fix | Delete
return (a + diff >= b && b >= a - diff);
[362] Fix | Delete
};
[363] Fix | Delete
[364] Fix | Delete
transformKey = (function() {
[365] Fix | Delete
var el, key, _i, _len, _ref1;
[366] Fix | Delete
el = document.createElement('div');
[367] Fix | Delete
_ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
[368] Fix | Delete
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
[369] Fix | Delete
key = _ref1[_i];
[370] Fix | Delete
if (el.style[key] !== void 0) {
[371] Fix | Delete
return key;
[372] Fix | Delete
}
[373] Fix | Delete
}
[374] Fix | Delete
})();
[375] Fix | Delete
[376] Fix | Delete
tethers = [];
[377] Fix | Delete
[378] Fix | Delete
position = function() {
[379] Fix | Delete
var tether, _i, _len;
[380] Fix | Delete
for (_i = 0, _len = tethers.length; _i < _len; _i++) {
[381] Fix | Delete
tether = tethers[_i];
[382] Fix | Delete
tether.position(false);
[383] Fix | Delete
}
[384] Fix | Delete
return flush();
[385] Fix | Delete
};
[386] Fix | Delete
[387] Fix | Delete
now = function() {
[388] Fix | Delete
var _ref1;
[389] Fix | Delete
return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
[390] Fix | Delete
};
[391] Fix | Delete
[392] Fix | Delete
(function() {
[393] Fix | Delete
var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
[394] Fix | Delete
lastCall = null;
[395] Fix | Delete
lastDuration = null;
[396] Fix | Delete
pendingTimeout = null;
[397] Fix | Delete
tick = function() {
[398] Fix | Delete
if ((lastDuration != null) && lastDuration > 16) {
[399] Fix | Delete
lastDuration = Math.min(lastDuration - 16, 250);
[400] Fix | Delete
pendingTimeout = setTimeout(tick, 250);
[401] Fix | Delete
return;
[402] Fix | Delete
}
[403] Fix | Delete
if ((lastCall != null) && (now() - lastCall) < 10) {
[404] Fix | Delete
return;
[405] Fix | Delete
}
[406] Fix | Delete
if (pendingTimeout != null) {
[407] Fix | Delete
clearTimeout(pendingTimeout);
[408] Fix | Delete
pendingTimeout = null;
[409] Fix | Delete
}
[410] Fix | Delete
lastCall = now();
[411] Fix | Delete
position();
[412] Fix | Delete
return lastDuration = now() - lastCall;
[413] Fix | Delete
};
[414] Fix | Delete
_ref1 = ['resize', 'scroll', 'touchmove'];
[415] Fix | Delete
_results = [];
[416] Fix | Delete
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
[417] Fix | Delete
event = _ref1[_i];
[418] Fix | Delete
_results.push(window.addEventListener(event, tick));
[419] Fix | Delete
}
[420] Fix | Delete
return _results;
[421] Fix | Delete
})();
[422] Fix | Delete
[423] Fix | Delete
MIRROR_LR = {
[424] Fix | Delete
center: 'center',
[425] Fix | Delete
left: 'right',
[426] Fix | Delete
right: 'left'
[427] Fix | Delete
};
[428] Fix | Delete
[429] Fix | Delete
MIRROR_TB = {
[430] Fix | Delete
middle: 'middle',
[431] Fix | Delete
top: 'bottom',
[432] Fix | Delete
bottom: 'top'
[433] Fix | Delete
};
[434] Fix | Delete
[435] Fix | Delete
OFFSET_MAP = {
[436] Fix | Delete
top: 0,
[437] Fix | Delete
left: 0,
[438] Fix | Delete
middle: '50%',
[439] Fix | Delete
center: '50%',
[440] Fix | Delete
bottom: '100%',
[441] Fix | Delete
right: '100%'
[442] Fix | Delete
};
[443] Fix | Delete
[444] Fix | Delete
autoToFixedAttachment = function(attachment, relativeToAttachment) {
[445] Fix | Delete
var left, top;
[446] Fix | Delete
left = attachment.left, top = attachment.top;
[447] Fix | Delete
if (left === 'auto') {
[448] Fix | Delete
left = MIRROR_LR[relativeToAttachment.left];
[449] Fix | Delete
}
[450] Fix | Delete
if (top === 'auto') {
[451] Fix | Delete
top = MIRROR_TB[relativeToAttachment.top];
[452] Fix | Delete
}
[453] Fix | Delete
return {
[454] Fix | Delete
left: left,
[455] Fix | Delete
top: top
[456] Fix | Delete
};
[457] Fix | Delete
};
[458] Fix | Delete
[459] Fix | Delete
attachmentToOffset = function(attachment) {
[460] Fix | Delete
var _ref1, _ref2;
[461] Fix | Delete
return {
[462] Fix | Delete
left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
[463] Fix | Delete
top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
[464] Fix | Delete
};
[465] Fix | Delete
};
[466] Fix | Delete
[467] Fix | Delete
addOffset = function() {
[468] Fix | Delete
var left, offsets, out, top, _i, _len, _ref1;
[469] Fix | Delete
offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
[470] Fix | Delete
out = {
[471] Fix | Delete
top: 0,
[472] Fix | Delete
left: 0
[473] Fix | Delete
};
[474] Fix | Delete
for (_i = 0, _len = offsets.length; _i < _len; _i++) {
[475] Fix | Delete
_ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
[476] Fix | Delete
if (typeof top === 'string') {
[477] Fix | Delete
top = parseFloat(top, 10);
[478] Fix | Delete
}
[479] Fix | Delete
if (typeof left === 'string') {
[480] Fix | Delete
left = parseFloat(left, 10);
[481] Fix | Delete
}
[482] Fix | Delete
out.top += top;
[483] Fix | Delete
out.left += left;
[484] Fix | Delete
}
[485] Fix | Delete
return out;
[486] Fix | Delete
};
[487] Fix | Delete
[488] Fix | Delete
offsetToPx = function(offset, size) {
[489] Fix | Delete
if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
[490] Fix | Delete
offset.left = parseFloat(offset.left, 10) / 100 * size.width;
[491] Fix | Delete
}
[492] Fix | Delete
if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
[493] Fix | Delete
offset.top = parseFloat(offset.top, 10) / 100 * size.height;
[494] Fix | Delete
}
[495] Fix | Delete
return offset;
[496] Fix | Delete
};
[497] Fix | Delete
[498] Fix | Delete
parseAttachment = parseOffset = function(value) {
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function