2795,6,165,42,381,58,160,56,538,52,145,46,227,44,917,71,219,54,405,50,131,67,169,55,248,53,1070,50,1100,65,969,48,136,50,206,56,166,56,131,42,183,38,662,35,198,28,1665,31,431,33,467,46,95,56,216,57,207,55,295,54,214,48,95,58,209,59,207,57,293,56,230,19,1026,43,255,44,150,39,1139,55,300,56,300,62,212,40,277,30,427,42,461,32,434,39,1377,30,2212,46,367,40,135,49,393,46,442,47,649,60,205,44,520,56,588,60,223,60,195,54,233,49,569,51,340,40,982,62,314,60,675,39,1549,55,289,71,702,47,349,60,972,42,760,54,284,39,887,44,1001,38,75,52,134,59,171,54,397,47,1092,55,75,53,424,99,240,132,255,134,329,150,184,118,572,70,883,79,87,76,299,83,202,101,117,78,96,82,366,82,264,85,131,79,292,71,272,61,256,70,207,72,562,68,449,57,214,53,81,86,277,86,987,85,530,84,519,69,1172,92,685,82,943,84,658,64,183,82,630,81,379,97,394,102,337,72,1190,31,728,39,582,47,433,45,60,46,251,47,355,67,734,50,348,41,155,54,344,44,419,60,2818,55,504,62,611,72,3424,63,877,58,939,53,828,58,756,55,996,54,406,42,1278,72,560,83,226,52,2734,67,770,66,154,54,1460,50,195,52,841,67,416,53,1351,55,1459,71,1648,69,1825,55,634,46,348,34,3502,63,1816,52,107,47,179,44,276,58,132,36,738,61,556,71,299,55,706,77,221,73,718,44,433,40,164,40,152,62,278,62,280,44,412,55,167,74,453,69,562,94,244,128,226,110,524,62,1392,83,480,77,532,73,304,63,217,56,703,77,310,61,740,42,3524,72,759,90,227,87,854,86,1054,107,345,57,392,59,930,44,973,73,484,64,725,65,513,62,168,72,305,70,197,50,176,50,1294,54,456,50,273,50,1290,78,155,54,653,49,239,50,446,50,382,80,202,63,218,56,525,47,101,54,132,51,111,52,219,49,411,39,782,22,1280,49,246,36,488,49,297,51,760,30,577,30,1135,35,1254,48,670,48,199,58,546,42,247,52,279,50,1233,67,153,64,160,53,1248,40,372,37,253,47,138,50,463,45,223,49,174,35,1020,55,235,50,141,41,810,30,1757,39,582,58,324,33,456,41,3507,63,268,35,522,39,95,31,290,35,472,31,859,45,298,37,318,33,70,45,231,57,666,47,553,51,765,51,222,29,381,42,447,59,303,53,294,56,162,51,96,54,112,50,491,39,557,35,390,40,2158,43,646,44,823,49,561,50,1793,46,194,53,441,41,624,47,401,31,4625,50,534,42,674,56,416,33,115,35,371,37,371,31,424,41,228,49,457,39,74,49,1617,56,286,55,1270,47,2509,43,4379,45,2211,46,2007,57,1744,45,2353,43,2069,51,1195,39,251,39,544,35,253,31,175,31,473,26,3477,47,69,41,123,82,227,65,1122,53,760,65,382,76,586,64,581,46,437,35,188,52,288,49,1016,49,358,46,220,43,214,55,549,59,474,45,449,65,384,45,510,51,125,49,195,44,408,47,285,45,414,49,288,46,519,51,371,41,229,35,65,39,120,37,533,35,148,45,195,45,276,47,671,51,796,80,900,58,635,71,595,43,1256,49,739,31,146,43,719,41,1015,51,479,52,4194,66,142,57,1207,57,1089,29,1084,41,668,31,205,59,385,43,881,35,776,35,325,33,252,31,110,8,350,20,184,35,242,41,108,29,1919,38,2995,34,2824,46,315,61,408,47,328,51,475,33,556,25,709,33,707,42,332,24,246,28,93,45,729,41,578,32,595 _info {"project":"extended-dom-element","branch":"master","version":368,"versionDate":"2024-06-03T14:14:34.000Z","fromVersion":0,"reset":true,"checksumDocs":"390-262532"} components/JSONFormatter/JSONFormatter.ls (function(){ return function(json){ var root; root = Div().html(include("element/element")(json)); root.openAtDepth = function(){ debug("JSONFormatter.openAtDepth isnt supported anymore. please consider changing it"); return root; }; root.render = function(){ debug("JSONFormatter.render isnt supported anymore. please consider changing it"); return root; }; return root; }; })(); components/JSONFormatter/element/_shared/prefix/prefix.ls (function(){ return function(prefix){ if (prefix) { return Div().css({ flex: "0 0 auto", color: Color.cyan[400], margin: "0 0.25em" }).html(prefix); } }; })(); components/JSONFormatter/element/_shared/singleValue.ls (function(){ return function(value, prefix, color, preventWrap){ var pw, div; pw = preventWrap; div = Div(); return div.css({ display: "flex", justifyContent: "flex-start", alignItems: "flex-start", flexWrap: !pw ? "wrap" : void 8, width: "100%" }).append(include("prefix/prefix")(prefix), div.value = Div().css({ color: color, flex: "0 0 auto", maxWidth: "100%", wordWrap: !pw ? "break-word" : void 8, whiteSpace: pw ? "nowrap" : void 8, overflow: pw ? "hidden" : void 8, textOverflow: pw ? "ellipsis" : void 8 }).text(value)); }; })(); components/JSONFormatter/element/boolean/boolean.ls (function(){ return function(json, prefix){ return include("../_shared/singleValue")(json ? "true" : "false", prefix, Color.pink[700]); }; })(); components/JSONFormatter/element/date/date.ls (function(){ return function(json, prefix){ var e; return include("../_shared/singleValue")((function(){ try { return json.toISOString(); } catch (e$) { e = e$; return json.toString(); } }()), prefix, Color.red[600]); }; })(); components/JSONFormatter/element/element.ls (function(){ var maxDepth; maxDepth = 10; return function(json, prefix, depth){ if (depth > maxDepth) { return include("unhandled/unhandled")("...max depth exceeded...", prefix); } else if (_.isFunction(json)) { return include("function/function")(json, prefix); } else if (_.isDate(json)) { return include("date/date")(json, prefix); } else if (json instanceof RegExp) { return include("regex/regex")(json, prefix); } else if (_.isObject(json)) { return include("object/object")(json, prefix, depth); } else if (_.isString(json)) { return include("string/string")(json, prefix); } else if (_.isNumber(json)) { return include("number/number")(json, prefix); } else if (_.isBoolean(json)) { return include("boolean/boolean")(json, prefix); } else if (_.isUndefined(json) || _.isNull(json)) { return include("undefined/undefined")(json, prefix); } else { return include("unhandled/unhandled")(json, prefix); } }; })(); components/JSONFormatter/element/function/formatSolocodeFunc/format.ls (function(){ return function(f){ if (f.indexOf("$$") >= 0) { return f.replace(/(\$[SP])/g, "/").replace(/(\$M)/g, "-").replace(/(\$D)/g, ".").replace(/(\$B)/g, " ").replace(/(\$\$)/g, ""); } else { return f; } }; })(); components/JSONFormatter/element/function/function.ls (function(){ return function(json, prefix){ var functionName; functionName = include("formatSolocodeFunc/format")(json.toString().replace("function ", '').replace(/[\r\n]/g, '').replace(/\{.*\}/, '') + '{…}'); return Div().css({ color: Color.purple[500] }).append(include("../_shared/singleValue")("function", prefix), Div().css({ maxWidth: "100%", wordWrap: "break-word" }).html(functionName)); }; })(); components/JSONFormatter/element/number/number.ls (function(){ return function(json, prefix){ return include("../_shared/singleValue")(json + "", prefix, Color.blue[500]); }; })(); components/JSONFormatter/element/object/arrayLength/arrayLength.ls (function(){ return function(json){ if (_.isArray(json)) { return Div().css({ flex: "0 0 auto", color: Color.lightBlue[600] }).html("[" + json.length + "]"); } }; })(); components/JSONFormatter/element/object/arrow/arrow.ls (function(){ return function(){ return SvgIcon({ svg: "/../extended-dom-element/components/JSONFormatter/svg/triangle.svg", color: Color.grey[500] }).css({ flex: "0 0 auto", fontSize: "0.8em", userSelect: "none", marginRight: "0.25em" }); }; })(); components/JSONFormatter/element/object/name/name.ls (function(){ return function(json, prefix){ var propType, ref$, ref1$, getFunctionParams, jsonReplacer, showPreview, div; propType = json.constructor != null ? (ref$ = (ref1$ = /function ([^(]*)/.exec(json.constructor.toString())) != null ? ref1$[1] : void 8) != null ? ref$ : "Object" : "Object"; getFunctionParams = function(fn){ return fn.toString().replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s))/mg, '').match(/^function\s*[^\(]*\(\s*([^\)]*)\)/m)[1]; }; jsonReplacer = function(key, value){ if (_.isFunction(value)) { return "function (" + getFunctionParams(value) + ")"; } else { return value; } }; if (prefix && propType === "Object") { try { propType = JSON.stringify(json, jsonReplacer); if (propType.length > 100) { propType = propType.substr(0, 200) + "…"; } showPreview = true; } catch (e$) {} } div = include("../../_shared/singleValue")(propType, prefix, Color.grey[700], showPreview); div.setCollapsed = function(collapsed){ if (!showPreview) { return; } if (collapsed) { return div.value.hide(); } else { return div.value.show(); } }; return div; }; })(); components/JSONFormatter/element/object/object.ls (function(){ return function(json, prefix, depth){ var collapsed, propertyContainer, updateState, toggle, div, header, arrow; depth = depth != null ? depth : 0; collapsed = prefix != null; propertyContainer = null; updateState = function(){ if (collapsed) { arrow.css({ transform: "rotateZ(90deg)", transition: "150ms" }); if (propertyContainer != null) { propertyContainer.hide(); } return header.setCollapsed(false); } else { if (propertyContainer == null) { propertyContainer = include("properties/properties")(json, prefix, depth); div.append(propertyContainer); } arrow.css({ transform: "rotateZ(180deg)", transition: "150ms" }); propertyContainer.show(); return header.setCollapsed(true); } }; toggle = function(){ collapsed = !collapsed; return updateState(); }; div = Div().append(header = include("name/name")(json, prefix).prepend(arrow = include("arrow/arrow")()).append(include("arrayLength/arrayLength")(json)).tap(toggle), !collapsed ? (header.setCollapsed(true), propertyContainer = include("properties/properties")(json, prefix, depth)) : void 8); updateState(); return div; }; })(); components/JSONFormatter/element/object/properties/properties.ls (function(){ return function(json, prefix, depth){ var hasProperties, notOwnPropertiesToShow, div, name, property, propName; hasProperties = false; notOwnPropertiesToShow = ["outerHTML"]; div = Div().css({ overflow: "hidden", marginLeft: "1em" }).append((function(){ var ref$, own$ = {}.hasOwnProperty, results$ = []; for (name in ref$ = json) if (own$.call(ref$, name)) { property = ref$[name]; hasProperties = true; results$.push(include("../../element")(property, name + ": ", depth + 1)); } return results$; }()), (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = notOwnPropertiesToShow).length; i$ < len$; ++i$) { propName = ref$[i$]; if (json[propName] != null && !json.hasOwnProperty(propName)) { hasProperties = true; results$.push(include("../../element")(json[propName], propName + ": ", depth + 1)); } } return results$; }())); if (!hasProperties) { div.css({ color: Color.grey[400] }).html("No properties"); } return div; }; })(); components/JSONFormatter/element/regex/regex.ls (function(){ return function(json, prefix){ return include("../_shared/singleValue")(json.toString(), prefix, Color.red[600]); }; })(); components/JSONFormatter/element/string/string.ls (function(){ return function(json, prefix){ var div; div = include("../_shared/singleValue")('"' + json + '"', prefix, Color.brown[500]); div.lastChild.css({ whiteSpace: "pre-wrap" }); return div; }; })(); components/JSONFormatter/element/undefined/undefined.ls (function(){ return function(json, prefix){ return include("../_shared/singleValue")(_.isUndefined(json) ? "undefined" : "null", prefix, Color.yellow[900]); }; })(); components/JSONFormatter/element/unhandled/unhandled.ls (function(){ return function(json, prefix){ return include("../_shared/singleValue")(json + "", prefix, Color.pink[300]); }; })(); components/JSONFormatter/svg/triangle.svg components/button/animation/darken.ls (function(){ return function(div){ var overlay; overlay = null; return { down: function(){ var bgColor, opacity; if (!overlay) { overlay = Div({ position: "absolute", left: 0, right: 0, top: 0, bottom: 0, backgroundColor: "black", borderRadius: div.style.borderRadius, pointerEvents: "none" }); } bgColor = getComputedStyle(div).backgroundColor; opacity = bgColor === "rgba(0, 0, 0, 0)" || bgColor === "rgb(255, 255, 255)" ? 0.03 : 0.055; overlay.css({ opacity: opacity }); return div.append(overlay); }, up: function(){ return overlay != null ? overlay.remove() : void 8; }, cancel: function(){ return overlay != null ? overlay.remove() : void 8; } }; }; })(); components/button/border/border.ls (function(){ return function(o){ if (o.type !== "secondary") { return; } return Div({ position: "absolute", top: 0, right: 0, left: 0, bottom: 0, border: "1px solid " + Color.grey[300] }); }; })(); components/button/button.ls (function(){ return function(o){ var ref$, isEnabled, div; o = _.isString(o) ? { label: o } : o ? o : {}; o.labelAllowWrap = (ref$ = o.labelAllowWrap) != null ? ref$ : false; o.iconColor = (ref$ = o.iconColor) != null ? ref$ : Color.black; o.iconPosition = (ref$ = o.iconPosition) != null ? ref$ : "left"; o.type = (ref$ = o.type) != null ? ref$ : "primary"; isEnabled = true; div = Div({ display: "inline-flex", minWidth: 0, verticalAlign: 0 }).addClass("button").html(inc("icon/icon")(o), inc("label/label")(o), inc("border/border")(o)).tap({ up: function(){ return typeof o.action == 'function' ? o.action(div) : void 8; }, animation: "hover", tapZone: o.tapZone }); if (o.key != null) { if (!o.action) { debug("key only works with action property (not with tap)"); } div.addClass("keyManager-" + o.key).bind("keyManager", function(){ return o.action(div); }); } div.icon = o.iconSvg; div.iconColor = o.iconColor; div.label = o.label; div.setIconColor = function(c){ o.iconColor = c; o.iconDiv.update(o); div.setState(div.state); return div; }; div.setState = function(state){ div.state = state; inc("types/" + o.type + "/applyState")(div); if (!isEnabled && state !== "disabled") { div.setState("disabled"); } return div; }; div.setLabel = function(l){ o.label = l; o.labelDiv.update(o); div.setState(div.state); return div; }; div.setIcon = function(i){ o.icon = i; o.iconDiv.update(o); div.setState(div.state); return div; }; div.setEnabled = function(enabled){ isEnabled = enabled; if (enabled) { div.setState("normal"); } else { div.setState("disabled"); } return div; }; div.setState("normal"); if (o.state) { div.setState(o.state); } return div; }; })(); components/button/icon/icon.ls (function(){ return function(o){ var update, div; if (!o.icon) { return; } update = function(){ return o.iconDiv.replaceWith(o.iconDiv = include(THISFILE)(o)); }; div = Div({ flex: "0 0 auto", order: o.iconPosition === "right" ? 1 : void 8 }).html(o.iconSvg = Svg({ svg: o.icon, color: o.iconColor }).css({ verticalAlign: "-0.16em", backgroundColor: o.iconBackgroundColor })); div.update = update; return o.iconDiv = div; }; })(); components/button/label/label.ls (function(){ return function(o){ var update, div; update = function(o){ div.secureHtml(o.label || " "); return div.css({ padding: !o.icon || !o.label ? "0" : o.iconPosition === "left" ? "0 0 0 0.3em" : "0 0.3em 0 0", width: !o.label ? 0 : void 8 }); }; div = Div({ flex: "1 1 auto", overflow: "hidden", textOverflow: "ellipsis", minWidth: 0, whiteSpace: !o.labelAllowWrap ? "nowrap" : void 8 }); update(o); div.update = update; return o.labelDiv = div; }; })(); components/button/types/primary/applyState.ls (function(){ return function(div){ return inc("states/" + div.state + "/apply")(div); }; })(); components/button/types/primary/states/correct/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(div.iconColor); } return div.css({ pointerEvents: "none", cursor: "default", backgroundColor: Color.green[500] }); }; })(); components/button/types/primary/states/disabled/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(Color.grey[500]); } return div.css({ pointerEvents: "none", cursor: "default", color: Color.grey[500] }); }; })(); components/button/types/primary/states/normal/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(div.iconColor); } return div.css({ padding: "0.5em 0.7em 0.55em 0.7em", backgroundColor: Color.grey[300], pointerEvents: "inherit", cursor: "pointer", color: Color.black, minHeight: "2.4em" }); }; })(); components/button/types/primary/states/wrong/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(div.iconColor); } return div.css({ pointerEvents: "none", cursor: "default", backgroundColor: Color.red[500] }); }; })(); components/button/types/secondary/applyState.ls (function(){ return function(div){ return inc("states/" + div.state + "/apply")(div); }; })(); components/button/types/secondary/states/correct/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(Color.green[500]); } return div.css({ pointerEvents: "none", cursor: "default", color: Color.green[500] }); }; })(); components/button/types/secondary/states/disabled/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(Color.grey[300]); } return div.css({ pointerEvents: "none", color: Color.grey[300], cursor: "default" }); }; })(); components/button/types/secondary/states/normal/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(div.iconColor); } return div.css({ padding: "0.5em 0.7em 0.55em 0.7em", backgroundColor: "transparent", pointerEvents: "inherit", cursor: "pointer", color: Color.black, minHeight: "2.4em" }); }; })(); components/button/types/secondary/states/wrong/apply.ls (function(){ return function(div){ var ref$; if ((ref$ = div.icon) != null) { ref$.setColor(Color.red[500]); } return div.css({ boxSizing: "border-box", pointerEvents: "none", cursor: "default", color: Color.red[500] }); }; })(); components/init.ls (function(){ return function(){ var tags, i$, len$, w, n, f, results$ = []; tags = ["span", "table", "tbody", "tr", "td", "ul", "ol", "li", "a", "img", "p", "h1", "div", "br", "section", "form", "input", "textarea", "pre", "iframe", "video", "canvas", "style"]; for (i$ = 0, len$ = tags.length; i$ < len$; ++i$) { (fn$.call(this, tags[i$])); } w = { body: document.body, JSONFormatter: inc("JSONFormatter/JSONFormatter"), Svg: inc("svg/svg"), SvgIcon: inc("svgIcon/svgIcon"), Button: inc("button/button"), ScrollDiv: inc("scrollDiv/scrollDiv"), ScrollDivNext: inc("scrollDivNext/scrollDivNext"), ZoomDiv: inc("zoomDiv/zoomDiv"), ListDiv: inc("listDiv/listDiv"), OverlayMenu: inc("overlayMenu/menu") }; for (n in w) { f = w[n]; results$.push(window[n] = f); } return results$; function fn$(tag){ var tagUpper; tagUpper = tag[0].toUpperCase() + tag.substr(1); window[tagUpper] = function(css){ var el; if (css) { el = document.createElement(tag); return el.css(css); } else { return document.createElement(tag); } }; } }; })(); components/listDiv/calcTopScopeRow/calc.ls (function(){ return function(o){ var lp, row; lp = o.getListPosition(); row = o.rowsByIndex[lp.rowIndex]; return { index: lp.rowIndex, row: row, data: o.data[lp.rowIndex], offsetTop: lp.topOffset, offsetBottom: lp.topOffset + row.offsetHeight }; }; })(); components/listDiv/contentDiv/contentDiv.ls (function(){ return function(o){ var contentDiv; contentDiv = Div().css({ height: "1000000px" }); o.div.html(contentDiv); return contentDiv; }; })(); components/listDiv/createRow/create.ls (function(){ return function(o, index, position){ var rowData, rowDiv, error; rowData = o.data[index]; if (!rowData) { return; } rowDiv = o.rowsByIndex[index]; if (!rowDiv) { try { rowDiv = o.row(rowData, index); } catch (e$) { error = e$; rowDiv = Div({ color: Color.red[400], background: Color.red[50], padding: "0.1em" }).html("Row error (index: " + index + ")"); error.message = "createRow error, " + error.message; setTimeout(function(){ throw error; }); } rowDiv.addClass("listRow").css({ width: "100%", position: "absolute", contain: "layout" }); } o.contentDiv.append(rowDiv); if (!rowDiv.positionHeight) { inc("updateAverageRowHeight/update")(o, rowDiv); } rowDiv.rowIndex = index; rowDiv.positionTop = 0; rowDiv.positionHeight = rowDiv.offsetHeight; o.rowsByIndex[index] = rowDiv; if (o.minRowIndex == null || index < o.minRowIndex) { o.minRowIndex = index; } if (o.maxRowIndex == null || index > o.maxRowIndex) { o.maxRowIndex = index; } if (position === "before") { inc("positionBefore/position")(o, index, index + 1); } if (position === "after") { inc("positionAfter/position")(o, index, index - 1); } return rowDiv; }; })(); components/listDiv/createRow/positionAfter/position.ls (function(){ return function(o, index1, index2){ var div1, div2, newPositionTop; div1 = o.rowsByIndex[index1]; div2 = o.rowsByIndex[index2]; newPositionTop = _.round(div2.positionTop + div2.positionHeight); div1.css({ top: newPositionTop + "px" }); return div1.positionTop = newPositionTop; }; })(); components/listDiv/createRow/positionBefore/position.ls (function(){ return function(o, index1, index2){ var div1, div2, newPositionTop; div1 = o.rowsByIndex[index1]; div2 = o.rowsByIndex[index2]; newPositionTop = _.round(div2.positionTop - div1.positionHeight); div1.css({ top: newPositionTop + "px" }); return div1.positionTop = newPositionTop; }; })(); components/listDiv/createRow/updateAverageRowHeight/update.ls (function(){ return function(o, rowDiv){ var t, h; t = o.averageRowHeightTotal; h = o.averageRowHeight; o.averageRowHeight = (h * t + rowDiv.offsetHeight) / (t + 1); return o.averageRowHeightTotal += 1; }; })(); components/listDiv/debugDiv/debugDiv.ls (function(){ return function(o){ var div; div = Div({ background: Color.orange[100], position: "absolute", maxWidth: "100%", pointerEvents: "none", padding: "0.1em", fontSize: "0.7em", opacity: 0.9 }); if (o.debug) { o.div.scrollContainerDiv.after(div); } return div; }; })(); components/listDiv/div/div.ls (function(){ return function(o, p){ return ScrollDiv({ enlargeScrollbarOnHover: p.enlargeScrollbarOnHover, fadeInScrollbarOnHover: p.fadeInScrollbarOnHover, scopeRender: p.scopeRender, scrollbarMode: p.scrollbarMode, onResize: function(){ return typeof o.onResize == 'function' ? o.onResize() : void 8; }, onScroll: function(){ return typeof o.onScroll == 'function' ? o.onScroll() : void 8; } }).addClass("listDiv"); }; })(); components/listDiv/getListPosition/get.ls (function(){ return function(o){ var i$, to$, i, row, topOffset; if (!o.hasStarted) { return o.listPosition; } for (i$ = o.topRowIndex, to$ = o.bottomRowIndex; i$ <= to$; ++i$) { i = i$; row = o.rowsByIndex[i]; if (!row) { break; } topOffset = row.positionTop - o.div.scrollTop - o.topFix; if (topOffset >= 0) { break; } } if (row) { return { rowIndex: row.rowIndex, topOffset: _.round(topOffset, 1) }; } else { return { rowIndex: 0, topOffset: 0 }; } }; })(); components/listDiv/info/info.ls (function(){ var a; a = []; return function(o, l){ if (!o.debug) { return; } if (!o.infoDiv) { o.infoDiv = Div().css({ background: Color.pink[50], position: "absolute", top: "1.5em", maxWidth: "100%", pointerEvents: "none", padding: "0.1em", fontSize: "0.7em", opacity: 0.9, textAlign: "left" }); o.div.scrollContainerDiv.after(o.infoDiv); } a.push(l); if (a.length > 3) { a.shift(); } return o.infoDiv.html(a.join("
")); }; })(); components/listDiv/insertRow/insert.ls (function(){ return function(o, p){ var position, rowsByIndexNew, index, ref$, row, top, r; position = p.position; if (o.data.length === 0) { o.data.push(p.data); o.setListPosition(null, true); return; } o.data.splice(p.position, 0, p.data); rowsByIndexNew = {}; for (index in ref$ = o.rowsByIndex) { row = ref$[index]; if (index < position) { rowsByIndexNew[index] = row; } else { row.rowIndex++; rowsByIndexNew[row.rowIndex] = row; } } o.rowsByIndex = rowsByIndexNew; o.reachedBottom = false; o.contentDiv.css({ height: "1000000px" }); if (position >= o.topRowIndex && position <= o.bottomRowIndex) { o.info("insertRow " + position + " VISIBLE"); if (position === 0) { top = o.rowsByIndex[1].positionTop; r = o.createRow(position, "before"); r.positionTop = top; r.css({ top: top + "px" }); } else { r = o.createRow(position, "after"); } o.bottomRowIndex += 1; return o.repositionCurrentRows(); } else if (position > o.bottomRowIndex) { o.info("insertRow " + position + " BELOW"); return o.maxRowIndex = o.bottomRowIndex; } else if (position < o.topRowIndex && !o.reachedTop) { o.info("insertRow " + position + " ABOVE, reachedTop = false"); o.topRowIndex += 1; return o.onScroll(); } else if (position < o.topRowIndex && o.reachedTop) { o.info("insertRow " + position + " ABOVE, reachedTop = true"); o.topRowIndex += 1; o.setListPosition(); return o.onScroll(); } }; })(); components/listDiv/listDiv.ls (function(){ return function(p){ var o, ref$; o = {}; o.data = (ref$ = p.data) != null ? ref$ : []; o.row = p.row; o.listPosition = p.listPosition || { rowIndex: 0, topOffset: 0 }; o.debug = (ref$ = p.debug) != null ? ref$ : false; o.nearScopeSize = 0; p.nearScopeSize == null && (p.nearScopeSize = 0); p.nearScopeDelay == null && (p.nearScopeDelay = 1000); o.rowsByIndex = {}; o.topFix = 0; o.reachedTop = false; o.reachedBottom = false; o.topRowIndex = null; o.bottomRowIndex = null; o.minRowIndex = null; o.maxRowIndex = null; o.averageRowHeight = 0; o.averageRowHeightTotal = 0; o.div = inc("div/div")(o, p); o.contentDiv = inc("contentDiv/contentDiv")(o); o.debugDiv = inc("debugDiv/debugDiv")(o); o.createRow = function(index, position){ return inc("createRow/create")(o, index, position); }; o.onDomAppend = function(){ return inc("onDomAppend/onDomAppend")(o); }; o.onScroll = function(){ return inc("onScroll/onScroll")(o, p); }; o.onResize = function(){ return inc("onResize/onResize")(o, p); }; o.getListPosition = function(){ return inc("getListPosition/get")(o); }; o.setListPosition = function(p, resetRows){ return inc("setListPosition/set")(p, resetRows, o); }; o.repositionCurrentRows = function(){ return inc("repositionCurrentRows/reposition")(o); }; o.updateRow = function(p){ return inc("updateRow/update")(o, p); }; o.insertRow = function(p){ return inc("insertRow/insert")(o, p); }; o.removeRow = function(rowIndex){ return inc("removeRow/remove")(o, rowIndex); }; o.scrollRowIntoView = function(rowIndex, options){ return inc("scrollRowIntoView/scroll")(o, rowIndex, options); }; o.info = function(l){ return inc("info/info")(o, l); }; o.calcTopScopeRow = function(){ return inc("calcTopScopeRow/calc")(o); }; o.onDomAppend(); o.div.setListPosition = o.setListPosition; o.div.getListPosition = o.getListPosition; o.div.repositionCurrentRows = o.repositionCurrentRows; o.div.updateRow = o.updateRow; o.div.insertRow = o.insertRow; o.div.removeRow = o.removeRow; o.div.scrollRowIntoView = o.scrollRowIntoView; o.div.calcTopScopeRow = o.calcTopScopeRow; o.div.o = o; setTimeout(function(){ o.nearScopeSize = p.nearScopeSize; return o.onScroll(); }, p.nearScopeDelay); return o.div; }; })(); components/listDiv/onDomAppend/onDomAppend.ls (function(){ return function(o){ var f; return o.div.contentDiv.onDomAppend(f = function(){ if (!o.div.isDomElement()) { return; } if (!o.div.isVisible() || o.div.offsetHeight === 0) { requestAnimationFrame(f); return; } if (!o.hasStarted) { o.hasStarted = true; return o.setListPosition(o.listPosition); } else { return o.div.scrollTop = o.scrollTop; } }); }; })(); components/listDiv/onResize/onResize.ls (function(){ return function(o, p){ return typeof o.repositionCurrentRows == 'function' ? o.repositionCurrentRows() : void 8; }; })(); components/listDiv/onScroll/cleanBottom/clean.ls (function(){ return function(o){ var bottomRow, topY, h, results$ = []; for (;;) { bottomRow = o.rowsByIndex[o.bottomRowIndex]; topY = bottomRow.positionTop - o.div.scrollTop - o.topFix; h = o.div.offsetHeight * (1 + o.nearScopeSize); if (topY < h) { break; } else if (o.topRowIndex === 0) { break; } else { bottomRow.remove(); results$.push(o.bottomRowIndex--); } } return results$; }; })(); components/listDiv/onScroll/cleanTop/clean.ls (function(){ return function(o){ var topRow, topY, bottomY, h, results$ = []; for (;;) { topRow = o.rowsByIndex[o.topRowIndex]; topY = topRow.positionTop - o.div.scrollTop - o.topFix; bottomY = topY + topRow.positionHeight; h = -o.div.offsetHeight * o.nearScopeSize; if (bottomY >= h) { break; } else if (o.bottomRowIndex === o.data.length - 1) { break; } else { topRow.remove(); results$.push(o.topRowIndex++); } } return results$; }; })(); components/listDiv/onScroll/fillBottom/fill.ls (function(){ return function(o){ var bottomRow, isLastRow, topY, bottomY, h1, h2, results$ = []; for (;;) { bottomRow = o.rowsByIndex[o.bottomRowIndex]; isLastRow = o.bottomRowIndex === o.data.length - 1; topY = bottomRow.positionTop - o.div.scrollTop - o.topFix; bottomY = topY + bottomRow.positionHeight; h1 = o.div.offsetHeight; h2 = h1 * (1 + o.nearScopeSize); if (!isLastRow) { if (bottomY < h2) { o.bottomRowIndex++; results$.push(o.createRow(o.bottomRowIndex, "after")); } else { break; } } else { if (bottomY <= h1 && !o.reachedBottom) { results$.push(inc("reachBottom/reach")(bottomRow, o)); } else { break; } } } return results$; }; })(); components/listDiv/onScroll/fillBottom/reachBottom/reach.ls (function(){ return function(bottomRow, o){ o.info("reachBottom"); o.reachedBottom = true; return o.contentDiv.css({ height: bottomRow.positionTop + bottomRow.positionHeight - o.topFix + "px" }); }; })(); components/listDiv/onScroll/fillTop/fill.ls (function(){ return function(o){ var topRow, isFirstRow, topY, h, results$ = []; for (;;) { topRow = o.rowsByIndex[o.topRowIndex]; isFirstRow = o.topRowIndex === 0; topY = topRow.positionTop - o.div.scrollTop - o.topFix; h = -o.div.offsetHeight * o.nearScopeSize; if (!isFirstRow) { if (topY >= h) { o.topRowIndex--; results$.push(o.createRow(o.topRowIndex, "before")); } else { break; } } else { if (topY >= 0 && !o.reachedTop) { inc("reachTop/reach")(topRow, o); break; } else { break; } } } return results$; }; })(); components/listDiv/onScroll/fillTop/reachTop/ios/ios.ls (function(){ return function(topRow, o){ var scrollTop; scrollTop = o.div.scrollTop; o.div.scrollContainerDiv.css({ overflowY: "hidden" }); o.contentDiv.css({ top: "-" + topRow.positionTop + "px", height: o.contentDiv.height() - o.topFix + "px" }); if (o.contentDiv.countScroll > 3) { o.contentDiv.css({ transform: "translateY(" + (topRow.positionTop - scrollTop) + "px)" }); requestAnimationFrame(function(){ return o.contentDiv.css({ transform: "translateY(0px)", transition: "300ms" }); }); } o.div.scrollTop = 0; return o.div.scrollContainerDiv.css({ overflowY: "scroll" }); }; })(); components/listDiv/onScroll/fillTop/reachTop/isiOs/isiOs.ls (function(){ return function(){ if (/iPad|iPhone|iPod/.test(navigator.platform)) { return true; } else if (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) { return true; } else { return false; } }; })(); components/listDiv/onScroll/fillTop/reachTop/other/other.ls (function(){ return function(topRow, o){ o.contentDiv.css({ top: "-" + topRow.positionTop + "px", height: o.contentDiv.height() - o.topFix + "px" }); return o.div.scrollTop -= o.topFix; }; })(); components/listDiv/onScroll/fillTop/reachTop/reach.ls (function(){ return function(topRow, o){ o.info("reachTop"); o.reachedTop = true; o.topFix = topRow.positionTop; if (inc("isiOs/isiOs")()) { return inc("ios/ios")(topRow, o); } else { return inc("other/other")(topRow, o); } }; })(); components/listDiv/onScroll/manageJump/manage.ls (function(){ return function(o){ var delta, listPosition, deltaFaktor, deltaRowIndex, newRowIndex; if (!o.scrollTop) { return; } if (engine.isiOsApp) { return; } delta = o.div.scrollTop - o.scrollTop; if (Math.abs(delta) < o.div.offsetHeight * 3) { return; } o.info("jump delta px = " + delta); listPosition = o.getListPosition(); deltaFaktor = delta / o.div.scrollHeightCustom; deltaRowIndex = parseInt(o.data.length * deltaFaktor); newRowIndex = listPosition.rowIndex + deltaRowIndex; o.setListPosition({ rowIndex: newRowIndex, topOffset: 0 }); return true; }; })(); components/listDiv/onScroll/manageResize/manage.ls (function(){ return function(o){ var newWidth; if (!(o.div.isVisible() && o.div.offsetWidth > 0 && o.div.offsetHeight > 0)) { return; } newWidth = o.div.offsetWidth; o.lastWidth == null && (o.lastWidth = newWidth); if (newWidth !== o.lastWidth) { o.info("resize"); o.lastWidth = newWidth; o.repositionCurrentRows(); return true; } }; })(); components/listDiv/onScroll/onScroll.ls (function(){ return function(o, p){ var ref$; if (!o.hasStarted || !o.div.isVisible() || _.isEmpty(o.rowsByIndex) || inc("manageResize/manage")(o) || inc("manageJump/manage")(o)) { return; } if (!o.scrollTop || o.div.scrollTop === o.scrollTop) { inc("fillTop/fill")(o); inc("fillBottom/fill")(o); } else if (o.div.scrollTop > o.scrollTop) { inc("fillBottom/fill")(o); inc("cleanTop/clean")(o); } else if (o.div.scrollTop < o.scrollTop) { inc("fillTop/fill")(o); inc("cleanBottom/clean")(o); } inc("updateScrollbarCustom/update")(o); o.scrollTop = o.div.scrollTop; (ref$ = o.contentDiv).countScroll == null && (ref$.countScroll = 0); o.contentDiv.countScroll += 1; if (typeof p.onScroll == 'function') { p.onScroll(o); } inc("onTopVisibleRowChange/onChange")(p, o); if (o.debug) { return o.debugDiv.html(("top: " + o.topRowIndex + " bottom: " + o.bottomRowIndex + " ") + ("min: " + o.minRowIndex + " max: " + o.maxRowIndex + " ") + ("nearScopeSize: " + o.nearScopeSize)); } }; })(); components/listDiv/onScroll/onTopVisibleRowChange/onChange.ls (function(){ return function(p, o){ var lp, index, data; if (!p.onTopVisibleRowChange) { return; } lp = o.getListPosition(); index = lp.rowIndex; data = o.data[lp.rowIndex]; if (o.lastVisibleTopRowIndex === index) { return; } o.lastVisibleTopRowIndex = index; return p.onTopVisibleRowChange(index, data); }; })(); components/listDiv/onScroll/updateScrollbarCustom/update.ls (function(){ return function(o){ var minRow, maxRow, firstRowTop, maxIndex, lastRowBottom; minRow = o.rowsByIndex[o.minRowIndex]; maxRow = o.rowsByIndex[o.maxRowIndex]; if (!minRow || !maxRow) { return; } firstRowTop = o.minRowIndex === 0 ? minRow.positionTop : minRow.positionTop - o.minRowIndex * o.averageRowHeight; maxIndex = o.data.length - 1; lastRowBottom = o.maxRowIndex === maxIndex ? maxRow.positionTop + maxRow.positionHeight : maxRow.positionTop + maxRow.positionHeight + (maxIndex - o.maxRowIndex) * o.averageRowHeight; o.div.setScrollHeightCustom(lastRowBottom - firstRowTop); return o.div.setScrollTopCustom(o.div.scrollTop - firstRowTop + o.topFix); }; })(); components/listDiv/removeRow/remove.ls (function(){ return function(o, position){ var oldRow, maxRow, rowsByIndexNew, index, ref$, row, nextRow; o.data.splice(position, 1); if (o.data.length === 0) { o.setListPosition(null, true); return; } oldRow = o.rowsByIndex[position]; if (oldRow != null) { oldRow.remove(); } if (position < o.maxRowIndex && oldRow != null) { maxRow = o.rowsByIndex[o.maxRowIndex]; maxRow.positionTop -= oldRow.positionHeight; } if (position <= o.maxRowIndex) { o.maxRowIndex--; } rowsByIndexNew = {}; for (index in ref$ = o.rowsByIndex) { row = ref$[index]; if (row.rowIndex < position) { rowsByIndexNew[row.rowIndex] = row; } else if (row.rowIndex > position) { row.rowIndex--; rowsByIndexNew[row.rowIndex] = row; } } o.rowsByIndex = rowsByIndexNew; o.reachedBottom = false; o.contentDiv.css({ height: "1000000px" }); if (position >= o.topRowIndex && position <= o.bottomRowIndex) { o.info("removeRow " + position + " VISIBLE"); if (nextRow = o.rowsByIndex[position]) { nextRow.positionTop = oldRow.positionTop; nextRow.css({ top: oldRow.positionTop + "px" }); } o.bottomRowIndex -= 1; } else if (position > o.bottomRowIndex) { o.info("removeRow " + position + " BELOW"); } else if (position < o.topRowIndex && !o.reachedTop) { o.info("removeRow " + position + " ABOVE, reachedTop = false"); o.topRowIndex -= 1; o.bottomRowIndex -= 1; } else if (position < o.topRowIndex && o.reachedTop) { o.info("removeRow " + position + " ABOVE, reachedTop = true"); o.topRowIndex -= 1; o.bottomRowIndex -= 1; o.setListPosition(); } return o.repositionCurrentRows(); }; })(); components/listDiv/repositionCurrentRows/reposition.ls (function(){ return function(o){ var i$, to$, i; if (!o.hasStarted || o.topRowIndex == null || o.bottomRowIndex == null) { return; } for (i$ = o.topRowIndex, to$ = o.bottomRowIndex; i$ <= to$; ++i$) { i = i$; inc("repositionAfter/reposition")(o, i, i - 1); } return o.onScroll(); }; })(); components/listDiv/repositionCurrentRows/repositionAfter/reposition.ls (function(){ return function(o, index1, index2){ var div1, div2, maxRow, newHeight, dif, newPositionTop; div1 = o.rowsByIndex[index1]; div2 = o.rowsByIndex[index2]; maxRow = o.rowsByIndex[o.maxRowIndex]; newHeight = div1.offsetHeight; dif = newHeight - div1.positionHeight; if (dif !== 0) { div1.positionHeight = newHeight; if (o.reachedBottom) { o.contentDiv.css({ height: o.contentDiv.offsetHeight + dif + "px" }); } if (maxRow !== div1) { maxRow.positionTop += dif; } } if (index1 <= o.topRowIndex || index2 > o.bottomRowIndex) { return; } newPositionTop = _.round(div2.positionTop + div2.positionHeight); div1.css({ top: newPositionTop + "px" }); return div1.positionTop = newPositionTop; }; })(); components/listDiv/scrollRowIntoView/scroll.ls (function(){ return function(o, rowIndex, options){ var row; if (rowIndex < o.topRowIndex) { o.setListPosition({ rowIndex: rowIndex, topOffset: 0 }); } else if (rowIndex > o.bottomRowIndex) { o.setListPosition({ rowIndex: rowIndex, bottomOffset: 0 }); } row = o.rowsByIndex[rowIndex]; o.div.scrollElementIntoView(row, options); return row; }; })(); components/listDiv/setListPosition/createStartRow/create.ls (function(){ return function(o){ var startIndex, rowDiv, top; o.div.scrollTop = o.contentDiv.offsetHeight / 2; startIndex = o.listPosition.rowIndex; if (!(startIndex >= 0)) { startIndex = 0; o.listPosition = { rowIndex: startIndex, topOffset: 0 }; } else if (startIndex > o.data.length - 1) { startIndex = o.data.length - 1; o.listPosition.rowIndex = startIndex; } rowDiv = o.createRow(startIndex); top = o.listPosition.topOffset != null ? o.div.scrollTop + o.listPosition.topOffset : o.listPosition.bottomOffset != null ? o.div.scrollTop + o.div.offsetHeight - rowDiv.positionHeight - o.listPosition.bottomOffset : o.listPosition.centerOffset != null ? o.div.scrollTop + o.div.offsetHeight / 2 + o.listPosition.centerOffset - rowDiv.positionHeight / 2 : void 8; top = _.round(top); rowDiv.css({ top: top + "px" }); if (o.debug) { rowDiv.css({ background: "yellow" }); } rowDiv.positionTop = top; o.topRowIndex = startIndex; return o.bottomRowIndex = startIndex; }; })(); components/listDiv/setListPosition/set.ls (function(){ return function(listPosition, resetRows, o){ listPosition == null && (listPosition = o.getListPosition()); o.listPosition = listPosition; if (!o.hasStarted) { return; } o.div.scrollContainerDiv.css({ overflowY: "hidden" }); if (resetRows) { o.rowsByIndex = {}; } o.topFix = 0; o.reachedTop = false; o.reachedBottom = false; o.topRowIndex = null; o.bottomRowIndex = null; o.minRowIndex = null; o.maxRowIndex = null; o.scrollTop = null; o.contentDiv = inc("../contentDiv/contentDiv")(o); o.div.setScrollHeightCustom(null); o.div.setScrollTopCustom(null); if (o.data.length > 0) { inc("createStartRow/create")(o); } o.onScroll(); return inc("waitFrames/wait")(2, function(){ return o.div.scrollContainerDiv.css({ overflowY: "scroll" }); }); }; })(); components/listDiv/setListPosition/waitFrames/wait.ls (function(){ return function(totalFrames, callback){ var counter, f; counter = 0; f = function(){ return requestAnimationFrame(function(){ counter = counter + 1; if (counter === totalFrames) { return callback(); } else { return requestAnimationFrame(f); } }); }; return f(); }; })(); components/listDiv/updateRow/update.ls (function(){ return function(o, p){ var position, oldRow, newRow; position = p.position; if (o.data[p.position] == null) { throw Error("updateRow position doesn't exist"); } if (p.data) { o.data[p.position] = p.data; } if (o.data.length === 1) { o.setListPosition(void 8, true); return; } oldRow = o.rowsByIndex[position]; if (!oldRow) { o.info("updateRow " + position + " unrendered"); return; } oldRow.remove(); delete o.rowsByIndex[position]; if (o.rowsByIndex[position + 1]) { o.createRow(position, "before"); } else { o.createRow(position, "after"); } newRow = o.rowsByIndex[position]; if (newRow.positionHeight === oldRow.positionHeight) { return o.info("updateRow " + position + " no height change"); } else { o.reachedBottom = false; o.contentDiv.css({ height: "1000000px" }); o.repositionCurrentRows(); return o.info("updateRow " + position + " with height change"); } }; })(); components/overlayMenu/backgroundDiv/div.ls (function(){ return function(m){ var onContextMenu; onContextMenu = function(e){ return e.preventDefault(); }; return Div({ position: "fixed", left: 0, right: 0, top: 0, bottom: 0, zIndex: 100 }).addClass("overlayMenu mainMenu keyManagerScope").html(Div({ position: "absolute", top: 0, bottom: 0, width: "100%", backgroundColor: Color.grey[700] }).keyframeAnimate({ keyframes: { "0%": { opacity: 0 }, "100%": { opacity: 0.2 } }, duration: 300 }).tap({ up: function(){ return m.close(); }, animation: "none" }).css({ cursor: "default" }).css(m.params.cssBackgroundDiv)).onWindowResize(function(){ return m.close(); }).onDomAppend(function(){ body.bind("keydown", m.onKeyDown); body.bind("mousemove", m.onMouseMove); return body.bind("contextmenu", onContextMenu); }).onDomRemove(function(){ body.unbind("keydown", m.onKeyDown); body.unbind("mousemove", m.onMouseMove); return body.unbind("contextmenu", onContextMenu); }).appendTo(m.params.backgroundParentDiv || app.currentPage.pageWrapper); }; })(); components/overlayMenu/close/close.ls (function(){ return function(m){ return m.backgroundDiv.remove(); }; })(); components/overlayMenu/createMenuDiv/close/close.ls (function(){ return function(div, parentItemDiv){ div.closeSubmenu(); return setTimeout(function(){ return div.remove(); }); }; })(); components/overlayMenu/createMenuDiv/closeSubmenu/close.ls (function(){ return function(menuDiv){ var ref$; if ((ref$ = menuDiv.submenuDiv) != null) { ref$.close(); } menuDiv.submenuDiv = null; return menuDiv.setFocus(); }; })(); components/overlayMenu/createMenuDiv/cornerDiv/div.ls (function(){ return function(m, div, parentItemDiv){ if (parentItemDiv || !m.showCornerDiv || !m.params.referenceDiv) { return; } return div.cornerDiv = Div({ position: "absolute", top: "-0.4em", left: "0.3em", display: "flex", width: "18px", height: "18px" }).html(Div({ width: "11px", height: "11px", transform: "rotate(45deg)", backgroundColor: "white" }).css(m.params.cssCornerDiv)); }; })(); components/overlayMenu/createMenuDiv/create.ls (function(){ return function(m, items, parentItemDiv){ var div; items = _.compact(_.ensureArray(items)); div = Div({ display: "flex", flexDirection: "column", position: "absolute", backgroundColor: "white", textAlign: "left", maxHeight: m.params.maxHeight, filter: "drop-shadow(1px 1px 3px rgba(0, 0, 0, 0.4))" }).css(m.params.cssMenuDiv).addClass("menuDiv").appendTo(m.backgroundDiv); div.html(inc("cornerDiv/div")(m, div, parentItemDiv), inc("itemsDiv/div")(m, items, div)); div.parentItemDiv = parentItemDiv; div.items = items; div.setTopLeftMaxHeight = function(){ return inc("setTopLeftMaxHeight/set")(m, div, parentItemDiv); }; div.setFocus = function(){ return inc("setFocus/set")(m, div); }; div.close = function(){ return inc("close/close")(div, parentItemDiv); }; div.openSubmenu = function(itemDiv, items){ return inc("openSubmenu/open")(m, div, itemDiv, items); }; div.closeSubmenu = function(){ return inc("closeSubmenu/close")(div); }; div.hasSubmenu = function(){ return inc("hasSubmenu/has")(div); }; div.setTopLeftMaxHeight(); div.setFocus(); div.m = m; return div; }; })(); components/overlayMenu/createMenuDiv/hasSubmenu/has.ls (function(){ return function(div){ return div.submenuDiv != null; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/div.ls (function(){ return function(m, items, menuDiv){ var index, item; return menuDiv.itemsDiv = ScrollDiv().css({ flex: "0 1 auto", maxWidth: m.params.maxWidth }).css(m.params.cssItemsDiv).html((function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = items).length; i$ < len$; ++i$) { index = i$; item = ref$[i$]; results$.push(inc("itemDiv/div")(m, item, index, menuDiv)); } return results$; }())); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/calc.ls (function(){ return function(m, menuDiv){ var submenuDiv; submenuDiv = m.currentSubmenuDiv; if (!submenuDiv || submenuDiv === menuDiv || !m.lastMousePosition) { return false; } return inc("checkIntersection/check")(submenuDiv, m); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/calVectorMouse/calc.ls (function(){ return function(m){ var p1, p2, dx, dy, vMouse; p1 = m.lastMousePosition; p2 = m.currentMousePosition; dx = p2.x - p1.x; dy = p2.y - p1.y; return vMouse = [ { x: p1.x, y: p1.y }, { x: p1.x + dx * 1000000, y: p1.y + dy * 1000000 } ]; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/calcIntersection/calc.ls (function(){ return function(v1, v2){ var calc, p1, q1, p2, q2, o1, o2, o3, o4, isIntersecting; calc = inc("calcOrientation/calc"); p1 = v1[0]; q1 = v1[1]; p2 = v2[0]; q2 = v2[1]; o1 = calc(p1, q1, p2); o2 = calc(p1, q1, q2); o3 = calc(p2, q2, p1); o4 = calc(p2, q2, q1); return isIntersecting = o1 !== o2 && o3 !== o4; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/calcIntersection/calcOrientation/calc.ls (function(){ return function(p, q, r){ var val; val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); if (val === 0) { return 0; } if (val > 0) { return 1; } return 2; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/check.ls (function(){ return function(submenuDiv, m){ var o, vMouse, vTop, vBottom, vLeft, vRight, calc; o = submenuDiv.offset(); vMouse = inc("calVectorMouse/calc")(m); vTop = [ { x: o.left, y: o.top }, { x: o.right, y: o.top } ]; vBottom = [ { x: o.left, y: o.bottom }, { x: o.right, y: o.bottom } ]; vLeft = [ { x: o.left, y: o.top }, { x: o.left, y: o.bottom } ]; vRight = [ { x: o.right, y: o.top }, { x: o.right, y: o.bottom } ]; calc = inc("calcIntersection/calc"); return calc(vMouse, vTop) || calc(vMouse, vBottom) || calc(vMouse, vLeft) || calc(vMouse, vRight); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/div.ls (function(){ return function(item, index, menuDiv, m){ var div; div = Div({ display: "flex", padding: "0.6em", maxWidth: "90vw", lineHeight: "1.4em", whiteSpace: "pre-line", wordBreak: "break-word", backgroundColor: item.selected ? Color.grey[250] : void 8, borderTop: index > 0 ? "1px solid " + Color.grey[200] : void 8 }).html(inc("icon/icon")(item), inc("label/label")(item), inc("iconSubmenu/icon")(item)).addClass("itemDiv"); div.bind("mouseenter", function(){ return inc("onMouseEnter/on")(div, menuDiv, m); }); div.bind("mouseleave", function(){ return inc("onMouseLeave/on")(div, menuDiv, m); }); div.index = index; div.item = item; div.menuDiv = menuDiv; div.setFocus = function(){ return inc("setFocus/set")(div); }; div.removeFocus = function(){ return inc("removeFocus/remove")(div); }; div.hasFocus = function(){ return inc("hasFocus/has")(div); }; return div; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/hasFocus/has.ls (function(){ return function(div){ return div.findFirst(".focusDiv") != null; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/icon/icon.ls (function(){ return function(item){ var icon; icon = item.icon; if (!icon) { return; } if (_.isObject(icon)) { return icon; } if (_.isFunction(icon)) { return icon(); } return SvgIcon({ svg: icon, color: item.iconColor || Color.grey[600] }).css({ flex: "0 0 auto", marginRight: "0.4em" }); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/iconSubmenu/icon.ls (function(){ return function(item){ if (!item.items) { return; } return SvgIcon({ svg: path("svg/arrow-right-small.svg"), color: Color.grey[600], size: "0.6em" }).css({ marginLeft: "0.4em" }); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/iconSubmenu/svg/arrow-right-small.svg components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/label/label.ls (function(){ return function(item){ return Div({ flex: "1 1 auto" }).html(item.label); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/onMouseEnter/on.ls (function(){ return function(div, menuDiv, m){ var delay; div.mouseOver = true; if (div.onDelayedMouseEnter == null) { return; } delay = inc("../_calcMouseIsMovingToSubmenu/calc")(m, menuDiv) ? 250 : 0; return setTimeout(function(){ if (div.mouseOver) { return typeof div.onDelayedMouseEnter == 'function' ? div.onDelayedMouseEnter() : void 8; } }, delay); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/onMouseLeave/on.ls (function(){ return function(div, menuDiv, m){ var isMovingToSubmenu; div.mouseOver = false; if (div.onMouseLeave == null) { return; } isMovingToSubmenu = inc("../_calcMouseIsMovingToSubmenu/calc")(m, menuDiv); return div.onMouseLeave(isMovingToSubmenu); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/removeFocus/remove.ls (function(){ return function(div){ var ref$; return (ref$ = div.findFirst(".focusDiv")) != null ? ref$.remove() : void 8; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/setFocus/set.ls (function(){ return function(div){ var ref$; if ((ref$ = div.menuDiv.findFirst(".focusDiv")) != null) { ref$.remove(); } return div.prepend(Div({ position: "absolute", top: 0, left: 0, right: 0, bottom: 0, background: Color.grey[250], pointerEvents: "none" }).addClass("focusDiv")); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/customDiv/div.ls (function(){ return function(m, item, index, menuDiv){ var div; div = Div().html(item.div).addClass("itemDiv"); if (item.tap || item.click) { div.tap(function(){ return item.tap(item) || item.click(item); }); } div.item = item; div.menuDiv = menuDiv; return div; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/div.ls (function(){ return function(m, item, index, menuDiv){ var func; func = item.div ? inc("customDiv/div") : item.tap || item.click ? inc("tapDiv/div") : item.items ? inc("submenuDiv/div") : inc("otherDiv/div"); return func(m, item, index, menuDiv); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/otherDiv/div.ls (function(){ return function(m, item, index, menuDiv){ var div; return div = inc("../_itemDiv/div")(item, index, menuDiv, m).tap({ up: function(){}, animation: "none" }).css({ cursor: "default" }); }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/submenuDiv/div.ls (function(){ return function(m, item, index, menuDiv){ var div; div = inc("../_itemDiv/div")(item, index, menuDiv, m).tap(function(e){ if (!div.hasFocus()) { div.setFocus(); return menuDiv.openSubmenu(div, item.items); } else if (e.type !== "mouseup") { div.removeFocus(); return menuDiv.closeSubmenu(); } }); div.onDelayedMouseEnter = function(){ div.setFocus(); return menuDiv.openSubmenu(div, item.items); }; div.onMouseLeave = function(isMovingToSubmenu){ if (!isMovingToSubmenu) { div.removeFocus(); return menuDiv.closeSubmenu(); } }; return div; }; })(); components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/tapDiv/div.ls (function(){ return function(m, item, index, menuDiv){ var div; div = inc("../_itemDiv/div")(item, index, menuDiv, m).tap(function(){ m.close(); return (typeof item.tap == 'function' ? item.tap(item) : void 8) || (typeof item.click == 'function' ? item.click(item) : void 8); }); div.onDelayedMouseEnter = function(){ div.setFocus(); return menuDiv.closeSubmenu(); }; div.onMouseLeave = function(){ return div.removeFocus(); }; return div; }; })(); components/overlayMenu/createMenuDiv/openSubmenu/open.ls (function(){ return function(m, menuDiv, itemDiv, items){ itemDiv.setFocus(); menuDiv.closeSubmenu(); menuDiv.submenuDiv = m.createMenuDiv(items, itemDiv); return m.currentSubmenuDiv = menuDiv.submenuDiv; }; })(); components/overlayMenu/createMenuDiv/setFocus/set.ls (function(){ return function(m, div){ m.focusMenuDiv = div; return div; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/calcOverflow/calc.ls (function(){ return function(m, o1, o2, yDistance, minPadding){ var screenSize, bottom, overflow; screenSize = body.offset(); bottom = o1.top + o2.height + minPadding + yDistance; overflow = screenSize.bottom - bottom; if (overflow < 0) { return overflow; } return 0; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/getIsUpIsLeft/get.ls (function(){ return function(m, o1, o2, minPadding, yDistance, direction, isSubMenu){ var fitsUp, fitsDown, isUp, fitsLeft, fitsRight, isLeft, changedLeftRight; fitsUp = o2.height + minPadding + yDistance < o1.top; fitsDown = o1.top + o1.height + o2.height + minPadding + yDistance < body.offsetHeight; isUp = !fitsUp && !fitsDown ? o1.top > 0.5 * body.offsetHeight : (_.includes(direction, "up") && fitsUp) || (_.includes(direction, "down") && !fitsDown); fitsLeft = o2.width + minPadding < o1.left; fitsRight = !isSubMenu ? o1.left + o2.width + minPadding < body.offsetWidth : o1.left + o1.width + o2.width + minPadding < body.offsetWidth; isLeft = (_.includes(direction, "left") && fitsLeft) || (_.includes(direction, "right") && !fitsRight); changedLeftRight = (_.includes(direction, "right") && !fitsRight) || (_.includes(direction, "left") && !fitsLeft); return { isUp: isUp, isLeft: isLeft, fitsLeft: fitsLeft, fitsRight: fitsRight, changedLeftRight: changedLeftRight }; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/getMaxHeight/get.ls (function(){ return function(m, o2, yDistance, minPadding, isUp, isRootMenu){ var maxHeight, heightLimit, refDiv; maxHeight = 10000; heightLimit = body.offsetHeight; if (m.params.referenceDiv && isRootMenu) { refDiv = m.params.referenceDiv.offset(); heightLimit = isUp ? refDiv.top : body.offsetHeight - refDiv.bottom; } if (heightLimit < o2.height + yDistance + minPadding) { maxHeight = heightLimit - yDistance - minPadding; } if (m.originalMaxHeight < maxHeight) { maxHeight = m.originalMaxHeight; } return maxHeight; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/sharedVars/vars.ls (function(){ return function(m, menuDiv){ var a, ref$, adjustX, adjustY, yDistance, minPadding; a = ((ref$ = m.params.adjustXY) != null ? ref$.split(" ") : void 8) || []; adjustX = +a[0] || 0; adjustY = +a[1] || 0; yDistance = m.showCornerDiv && !m.params.referencePoint ? 12 + adjustY : 2; minPadding = 14; m.originalMaxHeight == null && (m.originalMaxHeight = +menuDiv.css("maxHeight").replace("px", "") || 10000); return { adjustX: adjustX, adjustY: adjustY, yDistance: yDistance, minPadding: minPadding }; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/set.ls (function(){ return function(m, menuDiv, isRootMenu){ var direction, ref$, o1, o2, ref1$, adjustX, adjustY, yDistance, minPadding, isUp, isLeft, fitsLeft, fitsRight, changedLeftRight; direction = (ref$ = m.params.direction) != null ? ref$ : "down right"; o1 = m.params.referencePoint ? { top: m.params.referencePoint.y, left: m.params.referencePoint.x, width: 0, height: 0 } : (ref$ = m.params.referenceDiv) != null ? ref$.offset() : void 8; o2 = menuDiv.offset(); ref1$ = inc("../_shared/sharedVars/vars")(m, menuDiv), adjustX = ref1$.adjustX, adjustY = ref1$.adjustY, yDistance = ref1$.yDistance, minPadding = ref1$.minPadding; ref1$ = inc("../_shared/getIsUpIsLeft/get")(m, o1, o2, minPadding, yDistance, direction), isUp = ref1$.isUp, isLeft = ref1$.isLeft, fitsLeft = ref1$.fitsLeft, fitsRight = ref1$.fitsRight, changedLeftRight = ref1$.changedLeftRight; if (m.params.referencePoint) { return inc("setForRefPoint/set")(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, direction, fitsLeft, fitsRight); } else { return inc("setForRefDiv/set")(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, isRootMenu, changedLeftRight); } }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/setForRefDiv/cornerDiv/set.ls (function(){ return function(m, menuDiv, isUp, isLeft){ var refDiv, o3, o4, ref$, leftC, middleRefDiv, topC, ref1$; refDiv = m.params.referenceDiv.offset(); o3 = menuDiv.offset(); o4 = (ref$ = menuDiv.cornerDiv) != null ? ref$.offset() : void 8; leftC = isLeft ? o3.width - (o4 != null ? o4.width : void 8) - 6 : 6; if ((!isLeft && o4.left < refDiv.left) || (isLeft && o3.right - 6 > refDiv.right)) { middleRefDiv = refDiv.left + refDiv.width / 2; leftC = middleRefDiv - menuDiv.offset().left - (o4 != null ? o4.width : void 8) / 2; } topC = isUp ? o3.height - 9 : -9; return (ref1$ = menuDiv.cornerDiv) != null ? ref1$.css({ left: leftC + "px", top: topC + "px" }) : void 8; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/setForRefDiv/set.ls (function(){ return function(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, isRootMenu, changedLeftRight){ var w1, w2, top, left, maxHeight; w1 = isUp ? "up" : "down"; w2 = isLeft ? "left" : "right"; m.subMenuDirection = w1 + " " + w2; top = isUp ? o1.top - o2.height - yDistance : o1.top + o1.height + yDistance; top = Math.max(top, minPadding); left = isLeft ? o1.left + o1.width - o2.width : o1.left; left = Math.max(left, minPadding); left = Math.min(left, body.offsetWidth - o2.width - minPadding); if (m.showCornerDiv && m.params.referencePoint != null) { left = isLeft ? left + 19 : left - 19; } maxHeight = inc("../../_shared/getMaxHeight/get")(m, o2, yDistance, minPadding, isUp, isRootMenu); if (changedLeftRight) { adjustX *= -1; } menuDiv.css({ top: top + "px", left: left + adjustX + "px", maxHeight: maxHeight + "px" }); if (m.showCornerDiv) { return inc("cornerDiv/set")(m, menuDiv, isUp, isLeft); } }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/setForRefPoint/set.ls (function(){ return function(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, direction, fitsLeft, fitsRight){ var overflow, maxHeight, top, left; overflow = inc("../../_shared/calcOverflow/calc")(m, o1, o2, yDistance, minPadding); maxHeight = inc("../../_shared/getMaxHeight/get")(m, o2, yDistance, minPadding); top = maxHeight !== 10000 ? minPadding : o1.top + overflow + yDistance; left = isLeft ? o1.left + o1.width - o2.width : o1.left + 3; if (!fitsLeft && !fitsRight) { left = (window.innerWidth - menuDiv.offsetWidth) / 2; } return menuDiv.css({ top: top + "px", left: left + adjustX + "px", maxHeight: maxHeight + "px" }); }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/set.ls (function(){ return function(m, div, parentItemDiv){ if (!parentItemDiv) { return inc("root/set")(m, div, true); } else { return inc("submenu/set")(m, div, parentItemDiv); } }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcLeft/calc.ls (function(){ return function(div, isLeft, fitsLeft, fitsRight, o1, o2, m){ var upDown, ref$, left; upDown = (ref$ = m.subMenuDirection.split(" ")[0]) != null ? ref$ : (ref$ = m.params.direction.split(" ")[0]) != null ? ref$ : "down"; if (!isLeft && !fitsRight) { left = o1.left - o2.width; m.subMenuDirection = upDown + " left"; } else if (isLeft && !fitsLeft) { left = o1.left + o1.width; m.subMenuDirection = upDown + " right"; } else if (isLeft) { left = o1.left - o2.width; m.subMenuDirection = upDown + " left"; } else if (!isLeft) { left = o1.left + o1.width; m.subMenuDirection = upDown + " right"; } return left; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcTop/calc.ls (function(){ return function(o1, o2, overflow, parentIndex, maxHeight, isUp, minPadding){ var ref$, top; if (maxHeight !== 10000) { ref$ = inc("calcTopWithMaxHeight/calc")(o1, isUp, maxHeight, minPadding), top = ref$.top, maxHeight = ref$.maxHeight; } else { top = inc("calcAdjustedTop/calc")(o1, o2, overflow, parentIndex); } return { top: top, maxHeight: maxHeight }; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcTop/calcAdjustedTop/calc.ls (function(){ return function(o1, o2, overflow, parentIndex){ var mod, adjustedOverflow, top; mod = Math.floor(overflow / o1.height); adjustedOverflow = mod * o1.height; if (overflow !== 0) { adjustedOverflow += o1.height; if (parentIndex === 0) { adjustedOverflow -= 2; } } top = o1.top + adjustedOverflow; if (top + o2.height > body.offset().bottom) { top -= o1.height; } return top; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcTop/calcTopWithMaxHeight/calc.ls (function(){ return function(o1, isUp, maxHeight, minPadding){ var mod, adjustY, top; mod = Math.floor(o1.top / o1.height); adjustY = isUp ? 6 : 3; top = o1.top - mod * o1.height - adjustY; if (body.offsetHeight < top + maxHeight) { maxHeight = body.offsetHeight - top - minPadding; } return { top: top, maxHeight: maxHeight }; }; })(); components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/set.ls (function(){ return function(m, div, parentItemDiv){ var ref$, o1, o2, adjustX, adjustY, yDistance, minPadding, isUp, isLeft, fitsRight, fitsLeft, overflow, maxHeight, top, left; m.subMenuDirection = (ref$ = m.subMenuDirection) != null ? ref$ : (ref$ = m.params.direction) != null ? ref$ : "down right"; o1 = parentItemDiv.offset(); o2 = div.offset(); ref$ = inc("../_shared/sharedVars/vars")(m, div), adjustX = ref$.adjustX, adjustY = ref$.adjustY, yDistance = ref$.yDistance, minPadding = ref$.minPadding; ref$ = inc("../_shared/getIsUpIsLeft/get")(m, o1, o2, minPadding, yDistance, m.subMenuDirection, true), isUp = ref$.isUp, isLeft = ref$.isLeft, fitsRight = ref$.fitsRight, fitsLeft = ref$.fitsLeft; overflow = inc("../_shared/calcOverflow/calc")(m, o1, o2, yDistance, minPadding); maxHeight = inc("../_shared/getMaxHeight/get")(m, o2, yDistance, minPadding, isUp); ref$ = inc("calcTop/calc")(o1, o2, overflow, parentItemDiv.index, maxHeight, isUp, minPadding), top = ref$.top, maxHeight = ref$.maxHeight; left = inc("calcLeft/calc")(div, isLeft, fitsLeft, fitsRight, o1, o2, m); return div.css({ top: top + "px", left: left + adjustX + "px", maxHeight: maxHeight + "px" }); }; })(); components/overlayMenu/menu.ls (function(){ return function(params){ var m, ref$, div; m = {}; m.params = params; m.showCornerDiv = (ref$ = params.showCornerDiv) != null ? ref$ : true; m.enableKeyboard = (ref$ = params.enableKeyboard) != null ? ref$ : true; m.lastMousePositions = []; m.focusMenuDiv = undefined; m.backgroundDiv = inc("backgroundDiv/div")(m); m.createMenuDiv = function(items, parentItemDiv){ return inc("createMenuDiv/create")(m, items, parentItemDiv); }; m.onKeyDown = function(e){ return inc("onKeyDown/on")(m, e); }; m.onMouseMove = function(e){ return inc("onMouseMove/on")(m, e); }; m.close = function(){ return inc("close/close")(m); }; m.createMenuDiv(m.params.items); div = m.backgroundDiv; div.close = m.close; return div; }; })(); components/overlayMenu/onKeyDown/on.ls (function(){ return function(m, e){ var ref$; if (!m.enableKeyboard) { return; } if (e.target.isDivEditable) { return; } if (e.key === "Escape") { e.preventDefault(); return inc("onEsc/on")(m); } else if (e.key === "Enter") { e.preventDefault(); return inc("onEnter/on")(m); } else if ((ref$ = e.key) === "ArrowUp" || ref$ === "ArrowDown") { e.preventDefault(); return inc("onUpOrDown/on")(m, e.key); } else if (e.key === "ArrowRight") { e.preventDefault(); return inc("onRight/on")(m); } else if (e.key === "ArrowLeft") { e.preventDefault(); return inc("onLeft/on")(m); } }; })(); components/overlayMenu/onKeyDown/onEnter/on.ls (function(){ return function(m){ var menuDiv, focusItemDiv, ref$, ref1$; menuDiv = m.focusMenuDiv; focusItemDiv = (ref$ = menuDiv.findFirst(".focusDiv")) != null ? ref$.parent() : void 8; if (!focusItemDiv) { return; } focusItemDiv.triggerTap(); if (!((ref1$ = menuDiv.submenuDiv) != null && ref1$.isVisible())) { menuDiv.openSubmenu(focusItemDiv, focusItemDiv.item.items); } return inc("../onUpOrDown/on")(m, "ArrowDown"); }; })(); components/overlayMenu/onKeyDown/onEsc/on.ls (function(){ return function(m){ return m.close(); }; })(); components/overlayMenu/onKeyDown/onLeft/on.ls (function(){ return function(m){ var menuDiv, parentItemDiv; menuDiv = m.focusMenuDiv; parentItemDiv = menuDiv.parentItemDiv; if (!parentItemDiv) { return; } menuDiv.close(); parentItemDiv.menuDiv.setFocus(); return parentItemDiv.setFocus(); }; })(); components/overlayMenu/onKeyDown/onRight/on.ls (function(){ return function(m){ var menuDiv, focusItemDiv, ref$; menuDiv = m.focusMenuDiv; focusItemDiv = (ref$ = menuDiv.findFirst(".focusDiv")) != null ? ref$.parent() : void 8; if (!focusItemDiv) { return inc("../onUpOrDown/on")(m, "ArrowDown"); } else if (focusItemDiv != null && focusItemDiv.item.items) { return inc("../onEnter/on")(m); } }; })(); components/overlayMenu/onKeyDown/onUpOrDown/calcNewItemDiv/calc.ls (function(){ return function(menuDiv, lastFocusItemDiv, key){ var itemDivs, lastIndex, that; itemDivs = menuDiv.itemsDiv.childrenAll(); itemDivs = _.filter(itemDivs, function(div){ var i; if (!div.hasClass("itemDiv")) { return false; } else { i = div.item; return i.items != null || i.tap != null || i.click != null; } }); lastIndex = _.indexOf(itemDivs, lastFocusItemDiv); if (key === "ArrowDown") { if (!lastFocusItemDiv) { return _.first(itemDivs); } else if (that = itemDivs[lastIndex + 1]) { return that; } else { return _.last(itemDivs); } } else if (key === "ArrowUp") { if (!lastFocusItemDiv) { return _.last(itemDivs); } else if (that = itemDivs[lastIndex - 1]) { return that; } else { return _.first(itemDivs); } } }; })(); components/overlayMenu/onKeyDown/onUpOrDown/on.ls (function(){ return function(m, key){ var menuDiv, lastFocusItemDiv, ref$, newItemDiv; menuDiv = m.focusMenuDiv; lastFocusItemDiv = (ref$ = menuDiv.findFirst(".focusDiv")) != null ? ref$.parent() : void 8; newItemDiv = inc("calcNewItemDiv/calc")(menuDiv, lastFocusItemDiv, key); return newItemDiv != null ? newItemDiv.setFocus() : void 8; }; })(); components/overlayMenu/onMouseMove/on.ls (function(){ return function(m, e){ m.lastMousePosition = m.currentMousePosition; return m.currentMousePosition = { x: e.clientX, y: e.clientY }; }; })(); components/scrollDiv/calcDefaultScrollBarMode/calc.ls (function(){ return function(){ var a, isDesktop, defaultScrollBarMode; a = navigator.userAgent.toLowerCase(); isDesktop = _.includes(a, "android") || _.includes(a, "ipad") || _.includes(a, "iphone") ? false : _.includes(a, "chrome") && _.includes(a, "linux") ? false : true; return defaultScrollBarMode = isDesktop ? "show" : "auto"; }; })(); components/scrollDiv/cssHeader/cssHeader.ls (function(){ return function(){ var style; if (document.head == null || document.head.findFirst('#scrollDivContainerStyles')) { return; } style = Style(); style.setAttribute("id", "scrollDivContainerStyles"); style.innerHTML = '\n .scrollDivContainer{\n -ms-overflow-style:none;\n }\n\n .scrollDivContainer::-webkit-scrollbar{\n display: none;\n }\n'; return document.head.append(style); }; })(); components/scrollDiv/functions/_shared/scrollTo/scrollTo.ls (function(){ return function(scrollDiv){ var scrollContainer, lastTime, onFrame, overflowX, overflowY; scrollDiv.initialScrollOffset = { left: scrollDiv.scrollContainer.scrollLeft, top: scrollDiv.scrollContainer.scrollTop }; if (scrollDiv.scrollFrameRunning) { return; } scrollDiv.scrollFrameRunning = true; scrollContainer = scrollDiv.scrollContainer; onFrame = function(timestamp){ var targetOffset, percentage, maxScroll, delta, ref$; if (!(targetOffset = scrollDiv.targetOffset)) { delete scrollDiv.scrollFrameRunning; return; } if (lastTime == null) { lastTime = timestamp; requestAnimationFrame(onFrame); return; } if (scrollDiv.preventAutoScroll) { scrollDiv.targetOffset = undefined; delete scrollDiv.scrollDuration; delete scrollDiv.currentScrollDuration; delete scrollDiv.scrollFrameRunning; delete scrollDiv.initialScrollOffset; return; } scrollDiv.currentScrollDuration += timestamp - lastTime; percentage = Math.min(1, scrollDiv.currentScrollDuration / scrollDiv.scrollDuration); percentage = Math.pow(percentage, 2) * (3 - 2 * percentage); lastTime = timestamp; maxScroll = { top: scrollContainer.scrollHeight - scrollContainer.offsetHeight, left: scrollContainer.scrollWidth - scrollContainer.offsetWidth }; if (targetOffset.top < 0) { targetOffset.top = 0; } else if (targetOffset.top + 1 > maxScroll.top) { targetOffset.top = maxScroll.top; } if (targetOffset.left < 0) { targetOffset.left = 0; } else if (targetOffset.left + 1 > maxScroll.left) { targetOffset.left = maxScroll.left; } delta = { x: targetOffset.left - scrollDiv.initialScrollOffset.left, y: targetOffset.top - scrollDiv.initialScrollOffset.top }; scrollContainer.scrollLeft = scrollDiv.initialScrollOffset.left + delta.x * percentage; scrollContainer.scrollTop = scrollDiv.initialScrollOffset.top + delta.y * percentage; if (percentage >= 1) { scrollContainer.scrollTop = targetOffset.top; scrollContainer.scrollLeft = targetOffset.left; scrollDiv.targetOffset = undefined; delete scrollDiv.scrollDuration; delete scrollDiv.currentScrollDuration; delete scrollDiv.scrollFrameRunning; return ref$ = scrollDiv.initialScrollOffset, delete scrollDiv.initialScrollOffset, ref$; } else { return requestAnimationFrame(onFrame); } }; scrollDiv.updateScrollDiv(); overflowX = scrollDiv.scrollContainer.css("overflowX"); overflowY = scrollDiv.scrollContainer.css("overflowY"); scrollDiv.scrollContainer.css({ overflowX: "hidden", overflowY: "hidden" }); return requestAnimationFrame(function(){ var currentOverflowX, currentOverflowY; currentOverflowX = scrollContainer.css("overflowX"); currentOverflowY = scrollContainer.css("overflowY"); if (currentOverflowX === "hidden") { scrollContainer.css({ overflowX: overflowX }); } if (currentOverflowY === "hidden") { scrollContainer.css({ overflowY: overflowY }); } return onFrame(); }); }; })(); components/scrollDiv/functions/fitSizeToContent/fit.ls (function(){ return function(div){ return function(axis){ if (axis === "horizontal") { div.css({ width: div.content.offsetWidth + "px" }); return div.scrollBars.horizontal.update(); } else if (axis === "vertical") { div.css({ height: div.content.offsetHeight + "px" }); return div.scrollBars.vertical.update(); } else { div.css({ height: div.content.offsetHeight + "px", width: div.content.offsetWidth + "px" }); div.scrollBars.horizontal.update(); return div.scrollBars.vertical.update(); } }; }; })(); components/scrollDiv/functions/scrollBarMode/scrollBarMode.ls (function(){ return function(div, scrollBarMode){ return function(mode){ var ref$; if (!mode) { return scrollBarMode; } if (_.isString(mode)) { scrollBarMode.horizontal = mode; scrollBarMode.vertical = mode; } else { scrollBarMode.horizontal = (ref$ = mode.horizontal) != null ? ref$ : scrollBarMode != null ? scrollBarMode.horizontal : void 8; scrollBarMode.vertical = (ref$ = mode.vertical) != null ? ref$ : scrollBarMode != null ? scrollBarMode.vertical : void 8; } div.scrollBars.horizontal.setMode(scrollBarMode.horizontal); div.scrollBars.vertical.setMode(scrollBarMode.vertical); return div; }; }; })(); components/scrollDiv/functions/scrollElementIntoView/calcOffset/calc.ls (function(){ return function(scrollDiv, el, options){ var padding, center, top, contentContainer, scrollContainer, scrollbarInsets, scrollContainerHeight, scrollContainerWidth, calcElementOffset, elementOffset, viewportOverflowY, viewportOverflowX, paddingV, skipScrollV, scrollTop, paddingH, x1, skipScrollH, scrollLeft; padding = (options != null ? options.padding : void 8) || 5; center = (options != null ? options.center : void 8) || false; top = (options != null ? options.top : void 8) || false; contentContainer = scrollDiv.content; scrollContainer = scrollDiv.scrollContainer; scrollbarInsets = { bottom: scrollDiv.scrollBars.vertical.isVisible() ? scrollDiv.offsetHeight - scrollDiv.scrollBars.vertical.offsetTop - scrollDiv.scrollBars.vertical.offsetHeight : scrollDiv.scrollBars.horizontal.isVisible() ? scrollDiv.offsetHeight - scrollDiv.scrollBars.horizontal.offsetTop - scrollDiv.scrollBars.horizontal.offsetHeight : 0, right: scrollDiv.scrollBars.vertical.isVisible() ? scrollDiv.offsetWidth - scrollDiv.scrollBars.vertical.offsetLeft - scrollDiv.scrollBars.vertical.offsetWidth : scrollDiv.scrollBars.horizontal.isVisible() ? scrollDiv.offsetWidth - scrollDiv.scrollBars.horizontal.offsetWidth - scrollDiv.scrollBars.horizontal.offsetWidth : 0, left: scrollDiv.scrollBars.horizontal.isVisible() ? scrollDiv.scrollBars.horizontal.offsetLeft : 0, top: scrollDiv.scrollBars.vertical.isVisible() ? scrollDiv.scrollBars.vertical.offsetTop : 0 }; scrollContainerHeight = scrollDiv.offsetHeight - scrollbarInsets.bottom - scrollbarInsets.top; scrollContainerWidth = scrollDiv.offsetWidth - scrollbarInsets.right - scrollbarInsets.left; calcElementOffset = function(element){ var offset; offset = { width: element.offsetWidth, height: element.offsetHeight, top: 0, left: 0 }; while (element != null && element !== scrollDiv) { offset.top += element.offsetTop; offset.left += element.offsetLeft; element = element.offsetParent; } return offset; }; elementOffset = calcElementOffset(el); if (!center && elementOffset.height + 1 > scrollContainerHeight) { viewportOverflowY = true; } if (!center && elementOffset.width + 1 > scrollContainerWidth) { viewportOverflowX = true; } paddingV = padding; if (center) { paddingV = (scrollContainerHeight - elementOffset.height) / 2; } else { if (top || viewportOverflowY || scrollContainer.scrollTop > elementOffset.top - paddingV - scrollbarInsets.top) {} else if (scrollContainer.scrollTop < elementOffset.top - scrollContainerHeight - scrollbarInsets.top + paddingV + elementOffset.height) { paddingV = scrollContainerHeight - paddingV - elementOffset.height; } else { skipScrollV = true; } } if (!skipScrollV) { scrollTop = elementOffset.top - paddingV - scrollbarInsets.top; } else { scrollTop = scrollContainer.scrollTop; } paddingH = padding; x1 = elementOffset.left; if (center) { paddingH = (scrollContainerWidth - elementOffset.width) / 2; } else { if (viewportOverflowX || scrollContainer.scrollLeft > x1 - paddingH - scrollbarInsets.left) {} else if (scrollContainer.scrollLeft < x1 - scrollContainerWidth - scrollbarInsets.left + paddingH + elementOffset.width) { paddingH = scrollContainerWidth - paddingH - elementOffset.width; } else { skipScrollH = true; } } if (!skipScrollH) { scrollLeft = x1 - paddingH - scrollbarInsets.left; } else { scrollLeft = scrollContainer.scrollLeft; } return { top: _.round(scrollTop, 1), left: _.round(scrollLeft, 1) }; }; })(); components/scrollDiv/functions/scrollElementIntoView/scroll.ls (function(){ return function(div){ var scrollContainer; scrollContainer = div.scrollContainer; return function(element, options){ var scroll; scroll = function(){ var targetOffset, isCurrentTarget, ref$; targetOffset = include("calcOffset/calc")(div, element, options); isCurrentTarget = _.isEqual(targetOffset, div.targetOffset); div.targetOffset = targetOffset; if (options != null && options.instant) { scrollContainer.scrollTop = div.targetOffset.top; return scrollContainer.scrollLeft = div.targetOffset.left; } else if (isCurrentTarget && div.scrollFrameRunning) {} else { div.scrollDuration = (ref$ = options != null ? options.duration : void 8) != null ? ref$ : 300; div.currentScrollDuration = 0; return include("../_shared/scrollTo/scrollTo")(div); } }; return requestAnimationFrame(function(){ if (div.content.contains(element)) { return scroll(); } }); }; }; })(); components/scrollDiv/functions/scrollToPosition/scroll.ls (function(){ return function(div){ var scrollContainer; scrollContainer = div.scrollContainer; return function(targetOffset, options){ var scroll; scroll = function(){ var ref$, isCurrentTarget; targetOffset = { top: (ref$ = targetOffset.top) != null ? ref$ : scrollContainer.scrollTop, left: (ref$ = targetOffset.left) != null ? ref$ : scrollContainer.scrollLeft }; isCurrentTarget = _.isEqual(targetOffset, div.targetOffset); div.targetOffset = targetOffset; if (options != null && options.instant) { scrollContainer.scrollTop = div.targetOffset.top; return scrollContainer.scrollLeft = div.targetOffset.left; } else { if (isCurrentTarget && div.scrollFrameRunning) { return; } div.scrollDuration = (ref$ = options != null ? options.duration : void 8) != null ? ref$ : 300; div.currentScrollDuration = 0; return include("../_shared/scrollTo/scrollTo")(div); } }; return requestAnimationFrame(function(){ return scroll(); }); }; }; })(); components/scrollDiv/functions/scrollToTop/scroll.ls (function(){ return function(div){ var scrollContainer; scrollContainer = div.scrollContainer; return function(options){ var scroll; scroll = function(){ var targetOffset, isCurrentTarget, ref$; targetOffset = { top: 0, left: scrollContainer.scrollLeft }; isCurrentTarget = _.isEqual(targetOffset, div.targetOffset); div.targetOffset = targetOffset; if (options != null && options.instant) { scrollContainer.scrollTop = div.targetOffset.top; return scrollContainer.scrollLeft = div.targetOffset.left; } else { if (isCurrentTarget && div.scrollFrameRunning) { return; } div.scrollDuration = (ref$ = options != null ? options.duration : void 8) != null ? ref$ : 300; div.currentScrollDuration = 0; return include("../_shared/scrollTo/scrollTo")(div); } }; return requestAnimationFrame(function(){ return scroll(); }); }; }; })(); components/scrollDiv/functions/setScrollBarMargins/set.ls (function(){ return function(div, initialMargins){ var lastScrollBarMargins, setMargins; lastScrollBarMargins = initialMargins; setMargins = function(margins, force){ var ref$; if (!force && _.isEqual(margins, lastScrollBarMargins)) { return; } lastScrollBarMargins = margins; div.scrollBars.vertical.css({ marginTop: (ref$ = margins.top) != null ? ref$ : "", marginBottom: (ref$ = margins.bottom) != null ? ref$ : "", marginRight: (ref$ = margins.right) != null ? ref$ : "" }); div.scrollBars.horizontal.css({ marginBottom: (ref$ = margins.bottom) != null ? ref$ : "", marginLeft: (ref$ = margins.left) != null ? ref$ : "", marginRight: (ref$ = margins.right) != null ? ref$ : "" }); }; setMargins(lastScrollBarMargins, true); return setMargins; }; })(); components/scrollDiv/functions/setScrollEnabled/set.ls (function(){ return function(div, scrollEnabled, scrollBarMode){ return function(options){ var ref$, x, y; scrollEnabled.horizontal = _.isBoolean(options) ? options : (ref$ = options != null ? options.horizontal : void 8) != null ? ref$ : scrollEnabled.horizontal; scrollEnabled.vertical = _.isBoolean(options) ? options : (ref$ = options != null ? options.vertical : void 8) != null ? ref$ : scrollEnabled.vertical; if (scrollEnabled.horizontal) { x = "scroll"; div.scrollBars.horizontal.setMode(scrollBarMode.horizontal); } else { x = "hidden"; div.scrollBars.horizontal.setMode("hide"); } if (scrollEnabled.vertical) { y = "scroll"; div.scrollBars.vertical.setMode(scrollBarMode.vertical); } else { y = "hidden"; div.scrollBars.vertical.setMode("hide"); } div.scrollContainer.css({ overflowX: x, overflowY: y }); return div.content.css({ width: !scrollEnabled.horizontal ? "100%" : "", height: !scrollEnabled.vertical ? "100%" : "", paddingRight: "30px", paddingBottom: "30px" }); }; }; })(); components/scrollDiv/onScroll/calcNeedsUpdate/calc.ls (function(){ return function(div){ var lastValues, calc; lastValues = { scrollTop: 0, scrollLeft: 0, scrollHeight: 0, scrollWidth: 0, offsetHeight: 0, offsetWidth: 0 }; div.lastValues = lastValues; return calc = function(){ var needsUpdate, n, v; needsUpdate = false; for (n in lastValues) { v = div[n]; if (v !== lastValues[n]) { needsUpdate = true; lastValues[n] = v; } } return needsUpdate; }; }; })(); components/scrollDiv/onScroll/onScroll.ls (function(){ return function(div, onScroll, scrollBarMode){ var needsUpdate, scopeRender, update, resize, modified, scroll; needsUpdate = include("calcNeedsUpdate/calc")(div); scopeRender = include("scopeRender/render"); update = function(forceUpdate){ if (!needsUpdate() && !forceUpdate) { return; } if (typeof onScroll == 'function') { onScroll(); } if (scrollBarMode.horizontal !== "hide") { div.scrollBars.horizontal.update(); } if (scrollBarMode.vertical !== "hide") { div.scrollBars.vertical.update(); } return scopeRender(div); }; div.updateScrollDiv = function(){ return update(true); }; resize = function(){ return requestAnimationFrame(function(){ return requestAnimationFrame(update); }); }; modified = function(e){ if (e == null || e.target === div.scrollContainer) { return requestAnimationFrame(update); } }; scroll = function(e){ if (e == null || e.target === div.scrollContainer) { inc("../scrollBackFix/update/update")(div); return update(); } }; div.scrollContainer.onWindowResize(resize); div.scrollContainer.onChildrenModified(modified); div.scrollContainer.onDomRemove(function(){ return body.unbind("scroll", scroll, true, true); }); return div.scrollContainer.onDomAppend(function(){ body.bind("scroll", scroll, true, true); return update(); }); }; })(); components/scrollDiv/onScroll/scopeRender/calcOffsetAndDistance/calc.ls (function(){ return function(elements, scrollContainer){ var scopeCenter, i$, len$, el; scopeCenter = { x: scrollContainer.scrollLeft + scrollContainer.offsetWidth / 2, y: scrollContainer.scrollTop + scrollContainer.offsetHeight / 2 }; for (i$ = 0, len$ = elements.length; i$ < len$; ++i$) { el = elements[i$]; el.offsetInScrollContainer = include("calcOffset/calc")(el, scrollContainer); el.scopeDistance = Math.pow(el.offsetInScrollContainer.top - scopeCenter.y, 2) + Math.pow(el.offsetInScrollContainer.left - scopeCenter.x, 2); } return elements; }; })(); components/scrollDiv/onScroll/scopeRender/calcOffsetAndDistance/calcOffset/calc.ls (function(){ return function(el, scrollContainer){ var top, left; top = 0; left = 0; while (el !== scrollContainer) { top += el.offsetTop; left += el.offsetLeft; el = el.parentNode; } return { top: top, left: left }; }; })(); components/scrollDiv/onScroll/scopeRender/render.ls (function(){ return function(div){ var scrollContainer, ref$, o, ref1$, render; scrollContainer = div.scrollContainer; if (!((ref$ = div.scopeRender) != null && ref$.enabled)) { return; } o = div.scopeRender; o.maxDurations == null && (o.maxDurations = "50 20 10"); o.maxDurationFirstFrameScope == null && (o.maxDurationFirstFrameScope = o.maxDurations.split(" ")[0]); o.maxDurationPerFrameScope == null && (o.maxDurationPerFrameScope = o.maxDurations.split(" ")[1]); o.maxDurationPerFrameNearScope == null && (o.maxDurationPerFrameNearScope = o.maxDurations.split(" ")[2]); o.nearScopeSize == null && (o.nearScopeSize = 0.5); o.maxDurationScope == null && (o.maxDurationScope = (ref1$ = o.maxDurationFirstFrameScope) != null ? ref1$ : o.maxDurationScope); render = function(){ var elements, containerHeight, containerWidth, countNearScope, renderPass, renderPassNearScope; if (!scrollContainer.isVisible()) { scrollContainer.scopeRenderWaiting = false; return; } elements = scrollContainer.getElementsByClassName("onScopeRender"); if (elements.length === 0) { scrollContainer.scopeRenderWaiting = false; return; } elements = include("calcOffsetAndDistance/calc")(elements, scrollContainer); elements = _.orderBy(elements, "scopeDistance", "asc"); containerHeight = scrollContainer.offsetHeight; containerWidth = scrollContainer.offsetWidth; countNearScope = -1; renderPass = include("renderElements/render")({ elements: elements, topLimit: 0, bottomLimit: containerHeight, leftLimit: 0, rightLimit: containerWidth, scrollContainer: scrollContainer, maxDuration: o.maxDurationScope }); if (renderPass.count === 0) { renderPassNearScope = include("renderElements/render")({ elements: elements, topLimit: -containerHeight * o.nearScopeSize, bottomLimit: containerHeight * (1 + o.nearScopeSize), leftLimit: -containerWidth * o.nearScopeSize, rightLimit: containerWidth * (1 + o.nearScopeSize), scrollContainer: scrollContainer, maxDuration: o.maxDurationPerFrameNearScope }); } if (o.debug) { if (renderPass.count > 0) { debug("scope " + renderPass.count + " in " + renderPass.duration + "ms (max=" + o.maxDurationScope + "ms)"); } else if (renderPassNearScope.count > 0) { debug("nearScope " + renderPassNearScope.count + " in " + renderPassNearScope.duration + "ms (max=" + o.maxDurationPerFrameNearScope + "ms)"); } } if (renderPass.count > 0) { o.maxDurationScope = o.maxDurationPerFrameScope; } if (renderPass.count <= 0 && renderPassNearScope.count <= 0) { return scrollContainer.scopeRenderWaiting = false; } else if (o.renderSlow) { scrollContainer.scopeRenderWaiting = true; return setTimeout(render, 500); } else { scrollContainer.scopeRenderWaiting = true; return requestAnimationFrame(render); } }; return render(); }; })(); components/scrollDiv/onScroll/scopeRender/renderElements/render.ls (function(){ return function(o){ var startedAt, count, duration, i$, ref$, len$, el, offsetTop, offsetLeft; startedAt = new Date(); count = 0; duration = 0; for (i$ = 0, len$ = (ref$ = o.elements).length; i$ < len$; ++i$) { el = ref$[i$]; offsetTop = el.offsetInScrollContainer.top - o.scrollContainer.scrollTop; if (offsetTop + el.offsetHeight < o.topLimit || offsetTop > o.bottomLimit) { continue; } offsetLeft = el.offsetInScrollContainer.left - o.scrollContainer.scrollLeft; if (offsetLeft + el.offsetWidth < o.leftLimit || offsetLeft > o.rightLimit) { continue; } el.removeClass("onScopeRender"); el.onScopeRenderHandler(); count++; duration = new Date() - startedAt; if (duration > o.maxDuration) { break; } } return { count: count, duration: duration }; }; })(); components/scrollDiv/overwriteProperties/defineProperty/define.ls (function(){ return function(div, p, v){ return Object.defineProperty(div, p, { configurable: true, enumerable: true, get: v.get, set: v.set }); }; })(); components/scrollDiv/overwriteProperties/overwrite.ls (function(){ return function(div){ var properties, p, v, results$ = []; properties = { "append": { get: function(){ return function(){ div.content.append(arguments); return this; }; } }, "prepend": { get: function(){ return function(){ div.content.prepend(arguments); return this; }; } }, "html": { get: function(){ return function(){ div.content.html(arguments); return this; }; } }, "secureHtml": { get: function(){ return function(){ div.content.secureHtml(arguments); return this; }; } }, "text": { get: function(){ return function(){ div.content.text(arguments); return this; }; } }, "empty": { get: function(){ return function(){ div.content.empty(arguments); return this; }; } }, "scrollTop": { get: function(){ return div.scrollContainer.scrollTop; }, set: function(value){ div.scrollContainer.scrollTop = value; if (div.enableScrollBackFix) { div.lastValues.scrollTop = value; return div.updateScrollDiv(); } } }, "scrollHeight": { get: function(){ return div.scrollContainer.scrollHeight; } }, "scrollLeft": { get: function(){ return div.scrollContainer.scrollLeft; }, set: function(value){ return div.scrollContainer.scrollLeft = value; } }, "scrollWidth": { get: function(){ return div.scrollContainer.scrollWidth; } }, "childrenAll": { get: function(){ return function(){ return div.content.childrenAll(); }; } } }; for (p in properties) { v = properties[p]; results$.push(include("defineProperty/define")(div, p, v)); } return results$; }; })(); components/scrollDiv/scrollBackFix/reset/reset.ls (function(){ return function(div){ div.scrollBackFix = 0; div.content.css({ borderBottom: div.scrollBackFix + "px solid transparent" }); return div.lastValues.scrollTop = div.scrollTop; }; })(); components/scrollDiv/scrollBackFix/update/update.ls (function(){ return function(div){ var dif, d, fix; if (!div.enableScrollBackFix) { return; } if (div.lastValues.scrollTop > div.scrollTop && (div.scrollHeight !== div.lastValues.scrollHeight || div.offsetHeight !== div.lastValues.offsetHeight)) { dif = div.lastValues.scrollTop - div.scrollTop; div.scrollBackFix == null && (div.scrollBackFix = 0); div.scrollBackFix += dif; div.content.css({ borderBottom: div.scrollBackFix + "px solid transparent" }); return div.scrollContainer.scrollTop = div.lastValues.scrollTop; } else if (div.scrollBackFix > 0) { d = div.scrollContainer; d = d.scrollHeight - (d.scrollTop + d.offsetHeight); if (d <= 0) { return; } fix = div.scrollBackFix - d; fix = Math.max(0, fix); div.scrollBackFix = fix; fix = Math.ceil(fix); return div.content.css({ borderBottom: fix + "px solid transparent" }); } }; })(); components/scrollDiv/scrollBars/scrollBar/background/background.ls (function(){ return function(o){ var div; div = Div().addClass("scrollBar").css({ pointerEvents: "none" }).css({ position: "absolute", top: o.orientation === "vertical" ? 0 : void 8, left: o.orientation !== "vertical" ? 0 : void 8, bottom: 0, right: 0, width: o.orientation === "vertical" ? "0.7em" : void 8, height: o.orientation !== "vertical" ? "0.7em" : void 8, zIndex: 2 }); return o.background = div; }; })(); components/scrollDiv/scrollBars/scrollBar/bar/bar.ls (function(){ return function(o){ var updateThickness, div, div2; updateThickness = function(){ var w; w = body.width(); w = w < 500 ? "0.25em" : w < 800 ? "0.3em" : "0.35em"; return div2.css({ width: o.orientation === "vertical" ? w : void 8, height: o.orientation !== "vertical" ? w : void 8 }); }; div = Div().addClass("scrollDiv_bar").css({ position: "absolute", cursor: "pointer", willChange: "transform", pointerEvents: !engine.isMobileApp ? "auto" : void 8, top: o.orientation === "vertical" ? 0 : void 8, right: o.orientation === "vertical" ? 0 : void 8, bottom: o.orientation !== "vertical" ? 0 : void 8, left: o.orientation !== "vertical" ? 0 : void 8, width: o.orientation === "vertical" ? "100%" : void 8, height: o.orientation !== "vertical" ? "100%" : void 8 }).append(div2 = Div().css({ position: "absolute", height: o.orientation === "vertical" ? "100%" : "0.2em", width: o.orientation === "vertical" ? "0.2em" : "100%", backgroundColor: Color.grey[700], right: o.orientation === "vertical" ? 0 : void 8, left: o.orientation !== "vertical" ? 0 : void 8, top: o.orientation === "vertical" ? 0 : void 8, bottom: o.orientation !== "vertical" ? 0 : void 8, borderRadius: "0.1em", opacity: 0.3 })).appendTo(o.background).onWindowResize(updateThickness); updateThickness(); if (o.mode === "hide") { div.hide(); } return o.bar = div; }; })(); components/scrollDiv/scrollBars/scrollBar/drag/drag.ls (function(){ return function(o){ var x, y, onDrag, mouseDown, mouseMove, mouseUp; x = null; y = null; onDrag = function(delta){ var scrollContainer, scrollDimension, ref$, dimension, backgroundDimension, handlerDimension; if (delta === 0) { return; } scrollContainer = o.div.scrollContainer; if (o.orientation === "vertical") { scrollDimension = (ref$ = o.div.scrollHeightCustom) != null ? ref$ : scrollContainer.scrollHeight; dimension = o.div.offsetHeight; backgroundDimension = o.background.offsetHeight; } else { scrollDimension = scrollContainer.scrollWidth; dimension = o.div.offsetWidth; backgroundDimension = o.background.offsetWidth; } handlerDimension = dimension / scrollDimension * dimension; delta = delta * dimension / handlerDimension; delta = delta * dimension / backgroundDimension; if (o.orientation === "vertical") { return scrollContainer.scrollTop += delta; } else { return scrollContainer.scrollLeft += delta; } }; mouseDown = function(e){ x = e.clientX; y = e.clientY; body.bind("mousemove", mouseMove); return body.bind("mouseup", mouseUp); }; mouseMove = function(e){ var dy, dx; e.stopPropagation(); e.preventDefault(); if (o.orientation === "vertical") { dy = e.clientY - y; y = e.clientY; return onDrag(dy); } else { dx = e.clientX - x; x = e.clientX; return onDrag(dx); } }; mouseUp = function(e){ body.unbind("mousemove", mouseMove); return body.unbind("mouseup", mouseUp); }; return o.bar.bind("mousedown", mouseDown); }; })(); components/scrollDiv/scrollBars/scrollBar/onFrame/onFrameHorizontal.ls (function(){ return function(o){ var lastBarWidth, lastBarLeft, minWidth, hideTimeOut, onHideTimeout, onFrame; lastBarWidth = null; lastBarLeft = null; minWidth = 20; hideTimeOut = null; onHideTimeout = function(){ var hideTimeOut; o.bar.fadeOut(); return hideTimeOut = null; }; onFrame = function(){ var wrapperWidth, contentWidth, scrollLeft, barWidth, barLeft, isScrollable, w, x; wrapperWidth = o.div.scrollContainer.offsetWidth; contentWidth = o.div.scrollContainer.scrollWidth; scrollLeft = o.div.scrollContainer.scrollLeft; barWidth = wrapperWidth / contentWidth * wrapperWidth; barLeft = scrollLeft / contentWidth * wrapperWidth; barWidth = _.round(barWidth); barLeft = _.round(barLeft); if (barWidth < minWidth) { barLeft -= (minWidth - barWidth) * (scrollLeft / (contentWidth - wrapperWidth)); barWidth = minWidth; } isScrollable = contentWidth - 2 > wrapperWidth; o.div.isScrollable.horizontal = isScrollable; o.div.scrollContainer.css({ overflowX: isScrollable && o.scrollEnabled ? "scroll" : "hidden" }); if (!isScrollable || o.mode === "hide") { return o.bar.hide(); } else { o.bar.show(); if (o.mode === "auto") { clearTimeout(hideTimeOut); hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay); } if (barWidth !== lastBarWidth) { lastBarWidth = barWidth; w = barWidth / wrapperWidth * o.background.offsetWidth; o.bar.css({ width: w + "px" }); } if (barLeft !== lastBarLeft) { lastBarLeft = barLeft; x = barLeft / wrapperWidth * o.background.offsetWidth; return o.bar.css({ transform: "translateX(" + x + "px)" }); } } }; if (o.mode === "auto") { hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay); } return onFrame; }; })(); components/scrollDiv/scrollBars/scrollBar/onFrame/onFrameVertical.ls (function(){ return function(o){ var lastBarHeight, lastBarTop, minHeight, hideTimeOut, onHideTimeout, onFrame; lastBarHeight = null; lastBarTop = null; minHeight = 20; hideTimeOut = null; onHideTimeout = function(){ var hideTimeOut; o.bar.fadeOut(); return hideTimeOut = null; }; onFrame = function(){ var wrapperHeight, ref$, contentHeight, scrollTop, barHeight, barTop, isScrollable, h, y; wrapperHeight = (ref$ = o.div.scrollWrapperHeight) != null ? ref$ : o.div.scrollContainer.offsetHeight; contentHeight = (ref$ = o.div.scrollHeightCustom) != null ? ref$ : o.div.scrollContainer.scrollHeight; scrollTop = (ref$ = o.div.scrollTopCustom) != null ? ref$ : o.div.scrollContainer.scrollTop; barHeight = wrapperHeight / contentHeight * wrapperHeight; barTop = scrollTop / contentHeight * wrapperHeight; barHeight = _.round(barHeight); barTop = _.round(barTop); if (barHeight < minHeight) { barTop -= (minHeight - barHeight) * (scrollTop / (contentHeight - wrapperHeight)); barHeight = minHeight; } isScrollable = contentHeight - 2 > wrapperHeight; o.div.isScrollable.vertical = isScrollable; o.div.scrollContainer.css({ overflowY: isScrollable && o.scrollEnabled ? "scroll" : "hidden" }); if (!isScrollable || o.mode === "hide") { return o.bar.hide(); } else { o.bar.show(); if (o.mode === "auto") { clearTimeout(hideTimeOut); hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay); } if (barHeight !== lastBarHeight) { lastBarHeight = barHeight; h = barHeight / wrapperHeight * o.background.offsetHeight; o.bar.css({ height: h + "px" }); } if (barTop !== lastBarTop) { lastBarTop = barTop; y = barTop / wrapperHeight * o.background.offsetHeight; return o.bar.css({ transform: "translateY(" + y + "px)" }); } } }; if (o.mode === "auto") { hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay); } return onFrame; }; })(); components/scrollDiv/scrollBars/scrollBar/scrollBar.ls (function(){ return function(div, orientation, mode, scrollEnabled){ var o, update; o = { div: div, orientation: orientation, mode: mode, fadeOutDelay: 2000, scrollEnabled: scrollEnabled }; include("background/background")(o); include("bar/bar")(o); update = o.orientation === "vertical" ? include("onFrame/onFrameVertical")(o) : include("onFrame/onFrameHorizontal")(o); include("drag/drag")(o); o.background.setMode = function(mode){ o.mode = mode; if (mode === "hide") { return o.bar.hide(); } else if (mode === "show") { return o.bar.show(); } }; o.background.update = function(){ return update(); }; return o.background; }; })(); components/scrollDiv/scrollBars/scrollBars.ls (function(){ return function(div, scrollBarMode, scrollEnabled){ var scrollbars; scrollbars = { vertical: include("scrollBar/scrollBar")(div, "vertical", scrollBarMode.vertical, scrollEnabled.vertical), horizontal: include("scrollBar/scrollBar")(div, "horizontal", scrollBarMode.horizontal, scrollEnabled.horizontal) }; return scrollbars; }; })(); components/scrollDiv/scrollDiv.ls (function(){ return function(o){ var scrollEnabled, ref$, ref1$, ref2$, scrollBarMargins, defaultScrollBarMode, scrollBarMode, ref3$, ref4$, div; return inc("../scrollDivNext/scrollDivNext")(o); o == null && (o = {}); include("cssHeader/cssHeader")(); scrollEnabled = { horizontal: (ref$ = o.enableHorizontalScroll) != null ? ref$ : (ref$ = (ref1$ = o.enableScroll) != null ? ref1$.horizontal : void 8) != null ? ref$ : (ref$ = o.enableScroll) != null ? ref$ : true, vertical: (ref$ = o.enableVerticalScroll) != null ? ref$ : (ref$ = (ref2$ = o.enableScroll) != null ? ref2$.vertical : void 8) != null ? ref$ : (ref$ = o.enableScroll) != null ? ref$ : true }; scrollBarMargins = o.scrollBarMargins; scrollBarMargins == null && (scrollBarMargins = { left: 0, top: 0, bottom: 0, right: 0 }); defaultScrollBarMode = include("calcDefaultScrollBarMode/calc")(); scrollBarMode = { horizontal: scrollEnabled.horizontal ? (ref$ = (ref3$ = o.scrollBarMode) != null ? ref3$.horizontal : void 8) != null ? ref$ : (ref$ = o.scrollBarMode) != null ? ref$ : defaultScrollBarMode : "hide", vertical: scrollEnabled.vertical ? (ref$ = (ref4$ = o.scrollBarMode) != null ? ref4$.vertical : void 8) != null ? ref$ : (ref$ = o.scrollBarMode) != null ? ref$ : defaultScrollBarMode : "hide" }; div = Div().addClass("scrollDiv"); div.css({ overflow: "hidden", display: "flex", flexDirection: "column", alignItems: "stretch", justifyContent: "flex-start" }).append(div.scrollContainer = Div().addClass("scrollDivContainer").css({ flex: "1 1 auto", marginBottom: "-30px", marginRight: "-30px", overflowX: scrollEnabled.horizontal ? "scroll" : "hidden", overflowY: scrollEnabled.vertical ? "scroll" : "hidden", webkitOverflowScrolling: "touch" }).append(div.content = Div().css({ paddingRight: "30px", paddingBottom: "30px", minWidth: "100%", minHeight: "100%", width: !scrollEnabled.horizontal ? "calc(100% - 30px)" : void 8, height: !scrollEnabled.vertical ? "calc(100% - 10px)" : void 8, float: "left" }))).bind("touchstart mousedown", function(){ return div.preventAutoScroll = true; }, true, true).bind("touchend touchcancel mouseup mousecancel", function(){ return div.preventAutoScroll = false; }, true, true).bind("mousewheel", function(){ div.preventAutoScroll = true; return setTimeout(function(){ return div.preventAutoScroll = false; }, 500); }, true, true); div.isScrollable = { horizontal: false, vertical: false }; div.scrollBars = include("scrollBars/scrollBars")(div, scrollBarMode, scrollEnabled); div.scopeRender = o.scopeRender; div.enableScrollBackFix = o.enableScrollBackFix || false; div.append(_.values(div.scrollBars)); include("onScroll/onScroll")(div, o.onScroll, scrollBarMode); include("overwriteProperties/overwrite")(div); div.setScrollBarMargins = include("functions/setScrollBarMargins/set")(div, scrollBarMargins); div.setScrollEnabled = include("functions/setScrollEnabled/set")(div, scrollEnabled, scrollBarMode); div.scrollBarMode = include("functions/scrollBarMode/scrollBarMode")(div, scrollBarMode); div.fitSizeToContent = include("functions/fitSizeToContent/fit")(div); div.scrollElementIntoView = include("functions/scrollElementIntoView/scroll")(div); div.scrollToTop = include("functions/scrollToTop/scroll")(div); div.scrollToPosition = include("functions/scrollToPosition/scroll")(div); div.resetScrollBackFix = function(){ return inc("scrollBackFix/reset/reset")(div); }; div.updateScrollBackFix = function(){ return inc("scrollBackFix/update/update")(div); }; return div; }; })(); components/scrollDivNext/div/_overwriteProperties/overwrite.ls (function(){ return function(div, s){ var props, p, v, results$ = []; div.cssOriginal = div.css; props = { html: { get: function(){ return function(){ s.contentDiv.html(arguments); return this; }; } }, append: { get: function(){ return function(){ s.contentDiv.append(arguments); return this; }; } }, prepend: { get: function(){ return function(){ s.contentDiv.prepend(arguments); return this; }; } }, secureHtml: { get: function(){ return function(){ s.contentDiv.secureHtml(arguments); return this; }; } }, text: { get: function(){ return function(){ s.contentDiv.text(arguments); return this; }; } }, empty: { get: function(){ return function(){ s.contentDiv.empty(arguments); return this; }; } }, childrenAll: { get: function(){ return function(){ return s.contentDiv.childrenAll(); }; } }, css: { get: function(){ return function(css){ var p, v, cssProperty; if (_.isString(css)) { return div.cssOriginal(css); } for (p in css) { v = css[p]; cssProperty = {}; cssProperty[p] = v; if (_.includes(p, "overflow")) { throw Error("dont use overflow css in ScrollDiv!"); } else if (_.includes(p, "padding")) { s.contentDiv.css(cssProperty); } else { div.cssOriginal(cssProperty); } } return this; }; } }, scrollHeight: { get: function(){ return s.scrollContainerDiv.scrollHeight; } }, scrollWidth: { get: function(){ return s.scrollContainerDiv.scrollWidth; } }, scrollTop: { get: function(){ return s.scrollContainerDiv.scrollTop; }, set: function(v){ return s.scrollContainerDiv.scrollTop = v; } }, scrollLeft: { get: function(){ return s.scrollContainerDiv.scrollLeft; }, set: function(v){ return s.scrollContainerDiv.scrollLeft = v; } } }; for (p in props) { v = props[p]; results$.push(Object.defineProperty(div, p, { configurable: true, enumerable: true, get: v.get, set: v.set })); } return results$; }; })(); components/scrollDivNext/div/centerSpacer/spacer.ls (function(){ return function(){ return Div({ flex: "1 1 auto" }).addClass("centerSpacer").hide(); }; })(); components/scrollDivNext/div/contentDiv/div.ls (function(){ return function(s){ var div; div = Div({ minWidth: "100%", minHeight: "100%", borderRight: "", borderBottom: "", maxWidth: "" }); return s.contentDiv = div; }; })(); components/scrollDivNext/div/cropDiv/div.ls (function(){ return function(s){ var div; div = Div({ flex: "1 1 auto", alignSelf: "stretch", display: "flex", flexDirection: "column", justifyContent: "flex-start", alignItems: "stretch", overflow: "hidden" }); inc("neverScroll/never")(div); return s.cropDiv = div; }; })(); components/scrollDivNext/div/cropDiv/neverScroll/never.ls (function(){ return function(div){ return div.bind("scroll", function(){ div.scrollTop = 0; return div.scrollLeft = 0; }); }; })(); components/scrollDivNext/div/div.ls (function(){ return function(s){ var div; div = Div({ display: "flex", flexDirection: "column", justifyContent: "flex-start", alignItems: "stretch", overflow: "hidden" }).addClass("scrollDiv").html(inc("resizeDetectionObject/object")(s, "outside"), inc("cropDiv/div")(s).html(inc("scrollContainerDiv/div")(s).html(inc("centerSpacer/spacer")(), s.contentOutsideDiv = Div({ minHeight: "100%", minWidth: "100%", maxWidth: "100%", overflow: "hidden", display: "flex", flexDirection: "column", alignItems: "flex-start", justifyContent: "flex-start" }).html(inc("resizeDetectionObject/object")(s, "inside"), inc("contentDiv/div")(s)), inc("centerSpacer/spacer")()))); inc("_overwriteProperties/overwrite")(div, s); return s.div = div; }; })(); components/scrollDivNext/div/resizeDetectionObject/object.ls (function(){ return function(s, type){ var onResize, obj; onResize = function(e){ return s.onResize(type, e); }; return obj = document.createElement("object").attr({ type: "text/html", data: "about:blank" }).css({ position: "absolute", top: 0, left: 0, width: "100%", height: "100%", visibility: "hidden" }).bind("load", function(){ var e; onResize("onLoaded"); try { return obj.contentWindow.addEventListener("resize", onResize); } catch (e$) { e = e$; try { return obj.contentDocument.addEventListener("resize", onResize); } catch (e$) {} } }); }; })(); components/scrollDivNext/div/scrollContainerDiv/cssHeader/cssHeader.ls (function(){ return function(){ var s; if (document.head == null || document.head.findFirst('#scrollContainerDivStyle')) { return; } s = Style().attr({ id: "scrollContainerDivStyle" }); s.innerHTML = ".scrollContainerDiv::-webkit-scrollbar{display: none;}"; return document.head.append(s); }; })(); components/scrollDivNext/div/scrollContainerDiv/div.ls (function(){ var isOldSafari; isOldSafari = inc("isSafari_iOs13_or_less/is")(); return function(s){ var div; inc("cssHeader/cssHeader")(); div = Div({ flex: "1 1 auto", alignSelf: "stretch", display: "flex", flexDirection: "column", alignItems: "flex-start", justifyContent: "flex-start", minWidth: "100%", minHeight: "100%", overflow: "", marginRight: "", marginBottom: "" }).css(isOldSafari ? { webkitOverflowScrolling: "touch" } : void 8).addClass("scrollContainerDiv").onWindowResize(function(){ return s.refresh(); }).onDomAppend(function(){ return s.refresh(); }).bind("scroll", function(e){ return s.onScroll(e); }); inc("onChildrenModified/on")(s, div); return s.scrollContainerDiv = div; }; })(); components/scrollDivNext/div/scrollContainerDiv/isSafari_iOs13_or_less/is.ls (function(){ return function(){ var version, mVersion; version = navigator.userAgent.match(/Version\/(\d+)\.(\d+)\.?(\d+)?/); mVersion = version != null ? version[1] : void 8; return mVersion && +mVersion <= 13; }; })(); components/scrollDivNext/div/scrollContainerDiv/onChildrenModified/on.ls (function(){ return function(s, div){ var onMutations, observer, config; if (div.mutationObserver) { div.mutationObserver.disconnect(); } onMutations = function(mutationRecords){ var i$, len$, mutation, onScopeRenderElements, results$ = []; for (i$ = 0, len$ = mutationRecords.length; i$ < len$; ++i$) { mutation = mutationRecords[i$]; onScopeRenderElements = mutation.target.querySelectorAll('.onScopeRender'); if (onScopeRenderElements.length !== 0) { results$.push(s.refresh()); } } return results$; }; observer = new MutationObserver(onMutations); config = { childList: true, subtree: true, attributes: false, characterData: false }; observer.observe(div, config); return div.mutationObserver = observer; }; })(); components/scrollDivNext/isScrollable/is.ls (function(){ return function(s, type){ var wrapperWidth, contentWidth, wrapperHeight, contentHeight; if (type === "x") { wrapperWidth = s.scrollContainerDiv.offsetWidth; contentWidth = s.scrollContainerDiv.scrollWidth; return wrapperWidth < contentWidth; } else if (type === "y") { wrapperHeight = s.scrollContainerDiv.offsetHeight; contentHeight = s.scrollContainerDiv.scrollHeight; return wrapperHeight < contentHeight; } }; })(); components/scrollDivNext/onResize/on.ls (function(){ return function(s, type, e){ var ref$; s.refresh(); return typeof (ref$ = s.params).onResize == 'function' ? ref$.onResize(type, e) : void 8; }; })(); components/scrollDivNext/onScroll/on.ls (function(){ return function(s, e){ var ref$; s.refresh(e); return typeof (ref$ = s.params).onScroll == 'function' ? ref$.onScroll() : void 8; }; })(); components/scrollDivNext/refresh/hideMinScrollRange/x/hide.ls (function(){ return function(s){ var sc, range; sc = s.scrollContainerDiv; range = sc.scrollWidth - sc.offsetWidth; if (range <= s.minScrollRangeX) { sc.css({ overflowX: "hidden" }); s.scrollbarX.hide(); } else { sc.css({ overflowX: "scroll" }); s.scrollbarX.show(); } }; })(); components/scrollDivNext/refresh/hideMinScrollRange/y/hide.ls (function(){ return function(s){ var sc, range; sc = s.scrollContainerDiv; range = sc.scrollHeight - sc.offsetHeight; if (range <= s.minScrollRangeY) { sc.css({ overflowY: "hidden" }); s.scrollbarY.hide(); } else { sc.css({ overflowY: "scroll" }); s.scrollbarY.show(); } }; })(); components/scrollDivNext/refresh/refresh.ls (function(){ return function(s, scrollEvent){ inc("scrollBackStop/stop")(s); inc("scopeRender/render")(s); if (s.enableScrollY) { inc("hideMinScrollRange/y/hide")(s); inc("setScrollbarAutoHide/set")(s, scrollEvent, s.scrollbarY); s.scrollbarY.update(); } if (s.enableScrollX) { inc("hideMinScrollRange/x/hide")(s); inc("setScrollbarAutoHide/set")(s, scrollEvent, s.scrollbarX); s.scrollbarX.update(); } }; })(); components/scrollDivNext/refresh/scopeRender/render.ls (function(){ return function(s){ var ref$; if (!((ref$ = s.scopeRender) != null && ref$.enabled) || s.scopeRenderIsBusy) { return; } inc("render/render")(s); }; })(); components/scrollDivNext/refresh/scopeRender/render/debugMessage/debug.ls (function(){ return function(s, rInScope, rNearScope){ var m; m = ""; if (rInScope.count > 0) { m += "rendering " + rInScope.count + " in scope in " + rInScope.duration + "ms (max=" + rInScope.maxDuration + "ms)"; } else if (rNearScope.count > 0) { m += "rendering " + rNearScope.count + " in near scope in " + rNearScope.duration + "ms (max=" + rNearScope.maxDuration + "ms)"; } if (!s.scopeRenderIsBusy) { m += "all done"; } return debug(m); }; })(); components/scrollDivNext/refresh/scopeRender/render/getParams/get.ls (function(){ return function(s){ var that, sc, a, ref$, ref1$; if (that = s.scopeRender.params) { return that; } sc = s.scopeRender; a = (ref$ = (ref1$ = sc.maxDurations) != null ? ref1$.split(" ") : void 8) != null ? ref$ : []; return sc.params = { nearScopeSize: (ref$ = sc.nearScopeSize) != null ? ref$ : 0.5, debug: (ref$ = sc.debug) != null ? ref$ : false, maxDurationFirstFrameScope: (ref$ = a[0]) != null ? ref$ : 50, maxDurationPerFrameScope: (ref$ = a[1]) != null ? ref$ : 20, maxDurationPerFrameNearScope: (ref$ = a[2]) != null ? ref$ : 10 }; }; })(); components/scrollDivNext/refresh/scopeRender/render/getPendingElementsSortedByDistance/get.ls (function(){ return function(s){ var sc, elements; sc = s.scrollContainerDiv; elements = sc.getElementsByClassName("onScopeRender"); if (elements.length === 0) { return []; } return elements = inc("sortByDistance/sort")(elements, sc); }; })(); components/scrollDivNext/refresh/scopeRender/render/getPendingElementsSortedByDistance/sortByDistance/calcElementOffset/calc.ls (function(){ return function(el, scrollContainer){ var top, left; top = 0; left = 0; while (el !== scrollContainer) { top += el.offsetTop; left += el.offsetLeft; el = el.parentNode; } return { top: top, left: left }; }; })(); components/scrollDivNext/refresh/scopeRender/render/getPendingElementsSortedByDistance/sortByDistance/sort.ls (function(){ return function(elements, sc){ var scopeCenter, i$, len$, el; scopeCenter = { x: sc.scrollLeft + sc.offsetWidth / 2, y: sc.scrollTop + sc.offsetHeight / 2 }; for (i$ = 0, len$ = elements.length; i$ < len$; ++i$) { el = elements[i$]; el.offsetInScrollContainer = include("calcElementOffset/calc")(el, sc); el.scopeDistance = Math.pow(el.offsetInScrollContainer.top - scopeCenter.y, 2) + Math.pow(el.offsetInScrollContainer.left - scopeCenter.x, 2); } return _.orderBy(elements, "scopeDistance", "asc"); }; })(); components/scrollDivNext/refresh/scopeRender/render/render.ls (function(){ return function(s){ var sc, cd, params, elements, resultInScope, resultNearScope; sc = s.scrollContainerDiv; cd = s.cropDiv; params = inc("getParams/get")(s); elements = inc("getPendingElementsSortedByDistance/get")(s); if (elements.length === 0 || !sc.isVisible()) { s.scopeRenderIsBusy = false; return; } resultInScope = include("renderElements/render")({ elements: elements, topLimit: 0, bottomLimit: cd.offsetHeight, leftLimit: 0, rightLimit: cd.offsetWidth, scrollContainer: sc, maxDuration: s.scopeRenderIsBusy != null && !s.scopeRenderIsBusy ? params.maxDurationFirstFrameScope : params.maxDurationPerFrameScope }); s.scopeRenderIsBusy = true; if (resultInScope.count === 0) { resultNearScope = include("renderElements/render")({ elements: elements, topLimit: -cd.offsetHeight * params.nearScopeSize, bottomLimit: cd.offsetHeight * (1 + params.nearScopeSize), leftLimit: -cd.offsetWidth * params.nearScopeSize, rightLimit: cd.offsetWidth * (1 + params.nearScopeSize), scrollContainer: sc, maxDuration: params.maxDurationPerFrameNearScope }); } if ((resultInScope != null ? resultInScope.count : void 8) > 0 || (resultNearScope != null ? resultNearScope.count : void 8) > 0) { requestAnimationFrame(function(){ return inc(THISFILE)(s); }); } else { s.scopeRenderIsBusy = false; } if (params.debug) { inc("debugMessage/debug")(s, resultInScope, resultNearScope); } }; })(); components/scrollDivNext/refresh/scopeRender/render/renderElements/isInScope/is.ls (function(){ return function(el, renderObj){ var offsetTop, offsetLeft; offsetTop = el.offsetInScrollContainer.top - renderObj.scrollContainer.scrollTop; if (offsetTop + el.offsetHeight < renderObj.topLimit || offsetTop > renderObj.bottomLimit) { return false; } offsetLeft = el.offsetInScrollContainer.left - renderObj.scrollContainer.scrollLeft; if (offsetLeft + el.offsetWidth < renderObj.leftLimit || offsetLeft > renderObj.rightLimit) { return false; } return true; }; })(); components/scrollDivNext/refresh/scopeRender/render/renderElements/render.ls (function(){ return function(renderObj){ var startedAt, count, duration, i$, ref$, len$, el; startedAt = new Date(); count = 0; duration = 0; for (i$ = 0, len$ = (ref$ = renderObj.elements).length; i$ < len$; ++i$) { el = ref$[i$]; if (!inc("isInScope/is")(el, renderObj)) { continue; } el.removeClass("onScopeRender"); el.onScopeRenderHandler(); count++; duration = new Date() - startedAt; if (duration > renderObj.maxDuration) { break; } } return { count: count, duration: duration, maxDuration: renderObj.maxDuration }; }; })(); components/scrollDivNext/refresh/scrollBackStop/calcCompensation/calc.ls (function(){ return function(s, sc){ var comp; comp = sc.lastValues.scrollTop - sc.scrollTop; sc.scrollBackComp == null && (sc.scrollBackComp = 0); sc.scrollBackComp += comp; s.contentDiv.css({ borderBottom: sc.scrollBackComp + "px solid transparent" }); sc.scrollTop = sc.lastValues.scrollTop; }; })(); components/scrollDivNext/refresh/scrollBackStop/reset/reset.ls (function(){ return function(s){ var sc; sc = s.scrollContainerDiv; s.contentDiv.css({ borderBottom: 0 + "px solid transparent" }); sc.scrollBackStop = 0; sc.lastValues.scrollTop = sc.scrollTop; s.refresh(); }; })(); components/scrollDivNext/refresh/scrollBackStop/stop.ls (function(){ return function(s){ var sc, ref$, ref1$, ref2$; if (!s.enableScrollBackStop) { return; } sc = s.scrollContainerDiv; if (((ref$ = sc.lastValues) != null ? ref$.scrollTop : void 8) > sc.scrollTop && (sc.scrollHeight !== ((ref1$ = sc.lastValues) != null ? ref1$.scrollHeight : void 8) || sc.offsetHeight !== ((ref2$ = sc.lastValues) != null ? ref2$.offsetHeight : void 8))) { inc("calcCompensation/calc")(s, sc); } else if (sc.scrollBackComp > 0) { inc("updateCompensation/update")(s, sc); } sc.lastValues = { scrollTop: sc.scrollTop, scrollLeft: sc.scrollLeft, scrollHeight: sc.scrollHeight, scrollWidth: sc.scrollWidth, offsetHeight: sc.offsetHeight, offsetWidth: sc.offsetWidth }; }; })(); components/scrollDivNext/refresh/scrollBackStop/updateCompensation/update.ls (function(){ return function(s, sc){ var dif, comp; dif = sc.scrollHeight - (sc.scrollTop + sc.offsetHeight); if (dif <= 0) { return; } comp = sc.scrollBackComp - dif; sc.scrollBackComp = comp >= 0 ? Math.ceil(comp) : 0; s.contentDiv.css({ borderBottom: sc.scrollBackComp + "px solid transparent" }); }; })(); components/scrollDivNext/refresh/setScrollbarAutoHide/set.ls (function(){ return function(s, scrollEvent, div){ if (s.scrollbarMode === "show") { div.css({ opacity: 1, transition: "" }); clearTimeout(div.autoTimeout); return; } if (div.scrollEventCounter == null) { div.css({ opacity: 0 }); div.scrollEventCounter = 0; return; } if (!scrollEvent) { return; } if (div.scrollEventCounter <= 2) { div.scrollEventCounter++; return; } div.css({ opacity: 1, transition: "" }); clearTimeout(div.autoTimeout); if (!s.fadeInScrollbarOnHover) { div.firstChild.css({ pointerEvents: "auto" }); } if (!div.hoverEnabled && !div.dragEnabled) { div.autoTimeout = setTimeout(function(){ if (!s.fadeInScrollbarOnHover) { div.firstChild.css({ pointerEvents: "none" }); } return div.customFadeOut(); }, 2000); } }; })(); components/scrollDivNext/scrollDivNext.ls (function(){ return function(params){ var s, p, ref$, div, a, i$, len$, n; s = {}; p = params != null ? params : {}; s.params = p; s.enableScrollX = (ref$ = p.enableScrollX) != null ? ref$ : false; s.enableScrollY = (ref$ = p.enableScrollY) != null ? ref$ : true; s.enableScrollDiagonal = (ref$ = p.enableScrollDiagonal) != null ? ref$ : false; s.minScrollRangeY = (ref$ = p.minScrollRangeY) != null ? ref$ : 0; s.minScrollRangeX = (ref$ = p.minScrollRangeX) != null ? ref$ : 0; s.scrollbarMode = (ref$ = p.scrollbarMode) != null ? ref$ : "auto"; s.scrollbarMargins = (ref$ = p.scrollbarMargins) != null ? ref$ : null; s.hideInitAutoScrollbar = (ref$ = p.hideInitAutoScrollbar) != null ? ref$ : false; s.scopeRender = (ref$ = p.scopeRender) != null ? ref$ : {}; s.enableScrollBackStop = (ref$ = p.enableScrollBackStop) != null ? ref$ : false; s.preventAutoScroll = (ref$ = p.preventAutoScroll) != null ? ref$ : false; s.centerContent = (ref$ = p.centerContent) != null ? ref$ : false; s.enlargeScrollbarOnHover = (ref$ = p.enlargeScrollbarOnHover) != null ? ref$ : true; s.fadeInScrollbarOnHover = (ref$ = p.fadeInScrollbarOnHover) != null ? ref$ : true; s.div = inc("div/div")(s); s.scrollbarY = inc("scrollbar/y/scrollbar")(s); s.scrollbarX = inc("scrollbar/x/scrollbar")(s); s.refresh = function(e){ return inc("refresh/refresh")(s, e); }; s.onScroll = function(e){ return inc("onScroll/on")(s, e); }; s.onResize = function(type, e){ return inc("onResize/on")(s, type, e); }; s.setEnableScrollY = function(enabled){ return inc("setEnableScroll/y/set")(s, enabled); }; s.setEnableScrollX = function(enabled){ return inc("setEnableScroll/x/set")(s, enabled); }; s.setEnableScrollDiagonal = function(enabled){ return inc("setEnableScrollDiagonal/set")(s, enabled); }; s.setScrollbarMode = function(mode){ return inc("setScrollbarMode/set")(s, mode); }; s.setScrollbarMargins = function(margins){ return inc("setScrollbarMargins/set")(s, margins); }; s.setCenterContent = function(enable){ return inc("setCenterContent/set")(s, enable); }; s.isScrollableX = function(){ return inc("isScrollable/is")(s, "x"); }; s.isScrollableY = function(){ return inc("isScrollable/is")(s, "y"); }; s.resetScrollBackStop = function(){ return inc("refresh/scrollBackStop/reset/reset")(s); }; s.setScrollTopCustom = function(scrollTop){ return inc("setScrollTopCustom/set")(s, scrollTop); }; s.setScrollHeightCustom = function(scrollHeight){ return inc("setScrollHeightCustom/set")(s, scrollHeight); }; s.scrollElementIntoView = function(div, params){ return inc("scrollElementIntoView/scroll")(s, div, params); }; s.scrollToTop = function(params){ return inc("scrollTo/scroll")(s, 0, params); }; s.scrollToPosition = function(position, params){ return inc("scrollTo/scroll")(s, position, params); }; s.setScopeRender = function(params){ return inc("setScopeRender/set")(s, params); }; s.setEnableScrollX(s.enableScrollX); s.setEnableScrollY(s.enableScrollY); s.setEnableScrollDiagonal(s.enableScrollDiagonal); s.setScrollbarMargins(s.scrollbarMargins); s.setCenterContent(s.centerContent); div = s.div; div.s = s; a = "setEnableScrollX setEnableScrollY setEnableScrollDiagonal setScrollbarMode setScrollbarMargins setScopeRender scrollElementIntoView scrollToTop scrollToPosition isScrollableX isScrollableY resetScrollBackStop setCenterContent setScrollTopCustom setScrollHeightCustom contentDiv scrollContainerDiv "; for (i$ = 0, len$ = (ref$ = a.split(" ")).length; i$ < len$; ++i$) { n = ref$[i$]; div[n] = s[n]; } return div; }; })(); components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calc.ls (function(){ return function(s, el, params){ var ref$, sc, elementOffset, scrollTop, scrollLeft; params == null && (params = {}); params = { padding: (ref$ = params.padding) != null ? ref$ : 5, center: (ref$ = params.center) != null ? ref$ : false, top: (ref$ = params.top) != null ? ref$ : false, bottom: (ref$ = params.bottom) != null ? ref$ : false, left: (ref$ = params.left) != null ? ref$ : false, right: (ref$ = params.right) != null ? ref$ : false }; sc = s.scrollContainerDiv; elementOffset = inc("calcElementOffset/calc")(el, sc); scrollTop = inc("calcScrollTop/calc")(s, sc, elementOffset, params); scrollLeft = inc("calcScrollLeft/calc")(s, sc, elementOffset, params); return { top: _.round(scrollTop, 1), left: _.round(scrollLeft, 1) }; }; })(); components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcElementOffset/calc.ls (function(){ return function(el, sc){ var o; o = { width: el.offsetWidth, height: el.offsetHeight, top: 0, left: 0 }; while (el !== sc) { o.top += el.offsetTop; o.left += el.offsetLeft; el = el.parentNode; } return o; }; })(); components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcScrollLeft/calc.ls (function(){ return function(s, sc, elOffset, params){ var paddingIsntPossible, t, that, padding, pLeft, pRight; paddingIsntPossible = s.cropDiv.offsetWidth - 1 < elOffset.width + params.padding * 2; if (params.center === true || paddingIsntPossible) { t = elOffset.left + elOffset.width / 2; t -= s.cropDiv.offsetWidth / 2; return t; } else if (params.left === true) { return elOffset.left; } else if (params.right === true) { t = elOffset.left + elOffset.width; t -= s.cropDiv.offsetWidth; return t; } else if (that = params.padding) { padding = that; pLeft = elOffset.left - sc.scrollLeft; pRight = s.cropDiv.offsetWidth - pLeft - elOffset.width; if (pLeft >= padding && pRight >= padding) { return sc.scrollLeft; } else if (pLeft < padding) { return sc.scrollLeft - (padding - pLeft); } else { return sc.scrollLeft + (padding - pRight); } } }; })(); components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcScrollTop/calc.ls (function(){ return function(s, sc, elOffset, params){ var sbMargins, t, cropDivHeight, that, padding, pTop, pBottom; sbMargins = inc("calcScrollBarMargins/calc")(s); if (params.center === true) { t = elOffset.top + elOffset.height / 2; cropDivHeight = s.cropDiv.offsetHeight; if (sbMargins) { cropDivHeight -= sbMargins.top + sbMargins.bottom; } t -= cropDivHeight / 2; return t; } else if (params.top === true) { t = elOffset.top; if (sbMargins) { t -= sbMargins.top; } return t; } else if (params.bottom === true) { t = elOffset.top + elOffset.height; t -= s.cropDiv.offsetHeight; if (sbMargins) { t += sbMargins.bottom; } return t; } else if (that = params.padding) { padding = that; pTop = elOffset.top - sc.scrollTop; pBottom = s.cropDiv.offsetHeight - pTop - elOffset.height; if (sbMargins) { pTop -= sbMargins.top; pBottom -= sbMargins.bottom; } if (pTop >= padding && pBottom >= padding) { return sc.scrollTop; } else if (pTop < padding) { return sc.scrollTop - (padding - pTop); } else { return sc.scrollTop + (padding - pBottom); } } }; })(); components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcScrollTop/calcScrollBarMargins/calc.ls (function(){ return function(s){ var sbMargins, top, bottom, t, b; if (sbMargins = s.params.scrollbarMargins) { top = Div({ height: sbMargins.top }).appendTo(s.cropDiv); bottom = Div({ height: sbMargins.bottom }).appendTo(s.cropDiv); t = top.height(); b = bottom.height(); top.remove(); bottom.remove(); return { top: t, bottom: b }; } }; })(); components/scrollDivNext/scrollElementIntoView/scroll.ls (function(){ return function(s, targetDiv, params){ var ref$, targetPosition; if (!targetDiv || !targetDiv.isVisible() || !s.scrollContainerDiv.contains(targetDiv) || s.preventAutoScroll) { return; } if ((ref$ = app.currentPage) != null) { ref$.updateLayout(); } targetPosition = inc("calcScrollTarget/calc")(s, targetDiv, params); return s.scrollToPosition(targetPosition, params); }; })(); components/scrollDivNext/scrollTo/animatedScroll/scroll.ls (function(){ return function(s, sc, params, targetPosition){ var startedAt, startScrollLeft, startScrollTop, onFrame; if (_.isEqual(targetPosition, s.targetPosition)) { return; } s.targetPosition = targetPosition; startedAt = new Date(); startScrollLeft = sc.scrollLeft; startScrollTop = sc.scrollTop; onFrame = function(){ var duration, percentage; if (!_.isEqual(targetPosition, s.targetPosition)) { return; } if (!s.div.isVisible()) { return; } duration = new Date() - startedAt; percentage = Math.min(1, duration / params.duration); percentage = Math.pow(percentage, 2) * (3 - 2 * percentage); sc.scrollLeft = startScrollLeft + (targetPosition.left - startScrollLeft) * percentage; sc.scrollTop = startScrollTop + (targetPosition.top - startScrollTop) * percentage; if (percentage < 1) { return requestAnimationFrame(onFrame); } else { return s.targetPosition = undefined; } }; return requestAnimationFrame(onFrame); }; })(); components/scrollDivNext/scrollTo/scroll.ls (function(){ return function(s, targetPosition, params){ var sc, ref$; if (targetPosition == null || s.preventAutoScroll) { return; } sc = s.scrollContainerDiv; params == null && (params = {}); params = { padding: (ref$ = params.padding) != null ? ref$ : 5, center: (ref$ = params.center) != null ? ref$ : false, top: (ref$ = params.top) != null ? ref$ : false, bottom: (ref$ = params.bottom) != null ? ref$ : false, left: (ref$ = params.left) != null ? ref$ : false, right: (ref$ = params.right) != null ? ref$ : false, instant: (ref$ = params.instant) != null ? ref$ : false, duration: (ref$ = params.duration) != null ? ref$ : 300 }; if (_.isNumber(targetPosition)) { targetPosition = { top: targetPosition, left: sc.scrollLeft }; } if ((params != null ? params.instant : void 8) === true) { sc.scrollTop = targetPosition.top; sc.scrollLeft = targetPosition.left; s.targetPosition = null; } else { inc("animatedScroll/scroll")(s, sc, params, targetPosition); } }; })(); components/scrollDivNext/scrollbar/_shared/changeScrollbarSize/change.ls (function(){ return function(s, div, barDiv, size, axis){ if (!s.enlargeScrollbarOnHover) { return; } div.css({ transition: "200ms" }); barDiv.css({ borderRadius: size - 3 + "px", transition: "200ms" }); if (axis === "y") { div.css({ width: size + "px" }); barDiv.css({ width: size + "px" }); } else { div.css({ height: size + "px" }); barDiv.css({ height: size + "px" }); } setTimeout(function(){ div.css({ transition: "" }); return barDiv.css({ transition: "" }); }, 200); }; })(); components/scrollDivNext/scrollbar/_shared/enableDrag/enable.ls (function(){ return function(p){ var x, y, mouseDown, mouseMove, mouseUp; x = 0; y = 0; mouseDown = function(e){ p.div.dragEnabled = true; x = e.clientX; y = e.clientY; body.bind("mousemove", mouseMove); return body.bind("mouseup", mouseUp); }; mouseMove = function(e){ var dx, dy; e.stopPropagation(); e.preventDefault(); dx = e.clientX - x; x = e.clientX; dy = e.clientY - y; y = e.clientY; return p.onDrag({ x: dx, y: dy }); }; mouseUp = function(e){ body.unbind("mousemove", mouseMove); body.unbind("mouseup", mouseUp); p.div.dragEnabled = false; if (!p.div.hoverEnabled) { p.div.changeScrollbarSize(5); p.div.setScrollbarInvisible(); } return p.s.refresh("fakeEvent"); }; p.barDiv.bind("mousedown", mouseDown); }; })(); components/scrollDivNext/scrollbar/_shared/enableHover/enable.ls (function(){ return function(p){ var mouseEnter, mouseLeave; mouseEnter = function(){ clearTimeout(p.div.resetTimeout); clearTimeout(p.div.autoTimeout); p.div.hoverEnabled = true; p.div.setScrollbarVisible(); return p.div.changeScrollbarSize(9); }; mouseLeave = function(e){ p.div.hoverEnabled = false; if (!p.div.dragEnabled) { p.div.changeScrollbarSize(5); p.div.setScrollbarInvisible(); } return p.s.refresh("fakeEvent"); }; p.div.bind("mouseenter", mouseEnter); p.div.bind("mouseleave", mouseLeave); }; })(); components/scrollDivNext/scrollbar/_shared/fadeOut/fadeOut.ls (function(){ return function(div){ div.css({ opacity: 1 }); requestAnimationFrame(function(){ return div.css({ opacity: 0, transition: "opacity 400ms" }); }); }; })(); components/scrollDivNext/scrollbar/_shared/setScrollbarInvisible/set.ls (function(){ return function(s, div){ if (s.scrollbarMode === "auto" && s.fadeInScrollbarOnHover) { clearTimeout(div.resetTimeout); div.resetTimeout = setTimeout(function(){ if (!s.fadeInScrollbarOnHover) { div.firstChild.css({ pointerEvents: "none" }); } return div.customFadeOut(); }, 2000); } }; })(); components/scrollDivNext/scrollbar/_shared/setScrollbarVisible/set.ls (function(){ return function(s, div){ var ref$; if (((ref$ = s.scrollbarMode) === "show" || ref$ === "auto") && s.fadeInScrollbarOnHover) { div.css({ opacity: 1, transition: "200ms" }); } }; })(); components/scrollDivNext/scrollbar/x/onDrag/on.ls (function(){ return function(s, delta){ var sc, factor; sc = s.scrollContainerDiv; factor = sc.scrollWidth / sc.offsetWidth; return sc.scrollLeft += delta.x * factor; }; })(); components/scrollDivNext/scrollbar/x/scrollbar.ls (function(){ return function(s){ var div, barDiv; div = Div({ position: "absolute", left: 0, right: 0, bottom: 0, height: "5px", background: "rgba(0,0,200,0.05)", pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none" }).addClass("scrollbarWrapper").html(barDiv = Div({ position: "absolute", bottom: 0, height: "5px", background: Color.grey[800], opacity: 0.5, borderRadius: "2px", cursor: "pointer", pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none" }).html(Div({ position: "absolute", top: "-10px", left: "-10px", bottom: "-10px", right: 0, background: "transparent" }))); inc("../_shared/enableDrag/enable")({ div: div, barDiv: barDiv, onDrag: function(delta){ return inc("onDrag/on")(s, delta); }, s: s }); inc("../_shared/enableHover/enable")({ div: div, barDiv: barDiv, s: s }); div.update = function(){ return inc("update/update")(s, barDiv); }; div.changeScrollbarSize = function(size){ return inc("../_shared/changeScrollbarSize/change")(s, div, barDiv, size, "x"); }; div.setScrollbarVisible = function(){ return inc("../_shared/setScrollbarVisible/set")(s, div); }; div.setScrollbarInvisible = function(){ return inc("../_shared/setScrollbarInvisible/set")(s, div); }; div.customFadeOut = function(){ return inc("../_shared/fadeOut/fadeOut")(div); }; return div; }; })(); components/scrollDivNext/scrollbar/x/update/update.ls (function(){ return function(s, barDiv){ var scrollLeft, wContainer, wContent, wBar, xBar; scrollLeft = s.scrollContainerDiv.scrollLeft; wContainer = s.cropDiv.offsetWidth; wContent = s.scrollContainerDiv.scrollWidth; if (s.enableScrollY) { wContent -= 30; } wBar = _.round(wContainer / wContent * wContainer); xBar = _.round(scrollLeft / wContent * wContainer); return barDiv.css({ width: wBar + "px", transform: "translateX(" + xBar + "px)" }); }; })(); components/scrollDivNext/scrollbar/y/onDrag/on.ls (function(){ return function(s, delta){ var sc, scrollHeight, ref$, factor; sc = s.scrollContainerDiv; scrollHeight = (ref$ = s.scrollHeightCustom) != null ? ref$ : sc.scrollHeight; factor = scrollHeight / sc.offsetHeight; return sc.scrollTop += delta.y * factor; }; })(); components/scrollDivNext/scrollbar/y/scrollbar.ls (function(){ return function(s){ var div, barDiv; div = Div({ position: "absolute", top: 0, right: 0, bottom: 0, width: "5px", background: "rgba(0,0,200,0.05)", pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none" }).addClass("scrollbarWrapper").html(barDiv = Div({ position: "absolute", right: 0, width: "5px", background: Color.grey[800], opacity: 0.4, borderRadius: "2px", cursor: "pointer", pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none" }).html(Div({ position: "absolute", top: "-10px", left: "-10px", bottom: "-10px", right: 0, background: "transparent" }))); inc("../_shared/enableDrag/enable")({ div: div, barDiv: barDiv, onDrag: function(delta){ return inc("onDrag/on")(s, delta); }, s: s }); inc("../_shared/enableHover/enable")({ div: div, barDiv: barDiv, s: s }); div.update = function(){ return inc("update/update")(s, barDiv); }; div.changeScrollbarSize = function(size){ return inc("../_shared/changeScrollbarSize/change")(s, div, barDiv, size, "y"); }; div.setScrollbarVisible = function(){ return inc("../_shared/setScrollbarVisible/set")(s, div); }; div.setScrollbarInvisible = function(){ return inc("../_shared/setScrollbarInvisible/set")(s, div); }; div.customFadeOut = function(){ return inc("../_shared/fadeOut/fadeOut")(div); }; return div; }; })(); components/scrollDivNext/scrollbar/y/update/calcScrollbarMarginFactor/calc.ls (function(){ return function(s){ if (!s.customScrollbarMargins) { return 1; } else { return s.scrollbarY.offsetHeight / s.cropDiv.offsetHeight; } }; })(); components/scrollDivNext/scrollbar/y/update/update.ls (function(){ return function(s, barDiv){ var scrollTop, ref$, hContainer, hContent, marginFactor, hBar, yBar; scrollTop = (ref$ = s.scrollTopCustom) != null ? ref$ : s.scrollContainerDiv.scrollTop; hContainer = s.cropDiv.offsetHeight; hContent = (ref$ = s.scrollHeightCustom) != null ? ref$ : s.scrollContainerDiv.scrollHeight; if (s.enableScrollX) { hContent -= 30; } marginFactor = inc("calcScrollbarMarginFactor/calc")(s); hBar = _.round(hContainer / hContent * hContainer * marginFactor); yBar = _.round(scrollTop / hContent * hContainer * marginFactor); return barDiv.css({ height: hBar + "px", transform: "translateY(" + yBar + "px)" }); }; })(); components/scrollDivNext/setCenterContent/set.ls (function(){ return function(s, enable){ var i$, ref$, len$, el; for (i$ = 0, len$ = (ref$ = s.div.findAll(".centerSpacer")).length; i$ < len$; ++i$) { el = ref$[i$]; if (enable) { el.show(); } else { el.hide(); } } return s.div; }; })(); components/scrollDivNext/setEnableScroll/x/set.ls (function(){ return function(s, enabled){ s.enableScrollX = enabled; s.scrollContainerDiv.css(enabled ? { overflowX: "scroll", marginBottom: "-30px" } : { overflowX: "hidden", marginBottom: "" }); s.contentDiv.css(enabled ? { borderBottom: "30px solid transparent", maxWidth: "" } : { borderBottom: "", maxWidth: "100%" }); s.contentOutsideDiv.css({ maxWidth: enabled ? "" : "100%" }); s.setScrollbarMode(s.scrollbarMode); return s.div; }; })(); components/scrollDivNext/setEnableScroll/y/set.ls (function(){ return function(s, enabled){ s.enableScrollY = enabled; s.scrollContainerDiv.css(enabled ? { overflowY: "scroll", marginRight: "-30px" } : { overflowY: "hidden", marginRight: "" }); s.contentDiv.css(enabled ? { borderRight: "30px solid transparent", maxHeight: "" } : { borderRight: "", maxHeight: "100%" }); s.setScrollbarMode(s.scrollbarMode); return s.div; }; })(); components/scrollDivNext/setEnableScrollDiagonal/fixChromeSvgFontSizeBug/fix.ls (function(){ return function(s){ var div, div2; div = s.contentDiv; div2 = Div({ height: div.height() + "px", width: div.width() + "px" }); div.replaceWith(div2); return div2.replaceWith(div); }; })(); components/scrollDivNext/setEnableScrollDiagonal/onWheel/on.ls (function(){ return function(s, e){ var cd; e.preventDefault(); cd = s.scrollContainerDiv; if (s.enableScrollY) { cd.scrollTop += e.deltaY / 2; } if (s.enableScrollX) { return cd.scrollLeft += e.deltaX / 2; } }; })(); components/scrollDivNext/setEnableScrollDiagonal/set.ls (function(){ return function(s, enabled){ if (enabled && (!s.enableScrollX || !s.enableScrollY)) { throw Error("enableScrollDiagonal requires enabled scrollbars"); } if (enabled === s.enableScrollDiagonal) { return s.div; } s.enableScrollDiagonal = enabled; s.onWheel == null && (s.onWheel = function(e){ return inc("onWheel/on")(s, e); }); if (enabled) { s.scrollContainerDiv.bind("wheel", s.onWheel); } else { s.scrollContainerDiv.unbind("wheel", s.onWheel); inc("fixChromeSvgFontSizeBug/fix")(s); } return s.div; }; })(); components/scrollDivNext/setScopeRender/set.ls (function(){ return function(s, params){ s.scopeRender = params; s.refresh(); return s.div; }; })(); components/scrollDivNext/setScrollHeightCustom/set.ls (function(){ return function(s, scrollHeightCustom){ s.scrollHeightCustom = scrollHeightCustom; s.refresh(); return s.div; }; })(); components/scrollDivNext/setScrollTopCustom/set.ls (function(){ return function(s, scrollTop){ s.scrollTopCustom = scrollTop; s.refresh(); return s.div; }; })(); components/scrollDivNext/setScrollbarMargins/set.ls (function(){ return function(s, m){ if (!m) { return; } s.customScrollbarMargins = m; s.scrollbarY.css({ marginTop: m.top, marginBottom: m.bottom }); s.scrollbarX.css({ marginBottom: m.bottom }); return s.div; }; })(); components/scrollDivNext/setScrollbarMode/set.ls (function(){ return function(s, mode){ var ref$; s.scrollbarMode = mode; if (s.enableScrollY && ((ref$ = s.scrollbarMode) === "show" || ref$ === "auto")) { s.scrollbarY.appendTo(s.cropDiv); } else { s.scrollbarY.remove(); } if (s.enableScrollX && ((ref$ = s.scrollbarMode) === "show" || ref$ === "auto")) { s.scrollbarX.appendTo(s.cropDiv); } else { s.scrollbarX.remove(); } s.refresh(); return s.div; }; })(); components/svg/createElement/create.ls (function(){ return function(o){ var elem, s, ref$, d, w, h; if (_.isObject(o.svg)) { elem = o.svg; } else { if (_.includes(o.svg, "<")) { s = o.svg; } else if (_.includes(o.svg, "/")) { s = include(o.svg).trim(); } else { if ((ref$ = window.log) != null) { ref$.log({ event: "debugBrokenSvg", value: { o: o } }); } throw Error("Svg: svg not found or invalid"); } d = document.createElement("div"); d.innerHTML = s; elem = d.getElementsByTagName("svg")[0]; } if (!elem.getAttribute("viewBox")) { w = elem.getAttribute("width").replace("px", ""); h = elem.getAttribute("height").replace("px", ""); s = "0 0 " + w + " " + h; elem.setAttribute("viewBox", "0 0 " + w + " " + h); } return elem.css({ display: "block", boxSizing: "content-box", width: "100%", height: "100%" }); }; })(); components/svg/svg.ls (function(){ return function(o){ var elem, initSize, setSize, setSvg, setColor, div; if (_.isString(o)) { o = { svg: o }; } elem = inc("createElement/create")(o); initSize = function(){ if (o.size) { o.height = o.size; return o.width = o.size; } else if (!(o.width || o.height)) { o.height = "1em"; return o.width = "1em"; } else { o.width = o.width || o.height; return o.height = o.height || o.width; } }; setSize = function(w, h){ delete o.size; delete o.height; delete o.width; if (w && h) { o.width = w; o.height = h; } else if (w) { o.size = w; } initSize(); return div.css({ width: o.width, height: o.height }); }; setSvg = function(svg, w, h){ o.svg = svg; elem.replaceWith(elem = inc("createElement/create")(o)); if (w) { setSize(w, h); } return elem; }; setColor = function(c){ var i$, ref$, len$, e; if (!c) { return; } elem.setAttribute("fill", c); for (i$ = 0, len$ = (ref$ = elem.querySelectorAll("*")).length; i$ < len$; ++i$) { e = ref$[i$]; e.setAttribute("fill", c); } return elem; }; initSize(); setColor(o.color); div = Div({ display: "inline-block", width: o.width || o.height, height: o.height || o.width, boxSizing: "content-box" }).html(elem); div.setColor = setColor; div.setSvg = setSvg; div.setSize = setSize; div.svgElement = elem; return div; }; })(); components/svgIcon/getSrcUrl/calcCacheId/calc.ls (function(){ return function(p){ var id, that; id = (that = p.svgCacheId) ? that : _.isString(p.svg) && !_.startsWith(p.svg, " 1 ? arguments : newClasses.split(" "); for (i$ = 0, len$ = newClassNames.length; i$ < len$; ++i$) { name = newClassNames[i$]; inc("checkAdblockBlacklist/check")(name); existingClasses = this.getAttribute("class"); if (!existingClasses) { this.setAttribute("class", name); } else if ((" " + existingClasses + " ").indexOf(" " + name + " ") === -1) { this.setAttribute("class", existingClasses + " " + name); } } } return this; }; })(); elementProperties/addClass/checkAdblockBlacklist/check.ls (function(){ var classes; classes = projects.documentCache["extended-dom-element"]["elementProperties/addClass/checkAdblockBlacklist/classes_noMaster/classes.ls"] ? inc("classes_noMaster/classes")() : {}; return function(name){ if (classes[name]) { return debug("forbidden adblock blacklist className: " + name); } }; })(); elementProperties/after/after.ls (function(){ return function(element){ var prev, i$, len$, el; if (!element) { return this; } else if (arguments.length > 1) { this.after(arguments); } else if (_.isArray(element) && !element.jquery) { prev = this; for (i$ = 0, len$ = element.length; i$ < len$; ++i$) { el = element[i$]; prev.after(el); prev = el; } } else { element = element.jquery ? element[0] : element; this.parentNode.insertBefore(element, this.nextSibling); } return this; }; })(); elementProperties/animation/animation.ls (function(){ return function(o){ var div, oldCss, k, ref$, v, autoReverse, calcTimingFunction, timingFunction, duration, delay, transitionProperties, prop, animationProps, onTimeout, timeout, startTime, remainingTime; div = this; if ((o != null ? o.css : void 8) == null) { return div; } if (!div.isVisible()) { if (!o.secondTry) { o.secondTry = true; requestAnimationFrame(function(){ return div.animation(o); }); } return div; } oldCss = {}; for (k in ref$ = o.css) { v = ref$[k]; oldCss[k] = div.css(k); } if (o.reversed == null) { o.reversed = false; } else { o.reversed = !o.reversed; } o.repeatCount = o.repeatCount == null ? 0 : o.repeatCount === "infinite" ? o.repeatCount : !o.reversed ? parseInt(o.repeatCount) - 1 : o.repeatCount; autoReverse = (ref$ = o.autoReverse) != null ? ref$ : false; calcTimingFunction = function(easing){ if (easing === "bounce") { return "cubic-bezier(.46,1.3,.68,1.1)"; } else if (easing) { return easing; } else { return "ease-in-out"; } }; timingFunction = calcTimingFunction(o.easing); if (o.reversed) { timingFunction = include("calcReversedTimingFunction/calc")(timingFunction); } duration = (ref$ = o.duration) != null ? ref$ : 500; delay = (ref$ = o.delay) != null ? ref$ : 0; transitionProperties = ""; for (prop in ref$ = o.css) { v = ref$[prop]; transitionProperties += prop + ", "; } animationProps = { transition: duration + "ms", transitionProperty: transitionProperties, transitionDelay: delay + "ms", transitionTimingFunction: timingFunction }; div.css(_.assign(o.css, animationProps)); onTimeout = function(){ var ref$; o.delay = 0; if (o.reversed || !o.autoReverse) { if (o.repeatCount === "infinite" || o.repeatCount > 0) { if (!o.autoReverse) { div.css(oldCss); o.reversed = undefined; } else { o.css = oldCss; } return div.animation(o); } else { div.css({ transition: "", transitionProperty: "", animationTimingFunction: "", webkitAnimationTimingFunction: "" }); delete div.animationRunning; delete div.pauseAnimation; delete div.resumeAnimation; return (ref$ = o.onCompleted) != null ? ref$.call(div) : void 8; } } else { o.css = oldCss; return div.animation(o); } }; timeout = setTimeout(onTimeout, duration + delay); startTime = performance.now(); remainingTime = 0; div.animationRunning = true; div.pauseAnimation = function(){ var style, actualCss, k, ref$, _, elapsedTime; if (!div.animationRunning) { return; } clearTimeout(timeout); style = getComputedStyle(div); actualCss = {}; for (k in ref$ = oldCss) { _ = ref$[k]; actualCss[k] = style[k]; } for (k in ref$ = animationProps) { _ = ref$[k]; actualCss[k] = ""; } div.css(actualCss); elapsedTime = performance.now() - startTime; remainingTime = duration + delay - elapsedTime; return div.animationRunning = false; }; div.resumeAnimation = function(easingFunction){ var timingFunction, animationProps; if (div.animationRunning) { return; } if (remainingTime > duration) { delay = remainingTime - duration; } else { duration = remainingTime; delay = 0; } timingFunction = calcTimingFunction(easingFunction != null ? easingFunction : o.easing); if (o.reversed) { timingFunction = include("calcReversedTimingFunction/calc")(timingFunction); } animationProps = { transition: duration + "ms", transitionProperty: transitionProperties, transitionDelay: delay + "ms", transitionTimingFunction: timingFunction }; div.css(_.assign(o.css, animationProps)); timeout = setTimeout(onTimeout, duration + delay); startTime = performance.now(); return div.animationRunning = true; }; return div; }; })(); elementProperties/animation/calcReversedTimingFunction/calc.ls (function(){ return function(timingFunction){ var that; switch (that = timingFunction) { case "ease-in": return "ease-out"; case "ease-out": return "ease-in"; case "step-start": return "step-end"; case "step-end": return "step-start"; default: return that; } }; })(); elementProperties/append/append.ls (function(){ return function(){ var i$, len$, arg, j$, len1$, arg2; for (i$ = 0, len$ = (arguments).length; i$ < len$; ++i$) { arg = (arguments)[i$]; if (arg) { if (arg.nodeType) { this.appendChild(arg); } else if (arg.jquery) { arg.appendTo(this); } else if (_.isString(arg)) { this.insertAdjacentHTML("beforeend", arg); if (arg.indexOf("<") > -1) { this.convertCustomTags(); } } else if (arg.length) { for (j$ = 0, len1$ = arg.length; j$ < len1$; ++j$) { arg2 = arg[j$]; this.append(arg2); } } } } return this; }; })(); elementProperties/appendTo/appendTo.ls (function(){ return function(targetElement){ targetElement.append(this); return this; }; })(); elementProperties/attr/attr.ls (function(){ return function(name, value){ var n, v; if (value == null && _.isString(name)) { return this.getAttribute(name); } else if (_.isObject(name)) { for (n in name) { v = name[n]; this.setAttribute(n, v); } } else if (name) { this.setAttribute(name, value); } return this; }; })(); elementProperties/before/before.ls (function(){ return function(element){ var next, i$, ref$, len$, el; if (!element) { this; } else if (arguments.length > 1) { this.before(arguments); } else if (_.isArray(element) && !element.jquery) { next = this; for (i$ = 0, len$ = (ref$ = _.reverse(_.concat(element))).length; i$ < len$; ++i$) { el = ref$[i$]; next.before(el); next = el; } } else { element = element.jquery ? element[0] : element; this.parentNode.insertBefore(element, this); } return this; }; })(); elementProperties/bind/bind.ls (function(){ return function(event, handler, useCapture, passive){ var i$, ref$, len$, e, safeHandler, options; if (!handler) { return this; } for (i$ = 0, len$ = (ref$ = event.split(" ")).length; i$ < len$; ++i$) { e = ref$[i$]; if (!this.boundEventListeners) { this.boundEventListeners = []; } safeHandler = fn$; this.boundEventListeners.push({ event: e, safeHandler: safeHandler, handler: handler, useCapture: useCapture, passive: passive }); options = { capture: useCapture, passive: passive }; if (include("/util/supportsPassiveEvent/passiveEvent")()) { this.addEventListener(e, safeHandler, options); } else { this.addEventListener(e, safeHandler, useCapture); } } return this; function fn$(){ var thisElement, args; thisElement = this; args = [].slice.call(arguments); return trySafe(function(){ return handler.apply(thisElement, args); }); } }; })(); elementProperties/childrenAll/childrenAll.ls (function(){ return function(){ var children, c; return children = (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = this.childNodes).length; i$ < len$; ++i$) { c = ref$[i$]; if (c.nodeType !== 1) { continue; } results$.push(c); } return results$; }.call(this)); }; })(); elementProperties/classes/classes.ls (function(){ return function(classes){ var c; if (_.isArray(classes)) { this.setAttribute("class", classes.join(" ")); return this; } else if (_.isString(classes)) { this.setAttribute("class", classes); return this; } else { c = this.getAttribute("class"); return (c != null ? c.split(" ") : void 8) || []; } }; })(); elementProperties/clone/clone.ls (function(){ return function(){ return this.cloneNode(true); }; })(); elementProperties/contextMenu/contextMenu.ls (function(){ return function(onContextMenu){ var div; div = this; if (!onContextMenu) { return div; } div.addEventListener("contextmenu", function(e){ e.preventDefault(); return onContextMenu.call(div, e); }); return div; }; })(); elementProperties/convertCustomTags/convertCustomTags.ls (function(){ return function(){ var i$, ref$, len$, el, results$ = []; if (window.MathDiv2 != null) { for (i$ = 0, len$ = (ref$ = this.findAll("mat")).length; i$ < len$; ++i$) { el = ref$[i$]; if (!el.isConverted) { el.replaceWith(include("mat/mat")(el)); } } } if (window.MusicStaff != null) { for (i$ = 0, len$ = (ref$ = this.findAll("music")).length; i$ < len$; ++i$) { el = ref$[i$]; if (!el.isConverted) { el.replaceWith(include("music/music")(el)); } } } for (i$ = 0, len$ = (ref$ = this.findAll("verse")).length; i$ < len$; ++i$) { el = ref$[i$]; if (!el.isConverted) { results$.push(el.replaceWith(include("verse/verse")(el))); } } return results$; }; })(); elementProperties/convertCustomTags/mat/mat.ls (function(){ return function(el){ var text, ref$, ref1$, firstTextPart, v; text = (ref$ = (ref1$ = el.nextSibling) != null ? ref1$.textContent : void 8) != null ? ref$ : ""; firstTextPart = text.split(" ")[0]; if (firstTextPart && !el.attr("center") && !el.attr("align")) { if ((ref$ = el.nextSibling) != null) { ref$.textContent = text.substr(firstTextPart.length); } v = "" + el.innerHTML + "`" + firstTextPart + "`"; } else { v = el.outerHTML; } return MathDiv2({ value: v, enableHorizontalScroll: true, color: "currentcolor" }); }; })(); elementProperties/convertCustomTags/music/music.ls (function(){ return function(el){ var notes, mode, metric, clef, noMetric, noClef, noPitch, noLines, p, div; notes = el.innerHTML; mode = el.attr("mode"); metric = el.attr("metric"); clef = mode === "bass" || mode === "bassNoClef" ? "bass" : mode === "violin" ? "violin" : void 8; noMetric = !metric; noClef = mode === "rhythm" || mode === "violinNoClef" || mode === "bassNoClef" || !clef; noPitch = mode === "rhythm"; noLines = mode === "rhythm"; p = { notes: { musicAscii: notes, clef: clef }, metric: metric, noMetric: noMetric, noClef: noClef, noPitch: noPitch, noLines: noLines, height: "2.4em" }; div = MusicStaff(p).css({ verticalAlign: "middle", marginTop: "-0.3em", marginBottom: "-0.3em" }).addClass("music"); div.isConverted = true; return div; }; })(); elementProperties/convertCustomTags/verse/verse.ls (function(){ return function(el){ var div; div = Div({ display: "inline-block", marginLeft: "10px" }).addClass("verse").html(Span().css({ marginLeft: "-10px" }), el.innerHTML); div.isConverted = true; return div; }; })(); elementProperties/css/css.ls (function(){ var supportsCssVar, supportsTransform; supportsCssVar = include("cssSupport/supportsCssVar")(); supportsTransform = include("cssSupport/supportsTransform")(); if (!supportsTransform) { return include("cssFunctions/cssTransformPolyFill"); } else if (!supportsCssVar) { return include("cssFunctions/cssVarPolyFill"); } else { return include("cssFunctions/css"); } })(); elementProperties/css/cssFunctions/css.ls (function(){ var isiOs, isWebkit; isiOs = /iPad|iPhone|iPod/.test(navigator.platform); isWebkit = window.webkitRequestAnimationFrame != null; return function(css){ var p, v; if (_.isString(css)) { return getComputedStyle(this)[css]; } for (p in css) { v = css[p]; this.style[p] = v; if (p === "filter" && isiOs) { this.style.willChange = "filter"; } if (p === "userSelect" && isWebkit) { this.style.webkitUserSelect = v; } } return this; }; })(); elementProperties/css/cssFunctions/cssTransformPolyFill.ls (function(){ return function(css){ var p, v; if (_.isString(css)) { return getComputedStyle(this)[css]; } css = include("../../cssVarPolyFill/css")(this, css); for (p in css) { v = css[p]; if (p === "transform") { this.style["webkitTransform"] = v; } else { this.style[p] = v; } } return this; }; })(); elementProperties/css/cssFunctions/cssVarPolyFill.ls (function(){ return function(css){ var p, v; if (_.isString(css)) { return getComputedStyle(this)[css]; } css = include("../../cssVarPolyFill/css")(this, css); for (p in css) { v = css[p]; this.style[p] = v; if (p === "transform") { this.style["webkitTransform"] = v; } } return this; }; })(); elementProperties/css/cssSupport/_shared/cssSupports.ls (function(){ return function(v){ var ref$; return (ref$ = window.CSS) != null ? typeof ref$.supports == 'function' ? ref$.supports(v) : void 8 : void 8; }; })(); elementProperties/css/cssSupport/supportsCssVar.ls (function(){ return function(){ return include("_shared/cssSupports")("(--foo: red)"); }; })(); elementProperties/css/cssSupport/supportsTransform.ls (function(){ return function(){ return include("_shared/cssSupports")("(transform: translateX(0px))"); }; })(); elementProperties/cssClass/createCssTag/create.ls (function(){ return function(cssClassName, css){ var s, p, v, p2, html, style; s = (function(){ var ref$, results$ = []; for (p in ref$ = css) { v = ref$[p]; p2 = p.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase(); results$.push(p2 + ": " + v + ";\n"); } return results$; }()).join(""); html = "." + cssClassName + " {" + s + "}"; style = Style(); style.setAttribute("id", cssClassName); style.innerHTML = html; style.isCssClassStyle = true; return document.head.append(style); }; })(); elementProperties/cssClass/cssClass.ls (function(){ if (engine.cssClasses == null) { engine.cssClasses = { _total: 0 }; } return function(css){ var s, p, v, className; s = css.cssClass || (function(){ var ref$, results$ = []; for (p in ref$ = css) { v = ref$[p]; results$.push(p + v); } return results$; }()).join(""); className = engine.cssClasses[s]; if (!className) { engine.cssClasses._total += 1; className = css.cssClass || "css" + engine.cssClasses._total; engine.cssClasses[s] = className; include("createCssTag/create")(className, css); } this.addClass(className); return this; }; })(); elementProperties/cssVar/cssVar.ls (function(){ var supportsCssVar; supportsCssVar = include("../css/cssSupport/supportsCssVar")(); return function(cssVar){ var p, v; if (!supportsCssVar) { return include("../cssVarPolyFill/cssVar")(this, cssVar); } if (_.isString(cssVar)) { return this.style.getPropertyValue("--" + cssVar); } for (p in cssVar) { v = cssVar[p]; this.style.setProperty("--" + p, v); } return this; }; })(); elementProperties/cssVarPolyFill/css.ls (function(){ return function(div, css){ var cleanedCss, parseVar, parseReplacementString, addVarProperty, updateCss, initializeProperties, didAddVars, p, v, parts, varFunc, varProperty; include("prepare")(div); cleanedCss = {}; parseVar = function(s){ var result; if (!s) { return undefined; } result = /var\(\s*--([^,; ]+)\s*,?\s*([^,; ]+)?\s*\)/g.exec(s); return { varName: result != null ? result[1] : void 8, fallback: result != null ? result[2] : void 8 }; }; parseReplacementString = function(s){ var result; result = /(.*)(var\([^)]+\))(.*)/g.exec(s); return { prefix: result != null ? result[1] : void 8, varFunc: result != null ? result[2] : void 8, postfix: result != null ? result[3] : void 8 }; }; addVarProperty = function(varName, varProperty){ var varProperties; varProperties = div._varProperties[varName] || []; varProperties.push(varProperty); return div._varProperties[varName] = varProperties; }; updateCss = function(varProperties, value){ var css, i$, len$, varProperty; css = {}; for (i$ = 0, len$ = varProperties.length; i$ < len$; ++i$) { varProperty = varProperties[i$]; css[varProperty.property] = varProperty.prefix + (value != null ? value : varProperty.fallback) + varProperty.postfix; } return div.css(css); }; initializeProperties = function(){ var varName, ref$, varProperties, p, value, ref1$, results$ = []; for (varName in ref$ = div._varProperties) { varProperties = ref$[varName]; p = div; value = undefined; do { value = (ref1$ = p._cssVars) != null ? ref1$[varName] : void 8; } while (!value && (p = typeof p.parent == 'function' ? p.parent() : void 8)); results$.push(updateCss(varProperties, value)); } return results$; }; didAddVars = false; for (p in css) { v = css[p]; if (_.isString(v) && v.indexOf('var(') >= 0) { parts = parseReplacementString(v); varFunc = parseVar(parts.varFunc); if (varFunc.varName != null) { addVarProperty(varFunc.varName, varProperty = { property: p, fallback: varFunc.fallback, prefix: parts.prefix || "", postfix: parts.postfix || "" }); didAddVars = true; } } else { cleanedCss[p] = v; } } if (didAddVars) { requestAnimationFrame(initializeProperties); } return cleanedCss; }; })(); elementProperties/cssVarPolyFill/cssVar.ls (function(){ return function(div, cssVar){ var updateCss, p, v; include("prepare")(div); updateCss = function(d, varName, value){ var newValue, ref$, i$, len$, c, results$ = []; newValue = (ref$ = typeof d._cssVarChanged == 'function' ? d._cssVarChanged(varName, value) : void 8) != null ? ref$ : value; if (newValue === value) { for (i$ = 0, len$ = (ref$ = d.childrenAll()).length; i$ < len$; ++i$) { c = ref$[i$]; results$.push(updateCss(c, varName, newValue)); } return results$; } }; if (_.isString(cssVar)) { return div._cssVars[cssVar]; } for (p in cssVar) { v = cssVar[p]; div._cssVars[p] = v; updateCss(div, p, v); } return div; }; })(); elementProperties/cssVarPolyFill/prepare.ls (function(){ return function(div){ var updateCss; if (div._cssVars != null) { return; } div._cssVars = {}; div._varProperties = {}; updateCss = function(varProperties, value){ var css, i$, len$, varProperty; css = {}; for (i$ = 0, len$ = varProperties.length; i$ < len$; ++i$) { varProperty = varProperties[i$]; css[varProperty.property] = varProperty.prefix + (value != null ? value : varProperty.fallback) + varProperty.postfix; } return div.css(css); }; return div._cssVarChanged = function(varName, value){ var ref$, ref1$, varProperties; value = (ref$ = (ref1$ = div._cssVars) != null ? ref1$[varName] : void 8) != null ? ref$ : value; varProperties = (ref$ = div._varProperties) != null ? ref$[varName] : void 8; if (varProperties == null) { return value; } updateCss(varProperties, value); return value; }; }; })(); elementProperties/drag/animateToStart/animate.ls (function(){ return function(o){ var ref$; if (_.isFunction(o.duration)) { o.onAnimationComplete = o.duration; o.duration = undefined; } o.duration = (ref$ = o.duration) != null ? ref$ : 500; o.div.css({ transform: o.initialTransforms + ("translate(" + o.startTranslation.x + "px, " + o.startTranslation.y + "px)") + o.startScale.cssString, transition: "transform " + o.duration + "ms" }); return setTimeout(function(){ var ref$; o.div.css({ transition: "" }); return (ref$ = o.onAnimationComplete) != null ? ref$.call(o.div) : void 8; }, o.duration); }; })(); elementProperties/drag/animateToTarget/animate.ls (function(){ return function(params){ var div, currentTranslation, startTranslation, initialTransforms, startScale, ref$, ref1$, duration, ref2$, targetPosition, targetScale, offset, center, dx, dy, translation; div = params.div; currentTranslation = params.currentTranslation; startTranslation = params.startTranslation; initialTransforms = params.initialTransforms; startScale = params.startScale; if (!(((ref$ = params.targetPosition) != null ? ref$.x : void 8) != null && ((ref1$ = params.targetPosition) != null ? ref1$.y : void 8) != null)) { debug("animateToTarget is missing required targetPosition. possible parameters are"); debug("targetPosition: {x: 123, y: 123}"); debug("duration: 100"); debug("targetOpacity: 0"); debug("targetScale: 0"); debug("onAnimationComplete: -> "); return; } duration = (ref2$ = params.duration) != null ? ref2$ : 500; targetPosition = params.targetPosition; targetScale = (ref2$ = params.targetScale) != null ? ref2$ : 1; if (targetScale === 0) { targetScale = 0.001; } offset = div.offset(); center = { x: offset.left + offset.width / 2, y: offset.top + offset.height / 2 }; dx = targetPosition.x - center.x; dy = targetPosition.y - center.y; translation = { x: currentTranslation.x + startTranslation.x + dx, y: currentTranslation.y + startTranslation.y + dy }; div.css({ opacity: (ref2$ = params.targetOpacity) != null ? ref2$ : 1, transform: initialTransforms + ("translate(" + translation.x + "px, " + translation.y + "px) scale(" + targetScale * startScale.x + "," + targetScale * startScale.y + ")"), transition: duration + "ms", transitionProperty: "transform, opacity" }); return setTimeout(function(){ var ref$; div.css({ transition: "" }); return (ref$ = params.onAnimationComplete) != null ? ref$.call(div) : void 8; }, duration); }; })(); elementProperties/drag/animation/animation.ls (function(){ return function(div){ return { start: function(){ return div.css({ boxShadow: "1px 1px 4px rgba(0,0,0,0.2)" }); }, end: function(){ return div.css({ boxShadow: "" }); } }; }; })(); elementProperties/drag/calcInitialTransforms/calc.ls (function(){ return function(div){ var transform, transforms, result, i$, len$, i, t; transform = div.style.transform; transforms = transform != null ? transform.split(/[()]/) : void 8; result = ""; for (i$ = 0, len$ = transforms.length; i$ < len$; i$ += 2) { i = i$; t = transforms[i$]; if (t.trim() !== "translate" && t.trim() !== "scale" && t.length > 0) { result += t + ("(" + transforms[i + 1] + ")") + " "; } } return result; }; })(); elementProperties/drag/calcScale/calc.ls (function(){ return function(div){ var x, y, cssString, transform, transforms, i$, len$, i, t, scale, values; x = 1; y = 1; cssString = ""; transform = div.style.transform; transforms = transform != null ? transform.split(/[()]/) : void 8; for (i$ = 0, len$ = transforms.length; i$ < len$; ++i$) { i = i$; t = transforms[i$]; if (t.trim() === "scale") { scale = transforms[i + 1]; values = scale.split(','); x = +values[0].replace("px", "").trim(); y = values.length > 1 ? +values[1].replace("px", "").trim() : x; cssString = " scale(" + x + ", " + y + ") "; break; } } return { x: x, y: y, cssString: cssString }; }; })(); elementProperties/drag/calcTranslation/calc.ls (function(){ return function(div){ var translate, ref$, ref1$; translate = (ref$ = div.style.transform) != null ? (ref1$ = ref$.match(/translate\(([^)]*)/)) != null ? ref1$[1] : void 8 : void 8; if (translate == null) { return { x: 0, y: 0 }; } if (!_.includes(translate, ",")) { translate += ",0"; } return { x: parseFloat(translate.split(',')[0]), y: parseFloat(translate.split(',')[1]) }; }; })(); elementProperties/drag/drag.ls (function(){ return function(o){ var div, animation, that, startTranslation, startScale, currentTranslation, initialTransforms, started, bounds, initialDivOffset, callbackObject, updateTranslation, updatePosition, ensureTranslationIsInsideBounds, startDrag, endDrag, animateToStart, updateAbsolutePosition, animateToTarget; o = o || {}; div = this; div.css({ cursor: "pointer" }).addClass("dragElement"); animation = o.animation === "none" ? null : (that = o.animation) ? that : include("animation/animation")(div); started = false; callbackObject = function(gr){ return { translation: currentTranslation, velocity: gr.velocity, clientPosition: gr.clientPosition, updateTranslation: updateTranslation }; }; updateTranslation = function(t2){ var translation; startTranslation.x += t2.x; startTranslation.y += t2.y; ensureTranslationIsInsideBounds(currentTranslation); translation = { x: currentTranslation.x + startTranslation.x, y: currentTranslation.y + startTranslation.y }; return div.css({ transform: initialTransforms + ("translate(" + translation.x + "px, " + translation.y + "px)") + startScale.cssString }); }; updatePosition = function(gr){ var translation, ref$; if (!started) { startDrag(gr); } currentTranslation = { x: gr.translation.x, y: gr.translation.y }; if (o.dragDirection === "horizontal") { currentTranslation.y = 0; } if (o.dragDirection === "vertical") { currentTranslation.x = 0; } ensureTranslationIsInsideBounds(currentTranslation); translation = { x: currentTranslation.x + startTranslation.x, y: currentTranslation.y + startTranslation.y }; div.css({ transform: initialTransforms + ("translate(" + translation.x + "px, " + translation.y + "px)") + startScale.cssString }); if ((ref$ = o.onMove) != null) { ref$.call(div, callbackObject(gr)); } }; ensureTranslationIsInsideBounds = function(translation){ var ref$; if (o.updateBoundsOnDrag) { bounds = (ref$ = o.boundingDiv) != null ? ref$.offset() : void 8; } if (bounds == null) { return translation; } if (initialDivOffset.left + translation.x < bounds.left) { translation.x = bounds.left - initialDivOffset.left; } else if (initialDivOffset.left + initialDivOffset.width + translation.x > bounds.left + bounds.width) { translation.x = bounds.left + bounds.width - initialDivOffset.left - initialDivOffset.width; } if (initialDivOffset.top + translation.y < bounds.top) { translation.y = bounds.top - initialDivOffset.top; } else if (initialDivOffset.top + initialDivOffset.height + translation.y > bounds.top + bounds.height) { translation.y = bounds.top + bounds.height - initialDivOffset.top - initialDivOffset.height; } }; startDrag = function(gr){ var ref$, ref1$; started = true; initialDivOffset = div.offset(); bounds = (ref$ = o.boundingDiv) != null ? ref$.offset() : void 8; include("sendToFront/sendToFront")(div); currentTranslation = { x: 0, y: 0 }; startTranslation = include("calcTranslation/calc")(div); startScale = include("calcScale/calc")(div); if (animation != null) { if (typeof animation.start == 'function') { animation.start(); } } if ((ref1$ = o.onStart) != null) { ref1$.call(div, callbackObject(gr)); } initialTransforms = include("calcInitialTransforms/calc")(div); }; endDrag = function(gr){ var obj, ref$; if (!started) { return; } started = false; if (animation != null) { if (typeof animation.end == 'function') { animation.end(); } } obj = _.assign(callbackObject(gr), { animateToStart: animateToStart, updateAbsolutePosition: updateAbsolutePosition, animateToTarget: animateToTarget }); if ((ref$ = o.onEnd) != null) { ref$.call(div, obj); } }; animateToStart = function(duration, onAnimationComplete){ var obj; obj = { duration: duration, onAnimationComplete: onAnimationComplete, div: div, initialTransforms: initialTransforms, startTranslation: startTranslation, startScale: startScale }; return include("animateToStart/animate")(obj); }; updateAbsolutePosition = function(){ return include("updateAbsolutePosition/update")(div, initialTransforms, startScale); }; animateToTarget = function(params){ var obj; obj = params || {}; obj.div = div; obj.currentTranslation = currentTranslation; obj.startTranslation = startTranslation; obj.initialTransforms = initialTransforms; obj.startScale = startScale; return include("animateToTarget/animate")(obj); }; if (o.tapZone) { include("tapZone/tapZone")(div, o.tapZone); } return div.gesturePan({ id: "drag", onStart: function(gr){ if (!o.delaysStart) { return startDrag(gr); } }, onChanged: updatePosition, onEnded: endDrag, onCancel: endDrag, preventDefault: o.preventDefault, cancelStartOnScroll: o.cancelStartOnScroll, shouldStart: o.shouldStart }); }; })(); elementProperties/drag/sendToFront/sendToFront.ls (function(){ return function(div){ var i$, ref$, len$, el, maxEl, divZ, maxIndex; for (i$ = 0, len$ = (ref$ = body.find(".dragElement")).length; i$ < len$; ++i$) { el = ref$[i$]; if (div !== el && (!maxEl || +el.style.zIndex >= +maxEl.style.zIndex)) { maxEl = el; } } if (maxEl != null && div !== maxEl && +maxEl.style.zIndex >= +div.style.zIndex) { divZ = +div.style.zIndex; maxIndex = +maxEl.style.zIndex; if (maxIndex === divZ) { maxIndex = divZ + 1; } div.css({ zIndex: maxIndex }); return maxEl.css({ zIndex: divZ }); } }; })(); elementProperties/drag/tapZone/tapZone.ls (function(){ return function(div, tapZone){ var showBorder, a, res$, i$, i; if (!tapZone || div.tapZone != null) { return; } if (_.endsWith(tapZone, "debug")) { tapZone = tapZone.split(/debug/)[0].trim(); showBorder = true; } a = tapZone.split(" "); if (a.length === 1) { res$ = []; for (i$ = 1; i$ <= 4; ++i$) { i = i$; res$.push(tapZone); } a = res$; } else if (a.length === 2) { a = [a[0], a[1], a[0], a[1]]; } else if (a.length === 3) { a = [a[0], a[1], a[2], a[1]]; } return div.prepend(div.tapZone = Div().css({ position: "absolute", top: "-" + a[0], right: "-" + a[1], bottom: "-" + a[2], left: "-" + a[3], border: showBorder ? "1px solid red" : void 8 })); }; })(); elementProperties/drag/updateAbsolutePosition/update.ls (function(){ return function(div, initialTransforms, startScale){ var parentOff, divOff; parentOff = div.parent().offset(); divOff = div.offset(); return div.css({ transform: initialTransforms + startScale.cssString, left: divOff.left - parentOff.left + (divOff.width - divOff.width / startScale.x) / 2 + "px", top: divOff.top - parentOff.top + (divOff.height - divOff.height / startScale.y) / 2 + "px" }); }; })(); elementProperties/empty/empty.ls (function(){ return function(){ while (this.lastChild) { this.removeChild(this.lastChild); } return this; }; })(); elementProperties/fadeIn/fadeIn.ls (function(){ return function(duration, callback){ var e; duration = duration || 400; e = this; e.css({ opacity: 0 }); e.show(); requestAnimationFrame(function(){ e.css({ opacity: 1, transition: "opacity " + duration + "ms" }); return setTimeout(function(){ e.css({ opacity: "" }); return callback != null ? callback.call(e) : void 8; }, duration); }); return e; }; })(); elementProperties/fadeOut/fadeOut.ls (function(){ return function(duration, callback){ var e; duration = duration || 400; e = this; e.css({ opacity: 1 }); requestAnimationFrame(function(){ e.css({ opacity: 0, transition: "opacity " + duration + "ms" }); return setTimeout(function(){ e.hide(); e.css({ opacity: "" }); return callback != null ? callback.call(e) : void 8; }, duration); }); return e; }; })(); elementProperties/find/find.ls (function(){ return function(f){ var f2, i$, len$, c, elements, t; f2 = ""; for (i$ = 0, len$ = f.length; i$ < len$; ++i$) { c = f[i$]; if (!_.isNaN(_.parseInt(c))) { c = "\\3" + c + " "; } f2 += c; } return elements = (function(){ var i$, ref$, len$, results$ = []; for (i$ = 0, len$ = (ref$ = this.querySelectorAll(f2)).length; i$ < len$; ++i$) { t = ref$[i$]; results$.push(t); } return results$; }.call(this)); }; })(); elementProperties/findFirst/findFirst.ls (function(){ return function(f){ var f2, i$, len$, c; f2 = ""; for (i$ = 0, len$ = f.length; i$ < len$; ++i$) { c = f[i$]; if (!_.isNaN(_.parseInt(c))) { c = "\\3" + c + " "; } f2 += c; } return this.querySelector(f2); }; })(); elementProperties/findFirstText/findFirstText.ls (function(){ return function(text){ var f; f = function(el, text){ var children, matchingChild; if (!_.includes(el.textContent, text)) { return null; } children = el.childrenAll(); if (children.length === 0) { return el; } else if (children.length > 0) { matchingChild = _.find(children, function(el){ return _.includes(el.textContent, text); }); if (matchingChild) { return f(matchingChild, text); } else { return el; } } }; return f(this, text); }; })(); elementProperties/findLast/findLast.ls (function(){ return function(f){ return _.last(this.findAll(f)); }; })(); elementProperties/gestureRecognizer/base/base.ls (function(){ return function(o){ var cancelOthers, base; cancelOthers = function(){ var i$, ref$, len$, gr, results$ = []; if (!base.cancelsOthers) { return; } for (i$ = 0, len$ = (ref$ = o.div._gestureRecognizers).length; i$ < len$; ++i$) { gr = ref$[i$]; if (gr !== base && gr.state !== "ended") { if (typeof o.shouldRecognizeSimultaneously == 'function' && o.shouldRecognizeSimultaneously(base, gr)) { continue; } results$.push(gr.cancel()); } } return results$; }; base = { id: o.id, isActive: true, cancelsOthers: o.cancelsOthers || false, state: "ended", start: function(){ base.state = "started"; return typeof o.onStart == 'function' ? o.onStart(base) : void 8; }, cancel: function(){ base.state = "cancelled"; if (typeof o.onCancel == 'function') { o.onCancel(base); } return base.state = "ended"; }, recognized: function(){ base.state = "recognized"; cancelOthers(); return typeof o.onRecognized == 'function' ? o.onRecognized(base) : void 8; }, changed: function(){ base.state = "changed"; cancelOthers(); return typeof o.onChanged == 'function' ? o.onChanged(base) : void 8; }, ended: function(){ base.state = "ended"; return typeof o.onEnded == 'function' ? o.onEnded(base) : void 8; }, target: o.div, clientPosition: undefined, positionInDiv: function(){ var offset, pos; offset = o.div.offset(); return pos = { x: base.clientPosition.x - offset.left, y: base.clientPosition.y - offset.top }; }, translation: { x: 0, y: 0 }, velocity: { x: 0, y: 0 }, zoom: 0, rotation: 0 }; if (!o.div._gestureRecognizers) { o.div._gestureRecognizers = []; } o.div._gestureRecognizers.push(base); return base; }; })(); elementProperties/gestureRecognizer/deltaPoint/delta.ls (function(){ return function(p1, p2){ var delta; delta = { x: p2.x - p1.x, y: p2.y - p1.y, length: function(){ return Math.sqrt(Math.pow(delta.x, 2) + Math.pow(delta.y, 2)); }, velocity: function(dt){ return { x: (p2.x - p1.x) / dt, y: (p2.y - p1.y) / dt }; } }; return delta; }; })(); elementProperties/gestureRecognizer/event/normalize.ls (function(){ return function(e, trackingTouchesIdentifiers){ var touches, identifiers, midPos, i$, len$, touch, ref$, allTouchPositions; touches = e.type === "touchstart" || e.type === "touchend" || e.type === "touchcancel" ? e.changedTouches || e.touches : e.touches || e.changedTouches; if (touches != null) { if (trackingTouchesIdentifiers != null && trackingTouchesIdentifiers.length) { touches = _.filter(touches, function(t){ return _.indexOf(trackingTouchesIdentifiers, t.identifier) >= 0; }); } identifiers = _.map(touches, 'identifier'); midPos = { x: 0, y: 0 }; for (i$ = 0, len$ = touches.length; i$ < len$; ++i$) { touch = touches[i$]; midPos.x += (ref$ = touch.clientX) != null ? ref$ : 0; midPos.y += (ref$ = touch.clientY) != null ? ref$ : 0; } midPos.x /= touches.length; midPos.y /= touches.length; } else { midPos = { x: e.clientX || 0, y: e.clientY || 0 }; identifiers = ["mouse"]; } allTouchPositions = _.map(touches, function(t){ var ref$; return { x: (ref$ = t.clientX) != null ? ref$ : 0, y: (ref$ = t.clientY) != null ? ref$ : 0 }; }); return { clientX: midPos.x, clientY: midPos.y, numberOfTouches: (ref$ = touches != null ? touches.length : void 8) != null ? ref$ : 1, allTouchPositions: allTouchPositions, identifiers: identifiers }; }; })(); elementProperties/gestureRecognizer/longTap.ls (function(){ return function(o){ var isStandalone, numberOfTaps, maxAllowedMovement, maxDelay, longPressTime, lastLongTapOnDown, gr, taps, lastTime, timer, isDown, restart, down, scheduleLongPressTimer, cancelLongPressTimer, onLongPressTimer, up; isStandalone = o.div != null; if (!isStandalone) { o.div = this; } numberOfTaps = o.numberOfTaps || 1; maxAllowedMovement = o.maxAllowedMovement || 20; maxDelay = o.maxDelay || 750; longPressTime = o.longPressTime || 500; lastLongTapOnDown = o.lastLongTapOnDown != null ? o.lastLongTapOnDown : true; gr = include("base/base")(o); taps = 0; lastTime = undefined; timer = undefined; isDown = false; restart = function(){ taps = 0; return gr.start(); }; down = function(e){ var event, downPos, delta, t; if (!gr.isActive) { gr.state = "ended"; return; } event = include("event/normalize")(e); downPos = { x: event.clientX, y: event.clientY }; isDown = true; delta = gr.clientPosition != null ? include("deltaPoint/delta")(downPos, gr.clientPosition) : void 8; gr.clientPosition = downPos; t = performance.now(); if (gr.state !== "ended" && (delta.length() > maxAllowedMovement || t - lastTime > maxDelay)) { gr.cancel(); } if (gr.state === "ended") { restart(t); } lastTime = t; body.bind("touchend mouseup", up); return scheduleLongPressTimer(); }; scheduleLongPressTimer = function(){ if (!lastLongTapOnDown) { return; } cancelLongPressTimer(); return timer = setTimeout(onLongPressTimer, longPressTime); }; cancelLongPressTimer = function(){ return clearTimeout(timer); }; onLongPressTimer = function(){ if (!gr.isActive) { body.unbind("touchend mouseup", up); gr.state = "ended"; return; } if (isDown) { if (taps === numberOfTaps - 1) { gr.recognized(); gr.ended(); return body.unbind("touchend mouseup", up); } } }; up = function(e){ var event, upPos, delta, t; if (!gr.isActive) { body.unbind("touchend mouseup", up); gr.state = "ended"; return; } isDown = false; cancelLongPressTimer(); if (gr.state !== "ended") { event = include("event/normalize")(e); upPos = { x: event.clientX, y: event.clientY }; delta = include("deltaPoint/delta")(upPos, gr.clientPosition); gr.clientPosition = upPos; t = performance.now(); if (delta.length() > maxAllowedMovement || t - lastTime < longPressTime) { gr.cancel(); } else { gr.changed(); if (++taps >= numberOfTaps) { gr.recognized(); gr.ended(); } } } lastTime = t; return body.unbind("touchend mouseup", up); }; o.div.bind("touchstart mousedown", down); if (isStandalone) { return gr; } else { return this; } }; })(); elementProperties/gestureRecognizer/pan.ls (function(){ return function(o){ var numberOfTouchesRequired, usePassiveEventListener, gr, lastTime, downPos, lastPos, trackingTouchIdentifiers, scrollCancelTimeout, onScroll, start, down, move, up; o.div = this; numberOfTouchesRequired = o.numberOfTouchesRequired || 1; usePassiveEventListener = !o.preventDefault; gr = include("base/base")(o); lastTime = undefined; downPos = undefined; lastPos = undefined; trackingTouchIdentifiers = undefined; onScroll = function(){ clearTimeout(scrollCancelTimeout); scrollCancelTimeout = undefined; return body.unbind("scroll", onScroll, true, true); }; start = function(){ gr.start(); return body.bind("touchmove mousemove", move, o.useCapture, usePassiveEventListener); }; down = function(e){ var event, ref$, t; if (o.preventDefault && (!o.cancelStartOnScroll && gr.state !== "started" && gr.state !== "ended")) { e.preventDefault(); } if (o.stopPropagation) { e.stopPropagation(); } if (gr.state === "started" || gr.state === "changed") { return; } event = include("event/normalize")(e); gr.numberOfTouches = event.numberOfTouches; gr.allTouchPositions = event.allTouchPositions; trackingTouchIdentifiers = event.identifiers; downPos = { x: event.clientX, y: event.clientY }; lastPos = downPos; gr.clientPosition = downPos; gr.velocity = { x: 0, y: 0 }; if (!((ref$ = typeof o.shouldStart == 'function' ? o.shouldStart(gr) : void 8) != null ? ref$ : true)) { return; } t = performance.now(); if (gr.state === "ended" && event.numberOfTouches >= numberOfTouchesRequired) { body.bind("touchend mouseup touchcancel", up, o.useCapture, usePassiveEventListener); if (!o.cancelStartOnScroll) { start(); } else { if (scrollCancelTimeout == null) { t = _.isFinite(o.cancelStartOnScroll) ? o.cancelStartOnScroll : 300; scrollCancelTimeout = setTimeout(function(){ body.unbind("scroll", onScroll, true, true); start(); return scrollCancelTimeout = undefined; }, t); body.bind("scroll", onScroll, true, true); } } } return lastTime = t; }; move = function(e){ var event, pos, t, delta; event = include("event/normalize")(e, trackingTouchIdentifiers); gr.numberOfTouches = event.numberOfTouches; gr.allTouchPositions = event.allTouchPositions; if (event.numberOfTouches === 0) { body.unbind("touchend mouseup touchcancel", up, o.useCapture, usePassiveEventListener); body.unbind("touchmove mousemove", move, o.useCapture, usePassiveEventListener); gr.cancel(); return; } if (o.preventDefault) { e.preventDefault(); } if (o.stopPropagation) { e.stopPropagation(); } if (gr.state !== "started" && gr.state !== "changed") { body.unbind("touchend mouseup touchcancel", up, o.useCapture, usePassiveEventListener); body.unbind("touchmove mousemove", move, o.useCapture, usePassiveEventListener); return; } if (event.numberOfTouches < numberOfTouchesRequired) { gr.cancel(); return; } pos = { x: event.clientX, y: event.clientY }; t = performance.now(); delta = include("deltaPoint/delta")(downPos, gr.clientPosition); gr.clientPosition = pos; gr.translation = { x: delta.x, y: delta.y }; gr.velocity = include("deltaPoint/delta")(lastPos, pos).velocity(performance.now() - lastTime); gr.changed(); lastPos = pos; return lastTime = t; }; up = function(e){ var event; if (scrollCancelTimeout != null && gr.state !== "started" && gr.state !== "changed") { onScroll(); body.unbind("touchend mouseup touchcancel", up, o.useCapture, usePassiveEventListener); return; } event = include("event/normalize")(e, trackingTouchIdentifiers); gr.numberOfTouches = event.numberOfTouches; gr.allTouchPositions = event.allTouchPositions; if (event.numberOfTouches === 0) { if (_.filter(e.touches, function(t){ return _.indexOf(trackingTouchIdentifiers, t.identifier) >= 0; }).length === 0) { gr.cancel(); body.unbind("touchend mouseup touchcancel", up, o.useCapture, usePassiveEventListener); body.unbind("touchmove mousemove", move, o.useCapture, usePassiveEventListener); } return; } if (o.preventDefault) { e.preventDefault(); } if (o.stopPropagation) { e.stopPropagation(); } if (gr.state === "changed") { gr.recognized(); gr.ended(); } else if (gr.state !== "ended") { gr.cancel(); } body.unbind("touchend mouseup touchcancel", up, o.useCapture, usePassiveEventListener); return body.unbind("touchmove mousemove", move, o.useCapture, usePassiveEventListener); }; o.div.bind("touchstart mousedown", down, o.useCapture, usePassiveEventListener); return this; }; })(); elementProperties/gestureRecognizer/pinch.ls (function(){ return function(o){ var numberOfTouchesRequired, ignoreMouseEnter, gr, lastTime, lastDistance, initialDistance, centerPos, distance, down, move, up, mouseenter, mousewheel, mouseleave; o.div = this; numberOfTouchesRequired = 2; ignoreMouseEnter = false; gr = include("base/base")(o); lastTime = undefined; lastDistance = 0; initialDistance = 0; centerPos = function(e){ var touch1, touch2, center; touch1 = e.touches[0]; touch2 = e.touches[1]; return center = { x: (touch1.clientX + touch2.clientX) / 2, y: (touch1.clientY + touch2.clientY) / 2 }; }; distance = function(e){ var touch1, touch2, dx, dy; touch1 = e.touches[0]; touch2 = e.touches[1]; dx = touch1.clientX - touch2.clientX; dy = touch1.clientY - touch2.clientY; return Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); }; down = function(e){ var t; ignoreMouseEnter = true; t = performance.now(); if (gr.state === "ended" && e.touches.length === numberOfTouchesRequired) { lastDistance = distance(e); initialDistance = lastDistance; gr.clientPosition = centerPos(e); gr.start(); body.bind("touchend", up); body.bind("touchmove", move); } return lastTime = t; }; move = function(e){ var t, d; if (gr.state !== "started" && gr.state !== "changed") { body.unbind("touchend", up); body.unbind("touchmove", move); return; } if (event.numberOfTouches < numberOfTouchesRequired) { gr.cancel(); return; } t = performance.now(); d = distance(e); gr.velocity = (d - lastDistance) / (t - lastTime); gr.zoom = d / initialDistance; gr.changed(); lastDistance = d; return lastTime = t; }; up = function(e){ if (gr.state !== "ended") { gr.ended(); } body.unbind("touchend", up); return body.unbind("touchmove", move); }; mouseenter = function(){ if (ignoreMouseEnter) { return; } gr.zoom = 1; gr.start(); o.div.bind("mouseleave", mouseleave); return o.div.bind("mousewheel", mousewheel, void 8, false); }; mousewheel = function(e){ e.preventDefault(); gr.zoom = Math.max(0, gr.zoom + e.wheelDeltaY / 700); return gr.changed(); }; mouseleave = function(){ if (gr.state !== "ended") { gr.ended(); } return o.div.unbind("mouseleave", mouseleave, void 8, false); }; o.div.bind("touchstart", down); o.div.bind("mouseenter", mouseenter); return this; }; })(); elementProperties/gestureRecognizer/rotate.ls (function(){ return function(o){ var numberOfTouchesRequired, gr, lastTime, lastAngle, initialAngle, centerPos, angle, down, move, up, mouseenter, mousewheel, mouseleave; o.div = this; numberOfTouchesRequired = 2; gr = include("base/base")(o); lastTime = undefined; lastAngle = 0; initialAngle = 0; centerPos = function(e){ var touch1, touch2, center; touch1 = e.touches[0]; touch2 = e.touches[1]; return center = { x: (touch1.clientX + touch2.clientX) / 2, y: (touch1.clientY + touch2.clientY) / 2 }; }; angle = function(e){ var touch1, touch2, dx, dy; touch1 = e.touches[0]; touch2 = e.touches[1]; dx = touch1.clientX - touch2.clientX; dy = touch1.clientY - touch2.clientY; return Math.atan2(dy, dx); }; down = function(e){ var t; t = performance.now(); if (gr.state === "ended" && e.touches.length === numberOfTouchesRequired) { lastAngle = angle(e); initialAngle = lastAngle; gr.clientPosition = centerPos(e); gr.start(); body.bind("touchend", up); body.bind("touchmove", move); } return lastTime = t; }; move = function(e){ var t, d; if (gr.state !== "started" && gr.state !== "changed") { body.unbind("touchend", up); body.unbind("touchmove", move); return; } if (event.numberOfTouches < numberOfTouchesRequired) { gr.cancel(); return; } t = performance.now(); d = angle(e); gr.velocity = (d - lastAngle) / (t - lastTime); gr.rotation = (d - initialAngle) * 180 / Math.PI; gr.changed(); lastAngle = d; return lastTime = t; }; up = function(e){ if (gr.state !== "ended") { gr.ended(); } body.unbind("touchend", up); return body.unbind("touchmove", move); }; mouseenter = function(){ gr.angle = 0; gr.start(); o.div.bind("mouseleave", mouseleave); return o.div.bind("mousewheel", mousewheel); }; mousewheel = function(e){ gr.rotation = gr.rotation - e.wheelDeltaY / 10; return gr.changed(); }; mouseleave = function(){ if (gr.state !== "ended") { gr.ended(); } return o.div.unbind("mouseleave", mouseleave); }; o.div.bind("touchstart", down); o.div.bind("mouseenter", mouseenter); return this; }; })(); elementProperties/gestureRecognizer/sequence/sequence.ls (function(){ return function(o){ var div, maxDelay, gr, sequence, currentActiveIndex, timer, restart, deactivateCurrent, next, takeValuesOfSubRecognizer, scheduleCancelTimeout, timeout, initialize; div = o.div; maxDelay = o.maxDelay || 750; gr = include("../base/base")(o); sequence = []; currentActiveIndex = 0; gr.sequence = null; restart = function(){ initialize(); currentActiveIndex = 0; return sequence[currentActiveIndex].isActive = true; }; deactivateCurrent = function(){ return sequence[currentActiveIndex].isActive = false; }; next = function(){ deactivateCurrent(); if (currentActiveIndex === sequence.length - 1) { gr.recognized(); gr.ended(); return restart(); } else { currentActiveIndex++; sequence[currentActiveIndex].isActive = true; return scheduleCancelTimeout(); } }; takeValuesOfSubRecognizer = function(sgr){ return gr.clientPosition = sgr.clientPosition, gr.translation = sgr.translation, gr.velocity = sgr.velocity, gr.zoom = sgr.zoom, gr.rotation = sgr.rotation, sgr; }; gr.onStart = function(g){ takeValuesOfSubRecognizer(g); clearTimeout(timer); if (gr.state === "ended") { return gr.start(); } }; gr.onCancel = function(g){ takeValuesOfSubRecognizer(g); gr.cancel(); return restart(); }; gr.onEnded = function(g){ takeValuesOfSubRecognizer(g); gr.changed(); return next(); }; scheduleCancelTimeout = function(){ return timer = setTimeout(timeout, maxDelay); }; timeout = function(){ gr.cancel(); return restart(); }; initialize = function(){ var i$, ref$, len$, g, results$ = []; for (i$ = 0, len$ = (ref$ = sequence).length; i$ < len$; ++i$) { g = ref$[i$]; results$.push(g.isActive = false); } return results$; }; gr.setSequence = function(s){ sequence = s; initialize(); return restart(); }; return gr; }; })(); elementProperties/gestureRecognizer/swipe.ls (function(){ return function(o){ var numberOfTouchesRequired, minimumLength, minVelocity, direction, gr, lastTime, downPos, lastPos, down, move, cancel, up; o.div = this; numberOfTouchesRequired = o.numberOfTouchesRequired || 1; minimumLength = 10; minVelocity = 0.5; direction = o.direction || "right"; gr = include("base/base")(o); lastTime = undefined; downPos = undefined; lastPos = undefined; down = function(e){ var event, t; event = include("event/normalize")(e); downPos = { x: event.clientX, y: event.clientY }; lastPos = downPos; gr.clientPosition = downPos; t = performance.now(); if (gr.state === "ended" && event.numberOfTouches >= numberOfTouchesRequired) { gr.start(); body.bind("touchend mouseup", up); body.bind("touchmove mousemove", move); } return lastTime = t; }; move = function(e){ var event, pos, t, delta, velocity; event = include("event/normalize")(e); if (event.numberOfTouches < numberOfTouchesRequired) { gr.cancel(); return; } pos = { x: event.clientX, y: event.clientY }; t = performance.now(); delta = include("deltaPoint/delta")(downPos, gr.clientPosition); gr.clientPosition = pos; gr.translation = { x: delta.x, y: delta.y }; gr.velocity = delta.velocity(performance.now() - lastTime); gr.changed(); if (direction === "left") { if (delta.x > 0 || Math.abs(delta.x) < Math.abs(delta.y)) { cancel(); } else { velocity = Math.max(0, -gr.velocity.x); } } else if (direction === "right") { if (delta.x < 0 || Math.abs(delta.x) < Math.abs(delta.y)) { cancel(); } else { velocity = Math.max(0, gr.velocity.x); } } else if (direction === "up") { if (delta.y > 0 || Math.abs(delta.x) > Math.abs(delta.y)) { cancel(); } else { velocity = Math.max(0, -gr.velocity.y); } } else { if (delta.y < 0) { cancel(); } else { velocity = Math.max(0, gr.velocity.y); } } if (gr.state === "changed") { if (delta.length() > minimumLength && velocity > minVelocity) { gr.recognized(); gr.ended(); body.unbind("touchend mouseup", up); body.unbind("touchmove mousemove", move); } } return lastPos = pos; }; cancel = function(){ gr.cancel(); body.unbind("touchend mouseup", up); return body.unbind("touchmove mousemove", move); }; up = function(e){ if (gr.state !== "ended") { gr.cancel(); } body.unbind("touchend mouseup", up); return body.unbind("touchmove mousemove", move); }; o.div.bind("touchstart mousedown", down); return this; }; })(); elementProperties/gestureRecognizer/tap.ls (function(){ return function(o){ var isStandalone, numberOfTaps, maxAllowedMovement, maxDelay, gr, taps, lastTime, restart, down, scheduleCancelTimeout, timeout, up; isStandalone = o.div != null; if (!isStandalone) { o.div = this; } numberOfTaps = o.numberOfTaps || 1; maxAllowedMovement = o.maxAllowedMovement || 20; maxDelay = o.maxDelay || 750; gr = include("base/base")(o); taps = 0; lastTime = undefined; restart = function(){ taps = 0; return gr.start(); }; down = function(e){ var event, downPos, delta, t; if (!gr.isActive) { gr.state = "ended"; return; } event = include("event/normalize")(e); downPos = { x: event.clientX, y: event.clientY }; delta = gr.clientPosition != null ? include("deltaPoint/delta")(downPos, gr.clientPosition) : void 8; gr.clientPosition = downPos; t = performance.now(); if (gr.state !== "ended" && delta.length() > maxAllowedMovement) { gr.cancel(); } if (gr.state === "ended") { restart(t); } lastTime = t; scheduleCancelTimeout(); return body.bind("touchend mouseup", up); }; scheduleCancelTimeout = function(){ clearTimeout(timeout); return setTimeout(timeout, maxDelay); }; timeout = function(){ if (!gr.isActive) { gr.state = "ended"; body.unbind("touchend mouseup", up); return; } if (gr.state !== "ended") { if (performance.now() - lastTime > maxDelay) { gr.cancel(); return body.unbind("touchend mouseup", up); } } }; up = function(e){ var event, upPos, delta, t; if (!gr.isActive) { gr.state = "ended"; body.unbind("touchend mouseup", up); return; } if (gr.state !== "ended") { event = include("event/normalize")(e); upPos = { x: event.clientX, y: event.clientY }; delta = include("deltaPoint/delta")(upPos, gr.clientPosition); gr.clientPosition = upPos; t = performance.now(); if (delta.length() > maxAllowedMovement) { gr.cancel(); } else { gr.changed(); if (++taps >= numberOfTaps) { gr.recognized(); gr.ended(); } else { scheduleCancelTimeout(); } } } lastTime = t; return body.unbind("touchend mouseup", up); }; o.div.bind("touchstart mousedown", down); if (isStandalone) { return gr; } else { return this; } }; })(); elementProperties/gestureRecognizer/tapSequence.ls (function(){ return function(o){ var tapSequence, gr, sequence, createSequence, createRecognizer; o.div = this; tapSequence = o.tapSequence || "."; gr = include("sequence/sequence")(o); createSequence = function(){ var lastChar, index, count, seq, i$, to$, i, char, len$, s, name; lastChar = tapSequence.charAt(0); index = 0; count = 0; seq = []; for (i$ = 0, to$ = tapSequence.length; i$ < to$; ++i$) { i = i$; char = tapSequence.charAt(i); if (char !== lastChar) { seq.push({ char: lastChar, count: count }); lastChar = char; count = 1; } else { count++; } } seq.push({ char: lastChar, count: count }); sequence = []; for (i$ = 0, len$ = seq.length; i$ < len$; ++i$) { i = i$; s = seq[i$]; name = s.char === "." ? "tap" : "longTap"; sequence.push(createRecognizer(name, s.count, i === seq.length - 1)); } return sequence; }; createRecognizer = function(name, numberOfTaps, isLast){ return include(name + "")({ id: sequence.length + ": " + name, div: o.div, numberOfTaps: numberOfTaps, onStart: gr.onStart, onCancel: gr.onCancel, onEnded: gr.onEnded, lastLongTapOnDown: isLast, longPressTime: o.longPressTime, maxDelay: o.maxDelay }); }; gr.setSequence(createSequence()); return this; }; })(); elementProperties/hasClass/hasClass.ls (function(){ return function(c){ var a; if (_.startsWith(c, ".")) { throw Error("hasClass cannot start with a '.': '" + c + "'"); } a = this.getAttribute("class"); if (!a) { return false; } return (" " + a + " ").indexOf(" " + c + " ") > -1; }; })(); elementProperties/heapInfo/heapInfo.ls (function(){ return function(n){ var n2, heapInfo; try { if (!engine.isDebug) { return this; } } catch (e$) {} if (_.replaceAll == null) { _.replaceAll = function(text, find, replace){ return text.split(find).join(replace); }; } n = _.replaceAll(n, "/../", ""); n = _.replaceAll(n, "-", "_"); n = _.replaceAll(n, "/", "_"); n2 = "heap_info_" + n; heapInfo = eval("function " + n2 + "(){};\nnew " + n2 + "();"); n = _.replaceAll(n, "page_app01_pages_", ""); heapInfo[n] = new XMLSerializer(); this.heapInfoName = heapInfo; return this; }; })(); elementProperties/height/height.ls (function(){ return function(o){ var h, mT, mB; o = o || {}; h = this.getBoundingClientRect().height; if (o.withMargins) { mT = this.css("marginTop"); mB = this.css("marginBottom"); h += _.parseInt(mT) + _.parseInt(mB); } return _.round(h, 1); }; })(); elementProperties/hide/hide.ls (function(){ return function(){ if (this.style.display !== "none") { this.lastCssDisplayValue = this.style.display || ""; this.style.display = "none"; } return this; }; })(); elementProperties/html/html.ls (function(){ return function(){ var s; if (arguments.length === 1 && (_.isString(arguments[0]) || _.isNumber(arguments[0]))) { s = arguments[0]; if ((s != null ? typeof s.indexOf == 'function' ? s.indexOf("&") : void 8 : void 8) > -1 || (s != null ? typeof s.indexOf == 'function' ? s.indexOf("<") : void 8 : void 8) > -1) { this.innerHTML = s; this.convertCustomTags(); } else { this.innerText = s; } } else { this.empty(); this.append(arguments); } return this; }; })(); elementProperties/init.ls (function(){ var functions; functions = { addClass: include("addClass/addClass"), after: include("after/after"), animation: include("animation/animation"), attr: include("attr/attr"), append: include("append/append"), appendTo: include("appendTo/appendTo"), before: include("before/before"), bind: include("bind/bind"), buttonTrigger: include("tap/tap"), childrenAll: include("childrenAll/childrenAll"), classes: include("classes/classes"), clone: include("clone/clone"), contextMenu: include("contextMenu/contextMenu"), convertCustomTags: include("convertCustomTags/convertCustomTags"), css: include("css/css"), cssClass: include("cssClass/cssClass"), cssVar: include("cssVar/cssVar"), drag: include("drag/drag"), empty: include("empty/empty"), fadeIn: include("fadeIn/fadeIn"), fadeOut: include("fadeOut/fadeOut"), find: include("find/find"), findAll: include("find/find"), findFirst: include("findFirst/findFirst"), findFirstText: include("findFirstText/findFirstText"), findLast: include("findLast/findLast"), gesturePan: include("gestureRecognizer/pan"), gesturePinch: include("gestureRecognizer/pinch"), gestureRotate: include("gestureRecognizer/rotate"), gestureSwipe: include("gestureRecognizer/swipe"), gestureTapSequence: include("gestureRecognizer/tapSequence"), hasClass: include("hasClass/hasClass"), height: include("height/height"), hide: include("hide/hide"), html: include("html/html"), isDomElement: include("isDomElement/isDomElement"), isVisible: include("isVisible/isVisible"), keyframeAnimate: include("keyframeAnimate/keyframeAnimate"), offset: include("offset/offset"), offsetSave: include("offsetSave/offsetSave"), offsetAnimate: include("offsetAnimate/offsetAnimate"), onChildrenModified: include("onChildrenModified/onChildrenModified"), onAnimationFrame: include("onAnimationFrame/onAnimationFrame"), onElementClass: include("onElementClass/onElementClass"), onDomAppend: include("onDomAppend/onDomAppend"), onDomAppendAndVisible: include("onDomAppendAndVisible/onDomAppendAndVisible"), onDomRemove: include("onDomRemove/onDomRemove"), onScopeRender: include("onScopeRender/onScopeRender"), onWindowBlur: include("onWindowBlur/onWindowBlur"), onWindowFocus: include("onWindowFocus/onWindowFocus"), onWindowResize: include("onWindowResize/onWindowResize"), outerHtml: include("outerHtml/outerHtml"), parent: include("parent/parent"), position: include("position/position"), prepend: include("prepend/prepend"), remove: include("remove/remove"), removeClass: include("removeClass/removeClass"), replaceWith: include("replaceWith/replaceWith"), secureAppend: include("secureAppend/secureAppend"), securePrepend: include("securePrepend/securePrepend"), secureHtml: include("secureHtml/secureHtml"), show: include("show/show"), tap: include("tap/tap"), text: include("text/text"), triggerCustomEvent: include("triggerCustomEvent/triggerCustomEvent"), triggerTap: include("triggerTap/triggerTap"), unbind: include("unbind/unbind"), unwrap: include("unwrap/unwrap"), width: include("width/width"), wrap: include("wrap/wrap"), heapInfo: include("heapInfo/heapInfo") }; return function(){ var defineProperty, name, ref$, f, results$ = []; defineProperty = function(proto, name, f){ try { return Object.defineProperty(proto, name, { configurable: true, enumerable: true, get: function(){ return f; } }); } catch (e$) {} }; for (name in ref$ = functions) { f = ref$[name]; results$.push(defineProperty(Element.prototype, name, f)); } return results$; }; })(); elementProperties/isDomElement/isDomElement.ls (function(){ return function(){ return body.contains(this); }; })(); elementProperties/isVisible/isVisible.ls (function(){ return function(){ return !!(this.offsetWidth || this.offsetHeight || this.getClientRects().length); }; })(); elementProperties/keyframeAnimate/createAnimationClass/convertToString/convert.ls (function(){ return function(o){ var a, res$, p, v, p2; res$ = []; for (p in o) { v = o[p]; p2 = p.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase(); res$.push(p2 + ": " + v + ";\n"); } a = res$; return a.join(""); }; })(); elementProperties/keyframeAnimate/createAnimationClass/create.ls (function(){ var convertToString; convertToString = include("convertToString/convert"); return function(o, div){ var ref$, keyframes, res$, name, ref1$, value, style, html; if ((ref$ = document.head.findFirst("#" + o.animationName)) != null) { ref$.remove(); } if (_.isNumber(o.duration)) { o.duration += "ms"; } if (_.isNumber(o.delay)) { o.delay += "ms"; } res$ = []; for (name in ref1$ = o.keyframes) { value = ref1$[name]; res$.push(name + "{" + convertToString(value) + "}\n"); } keyframes = res$; keyframes = keyframes.join(""); style = Style(); style.setAttribute("id", o.animationName); html = "\n @keyframes " + o.animationName + " {" + keyframes + "}\n \n ." + o.animationName + " {\n animation-name: " + o.animationName + ";\n animation-duration: " + o.duration + ";\n animation-direction: " + o.direction + ";\n animation-iteration-count: " + o.iterationCount + ";\n animation-delay: " + o.delay + ";\n animation-timing-function: " + o.timing + ";\n animation-fill-mode: forwards;\n }\n"; style.innerHTML = html; return document.head.appendChild(style); }; })(); elementProperties/keyframeAnimate/keyframeAnimate.ls (function(){ return function(o){ var onAnimationEnd; if (typeof this.keyframeAnimateAbort == 'function') { this.keyframeAnimateAbort(); } o.animationName = "keyframeAnimation" + _.random(0, 20000); onAnimationEnd = function(){ include("removeAnimationClass/remove")(o, this); this.unbind("animationend"); this.keyframeAnimationAbort = null; return typeof o.onCompleted == 'function' ? o.onCompleted(this) : void 8; }; this.keyframeAnimateAbort = function(){ include("removeAnimationClass/remove")(o, this); return this.keyframeAnimationAbort = null; }; include("createAnimationClass/create")(o, this); this.addClass(o.animationName); this.css({ animationPlayState: "" }); this.unbind("animationend"); return this.bind("animationend", onAnimationEnd); }; })(); elementProperties/keyframeAnimate/removeAnimationClass/remove.ls (function(){ return function(o, div){ var changedCss, i$, ref$, frame, property; changedCss = {}; for (i$ in ref$ = o.keyframes) { frame = ref$[i$]; for (property in frame) { changedCss[property] = div.css(property); } } div.removeClass(o.animationName); div.css(changedCss); return (ref$ = document.head.findFirst("#" + o.animationName)) != null ? ref$.remove() : void 8; }; })(); elementProperties/offset/clientRect/firefoxPolyfill-wip-getBBox/polyfill.ls (function(){ return function(div){ var p, parent, zoom, bBox, top, left, height, width, bottom, right; p = _.parseInt; parent = div.closest("svg"); zoom = div.closest("div").width() / p(parent.getAttribute("width")); bBox = div.getBBox(); top = p(bBox.y) * zoom + div.getBoundingClientRect().top; left = p(bBox.x) * zoom + div.getBoundingClientRect().left; height = p(bBox.height) * zoom; width = p(bBox.width) * zoom; bottom = p(top + height) * zoom; right = p(left + width) * zoom; return { top: top, left: left, bottom: bottom, right: right, width: width, height: height }; }; })(); elementProperties/offset/clientRect/firefoxPolyfill/polyfill.ls (function(){ return function(div){ var parent, p, zoom, top, left, height, width, bottom, right; parent = div.closest("svg"); p = _.parseInt; zoom = div.closest("div").width() / p(parent.getAttribute("width")); top = p(div.getAttribute("lsg:y")) * zoom + parent.offset().top; left = p(div.getAttribute("lsg:x")) * zoom + parent.offset().left; height = p(div.getAttribute("lsg:h")) * zoom; width = p(div.getAttribute("lsg:w")) * zoom; bottom = top + height; right = left + width; return { top: top, left: left, bottom: bottom, right: right, width: width, height: height }; }; })(); elementProperties/offset/clientRect/offset.ls (function(){ return function(){ var r; if (_.includes(navigator.userAgent, "Firefox") && this instanceof SVGElement && this.tagName === "g" && !this.hasClass("lsg3")) { return inc("firefoxPolyfill/polyfill")(this); } r = this.getBoundingClientRect(); return { top: _.round(r.top, 1), left: _.round(r.left, 1), bottom: _.round(r.bottom, 1), right: _.round(r.right, 1), width: _.round(r.width, 1), height: _.round(r.height, 1) }; }; })(); elementProperties/offset/offset.ls (function(){ return function(p){ if (p != null && p.withoutTransform) { return inc("withoutTransform/offset").apply(this); } else { return inc("clientRect/offset").apply(this); } }; })(); elementProperties/offset/withoutTransform/offset.ls (function(){ return function(){ var el, t, l, w, h; el = this; t = 0; l = 0; w = el.offsetWidth; h = el.offsetHeight; while (el !== body) { t += el.offsetTop; l += el.offsetLeft; el = el.parentNode; } return { top: t, left: l, bottom: t + h, right: l + w, width: w, height: h }; }; })(); elementProperties/offsetAnimate/offsetAnimate.ls (function(){ return function(duration){ var el, d, o1, o2, o3, scaleChange, o4, leftChange, topChange; el = this; d = duration || 500; o1 = el.savedOffset; el.offsetSave(); o2 = el.savedOffset; if (_.isEqual(o1, o2)) { return; } el.css({ transition: "" }); inc("setStyles/set")(el, o1.styles); o3 = el.offset(); scaleChange = o1.width / o3.width; if (scaleChange !== 1) { el.css({ transform: "scale(" + scaleChange + ") " + el.style.transform }); } o4 = el.offset(); leftChange = (o1.left - o4.left) * scaleChange; if (leftChange !== 0) { el.css({ transform: "translateX(" + leftChange + "px) " + el.style.transform }); } topChange = (o1.top - o4.top) * scaleChange; if (topChange !== 0) { el.css({ transform: "translateY(" + topChange + "px) " + el.style.transform }); } setTimeout(function(){ inc("setStyles/set")(el, o2.styles); el.css({ transition: "all " + d + "ms", transitionTimingFunction: "ease-in-out" }); return setTimeout(function(){ return el.css({ transition: "" }); }, d); }, 30); return el; }; })(); elementProperties/offsetAnimate/setStyles/set.ls (function(){ return function(el, styles){ var i$, ref$, len$, s, v, results$ = []; for (i$ = 0, len$ = (ref$ = Array.from(el.style)).length; i$ < len$; ++i$) { s = ref$[i$]; if (s === "pointerEvents" || s === "cursor") { continue; } el.style.removeProperty(s); } for (s in styles) { v = styles[s]; results$.push(el.style[s] = v); } return results$; }; })(); elementProperties/offsetSave/getStyles/get.ls (function(){ return function(el){ var styles, i$, ref$, len$, s; styles = {}; for (i$ = 0, len$ = (ref$ = Array.from(el.style)).length; i$ < len$; ++i$) { s = ref$[i$]; styles[s] = el.style[s]; } return styles; }; })(); elementProperties/offsetSave/offsetSave.ls (function(){ return function(){ var el, o; el = this; o = el.offset(); o.offsetWidth = el.offsetWidth; o.offsetHeight = el.offsetHeight; o.styles = inc("getStyles/get")(el); el.savedOffset = o; return el; }; })(); elementProperties/onAnimationFrame/onAnimationFrame.ls (function(){ return function(f){ var thisElement, onFrame; thisElement = this; onFrame = function(){ var i$, ref$, len$, f; if (thisElement.isDomElement()) { for (i$ = 0, len$ = (ref$ = thisElement.onAnimationFrameHandlers).length; i$ < len$; ++i$) { f = ref$[i$]; setTimeout(fn$); } return requestAnimationFrame(onFrame); } function fn$(){ return f.call(thisElement); } }; if (!this.onAnimationFrameHandlers) { this.onAnimationFrameHandlers = []; this.onDomAppend(onFrame); } this.onAnimationFrameHandlers.push(f); onFrame(); return this; }; })(); elementProperties/onChildrenModified/onChildrenModified.ls (function(){ return function(f){ var thisElement, onMutations, observer, config; thisElement = this; if (thisElement.mutationObserver) { thisElement.mutationObserver.disconnect(); } onMutations = function(mutationRecords){ return f.call(thisElement); }; observer = new MutationObserver(onMutations); config = { childList: true, subtree: true, attributes: false, characterData: false }; observer.observe(this, config); this.mutationObserver = observer; return this; }; })(); elementProperties/onDomAppend/onDomAppend.ls (function(){ var isEdge; isEdge = navigator.appVersion.indexOf("Edge") !== -1; return function(f){ var thisElement; thisElement = this; this.addClass("onDomAppend"); this.onDomAppendHandlers == null && (this.onDomAppendHandlers = []); this.onDomAppendHandlers.push(function(){ if (isEdge) { return setTimeout(function(){ return f.call(thisElement); }); } else { return trySafe(function(){ return f.call(thisElement); }); } }); return this; }; })(); elementProperties/onDomAppendAndVisible/onDomAppendAndVisible.ls (function(){ return function(f){ var thisElement, enable; thisElement = this; enable = true; return this.onDomAppend(function(){ var onFrame; enable = true; onFrame = function(){ if (thisElement.isVisible()) { return f.call(thisElement); } else if (enable) { return requestAnimationFrame(onFrame); } }; return onFrame(); }).onDomRemove(function(){ return enable = false; }); }; })(); elementProperties/onDomRemove/onDomRemove.ls (function(){ var isEdge; isEdge = navigator.appVersion.indexOf("Edge") !== -1; return function(f){ var thisElement; thisElement = this; this.addClass("onDomRemove"); this.onDomRemoveHandlers == null && (this.onDomRemoveHandlers = []); this.onDomRemoveHandlers.push(function(){ if (isEdge) { return setTimeout(function(){ return f.call(thisElement); }); } else { return trySafe(function(){ return f.call(thisElement); }); } }); if (body.contains(this)) { this.onDomRemoveEnabled = true; } return this; }; })(); elementProperties/onElementClass/onElementClass.ls (function(){ return function(className, handler){ this.addClass(className); this[className] = handler; return this; }; })(); elementProperties/onScopeRender/onScopeRender.ls (function(){ return function(f){ var thisElement; thisElement = this; this.addClass("onScopeRender"); this.onScopeRenderHandler = function(){ return f.call(thisElement); }; return this; }; })(); elementProperties/onWindowBlur/init/init.ls (function(){ return function(){ window.onWindowBlurHandler = function(){ var i$, ref$, len$, el, results$ = []; for (i$ = 0, len$ = (ref$ = body.findAll(".onWindowBlur")).length; i$ < len$; ++i$) { el = ref$[i$]; results$.push(typeof el.onWindowBlurHandler == 'function' ? el.onWindowBlurHandler() : void 8); } return results$; }; return window.addEventListener("blur", window.onWindowBlurHandler); }; })(); elementProperties/onWindowBlur/onWindowBlur.ls (function(){ return function(f){ var thisElement; if (!window.onWindowBlurHandler) { include("init/init")(); } thisElement = this; this.addClass("onWindowBlur"); this.onWindowBlurHandler = function(){ return trySafe(function(){ return f.call(thisElement); }); }; return this; }; })(); elementProperties/onWindowFocus/init/init.ls (function(){ return function(){ window.onWindowFocusHandler = function(){ var i$, ref$, len$, el, results$ = []; for (i$ = 0, len$ = (ref$ = body.findAll(".onWindowFocus")).length; i$ < len$; ++i$) { el = ref$[i$]; results$.push(typeof el.onWindowFocusHandler == 'function' ? el.onWindowFocusHandler() : void 8); } return results$; }; return window.addEventListener("focus", window.onWindowFocusHandler); }; })(); elementProperties/onWindowFocus/onWindowFocus.ls (function(){ return function(f){ var thisElement; if (!window.onWindowFocusHandler) { include("init/init")(); } thisElement = this; this.addClass("onWindowFocus"); this.onWindowFocusHandler = function(){ return trySafe(function(){ return f.call(thisElement); }); }; return this; }; })(); elementProperties/onWindowResize/init/init.ls (function(){ return function(){ window.onWindowResizeHandler = function(){ var i$, ref$, len$, el, lresult$, j$, ref1$, len1$, f, results$ = []; for (i$ = 0, len$ = (ref$ = body.findAll(".onWindowResize")).length; i$ < len$; ++i$) { el = ref$[i$]; lresult$ = []; for (j$ = 0, len1$ = (ref1$ = el.onWindowResizeHandlers || []).length; j$ < len1$; ++j$) { f = ref1$[j$]; lresult$.push(f()); } results$.push(lresult$); } return results$; }; return window.addEventListener("resize", window.onWindowResizeHandler); }; })(); elementProperties/onWindowResize/onWindowResize.ls (function(){ return function(f){ var thisElement; if (!window.onWindowResizeHandler) { include("init/init")(); } thisElement = this; this.addClass("onWindowResize"); this.onWindowResizeHandlers == null && (this.onWindowResizeHandlers = []); this.onWindowResizeHandlers.push(function(){ return trySafe(function(){ return f.call(thisElement); }); }); return this; }; })(); elementProperties/outerHtml/outerHtml.ls (function(){ var xmlSerializer; return function(){ if (this.outerHTML != null) { return this.outerHTML; } if (xmlSerializer == null) { xmlSerializer = new XMLSerializer(); } return xmlSerializer.serializeToString(this); }; })(); elementProperties/parent/parent.ls (function(){ return function(){ return this.parentNode; }; })(); elementProperties/position/position.ls (function(){ return function(){ return { top: _.round(this.offsetTop, 1), left: _.round(this.offsetLeft, 1) }; }; })(); elementProperties/prepend/prepend.ls (function(){ return function(){ var i$, ref$, len$, arg, j$, ref1$, len1$, arg2; for (i$ = 0, len$ = (ref$ = _.reverse(arguments)).length; i$ < len$; ++i$) { arg = ref$[i$]; if (arg) { if (arg.nodeType) { this.insertBefore(arg, this.firstChild); } else if (arg.jquery) { arg.prependTo(this); } else if (_.isString(arg)) { this.insertAdjacentHTML("afterbegin", arg); } else if (arg.length) { for (j$ = 0, len1$ = (ref1$ = _.reverse(arg)).length; j$ < len1$; ++j$) { arg2 = ref1$[j$]; this.prepend(arg2); } } } } return this; }; })(); elementProperties/remove/remove.ls (function(){ return function(){ var ref$; try { return (ref$ = this.parentNode) != null ? ref$.removeChild(this) : void 8; } catch (e$) {} }; })(); elementProperties/removeClass/removeClass.ls (function(){ return function(n){ var c, a; c = this.getAttribute("class"); if (c) { a = c.split(" "); a = _.without(a, n); a = a.join(" "); this.setAttribute("class", a); } return this; }; })(); elementProperties/replaceWith/replaceWith.ls (function(){ return function(newElem){ var ref$; if (newElem == null) { return this.remove(); } else if (_.isArray(newElem)) { this.before(newElem); return this.remove(); } else { return (ref$ = this.parentNode) != null ? ref$.replaceChild(newElem, this) : void 8; } }; })(); elementProperties/secureAppend/secureAppend.ls (function(){ return function(){ var i$, len$, arg, j$, len1$, arg2; for (i$ = 0, len$ = (arguments).length; i$ < len$; ++i$) { arg = (arguments)[i$]; if (arg) { if (arg.nodeType) { this.appendChild(arg); } else if (arg.jquery) { arg.appendTo(this); } else if (_.isString(arg) || _.isNumber(arg)) { arg = include("../secureHtml/removeInsecureTags/remove")(arg + ""); arg = include("../secureHtml/cleanUnicode/clean")(arg); this.insertAdjacentHTML("beforeend", arg); if (arg.indexOf("<") > -1) { this.convertCustomTags(); } } else if (arg.length) { for (j$ = 0, len1$ = arg.length; j$ < len1$; ++j$) { arg2 = arg[j$]; this.secureAppend(arg2); } } } } return this; }; })(); elementProperties/secureHtml/cleanUnicode/clean.ls (function(){ return function(s){ return s.replace(/[\u030d\u030e\u0304\u0305\u033f\u0311\u0306\u0310\u0352\u0357\u0351\u0307\u0308\u030a\u0342\u0343\u0344\u034a\u034b\u034c\u0303\u0302\u030c\u0350\u0300\u0301\u030b\u030f\u0312\u0313\u0314\u033d\u0309\u0363\u0364\u0365\u0366\u0367\u0368\u0369\u036a\u036b\u036c\u036d\u036e\u036f\u033e\u035b\u0346\u0316\u0317\u0318\u0319\u031c\u031d\u031e\u031f\u0320\u0324\u0325\u0326\u0329\u032a\u032b\u032c\u032d\u032e\u032f\u0330\u0331\u0332\u0333\u0339\u033a\u033b\u033c\u0345\u0347\u0348\u0349\u034d\u034e\u0353\u0354\u0355\u0356\u0359\u035a\u0315\u031b\u0340\u0341\u0358\u0321\u0322\u0327\u0328\u0334\u0335\u0336\u034f\u035c\u035d\u035e\u035f\u0360\u0362\u0338\u0337\u0361]{2,}/g, "").replace(/[\u202e\u5350\u534d\u0fd5\u0fd6\u0fd7\u0fd8]/g, ""); }; })(); elementProperties/secureHtml/removeInsecureTags/checkAllowedAttributes/check.ls (function(){ var whitelist, tagRegex; whitelist = { mat: { center: /^true$/, align: /^[lcr]*$/ } }; tagRegex = /<([\s\S]*?)>/; return function(value){ var tag, parts, check, i$, len$, i, attr, parts2, valueCheck, getValueRegex, values; tag = value != null ? value.split(tagRegex)[1] : void 8; if (!tag) { return false; } parts = tag.trim().split(/\s+/); check = whitelist[parts[0]]; if (!check) { return false; } for (i$ = 0, len$ = parts.length; i$ < len$; ++i$) { i = i$; attr = parts[i$]; if (i > 0) { parts2 = attr.split("="); if (parts2.length > 2) { return false; } valueCheck = check[parts2[0]]; if (!valueCheck) { return false; } getValueRegex = /['\"]([\s\S]*?)['\"]/g; values = parts2[1].split(getValueRegex); if (values.length !== 3) { return false; } if (values[0] !== "" || values[2] !== "") { return false; } if (!valueCheck.test(values[1])) { return false; } } } return true; }; })(); elementProperties/secureHtml/removeInsecureTags/remove.ls (function(){ var whitelist, checkAllowedAttributes; whitelist = include("whitelist/whitelist"); checkAllowedAttributes = include("checkAllowedAttributes/check"); return function(string){ var tagRegex, isAllowed, escape, comps, i$, len$, i, s; tagRegex = /(<[\s\S]*?>)/g; isAllowed = function(s){ return _.indexOf(whitelist, s) >= 0 || checkAllowedAttributes(s); }; escape = function(s){ return s.replace(/(<)/g, "<").replace(/(>)/g, ">"); }; comps = string.split(tagRegex); for (i$ = 0, len$ = comps.length; i$ < len$; ++i$) { i = i$; s = comps[i$]; if (!isAllowed(s)) { comps[i] = escape(s); } } return comps.join(""); }; })(); elementProperties/secureHtml/removeInsecureTags/whitelist/whitelist.ls (function(){ var safeTags, colorNames, whitelist; safeTags = ["wbr", "br", "b", "sub", "sup", "s", "i", "u", "div", "mat", "verse", "code", "hr"]; colorNames = ["blue", "darkBlue", "darkblue", "red", "green", "lightYellow", "lightyellow", "yellow", "orange", "purple", "pink", "cyan", "lime", "grey", "brown"]; whitelist = _.concat(safeTags, _.map(colorNames, function(c){ return "t-" + c; }), _.map(colorNames, function(c){ return "m-" + c; })); return whitelist = _.concat(_.map(whitelist, function(t){ return "<" + t + ">"; }), _.map(whitelist, function(t){ return ""; })); })(); elementProperties/secureHtml/secureHtml.ls (function(){ return function(){ var appendArgument, s, i$, len$, arg; if (arguments.length === 0) { return this.innerHTML; } appendArgument = function(arg){ var i$, len$, a, secure; if (arg.nodeType) { this.appendChild(arg); return; } else if (arg.jquery) { arg.appendTo(this); return; } if (_.isArray(arg)) { for (i$ = 0, len$ = arg.length; i$ < len$; ++i$) { a = arg[i$]; appendArgument.call(this, a); } return; } if (_.isString(arg) || _.isNumber(arg)) { secure = include("removeInsecureTags/remove")(arg + ""); secure = include("cleanUnicode/clean")(secure); return this.insertAdjacentHTML("beforeend", secure); } }; if (arguments.length === 1 && (_.isString(arguments[0]) || _.isNumber(arguments[0]))) { s = arguments[0]; s = include("removeInsecureTags/remove")(s + ""); s = include("cleanUnicode/clean")(s); if ((s != null ? typeof s.indexOf == 'function' ? s.indexOf("&") : void 8 : void 8) > -1 || (s != null ? typeof s.indexOf == 'function' ? s.indexOf("<") : void 8 : void 8) > -1) { this.innerHTML = s; } else { this.innerText = s; } } else { this.empty(); for (i$ = 0, len$ = (arguments).length; i$ < len$; ++i$) { arg = (arguments)[i$]; if (arg != null) { appendArgument.call(this, arg); } } } this.convertCustomTags(); return this; }; })(); elementProperties/securePrepend/securePrepend.ls (function(){ return function(){ var i$, ref$, len$, arg, j$, ref1$, len1$, arg2; for (i$ = 0, len$ = (ref$ = _.reverse(arguments)).length; i$ < len$; ++i$) { arg = ref$[i$]; if (arg) { if (arg.nodeType) { this.insertBefore(arg, this.firstChild); } else if (arg.jquery) { arg.prependTo(this); } else if (_.isString(arg) || _.isNumber(arg)) { arg = include("../secureHtml/removeInsecureTags/remove")(arg + ""); arg = include("../secureHtml/cleanUnicode/clean")(arg); this.insertAdjacentHTML("afterbegin", arg); if (arg.indexOf("<") > -1) { this.convertCustomTags(); } } else if (arg.length) { for (j$ = 0, len1$ = (ref1$ = _.reverse(arg)).length; j$ < len1$; ++j$) { arg2 = ref1$[j$]; this.securePrepend(arg2); } } } } return this; }; })(); elementProperties/show/show.ls (function(){ return function(){ if (this.style.display === "none") { this.style.display = this.lastCssDisplayValue || ""; } return this; }; })(); elementProperties/tap/animation/default.ls (function(){ return function(div){ var overlay; overlay = null; return { down: function(){ var bgColor, opacity; if (!overlay) { overlay = Div({ position: "absolute", left: 0, right: 0, top: 0, bottom: 0, backgroundColor: Color.black, borderRadius: div.style.borderRadius, pointerEvents: "none", zIndex: div.style["zIndex"] }).addClass("tap-overlay"); } bgColor = getComputedStyle(div).backgroundColor; opacity = bgColor === "rgba(0, 0, 0, 0)" || bgColor === "rgb(255, 255, 255)" ? 0.03 : 0.055; overlay.css({ opacity: opacity }); return div.append(overlay); }, up: function(){ return overlay != null ? overlay.remove() : void 8; }, cancel: function(){ return overlay != null ? overlay.remove() : void 8; } }; }; })(); elementProperties/tap/animation/hover.ls (function(){ return function(div){ var overlay, addOverlay, removeOverlay; overlay = null; addOverlay = function(strength){ var bgColor, opacity; if (!overlay) { overlay = Div({ position: "absolute", left: 0, right: 0, top: 0, bottom: 0, backgroundColor: Color.black, borderRadius: div.style.borderRadius, pointerEvents: "none", zIndex: div.style["zIndex"] }).addClass("tap-overlay"); } bgColor = getComputedStyle(div).backgroundColor; opacity = bgColor === "rgba(0, 0, 0, 0)" || bgColor === "rgb(255, 255, 255)" ? 0.06 : 0.055; overlay.css({ opacity: opacity * strength }); return div.append(overlay); }; removeOverlay = function(){ return overlay != null ? overlay.remove() : void 8; }; return { startHover: function(){ return addOverlay(0.5); }, endHover: function(){ return removeOverlay(); }, down: function(){ return addOverlay(1); }, up: function(isMouseUpInside){ if (isMouseUpInside) { return addOverlay(0.5); } else { return removeOverlay(); } }, cancel: function(){ return removeOverlay(); } }; }; })(); elementProperties/tap/eventHandler/addCallbacks.ls (function(){ return function(o){ if (o.div._eventHandler == null) { o.div._eventHandler = inc("create/create")({ div: o.div, animation: o.animation }); } if (o.onUp != null) { o.div._eventHandler.upCallbacks.push(o.onUp); } if (o.onDown != null) { o.div._eventHandler.downCallbacks.push(o.onDown); } if (o.onCancel != null) { o.div._eventHandler.cancelCallbacks.push(o.onCancel); } if (o.onLongDown != null) { o.div._eventHandler.longDownCallbacks.push(o.onLongDown); } }; })(); elementProperties/tap/eventHandler/create/create.ls (function(){ return function(o){ var eventHandler, lastDownAt, timeout, isDown, isCancelled, triggerCallbacks, down, up, cancel, offsetContains, containsPoint, checkHovering, onEventDown, onEventMove, onEventEnter, onEventLeave, onEventUp, onEventCancel, onEventScroll, eventObj, ref$, ref1$; eventHandler = { upCallbacks: [], downCallbacks: [], cancelCallbacks: [], longDownCallbacks: [], animation: o.animation, tapZone: o.tapZone }; isDown = false; isCancelled = false; triggerCallbacks = function(callbacks, event, originalEvent){ var i$, len$, cb, results$ = []; for (i$ = 0, len$ = callbacks.length; i$ < len$; ++i$) { cb = callbacks[i$]; results$.push(cb.call(o.div, event, originalEvent)); } return results$; }; down = function(event, originalEvent){ var ref$, ref1$; clearTimeout(timeout); lastDownAt = new Date(); isCancelled = false; isDown = true; if ((ref$ = eventHandler.animation) != null) { if ((ref1$ = ref$.down) != null) { ref1$.call(o.div); } } triggerCallbacks(eventHandler.downCallbacks, event, originalEvent); return timeout = setTimeout(function(){ if (isDown && eventHandler.longDownCallbacks.length > 0) { isCancelled = true; return triggerCallbacks(eventHandler.longDownCallbacks, event, originalEvent); } }, 1000); }; up = function(event, originalEvent){ var isMouseUp, ref$, ref1$; clearTimeout(timeout); isMouseUp = originalEvent.changedTouches == null; if ((ref$ = eventHandler.animation) != null) { if ((ref1$ = ref$.up) != null) { ref1$.call(o.div, isMouseUp); } } if (isCancelled || !isDown) { return; } isDown = false; return triggerCallbacks(eventHandler.upCallbacks, event, originalEvent); }; cancel = function(){ var ref$, ref1$; if ((ref$ = eventHandler.animation) != null) { if ((ref1$ = ref$.cancel) != null) { ref1$.call(o.div); } } if (isCancelled) { return; } isCancelled = true; isDown = false; return triggerCallbacks(eventHandler.cancelCallbacks); }; offsetContains = function(el, e){ var offset, ref$; if (el == null) { return false; } offset = el.offset(); return (offset.left <= (ref$ = e.clientX) && ref$ <= offset.right) && (offset.top <= (ref$ = e.clientY) && ref$ <= offset.bottom); }; containsPoint = function(e){ return offsetContains(o.div, e) || offsetContains(o.div.tapZone, e); }; checkHovering = function(e){ var ref$, ref1$, ref2$, ref3$; if (isCancelled) { return; } if (containsPoint(e)) { if (!isDown) { if ((ref$ = eventHandler.animation) != null) { if ((ref1$ = ref$.down) != null) { ref1$.call(o.div); } } return isDown = true; } } else { if (isDown) { clearTimeout(timeout); if ((ref2$ = eventHandler.animation) != null) { if ((ref3$ = ref2$.up) != null) { ref3$.call(o.div); } } return isDown = false; } } }; onEventDown = function(e, originalEvent){ body.bind("scroll", onEventScroll, true); return down(e, originalEvent); }; onEventMove = function(e, originalEvent){ return checkHovering(e); }; onEventEnter = function(e, originalEvent){ var ref$, ref1$; return (ref$ = eventHandler.animation) != null ? (ref1$ = ref$.startHover) != null ? ref1$.call(o.div) : void 8 : void 8; }; onEventLeave = function(e, originalEvent){ var ref$, ref1$; if (!isDown) { return (ref$ = eventHandler.animation) != null ? (ref1$ = ref$.endHover) != null ? ref1$.call(o.div) : void 8 : void 8; } }; onEventUp = function(e, originalEvent){ body.unbind("scroll", onEventScroll, true); if (containsPoint(e)) { return up(e, originalEvent); } else { return cancel(); } }; onEventCancel = function(e, originalEvent){ body.unbind("scroll", onEventScroll, true); return cancel(); }; onEventScroll = function(e, originalEvent){ var ref$, ref1$; if ((ref$ = e.target) != null && ref$.hasClass("debugMessages")) { return; } if (o.div === e.target || ((ref1$ = e.target) != null && ref1$.contains(o.div))) { return cancel(); } }; eventObj = { div: o.div, onDown: onEventDown, onUp: onEventUp, onMove: onEventMove, onEnter: ((ref$ = eventHandler.animation) != null ? ref$.startHover : void 8) != null ? onEventEnter : void 8, onLeave: ((ref1$ = eventHandler.animation) != null ? ref1$.endHover : void 8) != null ? onEventLeave : void 8, onCancel: onEventCancel }; inc("touch/touch")(eventObj); inc("mouse/mouse")(eventObj); return eventHandler; }; })(); elementProperties/tap/eventHandler/create/mouse/isLeftClick/is.ls (function(){ var isMac; isMac = navigator.platform.match("Mac"); return function(e){ return e.button === 0 && !(isMac && e.ctrlKey); }; })(); elementProperties/tap/eventHandler/create/mouse/mouse.ls (function(){ var passive, isLeftClick; passive = inc("/util/supportsPassiveEvent/passiveEvent")(); isLeftClick = inc("isLeftClick/is"); return function(o){ var onMouseDown, onBodyMouseUp, onBodyMouseMove, onMouseEnter, onMouseLeave; onMouseDown = function(e){ if (!isLeftClick(e)) { return; } if (!e.tapDiv) { e.tapDiv = o.div; } if (e.tapDiv === o.div) { body.bind("mouseup", onBodyMouseUp, false, passive); body.bind("mousemove", onBodyMouseMove, false, passive); o.onDown(e, e); } }; onBodyMouseUp = function(e){ if (!isLeftClick(e)) { return; } body.unbind("mouseup", onBodyMouseUp, false, passive); body.unbind("mousemove", onBodyMouseMove, false, passive); o.onUp(e, e); }; onBodyMouseMove = function(e){ o.onMove(e, e); }; onMouseEnter = function(e){ if (o.preventMouseEnter) { delete o.preventMouseEnter; return; } if (typeof o.onEnter == 'function') { o.onEnter(e, e); } }; onMouseLeave = function(e){ if (typeof o.onLeave == 'function') { o.onLeave(e, e); } }; o.div.bind("mousedown", onMouseDown, false, passive); if (o.onEnter != null) { o.div.bind("mouseenter", onMouseEnter, false, passive); } if (o.onLeave != null) { return o.div.bind("mouseleave", onMouseLeave, false, passive); } }; })(); elementProperties/tap/eventHandler/create/touch/touch.ls (function(){ return function(o){ var passive, getTouch, onTouchStart, onTouchUp, onTouchMove, onTouchCancel; passive = inc("/util/supportsPassiveEvent/passiveEvent")(); getTouch = function(e){ var ref$, ref1$; return ((ref$ = e.changedTouches) != null ? ref$[0] : void 8) || ((ref1$ = e.touches) != null ? ref1$[0] : void 8); }; onTouchStart = function(e){ if (e.touches.length > 1) { return; } if (!e.tapDiv) { e.tapDiv = o.div; } if (e.tapDiv === o.div) { o.preventMouseEnter = true; o.div.bind("touchend", onTouchUp, false, passive); o.div.bind("touchmove", onTouchMove, false, passive); o.div.bind("touchcancel", onTouchCancel, false, passive); o.onDown(getTouch(e), e); } }; onTouchUp = function(e){ o.div.unbind("touchend", onTouchUp, false, passive); o.div.unbind("touchmove", onTouchMove, false, passive); o.div.unbind("touchcancel", onTouchCancel, false, passive); o.onUp(getTouch(e), e); }; onTouchMove = function(e){ o.onMove(getTouch(e), e); }; onTouchCancel = function(e){ o.onCancel(getTouch(e), e); }; return o.div.bind("touchstart", onTouchStart, false, passive); }; })(); elementProperties/tap/tap.ls (function(){ return function(onDown){ var div, onUp, onCancel, onLongDown, tapZone, o, animation; div = this; if (!onDown) { return div; } if (_.isFunction(onDown)) { onUp = onDown; onDown = null; onCancel = null; onLongDown = null; tapZone = null; } else if (_.isPlainObject(onDown)) { o = onDown; onDown = o.down; onUp = o.up; onCancel = o.cancel; onLongDown = o.longDown; animation = o.animation; tapZone = o.tapZone; } animation = (animation != null ? animation.down : void 8) != null || (animation != null ? animation.up : void 8) != null || (animation != null ? animation.cancel : void 8) != null || (animation != null ? animation.startHover : void 8) != null || (animation != null ? animation.endHover : void 8) != null ? animation : animation === "none" ? null : animation ? inc("animation/" + animation)(div) : inc("animation/default")(div); div.css({ cursor: "pointer" }); inc("eventHandler/addCallbacks")({ div: div, animation: animation, onUp: onUp, onDown: onDown, onCancel: onCancel, onLongDown: onLongDown }); inc("tapZone/tapZone")(div, tapZone); return div; }; })(); elementProperties/tap/tapZone/tapZone.ls (function(){ return function(div, tapZone){ var showBorder, a, res$, i$, i; if (!tapZone || div.tapZone != null) { return; } if (_.endsWith(tapZone, "debug")) { tapZone = tapZone.split(/debug/)[0].trim(); showBorder = true; } a = tapZone.split(" "); if (a.length === 1) { res$ = []; for (i$ = 1; i$ <= 4; ++i$) { i = i$; res$.push(tapZone); } a = res$; } else if (a.length === 2) { a = [a[0], a[1], a[0], a[1]]; } else if (a.length === 3) { a = [a[0], a[1], a[2], a[1]]; } return div.prepend(div.tapZone = Div({ position: "absolute", top: "-" + a[0], right: "-" + a[1], bottom: "-" + a[2], left: "-" + a[3], border: showBorder ? "1px solid red" : void 8 })); }; })(); elementProperties/text/text.ls (function(){ return function(){ if (arguments.length === 0) { return this.textContent; } this.textContent = _.reduce(arguments, function(result, arg){ return result + (arg + ""); }); return this; }; })(); elementProperties/triggerCustomEvent/triggerCustomEvent.ls (function(){ return function(params){ var invalid, event, ref$; invalid = _.keys(_.omit(params, ["event", "bubbles", "detail"])); if (invalid.length > 0) { debug("invalid trigger params", invalid); return; } event = new CustomEvent(params.event, { bubbles: (ref$ = params.bubbles) != null ? ref$ : true, detail: params.detail || {} }); this.dispatchEvent(event); return this; }; })(); elementProperties/triggerTap/triggerTap.ls (function(){ return function(type){ var div, eventType, offset, event, ref$, originalEvent; type == null && (type = "up"); div = this; eventType = (function(){ switch (type) { case "up": return "mouseup"; case "down": return "mousedown"; case "longDown": return "mousedown"; default: throw Error("unsupported type"); } }()); offset = div.offset(); event = new MouseEvent(eventType, { screenX: ((ref$ = window.screenLeft) != null ? ref$ : window.screenX) + offset.left + offset.width / 2, screenY: ((ref$ = window.screenTop) != null ? ref$ : window.screenY) + offset.top + offset.height / 2, clientX: offset.left + offset.width / 2, clientY: offset.top + offset.height / 2, button: 0 }); originalEvent = event; _.each((ref$ = div._eventHandler) != null ? ref$[type + "Callbacks"] : void 8, function(handler){ return handler.call(div, event, originalEvent); }); return div; }; })(); elementProperties/unbind/unbind.ls (function(){ return function(event, handler, useCapture, passive){ var events, i, e, options; events = event ? event.split(" ") : void 8; if (this.boundEventListeners) { i = 0; while (i < this.boundEventListeners.length) { e = this.boundEventListeners[i]; if (!events || _.includes(events, e.event)) { if (!handler || handler === e.handler) { if (useCapture == null || useCapture === e.useCapture) { if (passive == null || passive === e.passive) { options = { capture: useCapture, passive: passive }; this.boundEventListeners.splice(i, 1); if (include("/util/supportsPassiveEvent/passiveEvent")()) { this.removeEventListener(e.event, e.safeHandler, options); } else { this.removeEventListener(e.event, e.safeHandler, useCapture); } i--; } } } } i++; } } return this; }; })(); elementProperties/unwrap/unwrap.ls (function(){ return function(){ var a, res$, i$, ref$, len$, n; res$ = []; for (i$ = 0, len$ = (ref$ = this.childNodes).length; i$ < len$; ++i$) { n = ref$[i$]; res$.push(n); } a = res$; for (i$ = 0, len$ = a.length; i$ < len$; ++i$) { n = a[i$]; this.parentNode.insertBefore(n, this); } this.remove(); return this; }; })(); elementProperties/width/width.ls (function(){ return function(o){ var w, mL, mR; o = o || {}; w = this.getBoundingClientRect().width; if (o.withMargins) { mL = this.css("marginLeft"); mR = this.css("marginRight"); w += _.parseInt(mL) + _.parseInt(mR); } return _.round(w, 1); }; })(); elementProperties/wrap/wrap.ls (function(){ return function(wrapper){ this.replaceWith(wrapper); wrapper.append(this); return this; }; })(); init.ls (function(){ return function(){ include("elementProperties/init")(); include("components/init")(); include("util/setBodyScale/set")(); include("util/ignoreGhostMouseEvents/ignore")(); include("util/trySafe/trySafe")(); include("util/mutationObserver/observer")(); include("util/webWorker/webWorker")(); return include("jqueryStuff/init")(); }; })(); jqueryStuff/init.ls (function(){ return function(){ if (window.$ == null) { return; } include("jqueryCustom/custom")(); include("jqueryTap/tap")(); return include("jqueryIsVisible/isVisible")(); }; })(); jqueryStuff/jqueryCustom/custom.ls (function(){ return function(){ if ($.fn.hasOwnProperty("custom")) { return; } return Object.defineProperty($.fn, 'custom', { get: function(){ if (this[0].custom) { return this[0].custom; } else { return this[0].custom = {}; } } }); }; })(); jqueryStuff/jqueryIsVisible/isVisible.ls (function(){ return function(){ return $.fn.isVisible = function(){ return this.is(":visible"); }; }; })(); jqueryStuff/jqueryTap/tap.ls (function(){ return function(){ var f; f = function(onDown, onUp, onCancel){ var div, lastDownAt, timeout, startPageY, isDown, isCancelled, down, up, cancel, onMouseDown, onBodyMouseUp, onTouchStart, onTouchUp, onTouchMove; if (arguments.length === 1) { onUp = onDown; onDown = null; onCancel = null; } div = this; lastDownAt = null; timeout = null; startPageY = null; isDown = false; isCancelled = false; down = function(){ clearTimeout(timeout); lastDownAt = new Date(); isCancelled = false; isDown = true; return typeof onDown == 'function' ? onDown() : void 8; }; up = function(){ if (isCancelled || !isDown) { return; } isDown = false; return typeof onUp == 'function' ? onUp() : void 8; }; cancel = function(){ if (isCancelled || !isDown) { return; } isCancelled = true; isDown = false; return typeof onCancel == 'function' ? onCancel() : void 8; }; onMouseDown = function(e){ if (!e.originalEvent.tapDiv) { e.originalEvent.tapDiv = div; } if (e.originalEvent.tapDiv === div) { $("body").bind("mouseup", onBodyMouseUp); return down(); } }; onBodyMouseUp = function(e){ $("body").unbind("mouseup", onBodyMouseUp); return up(); }; onTouchStart = function(e){ div.bind("touchend", onTouchUp); div.bind("touchmove", onTouchMove); if (e.originalEvent.touches.length > 1) { return; } if (!e.originalEvent.tapDiv) { e.originalEvent.tapDiv = div; } if (e.originalEvent.tapDiv === div) { startPageY = e.originalEvent.touches[0].pageY; return down(); } }; onTouchUp = function(e){ div.unbind("touchend", onTouchUp); div.unbind("touchmove", onTouchMove); return up(); }; onTouchMove = function(e){ var pageY, pageYDiff; pageY = e.changedTouches[0].pageY; pageYDiff = pageY - startPageY; if (Math.abs(pageYDiff) > 10) { return cancel(); } }; requestAnimationFrame(function(){ return div.bind("mousedown", onMouseDown).bind("touchstart", onTouchStart); }); return div; }; $.fn.buttonTrigger = f; return $.fn.tap = f; }; })(); util/ignoreGhostMouseEvents/ignore.ls (function(){ return function(){ var lastTouchAt, onTouch, onMouse, b; if (engine.initIgnoreGhostMouseEvents) { return; } engine.initIgnoreGhostMouseEvents = true; lastTouchAt = null; onTouch = function(e){ return lastTouchAt = new Date(); }; onMouse = function(e){ var dif; if (typeof engine.onGhostMouseEvent == 'function' && engine.onGhostMouseEvent(e)) { return; } if (deepEq$(e.target.ignoreGhostMouseEvents, false, '===') || deepEq$(engine.ignoreGhostMouseEvents, false, '===')) { return; } dif = new Date() - lastTouchAt; if (dif < 1000) { e.preventDefault(); e.stopPropagation(); return false; } }; b = function(e, c){ return body.addEventListener(e, c, true); }; b("touchstart", onTouch); b("touchend", onTouch); b("mousedown", onMouse); b("mouseup", onMouse); b("mouseover", onMouse); b("mouseout", onMouse); b("mouseenter", onMouse); b("mouseleave", onMouse); return b("click", onMouse); }; })(); function deepEq$(x, y, type){ var toString = {}.toString, hasOwnProperty = {}.hasOwnProperty, has = function (obj, key) { return hasOwnProperty.call(obj, key); }; var first = true; return eq(x, y, []); function eq(a, b, stack) { var className, length, size, result, alength, blength, r, key, ref, sizeB; if (a == null || b == null) { return a === b; } if (a.__placeholder__ || b.__placeholder__) { return true; } if (a === b) { return a !== 0 || 1 / a == 1 / b; } className = toString.call(a); if (toString.call(b) != className) { return false; } switch (className) { case '[object String]': return a == String(b); case '[object Number]': return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); case '[object Date]': case '[object Boolean]': return +a == +b; case '[object RegExp]': return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase; } if (typeof a != 'object' || typeof b != 'object') { return false; } length = stack.length; while (length--) { if (stack[length] == a) { return true; } } stack.push(a); size = 0; result = true; if (className == '[object Array]') { alength = a.length; blength = b.length; if (first) { switch (type) { case '===': result = alength === blength; break; case '<==': result = alength <= blength; break; case '<<=': result = alength < blength; break; } size = alength; first = false; } else { result = alength === blength; size = alength; } if (result) { while (size--) { if (!(result = size in a == size in b && eq(a[size], b[size], stack))){ break; } } } } else { if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) { return false; } for (key in a) { if (has(a, key)) { size++; if (!(result = has(b, key) && eq(a[key], b[key], stack))) { break; } } } if (result) { sizeB = 0; for (key in b) { if (has(b, key)) { ++sizeB; } } if (first) { if (type === '<<=') { result = size < sizeB; } else if (type === '<==') { result = size <= sizeB } else { result = size === sizeB; } } else { first = false; result = size === sizeB; } } } stack.pop(); return result; } } util/mutationObserver/observer.ls (function(){ return function(){ var triggerOnDomAppend, triggerOnDomRemove, onMutations, observer, config; if (body.mutationObserver) { body.mutationObserver.disconnect(); } triggerOnDomAppend = function(el){ var i$, ref$, len$, handler, results$ = []; if (el != null && !el.onDomAppendTriggered) { el.onDomAppendTriggered = true; for (i$ = 0, len$ = (ref$ = el.onDomAppendHandlers || []).length; i$ < len$; ++i$) { handler = ref$[i$]; results$.push(handler()); } return results$; } }; triggerOnDomRemove = function(el){ var i$, ref$, len$, handler, results$ = []; if (el != null && el.onDomRemoveEnabled) { el.onDomRemoveEnabled = false; for (i$ = 0, len$ = (ref$ = el.onDomRemoveHandlers || []).length; i$ < len$; ++i$) { handler = ref$[i$]; results$.push(handler()); } return results$; } }; onMutations = function(mutationRecords){ var i$, len$, r, lresult$, j$, ref$, len1$, el, k$, ref1$, len2$, el2, lresult1$, results$ = []; for (i$ = 0, len$ = mutationRecords.length; i$ < len$; ++i$) { r = mutationRecords[i$]; lresult$ = []; for (j$ = 0, len1$ = (ref$ = r.addedNodes).length; j$ < len1$; ++j$) { el = ref$[j$]; if (!body.contains(el)) { continue; } if (typeof el.hasClass == 'function' && el.hasClass("onDomAppend")) { triggerOnDomAppend(el); } for (k$ = 0, len2$ = (ref1$ = (typeof el.getElementsByClassName == 'function' ? el.getElementsByClassName("onDomAppend") : void 8) || []).length; k$ < len2$; ++k$) { el2 = ref1$[k$]; triggerOnDomAppend(el2); } if (typeof el.hasClass == 'function' && el.hasClass("onDomRemove")) { el.onDomRemoveEnabled = true; } for (k$ = 0, len2$ = (ref1$ = (typeof el.getElementsByClassName == 'function' ? el.getElementsByClassName("onDomRemove") : void 8) || []).length; k$ < len2$; ++k$) { el2 = ref1$[k$]; el2.onDomRemoveEnabled = true; } } for (j$ = 0, len1$ = (ref$ = r.removedNodes).length; j$ < len1$; ++j$) { el = ref$[j$]; lresult1$ = []; if (typeof el.hasClass == 'function' && el.hasClass("onDomAppend")) { el.onDomAppendTriggered = false; } for (k$ = 0, len2$ = (ref1$ = (typeof el.getElementsByClassName == 'function' ? el.getElementsByClassName("onDomAppend") : void 8) || []).length; k$ < len2$; ++k$) { el2 = ref1$[k$]; el2.onDomAppendTriggered = false; } if (typeof el.hasClass == 'function' && el.hasClass("onDomRemove")) { triggerOnDomRemove(el); } for (k$ = 0, len2$ = (ref1$ = (typeof el.getElementsByClassName == 'function' ? el.getElementsByClassName("onDomRemove") : void 8) || []).length; k$ < len2$; ++k$) { el2 = ref1$[k$]; lresult1$.push(triggerOnDomRemove(el2)); } lresult$.push(lresult1$); } results$.push(lresult$); } return results$; }; observer = new MutationObserver(onMutations); config = { childList: true, subtree: true, attributes: false, characterData: false }; observer.observe(body, config); return body.mutationObserver = observer; }; })(); util/setBodyScale/_defineProperties/define.ls (function(){ return function(o){ var i$, ref$, len$, p, results$ = []; if (!o.prototype) { return; } for (i$ = 0, len$ = (ref$ = o.properties).length; i$ < len$; ++i$) { p = ref$[i$]; results$.push(include("defineProperty/define")({ prototype: o.prototype, name: p.name, get: p.get })); } return results$; }; })(); util/setBodyScale/_defineProperties/defineProperty/define.ls (function(){ return function(o){ var p, name, originalName, d; p = o.prototype; name = o.name; originalName = o.name + "Original"; d = Object.getOwnPropertyDescriptor(p, originalName); if (!d) { d = Object.getOwnPropertyDescriptor(p, name); if (!d) { return; } Object.defineProperty(p, originalName, d); } return Object.defineProperty(p, name, { configurable: true, enumerable: true, get: o.get }); }; })(); util/setBodyScale/document/elementFromPoint.ls (function(){ return function(){ if (document.elementFromPoint == null) { return; } document.elementFromPointOriginal = document.elementFromPointOriginal || document.elementFromPoint; return document.elementFromPoint = function(x, y){ return document.elementFromPointOriginal(x * body.bodyScale, y * body.bodyScale); }; }; })(); util/setBodyScale/element/getBoundingClientRect.ls (function(){ return function(){ return include("../_defineProperties/define")({ prototype: typeof Element != 'undefined' && Element !== null ? Element.prototype : void 8, properties: [{ name: "getBoundingClientRect", get: function(){ return function(){ var r, s; r = this.getBoundingClientRectOriginal(); s = body.bodyScale; return { top: r.top / s, left: r.left / s, height: r.height / s, width: r.width / s, bottom: r.bottom / s, right: r.right / s }; }; } }] }); }; })(); util/setBodyScale/mouse/mouse.ls (function(){ return function(){ return include("../_defineProperties/define")({ prototype: typeof MouseEvent != 'undefined' && MouseEvent !== null ? MouseEvent.prototype : void 8, properties: [ { name: "clientX", get: function(){ return this.clientXOriginal / body.bodyScale; } }, { name: "clientY", get: function(){ return this.clientYOriginal / body.bodyScale; } }, { name: "screenX", get: function(){ return this.screenXOriginal / body.bodyScale; } }, { name: "screenY", get: function(){ return this.screenYOriginal / body.bodyScale; } } ] }); }; })(); util/setBodyScale/set.ls (function(){ return function(){ return Object.defineProperty(body, "setBodyScale", { configurable: true, enumerable: true, get: function(){ return function(scale){ var fontSize; fontSize = (body.bodyScale || 1) * body.css('fontSize').replace("px", ""); body.css(scale === 1 ? { transform: "", transformOrigin: "", width: "", height: "", fontSize: fontSize + "px" } : { transform: "scale(" + scale + ")", transformOrigin: "top left", width: 100 / scale + "%", height: 100 / scale + "%", fontSize: fontSize / scale + "px" }); body.bodyScale = scale; include("document/elementFromPoint")(); include("element/getBoundingClientRect")(); include("touch/touch")(); return include("mouse/mouse")(); }; } }); }; })(); util/setBodyScale/touch/touch.ls (function(){ return function(){ return include("../_defineProperties/define")({ prototype: typeof Touch != 'undefined' && Touch !== null ? Touch.prototype : void 8, properties: [ { name: "clientX", get: function(){ return this.clientXOriginal / body.bodyScale; } }, { name: "clientY", get: function(){ return this.clientYOriginal / body.bodyScale; } }, { name: "screenX", get: function(){ return this.screenXOriginal / body.bodyScale; } }, { name: "screenY", get: function(){ return this.screenYOriginal / body.bodyScale; } }, { name: "pageX", get: function(){ return this.pageXOriginal / body.bodyScale; } }, { name: "pageY", get: function(){ return this.pageYOriginal / body.bodyScale; } } ] }); }; })(); util/supportsPassiveEvent/passiveEvent.ls (function(){ return function(){ var supportsPassive, opts; supportsPassive = false; try { opts = Object.defineProperty({}, "passive", { get: function(){ return supportsPassive = true; } }); window.addEventListener("test", null, opts); window.removeEventListener("test", null, opts); } catch (e$) {} return supportsPassive; }; })(); util/trySafe/trySafe.ls (function(){ return function(){ return window.trySafe = function(f){ var e; if (engine.isiOsApp) { try { return f(); } catch (e$) { e = e$; return helpers.errorHandler(e.message, e.file, e.line, e.column, e); } } else { return f(); } }; }; })(); util/webWorker/webWorker.ls (function(){ return function(){ return window.webWorker = include("worker/worker"); }; })(); util/webWorker/worker/createWorker/create.ls (function(){ return function(o){ var sendProgress, workerFunc, workerScript, blob, blobURL, worker; sendProgress = function(progress){ return postMessage({ type: "onProgress", progress: progress }); }; workerFunc = function(){ var calc; calc = function(data){ var result; result = _calc(data); return postMessage({ type: "onFinish", data: result }); }; return self.onmessage = function(e){ if (e.data.type === "start") { return calc(e.data.data); } }; }; workerScript = "sendProgress = " + sendProgress.toString() + ";" + "_calc = " + o.calc.toString() + ";" + "_f = " + workerFunc.toString() + "; _f();"; blob = new Blob([workerScript]); blobURL = window.URL.createObjectURL(blob); return worker = new Worker(blobURL); }; })(); util/webWorker/worker/fallback/worker.ls (function(){ return function(o){ var onProgress, workerScript, startWork, worker; onProgress = function(p){ return typeof o.onProgress == 'function' ? o.onProgress(p) : void 8; }; workerScript = eval("sendProgress = " + onProgress.toString() + ";" + "_calc = " + o.calc.toString() + ";" + "_calc;"); startWork = function(data){ var result; result = workerScript(data); return typeof o.onDone == 'function' ? o.onDone(result) : void 8; }; worker = { startWork: startWork, terminate: function(){} }; if (o.initialData) { worker.startWork(o.initialData); } return worker; }; })(); util/webWorker/worker/worker.ls (function(){ return function(o){ var worker; if (!window.Worker) { return include("fallback/worker")(o); } worker = include("createWorker/create")(o); worker.onmessage = function(e){ if (e.data.type === "onFinish") { return typeof o.onDone == 'function' ? o.onDone(e.data.data) : void 8; } else if (e.data.type === "onProgress") { return typeof o.onProgress == 'function' ? o.onProgress(e.data.progress) : void 8; } }; worker.startWork = function(data){ return worker.postMessage({ type: "start", data: data }); }; if (o.initialData) { worker.startWork(o.initialData); } return worker; }; })();